/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #111111;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #333333;
    --border-focus: #404040;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
}

.main-title {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 20px;
}

.main-title h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-title p {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 400;
}

.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
}

.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.subtext {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.select-input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a0a0a0' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.select-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.select-input option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.generate-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.generate-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.generate-btn:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.generate-btn.loading {
    position: relative;
    color: transparent;
}

.generate-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.usage-info {
    text-align: center;
    margin-top: 16px;
}

.usage-info span {
    font-size: 14px;
    color: var(--text-secondary);
}

.result-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.3s ease;
}

.excuse-text {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

.copy-btn, .new-excuse-btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.copy-btn {
    background: var(--success);
    color: white;
}

.copy-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.copy-btn.copied {
    background: var(--success);
    transform: scale(0.98);
}

.new-excuse-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.new-excuse-btn:hover {
    background: var(--border);
    transform: translateY(-1px);
}

.paywall-section {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.paywall-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.paywall-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.price {
    font-size: 32px;
    font-weight: 600;
    color: var(--accent);
    margin: 24px 0;
}

.paywall-subtext {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px !important;
}

.upgrade-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 16px;
    width: 100%;
}

.upgrade-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.back-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.back-btn:hover {
    color: var(--text-primary);
}

.footer {
    text-align: center;
    margin-top: 32px;
}

.footer p {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Unlock Unlimited Popup */
.unlock-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.unlock-popup {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.unlock-popup-content {
    text-align: center;
}

.unlock-popup-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.unlock-popup-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.unlock-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    text-align: left;
}

.feature {
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unlock-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    margin: 24px 0;
    text-align: center;
}

.unlock-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.unlock-now-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unlock-now-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.close-unlock-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-unlock-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-focus);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    body {
        padding: 16px;
    }
    
    .main-title {
        margin-bottom: 32px;
        margin-top: 16px;
    }
    
    .main-title h1 {
        font-size: 28px;
    }
    
    .main-title p {
        font-size: 16px;
    }
    
    .card {
        padding: 24px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .select-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .unlock-popup {
        padding: 24px;
        margin: 16px;
    }
    
    .unlock-features {
        text-align: center;
    }
}

/* Larger screens */
@media (min-width: 768px) {
    .container {
        max-width: 520px;
    }
    
    .result-actions {
        flex-direction: row;
    }
    
    .copy-btn, .new-excuse-btn {
        flex: 1;
    }
}