/* ==========================================================================
   ExamCracker AI - Main Design System & Theme Engine
   ========================================================================== */

:root {
  /* Core Brand Colors */
  --bg-dark: #090d16;
  --bg-surface: #0f172a;
  --bg-card: rgba(18, 24, 40, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.35);
  --border-active: rgba(99, 102, 241, 0.8);

  /* Primary Palettes */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --cyber-cyan: #06b6d4;
  --cyber-cyan-glow: rgba(6, 182, 212, 0.25);

  --amber-gold: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.25);

  --emerald-green: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);

  --crimson-alert: #f43f5e;
  --crimson-glow: rgba(244, 63, 94, 0.25);

  --purple-accent: #a855f7;

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Dimensions & Spacing */
  --sidebar-width: 280px;
  --header-height: 72px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Glassmorphism & Shadow */
  --backdrop-blur: blur(16px);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.35);
  --shadow-cyan-glow: 0 0 25px rgba(6, 182, 212, 0.3);

  --transition-fast: 0.18s ease;
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Overrides (Optional / Dynamic) */
body.light-mode {
  --bg-dark: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
}

/* CSS Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Futuristic Animated Mesh Background */
.mesh-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  background: 
    radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(6, 182, 212, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 50% 85%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(244, 63, 94, 0.06) 0%, transparent 40%);
  filter: blur(40px);
}

/* App Shell Structure */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: var(--backdrop-blur);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 24px 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--cyber-cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title .ai-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--purple-accent));
  color: #fff;
  -webkit-text-fill-color: #fff;
  letter-spacing: 0.5px;
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}

/* Navigation Links */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-category-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 12px 14px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.22) 0%, rgba(99, 102, 241, 0.05) 100%);
  border-color: rgba(99, 102, 241, 0.35);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
}

.nav-icon {
  font-size: 1.15rem;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.badge-cyan { background: var(--cyber-cyan-glow); color: var(--cyber-cyan); border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-gold { background: var(--amber-glow); color: var(--amber-gold); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-red { background: var(--crimson-glow); color: var(--crimson-alert); border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-green { background: var(--emerald-glow); color: var(--emerald-green); border: 1px solid rgba(16, 185, 129, 0.3); }

/* Sidebar Footer (User / Upgrade) */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pro-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pro-banner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.pro-banner p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top App Header / Command Bar */
.app-header {
  height: var(--header-height);
  padding: 0 32px;
  background: rgba(9, 13, 22, 0.75);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.exam-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.exam-picker-wrap:hover {
  border-color: var(--border-glow);
}

.exam-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
}

.exam-select {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.exam-select option {
  background-color: var(--bg-surface);
  color: var(--text-main);
  padding: 8px;
}

.countdown-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--amber-gold);
}

.countdown-box span.days {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.streak-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fb7185;
}

.xp-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-light);
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-md);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 0.9rem;
}

/* Page View Content Container */
.page-view {
  display: none;
  padding: 32px;
  flex: 1;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-view.active {
  display: block;
}

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

/* Utilities */
.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-gradient {
  background: linear-gradient(135deg, #fff 30%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.onboarding-exam-picker{display:grid;gap:10px}
.onboarding-exam-picker select{width:100%;background:#111827;color:#fff;border:1px solid var(--border-subtle);padding:12px 14px;border-radius:14px;font-size:.92rem;outline:none;box-sizing:border-box;min-height:46px}
.onboarding-exam-picker select:focus{border-color:#6366f1;box-shadow:0 0 0 3px rgba(99,102,241,.15)}
@media (max-width:640px){.onboarding-exam-picker select{min-height:50px;font-size:.95rem}.onboarding-exam-picker .form-input{min-height:48px;font-size:.95rem}}
