/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --primary-bg: #eef2ff;
    --accent: #06b6d4;
    --accent-bg: #ecfeff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--gray-900);
    background: var(--white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }

/* ========== TYPOGRAPHY ========== */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-heading {
    text-align: center;
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.2;
}

.section-sub {
    text-align: center;
    color: var(--gray-500);
    font-size: 1.1rem;
    margin-bottom: 48px;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid transparent;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(79,70,229,0.3);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 8px rgba(79,70,229,0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ========== NAV ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--gray-900);
}
.logo-icon { font-size: 1.5rem; }
.logo-text { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}
.nav-link {
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-link:hover { color: var(--primary); }

/* ========== HAMBURGER MENU ========== */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}
.menu-bar {
    width: 24px;
    height: 2px;
    background: var(--text-primary, #1a1a2e);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.menu-toggle.open .menu-bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.menu-toggle.open .menu-bar:nth-child(2) {
    opacity: 0;
}
.menu-toggle.open .menu-bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.nav-user {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

/* ========== HERO ========== */
.hero {
    padding: 140px 0 60px;
    background: linear-gradient(180deg, var(--gray-50) 0%, var(--white) 100%);
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--gray-500);
    line-height: 1.7;
    margin-bottom: 32px;
}

.hero-stats {
    display: flex;
    gap: 40px;
}
.stat-item { text-align: center; }
.stat-number { display: block; font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--gray-500); }

/* ========== UPLOAD CARD ========== */
.upload-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.drop-icon { color: var(--gray-400); margin-bottom: 12px; }
.drop-text { font-size: 1rem; color: var(--gray-700); margin-bottom: 8px; }
.drop-link { color: var(--primary); font-weight: 600; cursor: pointer; }
.drop-hint { font-size: 0.85rem; color: var(--gray-400); }

.drop-zone.has-file {
    border-color: var(--success);
    background: #f0fdf4;
}
.drop-zone.has-file .drop-text { color: var(--success); }

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--gray-400);
    font-size: 0.85rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.text-input {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    color: var(--gray-900);
}
.text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.text-input::placeholder { color: var(--gray-400); }

.upload-actions { margin-top: 20px; text-align: center; }
.upload-note { font-size: 0.8rem; color: var(--gray-400); margin-top: 12px; }

.btn-arrow { transition: transform 0.2s; }
.btn-primary:hover .btn-arrow { transform: translateX(4px); }

/* ========== LOADING ========== */
.loading-card {
    text-align: center;
    padding: 60px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 480px;
    margin: 0 auto;
}

.spinner { margin-bottom: 24px; }
.spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-title { font-size: 1.1rem; color: var(--gray-700); margin-bottom: 24px; }

.loading-steps { text-align: left; max-width: 320px; margin: 0 auto; }
.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: var(--gray-400);
    font-size: 0.9rem;
    transition: all 0.3s;
}
.loading-step.active { color: var(--primary); }
.loading-step.completed { color: var(--success); }

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
    transition: all 0.3s;
}
.loading-step.active .step-dot {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.2);
}
.loading-step.completed .step-dot { background: var(--success); }

/* ========== RESULTS ========== */
.result-header { margin-bottom: 32px; }

.result-score-card {
    display: flex;
    align-items: center;
    gap: 32px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.score-ring-container { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.score-ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--gray-100); stroke-width: 8; }
.score-ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 700;
}
.score-number small { font-size: 1rem; font-weight: 400; color: var(--gray-500); }

.score-info { flex: 1; }
.score-label { font-size: 1.3rem; font-weight: 600; margin-bottom: 4px; }
.score-desc { color: var(--gray-500); font-size: 0.9rem; margin-bottom: 12px; }
.score-threshold { display: flex; gap: 8px; }

.threshold-badge {
    display: inline-block;
    padding: 2px 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

/* Sub-scores */
.sub-scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.sub-score-item {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    text-align: center;
}

.sub-score-label { font-size: 0.8rem; color: var(--gray-500); margin-bottom: 4px; }
.sub-score-value { font-size: 1.5rem; font-weight: 700; }
.sub-score-bar {
    width: 100%;
    height: 4px;
    background: var(--gray-100);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}
.sub-score-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease;
}

