/* ==========================================================================
   Doppelyar Design System Tokens
   Strict adherence to approved project design specifications
   ========================================================================== */

:root {
  /* Typography */
  --font-main: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette - Light Mode (Default) */
  --bg-primary: #F6F1E7;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #FFFFFF;
  --bg-surface-soft: #EDE7DA;
  --bg-surface-translucent: rgba(255, 255, 255, 0.88);

  /* Navy Shades */
  --navy-primary: #16223F;
  --navy-lighter: #26365C;
  --navy-light: #26365C;
  --navy-deep: #0D162B;
  --navy-tint: rgba(22, 34, 63, 0.06);

  /* Gold Shades */
  --gold-primary: #EFA940;
  --gold-darker: #E2942A;
  --gold-light: #FDEED6;
  --gold-tint: rgba(239, 169, 64, 0.15);
  --gold-glow: rgba(239, 169, 64, 0.35);

  /* Text Colors */
  --text-primary: #1B2436;
  --text-secondary: #475569;
  --text-muted: #8A8FA0;
  --text-inverse: #FFFFFF;

  /* Status Colors */
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3B82F6;
  --info-bg: rgba(59, 130, 246, 0.12);

  /* Borders */
  --border-light: rgba(22, 34, 63, 0.08);
  --border-subtle: rgba(22, 34, 63, 0.04);
  --border-focus: var(--gold-primary);

  /* Hierarchical Radii */
  --radius-hero: 30px; /* Reserved ONLY for the primary hero centerpiece */
  --radius-lg: 20px;   /* Major cards */
  --radius-md: 14px;   /* Standard cards */
  --radius-sm: 10px;   /* Secondary / Tertiary cards & inputs */
  --radius-xs: 6px;    /* Micro badges */
  --radius-full: 9999px;

  /* Hierarchical Shadows */
  --shadow-hero: 0 24px 50px -18px rgba(22, 34, 63, 0.22), 0 0 0 1px rgba(239, 169, 64, 0.16);
  --shadow-standard: none;
  --shadow-card: none;
  --shadow-floating: 0 20px 40px -15px rgba(22, 34, 63, 0.28);
  --shadow-sm: 0 1px 3px rgba(22, 34, 63, 0.05);

  /* Layout */
  --app-max-width: 480px;
  --bottom-nav-height: 72px;

  /* Safe Area for iOS */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ==========================================================================
   Dark Mode Support (Attribute [data-theme="dark"] and Class .dark-mode)
   ========================================================================== */
[data-theme="dark"],
body.dark-mode {
  --bg-primary: #0D1424 !important;
  --bg-surface: #16223F !important;
  --bg-surface-elevated: #1F2D52 !important;
  --bg-surface-soft: #121A30 !important;
  --bg-surface-translucent: rgba(22, 34, 63, 0.9) !important;

  --navy-primary: #1E2D56 !important;
  --navy-lighter: #2B3D72 !important;
  --navy-light: #334155 !important;
  --navy-deep: #080D18 !important;
  --navy-tint: rgba(255, 255, 255, 0.08) !important;

  --gold-primary: #F3B353 !important;
  --gold-darker: #EFA940 !important;
  --gold-light: #3D2B14 !important;
  --gold-tint: rgba(243, 179, 83, 0.2) !important;
  --gold-glow: rgba(243, 179, 83, 0.4) !important;

  --text-primary: #F8FAFC !important;
  --text-secondary: #CBD5E1 !important;
  --text-muted: #94A3B8 !important;
  --text-inverse: #0D1424 !important;

  --border-light: rgba(255, 255, 255, 0.12) !important;
  --border-subtle: rgba(255, 255, 255, 0.06) !important;

  --shadow-standard: 0 10px 30px -14px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 8px 24px -10px rgba(0, 0, 0, 0.45);
  --shadow-floating: 0 20px 40px -15px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: var(--text-primary) !important;
}

body.dark-mode {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .app-container {
  background-color: var(--bg-primary) !important;
}

body.dark-mode .app-header,
body.dark-mode .bottom-nav,
body.dark-mode .modal-content,
body.dark-mode .modal-box,
body.dark-mode .form-card,
body.dark-mode .profile-card,
body.dark-mode .overview-card,
body.dark-mode .task-card,
body.dark-mode .chat-footer-card,
body.dark-mode .cockpit-card,
body.dark-mode .scenario-picker-card,
body.dark-mode .grammar-correction-card,
body.dark-mode .student-row-card {
  background-color: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-light) !important;
}

body.dark-mode .form-input,
body.dark-mode select.form-input,
body.dark-mode textarea.form-input {
  background-color: var(--bg-surface-soft) !important;
  color: #F8FAFC !important;
  border-color: var(--border-light) !important;
}

body.dark-mode .btn-secondary {
  background: var(--bg-surface-soft) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-light) !important;
}

/* Light Theme (Default) */
[data-theme="light"],
:root {
  --bg-primary: #F6F1E7 !important;
  --bg-surface: #FFFFFF !important;
  --bg-surface-elevated: #FFFFFF !important;
  --bg-surface-soft: #EDE7DA !important;
  --bg-surface-translucent: rgba(255, 255, 255, 0.88) !important;

  --navy-primary: #16223F !important;
  --navy-lighter: #26365C !important;
  --navy-light: #26365C !important;
  --navy-deep: #0D162B !important;
  --navy-tint: rgba(22, 34, 63, 0.06) !important;

  --gold-primary: #EFA940 !important;
  --gold-darker: #E2942A !important;
  --gold-light: #FDEED6 !important;
  --gold-tint: rgba(239, 169, 64, 0.15) !important;
  --gold-glow: rgba(239, 169, 64, 0.35) !important;

  --text-primary: #1B2436 !important;
  --text-secondary: #475569 !important;
  --text-muted: #8A8FA0 !important;
  --text-inverse: #FFFFFF !important;

  --border-light: rgba(22, 34, 63, 0.08) !important;
  --border-subtle: rgba(22, 34, 63, 0.04) !important;

  --shadow-standard: 0 10px 30px -14px rgba(22, 34, 63, 0.18);
  --shadow-card: 0 8px 24px -10px rgba(22, 34, 63, 0.12);
  --shadow-floating: 0 20px 40px -15px rgba(22, 34, 63, 0.22);
  --shadow-sm: 0 2px 8px rgba(22, 34, 63, 0.06);
}
