/* ═══════════════════════════════════════════════════════════
   RU-DZ CONNECT 3.0 — Premium Design System v2
   Theme: Midnight Blue + Emerald + Frost White
   Supports: Dark (default) & Light modes
   ═══════════════════════════════════════════════════════════ */

/* --- Theme Variables --- */
:root {
    color-scheme: dark;
    --midnight: #06152A;
    --midnight-deep: #041020;
    --midnight-surface: #0f172a;
    --emerald: #00D084;
    --emerald-dim: rgba(0, 208, 132, 0.15);
    --frost: #F8FAFC;
    --blue-accent: #3b82f6;
    --purple-accent: #8b5cf6;
    --amber-accent: #f59e0b;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Dark theme (default) */
    --bg-primary: #06152A;
    --bg-secondary: rgba(6, 21, 42, 0.7);
    --bg-surface: rgba(255, 255, 255, 0.02);
    --bg-surface-hover: rgba(255, 255, 255, 0.04);
    --bg-card: rgba(6, 21, 42, 0.4);
    --border-primary: rgba(255, 255, 255, 0.06);
    --border-secondary: rgba(255, 255, 255, 0.04);
    --text-primary: #F8FAFC;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --shadow-glow: rgba(0, 208, 132, 0.06);
    --scrollbar-track: rgba(6, 21, 42, 0.3);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
}

/* Light Theme */
html:not(.dark) {
    color-scheme: light;
    --bg-primary: #f1f5f9;
    --bg-secondary: rgba(255, 255, 255, 0.85);
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 255, 255, 0.9);
    --bg-card: rgba(255, 255, 255, 0.6);
    --border-primary: rgba(0, 0, 0, 0.08);
    --border-secondary: rgba(0, 0, 0, 0.05);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow-glow: rgba(0, 208, 132, 0.1);
    --scrollbar-track: rgba(0, 0, 0, 0.05);
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
}

/* --- Base --- */
body, button, input, select, textarea {
    font-family: "Readex Pro", "Cairo", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
h1, h2, h3, h4, h5, h6, .heading-font {
    font-family: "Cairo", sans-serif !important;
}
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    transition: background-color 0.4s ease, color 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT GRID SHELL — Dashboard 3-Column
   ═══════════════════════════════════════════════════════════ */
.dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background-color: var(--bg-primary);
    transition: background-color 0.4s ease;
}

.left-sidebar {
    width: 280px;
    height: 100%;
    flex-shrink: 0;
    border-inline-end: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 0%, rgba(0, 208, 132, 0.05), transparent 45%),
                radial-gradient(circle at 10% 40%, rgba(59, 130, 246, 0.04), transparent 35%);
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    transition: background 0.4s ease;
}

html:not(.dark) .main-content {
    background: radial-gradient(circle at 50% 0%, rgba(0, 208, 132, 0.08), transparent 45%),
                radial-gradient(circle at 10% 40%, rgba(59, 130, 246, 0.06), transparent 35%),
                var(--bg-primary);
}

.right-ai-panel {
    position: fixed;
    bottom: 80px; /* Space for mobile nav or padding */
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 100px);
    max-width: calc(100vw - 32px);
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.05);
    
    /* LTR positioning */
    right: 20px;
    left: auto;

    /* Hidden state by default */
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[dir="rtl"] .right-ai-panel {
    right: auto;
    left: 20px;
}

.right-ai-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1) !important;
}

/* ═══════════════════════════════════════════════════════════
   DESIGN SYSTEM — Glassmorphism Components
   ═══════════════════════════════════════════════════════════ */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-secondary);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    border-color: rgba(0, 208, 132, 0.25);
    background: var(--bg-surface-hover);
    box-shadow: 0 12px 40px 0 var(--shadow-glow);
    transform: translateY(-2px);
}

.journey-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.journey-card:hover {
    background: var(--bg-surface-hover);
    border-color: rgba(59, 130, 246, 0.3);
}

.university-card {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: 24px;
    padding: 1.5rem;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.university-card:hover {
    border-color: rgba(0, 208, 132, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 208, 132, 0.08);
}

.ai-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.progress-step {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background: var(--midnight-surface);
    border: 2px solid #334155;
    color: var(--text-secondary);
    font-weight: 700;
    transition: all 0.3s ease;
    z-index: 10;
}

.progress-step.completed {
    background: var(--emerald);
    border-color: var(--emerald);
    color: #06152A;
    box-shadow: 0 0 15px rgba(0, 208, 132, 0.4);
}

.progress-step.active {
    background: var(--blue-accent);
    border-color: var(--blue-accent);
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    animation: pulse-ring 2s infinite;
}

.quick-service-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.quick-service-card:hover {
    background: var(--bg-surface-hover);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.1);
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 208, 132, 0.4); }

