/* =============================================================
   Course Selection Helper — Premium Dark Theme
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    --accent: #00823e;
    --accent-dim: rgba(0, 130, 62, 0.12);
    --accent-glow: rgba(0, 130, 62, 0.3);
    
    --green: #10b981;
    --green-dim: rgba(16, 185, 129, 0.12);
    --yellow: #f59e0b;
    --yellow-dim: rgba(245, 158, 11, 0.12);
    --red: #e63946;
    --red-dim: rgba(230, 57, 70, 0.12);
    --purple: #8b5cf6;
    --purple-dim: rgba(139, 92, 246, 0.12);

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.1);
    --shadow-accent: 0 0 24px rgba(0, 130, 62, 0.2);

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Background mesh removed ───────────────────────────────── */

/* ── Typography ────────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5 {
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    opacity: 0.85;
}

/* ── Layout ────────────────────────────────────────────────── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

@media (max-width: 480px) {
    .container {
        padding: 0;
    }
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
    padding: 18px 0;
    border-bottom: 2px solid var(--border);
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.92) 0%, rgba(160, 15, 15, 0.92) 50%, rgba(0, 102, 0, 0.92) 100%);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.2rem;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.badge-official {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

@media (max-width: 600px) {
    .navbar {
        padding: 12px 0;
    }

    .logo {
        font-size: 1rem;
        gap: 8px;
    }

    .logo-icon {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .badge-official {
        font-size: 0.55rem;
        padding: 2px 6px;
    }
}

.desktop-only.inline {
    display: inline !important;
}

@media (max-width: 768px) {
    .desktop-only.inline {
        display: none !important;
    }
}

.hero {
    padding: 100px 0 80px;
    text-align: center;
    background: linear-gradient(rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.85)), url('https://images.unsplash.com/photo-1450101499163-c8848c66ca85?auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    color: #f1f1f1;
    border-bottom: 4px solid #e63946;
}

@media (max-width: 600px) {
    .hero {
        padding: 60px 0 50px;
    }
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 20px;
    padding: 6px 14px;
    background: var(--accent-dim);
    border-radius: 20px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    line-height: 1.1;
}

.hero-sub {
    font-size: 1.1rem;
    color: #cbd5e1;
    max-width: 620px;
    margin: 0 auto 40px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Hero Action Chips ──────────────────────────────────────── */
.hero-action-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    max-width: 960px;
    margin: 40px auto 0;
    padding: 0 8px;
}

.chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    color: #1e293b;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(6px);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chip-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.chip-btn--ai {
    background: linear-gradient(135deg, var(--accent), #0099cc);
    color: #000;
    border: none;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.35);
}

.chip-btn--ai:hover {
    box-shadow: 0 8px 28px rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
}

/* ── Kenyan Flag Chip Variants ─────────────────────────────── */
.chip-kenya-black {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #000;
}

.chip-kenya-black:hover {
    background: #111111;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    border-color: #000;
}

.chip-kenya-red {
    background: #b01010;
    color: #ffffff;
    border-color: #8a0c0c;
}

.chip-kenya-red:hover {
    background: #8a0c0c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(160, 15, 15, 0.45);
    border-color: #6e0a0a;
}

.chip-kenya-green {
    background: #006600;
    color: #ffffff;
    border-color: #004d00;
}

.chip-kenya-green:hover {
    background: #004d00;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 0, 0.45);
    border-color: #003300;
}