/* Suggestions */
.suggestions-section, .paragraph-section { margin-bottom: 32px; }
.section-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 16px; }

.suggestions-list { display: flex; flex-direction: column; gap: 12px; }

.suggestion-item {
    display: flex;
    gap: 16px;
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--primary);
}
.suggestion-item.severity-high { border-left-color: var(--danger); }
.suggestion-item.severity-medium { border-left-color: var(--warning); }
.suggestion-item.severity-low { border-left-color: var(--success); }

.suggestion-icon { font-size: 1.5rem; flex-shrink: 0; }
.suggestion-content { flex: 1; }
.suggestion-title { font-weight: 600; margin-bottom: 4px; }
.suggestion-detail { font-size: 0.9rem; color: var(--gray-500); line-height: 1.5; }

/* Paragraph analysis */
.paragraph-list { display: flex; flex-direction: column; gap: 8px; }

.paragraph-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
}
.paragraph-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }

.paragraph-index {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.paragraph-score {
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.paragraph-bar {
    flex: 1;
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
}
.paragraph-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

.paragraph-risk {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    flex-shrink: 0;
}
.risk-safe { background: #d1fae5; color: #065f46; }
.risk-warning { background: #fef3c7; color: #92400e; }
.risk-high { background: #fde8e8; color: #991b1b; }

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.3s ease;
}
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--gray-500);
    transition: all 0.2s;
}
.modal-close:hover { background: var(--gray-200); }

.modal-body { padding: 40px; text-align: center; }
.modal-icon { font-size: 3rem; margin-bottom: 12px; }
.modal-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 24px; }

.payment-details {
    text-align: left;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 20px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.95rem;
    color: var(--gray-600);
}
.payment-row.total {
    border-top: 1px solid var(--gray-200);
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 600;
    color: var(--gray-900);
    font-size: 1.1rem;
}

.mode-select {
    padding: 4px 8px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--white);
    cursor: pointer;
}

.preview-section { margin-bottom: 16px; }

.preview-result {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: left;
    margin-top: 12px;
}
.preview-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.preview-comparison strong { display: block; font-size: 0.8rem; color: var(--gray-500); margin-bottom: 4px; }
.preview-comparison p { font-size: 0.8rem; color: var(--gray-600); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.preview-scores { font-size: 0.85rem; color: var(--gray-600); }
.score-improved { color: var(--success); font-weight: 600; }

.payment-note {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 20px;
    padding: 10px;
    background: #fefce8;
    border-radius: var(--radius-sm);
}

.payment-buttons { }

/* ========== AUTH MODAL ========== */
.auth-modal { max-width: 420px; }

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-400);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    position: relative;
}
.auth-tab:hover { color: var(--gray-600); }
.auth-tab.active {
    color: var(--primary);
}
.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.auth-form {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    color: var(--gray-900);
}
.auth-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.auth-input::placeholder { color: var(--gray-400); }

/* ========== PASSWORD VISIBILITY TOGGLE ========== */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrapper .password-input {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    padding: 0;
}
.password-toggle:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}
.password-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.eye-icon {
    pointer-events: none;
}

.auth-error {
    font-size: 0.85rem;
    color: var(--danger);
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: var(--radius-sm);
    display: none;
}
.auth-error:not(:empty) { display: block; }

.auth-success {
    font-size: 0.85rem;
    color: var(--success);
    padding: 8px 12px;
    background: #f0fdf4;
    border-radius: var(--radius-sm);
    display: none;
}
.auth-success:not(:empty) { display: block; }

/* ========== REWRITE RESULT ========== */
.rewrite-section { padding-top: 120px; }

.rewrite-header { text-align: center; margin-bottom: 32px; }
.rewrite-success { font-size: 1.5rem; font-weight: 700; color: var(--success); margin-bottom: 8px; }
.rewrite-order { color: var(--gray-500); font-size: 0.9rem; }

.rewrite-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 32px;
}
.comparison-arrow {
    display: flex;
    align-items: center;
    font-size: 2rem;
    color: var(--primary);
    font-weight: 300;
    padding-top: 60px;
}

.comparison-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}
.comparison-card.original-card { border-color: var(--gray-300); }
.comparison-card.rewritten-card { border-color: var(--success); }

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}
.comparison-header h4 { font-size: 0.95rem; }

