/**
 * Pillora Design System — Design Tokens (v2.0)
 * Reusable Design Tokens File for Pillora Web Platform
 * Complies with W3C Design Tokens Community Group specification.
 * Supports Light Mode, Dark Mode ([data-theme="dark"]), and RTL ([dir="rtl"]).
 */

:root {
  /* ==========================================================================
     1. COLOR PRIMITIVES (Base Palette)
     ========================================================================== */
  
  /* Primary Teal (Trust, Medical, Precision) */
  --color-teal-50:  #F0FDFA;
  --color-teal-100: #CCFBF1;
  --color-teal-200: #99F6E4;
  --color-teal-300: #5EEAD4;
  --color-teal-400: #2DD4BF;
  --color-teal-500: #14B8A6;
  --color-teal-600: #0D9488;
  --color-teal-700: #0F766E; /* Brand Primary in Light Mode */
  --color-teal-800: #115E59;
  --color-teal-900: #134E4A;
  --color-teal-950: #042F2E;

  /* Neutral Slate (Clean, Readable, High-Contrast) */
  --color-slate-50:  #F8FAFC;
  --color-slate-100: #F1F5F9;
  --color-slate-200: #E2E8F0;
  --color-slate-300: #CBD5E1;
  --color-slate-400: #94A3B8;
  --color-slate-500: #64748B;
  --color-slate-600: #475569;
  --color-slate-700: #334155; /* WCAG AAA Muted text (7.5:1) */
  --color-slate-800: #1E293B;
  --color-slate-900: #0F172A; /* Primary text in Light Mode */
  --color-slate-950: #020617;

  /* Savings Emerald (Generic Price Drop, Discount Badges) */
  --color-emerald-50:  #ECFDF5;
  --color-emerald-100: #D1FAE5;
  --color-emerald-200: #A7F3D0;
  --color-emerald-300: #6EE7B7;
  --color-emerald-400: #34D399;
  --color-emerald-500: #10B981;
  --color-emerald-600: #047857; /* Upgraded to emerald-700 (5.5:1 AA contrast on white) */
  --color-emerald-700: #047857;

  /* Alert Amber & Warning */
  --color-amber-50:  #FFFBEB;
  --color-amber-100: #FEF3C7;
  --color-amber-500: #F59E0B;
  --color-amber-700: #B45309;
  --color-amber-800: #92400E;
  --color-amber-900: #78350F;

  /* Danger & Critical */
  --color-rose-50:  #FFF1F2;
  --color-rose-100: #FFE4E6;
  --color-rose-500: #F43F5E;
  --color-rose-600: #E11D48;
  --color-rose-700: #BE123C;

  /* ==========================================================================
     2. SEMANTIC TOKENS — LIGHT MODE (Default)
     ========================================================================== */
  --bg: #F8FBFA;
  --hero-bg: #ECFDF5;
  --sf: #FFFFFF;
  --sf2: #F1F7F6;
  --sf3: #E6F4F1;
  --tx: #0F172A;
  --mu: #334155;        /* 7.5:1 contrast against --bg & --sf (WCAG AAA) */
  --mu-subtle: #64748B; /* 4.5:1 contrast for secondary captions */
  --bd: #E2E8F0;
  --bd-hover: #0F766E;
  --ac: #0F766E;        /* Brand Primary */
  --ac-hover: #0D655E;
  --ac-active: #115E59;
  --ac-lt: #14B8A6;
  --ac-bg: #CCFBF1;
  --on: #FFFFFF;
  --acs: rgba(15, 118, 110, 0.08);

  /* Status Colors */
  --warn-bg: #FEF3C7;
  --warn-fg: #92400E;
  --amber-bg: #FEF3C7;
  --amber-fg: #92400E;
  --green-bg: #DCFCE7;
  --green-fg: #047857; /* Upgraded to emerald-700 for WCAG AA 5.5:1 text compliance */
  --danger-bg: #FFE4E6;
  --danger-fg: #BE123C;

  /* Footer Colors */
  --foot-bg: #0B191B;
  --foot-fg: #F1F5F9;
  --foot-mu: #94A3B8;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 20px -2px rgba(15, 118, 110, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px -6px rgba(15, 118, 110, 0.12), 0 6px 14px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, 0.18);
  --shadow-glow: 0 0 0 4px rgba(15, 118, 110, 0.15);
  --focus-ring: 0 0 0 3px rgba(15, 118, 110, 0.35);

  /* ==========================================================================
     3. TYPOGRAPHY TOKENS
     ========================================================================== */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-rtl: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', system-ui, -apple-system, sans-serif;

  /* Font Sizes */
  --text-2xs: 0.6875rem; /* 11px */
  --text-xs:  0.75rem;   /* 12px */
  --text-sm:  0.875rem;  /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg:  1.125rem;  /* 18px */
  --text-xl:  1.25rem;   /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-5xl: 3rem;      /* 48px */

  /* Font Weights */
  --font-regular: 400;
  --font-medium:  500;
  --font-semibold: 600;
  --font-bold:    700;
  --font-black:   800;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.55;
  --leading-relaxed: 1.75;
  --leading-rtl-body: 1.85;
  --leading-rtl-head: 1.45;

  /* ==========================================================================
     4. SPACING & SIZING TOKENS (8pt grid basis)
     ========================================================================== */
  --space-0-5: 0.125rem; /* 2px */
  --space-1:   0.25rem;  /* 4px */
  --space-1-5: 0.375rem; /* 6px */
  --space-2:   0.5rem;   /* 8px */
  --space-2-5: 0.625rem; /* 10px */
  --space-3:   0.75rem;  /* 12px */
  --space-4:   1rem;     /* 16px */
  --space-5:   1.25rem;  /* 20px */
  --space-6:   1.5rem;   /* 24px */
  --space-7:   1.75rem;  /* 28px */
  --space-8:   2rem;     /* 32px */
  --space-10:  2.5rem;   /* 40px */
  --space-12:  3rem;     /* 48px */
  --space-14:  3.5rem;   /* 56px */
  --space-16:  4rem;     /* 64px */
  --space-20:  5rem;     /* 80px */
  --space-24:  6rem;     /* 96px */

  /* ==========================================================================
     5. BORDER RADIUS TOKENS
     ========================================================================== */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 24px;
  --radius-3xl: 32px;
  --radius-full: 9999px;

  /* ==========================================================================
     6. INTERACTIVE & LAYOUT TOKENS
     ========================================================================== */
  --touch-target-min: 44px; /* WCAG 2.5.5 / 2.5.8 Touch Target Requirement */
  --header-height: 68px;
  --container-max-w: 1280px;
  --scroll-offset: 80px;

  /* Transitions & Animation Timings */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-Index Hierarchy */
  --z-base: 1;
  --z-sticky-header: 100;
  --z-drawer-backdrop: 900;
  --z-drawer: 950;
  --z-modal-backdrop: 1000;
  --z-modal: 1050;
  --z-toast: 1100;
}

