/* --- 1. DESIGN TOKENS --- */
:root {
    --primary: #1e40af;       /* Deep Medical Blue */
    --primary-light: #3b82f6; /* Hover State */
    --primary-shadow: #112566; 
    
    --accent: #fbbf24;        /* Gold/Amber */
    --accent-shadow: #b45309; 
    
    --success: #10b981;       /* Emerald */
    --success-shadow: #047857;

    --danger: #ef4444;        /* Red */
    --danger-shadow: #991b1b;

    --background: #f8fafc;    
    --surface: #ffffff;
    --surface-subtle: #f1f5f9;
    
    --text-main: #0f172a;     
    --text-muted: #64748b;
    --text-light: #94a3b8;    
    
    --border: #cbd5e1;        
    --border-shadow: #94a3b8;
    --radius-sm: 0.75rem;
    --radius-md: 1rem;
    --radius-lg: 2rem;
}

/* --- 2. GLOBAL RESETS --- */
html { scroll-behavior: smooth; }
body { 
    background-color: var(--background); 
    font-family: 'Inter', sans-serif; 
    color: var(--text-main); 
    -webkit-font-smoothing: antialiased; 
    overflow-x: hidden;
    overscroll-behavior-y: none; /* Prevent iOS rubber-banding */
}

/* --- 3. COMPONENTS --- */
.btn { 
    display: inline-flex; align-items: center; justify-content: center; 
    gap: 0.75rem; padding: 1rem 1.75rem; border-radius: var(--radius-md); 
    font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; 
    cursor: pointer; border: 2px solid transparent; user-select: none; 
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1); 
    -webkit-tap-highlight-color: transparent; 
}
.btn-primary { 
    background-color: var(--primary); color: white; 
    box-shadow: 0px 5px 0px var(--primary-shadow); 
}
.btn-primary:hover { 
    transform: translateY(-2px); 
    background-color: var(--primary-light); 
    box-shadow: 0px 7px 0px var(--primary-shadow); 
}
.btn-primary:active { transform: translateY(5px); box-shadow: none; }

.btn-text { 
    color: var(--text-muted); background: transparent; box-shadow: none; 
}
.btn-text:hover { color: var(--primary); background: var(--surface-subtle); }

.card-interactive { 
    background-color: var(--surface); border-radius: var(--radius-lg); 
    border: 3px solid var(--border); box-shadow: 0px 6px 0px var(--border-shadow); 
    transition: all 0.2s ease; cursor: pointer; position: relative; 
    overflow: hidden; -webkit-tap-highlight-color: transparent; 
}
.card-interactive:hover { 
    transform: translateY(-4px); 
    box-shadow: 0px 12px 0px var(--border-shadow); 
    border-color: var(--primary); 
}
.card-interactive:active { transform: translateY(2px); box-shadow: 0px 2px 0px var(--border-shadow); }
.card-interactive:hover .icon-container { 
    background-color: var(--primary); color: white; 
    border-color: var(--primary); transform: scale(1.1) rotate(-3deg); 
}

/* --- 4. FORMS --- */
.input-group { margin-bottom: 1.5rem; }
.input-label { 
    display: block; font-size: 0.875rem; font-weight: 800; 
    text-transform: uppercase; letter-spacing: 0.05em; 
    color: var(--text-main); margin-bottom: 0.5rem; 
}
.input-field { 
    width: 100%; padding: 1.1rem; border-radius: var(--radius-md); 
    border: 3px solid var(--border); font-weight: 600; 
    font-family: 'Inter', sans-serif; background-color: var(--background); 
    outline: none; transition: all 0.2s; 
    -webkit-appearance: none; appearance: none; 
}
.input-field:focus { 
    border-color: var(--primary); background-color: var(--surface); 
    box-shadow: 0px 4px 0px var(--border-shadow); transform: translateY(-2px); 
}
select.input-field { cursor: pointer; }

/* --- 5. UTILITIES --- */
.glass-panel { 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); 
    border-bottom: 3px solid var(--border); 
}
.tag { 
    font-size: 0.7rem; font-weight: 900; text-transform: uppercase; 
    padding: 0.4rem 0.8rem; border-radius: 0.75rem; letter-spacing: 0.05em; 
}