/* ═══════════════════════════════════════════════════════════
   MAP — Nodes, Routes, Pulses
   ═══════════════════════════════════════════════════════════ */
.map-node { cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.map-node:hover { filter: drop-shadow(0 0 12px var(--emerald)); }
.map-node-pulse { animation: mapPulse 2s infinite; }
@keyframes mapPulse {
    0% { r: 5px; opacity: 1; }
    50% { r: 14px; opacity: 0.3; }
    100% { r: 22px; opacity: 0; }
}
.route-line { stroke-dasharray: 6, 6; animation: dash 25s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -1000; } }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS — Core
   ═══════════════════════════════════════════════════════════ */
@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
.animate-float { animation: float 5s ease-in-out infinite; }

@keyframes fadeInDown {
    0% { opacity: 0; transform: translateY(-12px); }
    100% { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-down { animation: fadeInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* ═══════════════════════════════════════════════════════════
   PAGE TRANSITIONS — Smooth entry for every page
   ═══════════════════════════════════════════════════════════ */
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.page-transition {
    animation: pageEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ═══════════════════════════════════════════════════════════
   SCROLL REVEAL — Elements animate in on scroll
   ═══════════════════════════════════════════════════════════ */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ═══════════════════════════════════════════════════════════
   SKELETON LOADING — Shimmer placeholder
   ═══════════════════════════════════════════════════════════ */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.03) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.03) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.8s ease-in-out infinite;
    border-radius: 12px;
}
html:not(.dark) .skeleton {
    background: linear-gradient(90deg,
        rgba(0,0,0,0.04) 25%,
        rgba(0,0,0,0.08) 50%,
        rgba(0,0,0,0.04) 75%);
    background-size: 800px 100%;
}
.skeleton-text { height: 14px; width: 70%; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 50%; margin-bottom: 12px; }
.skeleton-card { height: 160px; width: 100%; }

/* ═══════════════════════════════════════════════════════════
   PARTICLE BACKGROUND — CSS-only Hero particles
   ═══════════════════════════════════════════════════════════ */
.particle-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.particle-field::before,
.particle-field::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--emerald);
    opacity: 0.3;
    animation: particleDrift 12s ease-in-out infinite;
}
.particle-field::before {
    top: 20%;
    left: 15%;
    box-shadow:
        80px 40px 0 rgba(0, 208, 132, 0.2),
        200px 100px 0 rgba(59, 130, 246, 0.15),
        350px 60px 0 rgba(0, 208, 132, 0.25),
        500px 140px 0 rgba(139, 92, 246, 0.15),
        120px 200px 0 rgba(0, 208, 132, 0.1),
        420px 30px 0 rgba(59, 130, 246, 0.2),
        600px 180px 0 rgba(0, 208, 132, 0.15),
        50px 280px 0 rgba(59, 130, 246, 0.1),
        300px 250px 0 rgba(139, 92, 246, 0.2),
        700px 90px 0 rgba(0, 208, 132, 0.12);
}
.particle-field::after {
    top: 35%;
    left: 40%;
    animation-delay: -6s;
    animation-direction: reverse;
    box-shadow:
        -60px -30px 0 rgba(59, 130, 246, 0.2),
        -180px 80px 0 rgba(0, 208, 132, 0.15),
        100px -50px 0 rgba(139, 92, 246, 0.12),
        -300px -90px 0 rgba(0, 208, 132, 0.2),
        250px 120px 0 rgba(59, 130, 246, 0.1),
        -150px 200px 0 rgba(0, 208, 132, 0.18),
        400px -40px 0 rgba(59, 130, 246, 0.15),
        -50px 150px 0 rgba(139, 92, 246, 0.1);
}
@keyframes particleDrift {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(15px, -20px); }
    50% { transform: translate(-10px, 15px); }
    75% { transform: translate(20px, 10px); }
}

/* ═══════════════════════════════════════════════════════════
   NEON & GRADIENT EFFECTS
   ═══════════════════════════════════════════════════════════ */
.neon-text { text-shadow: 0 0 10px rgba(0, 208, 132, 0.4); }
html:not(.dark) .neon-text { text-shadow: none; }