.comparison-score { display: flex; align-items: center; gap: 8px; }
.score-badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--gray-200);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}
.score-badge.improved { background: #d1fae5; color: #065f46; }
.score-risk { font-size: 0.8rem; color: var(--gray-500); }
.improvement-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--success);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.comparison-text {
    padding: 20px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--gray-700);
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ========== DIFF STYLES ========== */
.diff-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--primary);
    cursor: pointer;
    user-select: none;
    margin-left: 8px;
}
.diff-toggle input { cursor: pointer; }
.diff-toggle:hover { text-decoration: underline; }

.diff-added {
    background: #d1fae5;
    color: #065f46;
    padding: 1px 2px;
    border-radius: 3px;
}
.diff-deleted {
    background: #fee2e2;
    color: #991b1b;
    text-decoration: line-through;
    padding: 1px 2px;
    border-radius: 3px;
}
.diff-unchanged {
    /* normal text, no special styling */
}

.diff-legend {
    display: flex;
    gap: 16px;
    padding: 8px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    font-size: 0.78rem;
    color: var(--gray-500);
}
.diff-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.diff-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}
.diff-legend-dot.added { background: #d1fae5; border: 1px solid #065f46; }
.diff-legend-dot.deleted { background: #fee2e2; border: 1px solid #991b1b; }

.rewrite-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ========== FEATURES ========== */
.features { background: var(--gray-50); }

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}
.feature-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.feature-icon { font-size: 2.5rem; margin-bottom: 16px; }
.feature-card h4 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 0.9rem; color: var(--gray-500); line-height: 1.6; }

/* ========== PRICING ========== */
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.pricing-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    text-align: center;
    position: relative;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}
.pricing-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.pricing-card.featured {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.15), var(--shadow);
}

.pricing-badge {
    display: inline-block;
    padding: 2px 12px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 16px;
    align-self: center;
}
.pricing-badge.popular {
    background: var(--primary);
    color: white;
}

.pricing-name { font-size: 1.2rem; font-weight: 600; margin-bottom: 16px; }
.pricing-price { margin-bottom: 24px; }
.price { font-size: 2.5rem; font-weight: 800; }
.per { font-size: 0.9rem; color: var(--gray-500); }

.pricing-features {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
    flex: 1;
}
.pricing-features li {
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--gray-600);
}
.pricing-features li.disabled { color: var(--gray-300); }

/* ========== FAQ ========== */
.faq-list { max-width: 700px; margin: 0 auto; }

.faq-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--white);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-800);
    font-family: inherit;
    text-align: left;
    transition: background 0.2s;
}
.faq-question:hover { background: var(--gray-50); }

.faq-arrow { transition: transform 0.2s; flex-shrink: 0; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}
.faq-item.open .faq-answer {
    padding: 0 20px 16px;
    max-height: 300px;
}
.faq-answer p { font-size: 0.9rem; color: var(--gray-500); line-height: 1.7; }

/* ========== ORDERS PAGE ========== */
.orders-page { padding-top: 100px; min-height: 100vh; }

.orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.orders-title { font-size: 1.8rem; font-weight: 700; }

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.order-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.order-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }

.order-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.order-id-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
}

.order-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--gray-500);
}
.order-meta span { display: flex; align-items: center; gap: 4px; }

.order-format-badge {
    display: inline-block;
    padding: 1px 8px;
    background: var(--gray-100);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
}

.order-score-change {
    font-size: 0.85rem;
    font-weight: 600;
}
.order-score-change.improved { color: var(--success); }
.order-score-change.worsened { color: var(--danger); }

.order-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Order empty state */
.orders-empty {
    text-align: center;
    padding: 80px 24px;
    color: var(--gray-400);
}
.orders-empty-icon { font-size: 4rem; margin-bottom: 16px; }
.orders-empty-text { font-size: 1.1rem; margin-bottom: 24px; }

/* Pagination */
.orders-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}
.pagination-btn {
    padding: 8px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
    font-family: inherit;
}
.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-info { font-size: 0.85rem; color: var(--gray-500); }

/* ========== ORDER DETAIL MODAL ========== */
.order-detail-text {
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 16px;
}

.order-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gray-100);
}
.order-detail-row:last-child { border-bottom: none; }
.order-detail-label { color: var(--gray-500); }
.order-detail-value { font-weight: 500; }