@media (max-width: 768px) {
    .hero-action-chips {
        gap: 8px;
    }

    .chip-btn {
        font-size: 0.82rem;
        padding: 10px 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   AI MODALS
═══════════════════════════════════════════════════════════════ */
.ai-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.ai-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ai-modal-box {
    background: #ffffff;
    border-radius: 24px;
    padding: 40px 36px;
    max-width: 560px;
    width: 100%;
    position: relative;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-modal--wide .ai-modal-box {
    max-width: 700px;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.modal-icon {
    font-size: 2.8rem;
    text-align: center;
    margin-bottom: 12px;
}

.modal-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    margin-bottom: 10px;
}

.modal-desc {
    font-size: 0.93rem;
    color: #475569;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-input-group {
    margin-bottom: 16px;
}

.modal-input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: #006600;
    box-shadow: 0 0 0 3px rgba(0, 102, 0, 0.12);
}

.modal-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23006600' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.modal-textarea {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #0f172a;
    background: #f8fafc;
    min-height: 100px;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-textarea:focus {
    outline: none;
    border-color: #b01010;
    box-shadow: 0 0 0 3px rgba(176, 16, 16, 0.12);
}

.modal-cta {
    display: block;
    width: 100%;
    padding: 14px 24px;
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.22s ease;
    text-align: center;
}

.modal-cta:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.modal-error {
    background: #fff5f5;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 0.9rem;
    text-align: center;
}

/* ── Modal Result Cards ─────────────────────────────────────── */
.modal-results {
    margin-top: 24px;
}

.mod-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mod-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.mod-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.mod-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.mod-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.mod-course {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.mod-uni {
    font-size: 0.82rem;
    color: #006600;
    font-weight: 600;
}

.mod-demand {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.mod-demand.green {
    background: #dcfce7;
    color: #16a34a;
}

.mod-demand.yellow {
    background: #fef9c3;
    color: #ca8a04;
}

.mod-demand.red {
    background: #fee2e2;
    color: #dc2626;
}

.mod-why {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 10px;
    line-height: 1.55;
}

.mod-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.mod-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mod-chip {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: #e2e8f0;
    color: #334155;
}

/* ── Chat Window ────────────────────────────────────────────── */
.chat-window {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    min-height: 280px;
    max-height: 360px;
    overflow-y: auto;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.55;
    animation: fadeIn 0.25s ease;
}

.chat-msg--user {
    background: #1a1a1a;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg--ai {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-msg--ai.chat-thinking {
    opacity: 0.6;
    font-style: italic;
}

.chat-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-row .modal-input {
    flex: 1;
}

.chat-input-row .modal-cta {
    width: auto;
    padding: 13px 22px;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .ai-modal-box {
        padding: 28px 20px;
    }

    .modal-title {
        font-size: 1.2rem;
    }

    .chat-window {
        min-height: 200px;
    }
}


/* ── Steps progress ────────────────────────────────────────── */
.steps-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 40px 0;
    flex-wrap: wrap;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.step-item.active {
    color: var(--accent);
}

.step-item.done {
    color: var(--green);
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    background: var(--bg-glass);
    border: 1.5px solid var(--border);
    font-weight: 700;
}

.step-item.active .step-num {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.step-item.done .step-num {
    background: var(--green-dim);
    border-color: var(--green);
    color: var(--green);
}

.step-line {
    width: 40px;
    height: 1px;
    background: var(--border);
    margin: 0 4px;
}

@media (max-width: 500px) {
    .step-line {
        width: 16px;
    }

    .step-item span:last-child {
        display: none;
    }
}

/* ── Cards / Glass ─────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

@media (max-width: 480px) {
    .card {
        padding: 12px 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .form-section {
        margin-bottom: 0;
    }
}

.card:hover {
    border-color: var(--border-hover);
}

.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
}

/* ── Grade Form ────────────────────────────────────────────── */
.form-section {
    margin-bottom: 48px;
}

.form-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-title .icon {
    width: 38px;
    height: 38px;
    background: var(--accent-dim);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .form-title {
        font-size: 0.72rem;
        gap: 6px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        align-items: center;
    }



    #dynamic-form-title {
        font-size: 0.72rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.form-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

@media (max-width: 480px) {
    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 0 6px;
        width: 100%;
    }

    .subject-item label {
        font-size: 0.65rem;
    }

    .grade-select {
        padding: 8px 6px;
        font-size: 0.85rem;
    }
}

.subject-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subject-item label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.grade-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    appearance: none;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.grade-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.subject-item.filled label {
    color: #ef4444 !important;
    font-weight: 700;
}

.subject-item.filled .grade-select {
    border-color: #ef4444 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    background-color: #991b1b !important;
}

.grade-select option {
    background: #1e293b;
    color: #fff;
}

.interest-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .interest-row {
        grid-template-columns: 1fr;
    }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-input {
    padding: 11px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #e63946, #c1121f);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(230, 57, 70, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(230, 57, 70, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-red {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

.btn-red:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.btn-red:active {
    transform: translateY(0);
}

.btn-ghost {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.06);
}

.btn-green {
    background: linear-gradient(135deg, var(--green), #059669);
    color: #fff;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

.btn-green:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.btn-full {
    width: 100%;
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 480px) {
    .btn-lg {
        padding: 10px 14px;
        font-size: clamp(0.72rem, 3.5vw, 0.9rem);
        white-space: nowrap;
        letter-spacing: 0.02em;
    }

    #calculate-btn {
        font-size: clamp(0.72rem, 3.5vw, 0.9rem);
        padding: 10px 14px;
        white-space: nowrap;
    }
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Results Section ───────────────────────────────────────── */
#results-section {
    display: none;
}

#results-section.visible {
    display: block;
    animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.results-headline {
    font-size: 1.6rem;
    font-weight: 800;
}

.results-subline {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-top: 4px;
}

/* ── Cluster Cards ─────────────────────────────────────────── */
.clusters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.cluster-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.cluster-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.cluster-card.strong {
    border-left: 3px solid var(--green);
}

.cluster-card.moderate {
    border-left: 3px solid var(--yellow);
}

.cluster-card.weak {
    border-left: 3px solid var(--red);
}

.cluster-card.locked {
    opacity: 0.6;
    filter: blur(0px);
    border-style: dashed;
    cursor: pointer;
}

.cluster-card.locked:hover {
    opacity: 0.8;
}

.cluster-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.cluster-emoji {
    font-size: 1.6rem;
}

.cluster-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cluster-badge.strong {
    background: var(--green-dim);
    color: var(--green);
}

.cluster-badge.moderate {
    background: var(--yellow-dim);
    color: var(--yellow);
}

.cluster-badge.weak {
    background: var(--red-dim);
    color: var(--red);
}

.cluster-badge.locked {
    background: var(--bg-glass);
    color: var(--text-muted);
}

.cluster-name {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.3;
}

.cluster-careers {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.4;
}

.score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.score-cutoff {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.score-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-fill.strong {
    background: linear-gradient(90deg, var(--green), #34d399);
}

.score-fill.moderate {
    background: linear-gradient(90deg, var(--yellow), #fcd34d);
}

.score-fill.weak {
    background: linear-gradient(90deg, var(--red), #f87171);
}

.lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 11, 20, 0.25);
    backdrop-filter: blur(3px);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: #fff;
    gap: 6px;
    font-weight: 600;
    z-index: 5;
    pointer-events: none;
}

.cluster-card.locked .btn {
    position: relative;
    z-index: 10;
    background: var(--green) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}


/* ── Payment Wall ──────────────────────────────────────────── */
.payment-wall {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.06), rgba(139, 92, 246, 0.06));
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: 40px;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.payment-wall::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.08), transparent 70%);
    pointer-events: none;
}

.payment-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.payment-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.payment-desc {
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto 24px;
    font-size: 0.95rem;
}

.payment-price {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 8px;
}

.payment-price span {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.payment-features {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 28px;
}

.payment-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.payment-feature::before {
    content: '✓';
    color: var(--green);
    font-weight: 700;
}

.phone-pay-row {
    display: flex;
    gap: 12px;
    max-width: 440px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.phone-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.phone-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 5;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 8px;
}

#phone-input {
    padding-left: 105px !important;
    width: 100%;
}

/* ── Payment Status ────────────────────────────────────────── */
.payment-status-box {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    margin-top: 20px;
}

.payment-status-box.visible {
    display: block;
    animation: fadeUp 0.4s ease;
}

.pulse-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    margin: 0 auto 16px;
}

.congrats-cta-responsive {
    padding: 30px 40px;
}

@media (max-width: 600px) {
    .congrats-cta-responsive {
        padding: 18px 16px;
        border-radius: 14px !important;
    }

    .congrats-cta-responsive div {
        font-size: 1.1rem !important;
    }

    .congrats-cta-responsive p {
        font-size: 0.88rem !important;
    }

    .congrats-cta-responsive button {
        height: 44px !important;
        font-size: 0.88rem !important;
    }
}

.pulse-ring {
    animation: pulse 1.4s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(0, 212, 255, 0);
    }
}

/* ── AI Report ─────────────────────────────────────────────── */
#ai-report-section {
    display: none;
}

#ai-report-section.visible {
    display: block;
    animation: fadeUp 0.5s ease;
}