.gradient-border { position: relative; background-clip: padding-box; }
.gradient-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--emerald), var(--blue-accent), var(--purple-accent));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.gradient-border:hover::before { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   CHAT BUBBLES
   ═══════════════════════════════════════════════════════════ */
.chat-messages { scroll-behavior: smooth; }
.chat-bubble {
    max-width: 85%;
    border-radius: 16px;
    padding: 0.85rem 1.1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    display: inline-block;
}
.chat-assistant {
    margin-inline-end: auto;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-secondary);
}
.chat-user {
    margin-inline-start: auto;
    background: var(--emerald);
    color: #06152A;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 208, 132, 0.2);
}

/* ═══════════════════════════════════════════════════════════
   TICKER SCROLL
   ═══════════════════════════════════════════════════════════ */
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}
.animate-scroll {
    display: flex;
    width: max-content;
    animation: ticker-scroll 35s linear infinite;
}
.animate-scroll:hover { animation-play-state: paused; }

/* ═══════════════════════════════════════════════════════════
   SUGGESTION BUTTONS
   ═══════════════════════════════════════════════════════════ */
.suggestion-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-primary);
    background: var(--bg-surface);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}
.suggestion-btn:hover {
    background: var(--emerald-dim);
    border-color: var(--emerald);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════ */
.theme-toggle-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    color: var(--text-secondary);
}
.theme-toggle-btn:hover {
    background: var(--bg-surface-hover);
    border-color: rgba(0, 208, 132, 0.3);
    color: var(--emerald);
    transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════
   ONBOARDING MODAL
   ═══════════════════════════════════════════════════════════ */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}
@keyframes fadeIn { to { opacity: 1; } }

.onboarding-card {
    width: 90%;
    max-width: 540px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.onboarding-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 1.5rem 0;
}
.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}
.onboarding-dot.active {
    background: var(--emerald);
    width: 24px;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   STATS COUNTER CARDS
   ═══════════════════════════════════════════════════════════ */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--emerald), var(--blue-accent));
    opacity: 0;
    transition: opacity 0.3s;
}
.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 208, 132, 0.2);
    box-shadow: 0 12px 35px rgba(0, 208, 132, 0.08);
}
.stat-card:hover::before { opacity: 1; }

.stat-number {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--emerald), var(--blue-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ═══════════════════════════════════════════════════════════
   BUDGET CALCULATOR — Pie Chart & Sliders
   ═══════════════════════════════════════════════════════════ */
.pie-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
}
.budget-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #1e293b;
    outline: none;
    transition: background 0.3s;
}
.budget-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--emerald);
    cursor: pointer;
    border: 3px solid var(--bg-primary);
    box-shadow: 0 0 10px rgba(0, 208, 132, 0.3);
    transition: transform 0.2s;
}
.budget-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
#sidebar-toggle, #advisor-toggle { display: none; }
@media (max-width: 1024px) {
    .left-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    html[dir="rtl"] .left-sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }
    .left-sidebar.active {
        transform: translateX(0) !important;
    }
    /* On mobile, standard chat widget size or slightly larger */
    .right-ai-panel {
        bottom: 70px;
        right: 16px;
        left: 16px;
        width: auto !important;
        max-width: none;
        height: calc(100vh - 90px);
        transform: translateY(20px) scale(0.95);
    }
    html[dir="rtl"] .right-ai-panel {
        right: 16px;
        left: 16px;
    }
    .right-ai-panel.active {
        transform: translateY(0) scale(1) !important;
    }
    /* Hide bottom nav when advisor is open */
    .right-ai-panel.active ~ .mobile-bottom-nav,
    body.modal-open .mobile-bottom-nav {
        display: none !important;
    }
    /* Ensure chat input form is above safe area */
    .right-ai-panel #chat-form {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
    #sidebar-toggle, #advisor-toggle { display: flex; }
}

/* ═══════════════════════════════════════════════════════════
   LIGHT MODE OVERRIDES for Tailwind classes
   ═══════════════════════════════════════════════════════════ */