.order-detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ========== MODAL LOADING OVERLAY ========== */
.modal-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius);
}

.modal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.modal-loading-text {
    font-size: 0.95rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* ========== PAYMENT SPLIT LAYOUT ========== */
.payment-split-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    justify-content: center;
    margin-top: 16px;
}

.payment-summary {
    flex: 1;
    min-width: 180px;
    max-width: 260px;
}

.payment-split-layout #payment-qr-section {
    flex: 0 0 auto;
    min-width: 200px;
}

/* ========== PAYMENT QR SECTION ========== */
.payment-qr-layout {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.payment-qr-info {
    text-align: center;
    min-width: 140px;
}

.qr-price-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.qr-price-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
}

.qr-benefits {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.6;
}

.payment-qr-code {
    text-align: center;
}

.qr-code-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 10px;
}

.qr-code-box {
    width: 160px;
    height: 160px;
    background: var(--white);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border: 1px solid var(--gray-200);
}

.qr-code-hint {
    font-size: 0.8rem;
    color: var(--gray-700);
    margin-top: 6px;
}

.payment-qr-status {
    text-align: center;
    margin-bottom: 16px;
    color: var(--gray-500);
    font-size: 0.95rem;
}

.payment-timer {
    margin-left: 8px;
    color: var(--gray-400);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.mock-payment-section {
    text-align: center;
    margin-bottom: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--gray-200);
}

.mock-pay-btn {
    font-size: 0.85rem;
    padding: 8px 16px;
    background: var(--white);
    color: var(--gray-600);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.mock-pay-btn:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
}

.mock-pay-note {
    color: var(--gray-400);
    font-size: 0.75rem;
    margin-top: 6px;
}

.payment-separator {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 16px 0;
}

/* ========== TOAST ========== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastIn 0.3s ease;
    max-width: 90%;
    text-align: center;
    transition: opacity 0.3s;
}

.toast-success {
    background: #d1fae5;
    color: #065f46;
}

.toast-error {
    background: #fde8e8;
    color: #991b1b;
}

.toast-info {
    background: #eef2ff;
    color: #3730a3;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== FADE IN ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#result-section {
    animation: fadeIn 0.4s ease;
}

/* ========== FOCUS VISIBLE (Accessibility) ========== */
.btn:focus-visible,
.auth-tab:focus-visible,
.faq-question:focus-visible,
.modal-close:focus-visible,
.pagination-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========== FOOTER ========== */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 48px 0 24px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 32px;
}

.footer-brand .logo-text { font-size: 1.2rem; font-weight: 700; display: block; margin-bottom: 8px; }
.footer-brand p { font-size: 0.9rem; }

.footer-links h5 { color: var(--white); font-size: 0.9rem; margin-bottom: 12px; }
.footer-links a {
    display: block;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 8px;
    transition: color 0.2s;
}
.footer-links a:hover { color: var(--white); }

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: 24px;
    text-align: center;
    font-size: 0.85rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr; gap: 40px; }
    .hero-title { font-size: 2.5rem; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .pricing-cards { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
    .rewrite-comparison { grid-template-columns: 1fr; }
    .comparison-arrow { display: none; }
    .footer-content { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .order-card { flex-direction: column; gap: 12px; align-items: flex-start; }
    .order-actions { align-self: flex-end; }
}

@media (max-width: 640px) {
    .hero { padding: 100px 0 40px; min-height: auto; }
    .hero-title { font-size: 2rem; }
    .hero-stats { gap: 20px; }
    .features-grid { grid-template-columns: 1fr; }
    .result-score-card { flex-direction: column; text-align: center; }
    .sub-scores { grid-template-columns: repeat(2, 1fr); }
    .preview-comparison { grid-template-columns: 1fr; }
    .menu-toggle {
        display: flex;
    }
    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-primary, #ffffff);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 24px;
        z-index: 1000;
    }
    .nav-links.active {
        display: flex;
    }
    .nav-links .nav-link {
        font-size: 18px;
        display: block;
    }
    .nav-links .btn {
        display: block;
    }
    /* Hide nav-user and orders-link for now on mobile - they'll be inside the menu */
    .nav-user, #orders-link, #login-btn, #logout-btn {
        display: block !important;
    }
}