/* ==========================================================================
   7. SEMANTIC TOKENS — DARK MODE ([data-theme="dark"])
   ========================================================================== */
[data-theme="dark"] {
  --bg: #091315;
  --hero-bg: #0D1C1F;
  --sf: #102124;
  --sf2: #152B2F;
  --sf3: #1A363B;
  --tx: #F8FAFC;
  --mu: #CBD5E1;        /* 8.5:1 contrast against dark surfaces */
  --mu-subtle: #94A3B8;
  --bd: #1E373B;
  --bd-hover: #14B8A6;
  --ac: #14B8A6;        /* Teal 500 brightened for dark background */
  --ac-hover: #2DD4BF;
  --ac-active: #5EEAD4;
  --ac-lt: #2DD4BF;
  --ac-bg: rgba(20, 184, 166, 0.15);
  --on: #041B18;
  --acs: rgba(20, 184, 166, 0.14);

  /* Status Colors */
  --warn-bg: #451A03;
  --warn-fg: #FCD34D;
  --amber-bg: #451A03;
  --amber-fg: #FCD34D;
  --green-bg: #064E3B;
  --green-fg: #4ADE80;
  --danger-bg: #4C0519;
  --danger-fg: #FDA4AF;

  /* Footer Colors */
  --foot-bg: #060E10;
  --foot-fg: #F1F5F9;
  --foot-mu: #94A3B8;

  /* Dark Elevation Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.60);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.75);
  --shadow-glow: 0 0 0 4px rgba(20, 184, 166, 0.22);
  --focus-ring: 0 0 0 3px rgba(20, 184, 166, 0.45);
}

/* ==========================================================================
   8. RTL / URDU SPECIFIC SYSTEM TOKENS ([dir="rtl"])
   ========================================================================== */
[dir="rtl"] {
  --font-sans: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', system-ui, sans-serif;
  --line-height-body: var(--leading-rtl-body);
  --line-height-head: var(--leading-rtl-head);
  letter-spacing: 0 !important; /* Preserves delicate Urdu/Arabic ligatures */
}

/* Global scroll margin for anchors */
section[id] {
  scroll-margin-top: var(--scroll-offset);
}