html:not(.dark) .bg-\[\#06152A\],
html:not(.dark) .bg-\[\#06152A\]\/90,
html:not(.dark) .bg-\[\#06152A\]\/50 {
    background-color: #f1f5f9 !important;
}
html:not(.dark) .border-slate-800 {
    border-color: rgba(0, 0, 0, 0.08) !important;
}
html:not(.dark) .text-white {
    color: #0f172a !important;
}
html:not(.dark) .text-slate-100,
html:not(.dark) .text-slate-200,
html:not(.dark) .text-slate-300 {
    color: #334155 !important;
}
html:not(.dark) .text-slate-400,
html:not(.dark) .text-slate-500 {
    color: #64748b !important;
}
html:not(.dark) .bg-white\/5,
html:not(.dark) .bg-white\/2 {
    background-color: rgba(0, 0, 0, 0.03) !important;
}
html:not(.dark) .bg-slate-950\/40 {
    background-color: rgba(241, 245, 249, 0.9) !important;
}

/* Fix SVG map text visibility in Light Mode */
html:not(.dark) svg text[fill="white"] {
    fill: #0f172a !important;
}
html:not(.dark) svg text[fill="#64748b"] {
    fill: #475569 !important;
}
html:not(.dark) .route-line {
    stroke-opacity: 0.6;
}

/* No scrollbar utility */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ═══════════════════════════════════════════════════════════
   MOBILE UX ENHANCEMENTS — Comprehensive Touch & Layout
   ═══════════════════════════════════════════════════════════ */

/* --- Mobile Bottom Nav Enhancements --- */
.mobile-bottom-nav {
    gap: 2px;
}
.mob-nav-item {
    min-height: 48px;
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.mob-nav-item:active {
    transform: scale(0.92);
    opacity: 0.8;
}
.mob-nav-item.active {
    color: #00D084;
    position: relative;
}
.mob-nav-item.active::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 2px;
    background: #00D084;
}
html:not(.dark) .mob-nav-item.active { color: #059669; }
html:not(.dark) .mob-nav-item.active::after { background: #059669; }

/* --- Improved Touch Targets for All Interactive Elements --- */
@media (max-width: 1024px) {
    /* Bigger tap targets */
    button, a, input, select, textarea {
        -webkit-tap-highlight-color: transparent;
    }

    /* Better button sizing on mobile */
    .wiz-select-btn {
        min-height: 70px;
    }

    /* Cards: no hover-translateY on touch (causes jank) */
    .glass-card:hover,
    .stat-card:hover,
    .university-card:hover,
    .quick-service-card:hover {
        transform: none;
    }

    /* Active press effect instead */
    .glass-card:active,
    .stat-card:active,
    .university-card:active,
    .quick-service-card:active {
        transform: scale(0.98);
        transition-duration: 0.1s;
    }

    /* Wider main content padding for readability */
    .flex-1.overflow-y-auto {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* Quick service cards: better mobile grid */
    .grid.grid-cols-3 {
        gap: 6px !important;
    }

    /* Better chat input on mobile */
    #chat-input {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Prevent body scroll when modals are open */
    body.modal-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
    }

    /* Sidebar slide animation improvement */
    .left-sidebar,
    .right-ai-panel {
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1) !important;
        will-change: transform;
    }

    /* Better onboarding modal on small screens */
    .onboarding-card {
        width: 94%;
        padding: 1.5rem;
        max-height: 85vh;
        overflow-y: auto;
    }

    /* Stat cards: 2-col on mobile with equal size */
    .stat-card {
        padding: 1rem;
    }
    .stat-number {
        font-size: 1.5rem;
    }

    /* SVG Map: minimum height for small screens */
    #russiaMapSvg {
        min-height: 180px;
    }
}

/* --- Very Small Screens (≤ 380px) --- */
@media (max-width: 380px) {
    .mob-nav-item {
        font-size: 9px;
    }
    .mob-nav-item .mob-icon {
        font-size: 18px;
    }
    .onboarding-card {
        padding: 1.25rem;
    }
    .onboarding-card h2 {
        font-size: 1.1rem;
    }
}

/* --- Pull-to-refresh feel & momentum scroll --- */
.main-content .flex-1 {
    overscroll-behavior-y: contain;
}

/* --- Smooth focus styles for accessibility --- */
@media (max-width: 1024px) {
    *:focus-visible {
        outline: 2px solid #00D084;
        outline-offset: 2px;
        border-radius: 8px;
    }
}

/* --- Landscape phone fix --- */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-bottom-nav {
        padding: 0.25rem 0.5rem;
    }
    .mob-nav-item {
        min-height: 40px;
        font-size: 9px;
    }
    .mob-nav-item .mob-icon {
        font-size: 16px;
    }
}

/* --- Swipe hint animation for horizontal scrollable areas --- */
@keyframes swipeHint {
    0%, 100% { transform: translateX(0); opacity: 0; }
    30% { transform: translateX(-8px); opacity: 1; }
    70% { transform: translateX(8px); opacity: 1; }
}
.swipe-hint::after {
    content: '👆';
    position: absolute;
    bottom: 4px;
    left: 50%;
    animation: swipeHint 3s ease-in-out 2s 2;
    font-size: 14px;
    pointer-events: none;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.hide-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