/* --- 6. ANIMATIONS --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.5s ease-out forwards; }
.animate-slide-up { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.delay-100 { animation-delay: 100ms; } 
.delay-200 { animation-delay: 200ms; } 
.delay-300 { animation-delay: 300ms; }

/* Shake & Pop (For Quiz Feedback) */
@keyframes shake { 
    0%, 100% { transform: translateX(0); } 
    25% { transform: translateX(-5px); } 
    75% { transform: translateX(5px); } 
}
.animate-shake { animation: shake 0.4s ease-in-out; }

@keyframes pop { 
    0% { transform: scale(1); } 
    50% { transform: scale(1.03); } 
    100% { transform: scale(1); } 
}
.animate-pop { animation: pop 0.3s ease-out; }

/* --- 7. DASHBOARD LAYOUT --- */
.dashboard-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 1024px) { .dashboard-layout { grid-template-columns: 280px 1fr; } }

.sidebar-item { 
    display: flex; align-items: center; gap: 1rem; padding: 1rem; 
    border-radius: var(--radius-md); color: var(--text-muted); 
    font-weight: 700; transition: all 0.2s; cursor: pointer; 
    border: 2px solid transparent; 
}
.sidebar-item:hover { 
    background-color: white; color: var(--primary); border-color: var(--border); 
}
.sidebar-item.active { 
    background-color: var(--primary); color: white; 
    box-shadow: 0px 4px 0px var(--primary-shadow); 
}

/* --- 8. STATS & PROGRESS --- */
.stat-card { 
    background: white; padding: 1.5rem; border-radius: var(--radius-lg); 
    border: 3px solid var(--border); box-shadow: 0px 6px 0px var(--border-shadow); 
}
.stat-value { 
    font-size: 2.5rem; font-weight: 900; line-height: 1; 
    letter-spacing: -0.05em; color: var(--text-main); 
}
.stat-label { 
    font-size: 0.75rem; font-weight: 800; text-transform: uppercase; 
    color: var(--text-muted); letter-spacing: 0.05em; margin-top: 0.5rem; 
}

.progress-track { 
    height: 1.25rem; background: var(--surface-subtle); 
    border: 2px solid var(--border); border-radius: 1rem; 
    overflow: hidden; position: relative; margin-top: 1rem; 
}
.progress-fill { 
    height: 100%; background: var(--success); 
    border-right: 2px solid rgba(0,0,0,0.1); transition: width 1s ease-out; 
}

/* --- 9. MOBILE NAVIGATION --- */
.mobile-nav { 
    position: fixed; bottom: 0; left: 0; right: 0; 
    background: white; border-top: 3px solid var(--border); 
    display: flex; justify-content: space-around; 
    padding: 0.75rem; z-index: 50; 
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); 
    box-shadow: 0px -4px 20px rgba(0,0,0,0.05); 
}
.mobile-nav-item { 
    display: flex; flex-direction: column; align-items: center; 
    justify-content: center; color: var(--text-muted); 
    font-size: 0.65rem; font-weight: 800; text-transform: uppercase; 
    gap: 0.25rem; flex: 1; -webkit-tap-highlight-color: transparent; 
}
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-item.active svg { stroke-width: 3px; }

/* --- 10. QUESTION ENGINE --- */
.question-option { 
    padding: 1.25rem; border-radius: var(--radius-md); 
    border: 3px solid var(--border); background: var(--surface); 
    cursor: pointer; transition: all 0.2s; font-weight: 600; 
    display: flex; align-items: center; gap: 1rem; 
}
.question-option:hover { 
    border-color: var(--primary); background: var(--surface-subtle); 
}
.question-option.selected { 
    border-color: var(--primary); background: #eff6ff; 
    box-shadow: 0px 4px 0px var(--primary-shadow); 
}
.question-option.correct { 
    border-color: var(--success); background: #ecfdf5; color: #065f46; 
}
.question-option.wrong { 
    border-color: var(--danger); background: #fef2f2; color: #991b1b; 
}

.concept-card { 
    background: #fffbeb; border: 3px solid #fcd34d; 
    border-radius: var(--radius-lg); padding: 2rem; 
    box-shadow: 0px 8px 0px #b45309; margin-bottom: 2rem; 
    position: relative; overflow: hidden; 
}
.concept-icon { 
    position: absolute; right: -20px; top: -20px; opacity: 0.1; 
    width: 150px; height: 150px; color: #b45309; transform: rotate(15deg); 
}