.ai-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.ai-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--purple), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.ai-title {
    font-size: 1.4rem;
    font-weight: 800;
}

.ai-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.rec-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rec-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(16px);
}

.rec-card.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.rec-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.rec-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.rec-rank {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-dim);
    border-radius: 20px;
    padding: 3px 10px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.rec-course {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.rec-uni {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
}

.rec-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
}

.meta-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.meta-chip.green {
    background: var(--green-dim);
    color: var(--green);
    border-color: rgba(16, 185, 129, 0.2);
}

.meta-chip.yellow {
    background: var(--yellow-dim);
    color: var(--yellow);
    border-color: rgba(245, 158, 11, 0.2);
}

.meta-chip.red {
    background: var(--red-dim);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.2);
}

.meta-chip.purple {
    background: var(--purple-dim);
    color: var(--purple);
    border-color: rgba(139, 92, 246, 0.2);
}

.rec-why {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 14px;
}

.rec-careers-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}

.career-pill {
    font-size: 0.76rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.pro-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.pro-tip::before {
    content: '💡';
    flex-shrink: 0;
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border);
    padding: 64px 0 32px;
    margin-top: 80px;
    background: rgba(15, 23, 42, 0.4);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 48px;
}

.footer-col h4 {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.footer-about p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 320px;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.footer-bottom a {
    color: var(--text-muted);
}

.footer-bottom a:hover {
    color: var(--text-secondary);
}

@media (max-width: 992px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .footer-col h4 {
        margin-bottom: 16px;
        font-size: 0.8rem;
    }

    .footer-links a,
    .footer-about p {
        font-size: 0.8rem;
    }

    .footer-bottom {
        justify-content: center;
        text-align: center;
    }
}

/* ── Notification toast ────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 999;
    max-width: 320px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

.toast.error {
    background: #1c0a0a;
    border: 1px solid var(--red);
    color: var(--red);
}

.toast.success {
    background: #050f0c;
    border: 1px solid var(--green);
    color: var(--green);
}

.toast.info {
    background: #050c15;
    border: 1px solid var(--accent);
    color: var(--accent);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.section-divider {
    height: 1px;
    background: var(--border);
    margin: 48px 0;
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .hero {
        padding: 50px 0 40px;
    }

    .card {
        padding: 20px;
    }

    .clusters-grid {
        grid-template-columns: 1fr;
    }

    .payment-wall {
        padding: 28px 20px;
    }

    .phone-pay-row {
        flex-direction: column;
    }

    .results-header {
        flex-direction: column;
    }

    .hero-stats {
        gap: 24px;
    }
}