/* ============================================================
   TALKBACK — DESIGN TOKEN SYSTEM
   ============================================================
   File: css/variables.css
   Purpose: Single source of truth for all design values.
            Every color, spacing, font, shadow, radius, z-index,
            and animation timing used in the application.
   
   RULES:
   - Never hard-code colors in other CSS files
   - Always reference these variables
   - Dark theme is default
   - Light theme overrides dark values
   ============================================================ */


/* ============================================================
   1. DARK THEME (DEFAULT)
   ============================================================ */

[data-theme="dark"] {

  /* --------------------------------------------------------
     1A. BACKGROUND COLORS
     -------------------------------------------------------- */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-tertiary: #1a1a24;
  --bg-quaternary: #222232;

  /* --------------------------------------------------------
     1B. SURFACE COLORS
     Used for cards, panels, modals, drawers
     -------------------------------------------------------- */
  --surface: #16161f;
  --surface-hover: #1e1e2a;
  --surface-active: #252535;
  --surface-elevated: #1c1c28;
  --surface-overlay: rgba(0, 0, 0, 0.6);
  --surface-scrim: rgba(0, 0, 0, 0.8);

  /* --------------------------------------------------------
     1C. TEXT COLORS
     -------------------------------------------------------- */
  --text-primary: #f0f0f5;
  --text-secondary: #9898a8;
  --text-tertiary: #68687a;
  --text-disabled: #45455a;
  --text-inverse: #0a0a0f;
  --text-on-accent: #ffffff;
  --text-on-danger: #ffffff;
  --text-on-success: #ffffff;

  /* --------------------------------------------------------
     1D. ACCENT / BRAND COLORS
     -------------------------------------------------------- */
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-active: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-softer: rgba(99, 102, 241, 0.06);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-border: rgba(99, 102, 241, 0.3);

  /* --------------------------------------------------------
     1E. STATUS COLORS
     -------------------------------------------------------- */
  --danger: #ef4444;
  --danger-hover: #f87171;
  --danger-active: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);

  --success: #22c55e;
  --success-hover: #4ade80;
  --success-active: #16a34a;
  --success-soft: rgba(34, 197, 94, 0.12);
  --success-border: rgba(34, 197, 94, 0.3);

  --warning: #f59e0b;
  --warning-hover: #fbbf24;
  --warning-active: #d97706;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);

  --info: #3b82f6;
  --info-hover: #60a5fa;
  --info-active: #2563eb;
  --info-soft: rgba(59, 130, 246, 0.12);
  --info-border: rgba(59, 130, 246, 0.3);

  /* --------------------------------------------------------
     1F. PRESENCE COLORS
     -------------------------------------------------------- */
  --presence-available: #22c55e;
  --presence-busy: #f59e0b;
  --presence-dnd: #ef4444;
  --presence-speaking: #6366f1;
  --presence-offline: #68687a;

  /* --------------------------------------------------------
     1G. BORDER COLORS
     -------------------------------------------------------- */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-focus: var(--accent);
  --border-error: var(--danger);

  /* --------------------------------------------------------
     1H. SHADOW VALUES
     -------------------------------------------------------- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 4px 24px rgba(99, 102, 241, 0.25);
  --shadow-danger: 0 4px 24px rgba(239, 68, 68, 0.25);
  --shadow-success: 0 4px 24px rgba(34, 197, 94, 0.2);
  --shadow-inner: inset 0 1px 4px rgba(0, 0, 0, 0.3);

  /* --------------------------------------------------------
     1I. COMPONENT-SPECIFIC COLORS
     -------------------------------------------------------- */

  /* Navigation */
  --nav-bg: rgba(10, 10, 15, 0.85);
  --nav-border: var(--border);

  /* PTT Button */
  --ptt-bg: var(--accent);
  --ptt-bg-active: #4f46e5;
  --ptt-bg-denied: var(--danger);
  --ptt-ring: var(--accent-border);
  --ptt-ring-active: var(--accent);
  --ptt-glow: var(--accent-glow);

  /* Emergency */
  --emergency-bg: var(--danger);
  --emergency-glow: rgba(239, 68, 68, 0.3);

  /* Toast */
  --toast-bg: var(--surface-elevated);
  --toast-border: var(--border-strong);

  /* Modal */
  --modal-bg: var(--surface-elevated);
  --modal-border: var(--border-strong);
  --modal-overlay: var(--surface-scrim);

  /* Input */
  --input-bg: var(--bg-tertiary);
  --input-border: var(--border);
  --input-border-focus: var(--accent);
  --input-text: var(--text-primary);
  --input-placeholder: var(--text-tertiary);

  /* Scrollbar */
  --scrollbar-track: var(--bg-secondary);
  --scrollbar-thumb: var(--bg-quaternary);
  --scrollbar-thumb-hover: var(--surface-active);

  /* Skeleton Loading */
  --skeleton-base: var(--bg-tertiary);
  --skeleton-shine: var(--surface-hover);

  /* Footer */
  --footer-bg: #08080c;
  --footer-text: rgba(255, 255, 255, 0.7);
  --footer-text-muted: rgba(255, 255, 255, 0.35);
  --footer-border: rgba(255, 255, 255, 0.08);
}


/* ============================================================
   2. LIGHT THEME
   ============================================================ */

[data-theme="light"] {

  /* --------------------------------------------------------
     2A. BACKGROUND COLORS
     -------------------------------------------------------- */
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f1f5;
  --bg-quaternary: #e5e7ee;

  /* --------------------------------------------------------
     2B. SURFACE COLORS
     -------------------------------------------------------- */
  --surface: #ffffff;
  --surface-hover: #f5f5fa;
  --surface-active: #eeeef5;
  --surface-elevated: #ffffff;
  --surface-overlay: rgba(0, 0, 0, 0.3);
  --surface-scrim: rgba(0, 0, 0, 0.5);

  /* --------------------------------------------------------
     2C. TEXT COLORS
     -------------------------------------------------------- */
  --text-primary: #111118;
  --text-secondary: #555566;
  --text-tertiary: #888899;
  --text-disabled: #bbbbcc;
  --text-inverse: #ffffff;
  --text-on-accent: #ffffff;
  --text-on-danger: #ffffff;
  --text-on-success: #ffffff;

  /* --------------------------------------------------------
     2D. ACCENT / BRAND COLORS
     -------------------------------------------------------- */
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-active: #3730a3;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --accent-softer: rgba(79, 70, 229, 0.04);
  --accent-glow: rgba(79, 70, 229, 0.15);
  --accent-border: rgba(79, 70, 229, 0.25);

  /* --------------------------------------------------------
     2E. STATUS COLORS
     -------------------------------------------------------- */
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-active: #991b1b;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(220, 38, 38, 0.2);

  --success: #16a34a;
  --success-hover: #15803d;
  --success-active: #166534;
  --success-soft: rgba(22, 163, 74, 0.08);
  --success-border: rgba(22, 163, 74, 0.2);

  --warning: #d97706;
  --warning-hover: #b45309;
  --warning-active: #92400e;
  --warning-soft: rgba(217, 119, 6, 0.08);
  --warning-border: rgba(217, 119, 6, 0.2);

  --info: #2563eb;
  --info-hover: #1d4ed8;
  --info-active: #1e40af;
  --info-soft: rgba(37, 99, 235, 0.08);
  --info-border: rgba(37, 99, 235, 0.2);

  /* --------------------------------------------------------
     2F. PRESENCE COLORS
     -------------------------------------------------------- */
  --presence-available: #16a34a;
  --presence-busy: #d97706;
  --presence-dnd: #dc2626;
  --presence-speaking: #4f46e5;
  --presence-offline: #9898a8;

  /* --------------------------------------------------------
     2G. BORDER COLORS
     -------------------------------------------------------- */
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --border-focus: var(--accent);
  --border-error: var(--danger);

  /* --------------------------------------------------------
     2H. SHADOW VALUES
     -------------------------------------------------------- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.12);
  --shadow-accent: 0 4px 24px rgba(79, 70, 229, 0.15);
  --shadow-danger: 0 4px 24px rgba(220, 38, 38, 0.15);
  --shadow-success: 0 4px 24px rgba(22, 163, 74, 0.12);
  --shadow-inner: inset 0 1px 4px rgba(0, 0, 0, 0.06);

  /* --------------------------------------------------------
     2I. COMPONENT-SPECIFIC COLORS
     -------------------------------------------------------- */

  /* Navigation */
  --nav-bg: rgba(248, 249, 252, 0.9);
  --nav-border: var(--border);

  /* PTT Button */
  --ptt-bg: var(--accent);
  --ptt-bg-active: #3730a3;
  --ptt-bg-denied: var(--danger);
  --ptt-ring: var(--accent-border);
  --ptt-ring-active: var(--accent);
  --ptt-glow: var(--accent-glow);

  /* Emergency */
  --emergency-bg: var(--danger);
  --emergency-glow: rgba(220, 38, 38, 0.2);

  /* Toast */
  --toast-bg: var(--surface-elevated);
  --toast-border: var(--border-strong);

  /* Modal */
  --modal-bg: var(--surface-elevated);
  --modal-border: var(--border-strong);
  --modal-overlay: var(--surface-scrim);

  /* Input */
  --input-bg: var(--bg-tertiary);
  --input-border: var(--border);
  --input-border-focus: var(--accent);
  --input-text: var(--text-primary);
  --input-placeholder: var(--text-tertiary);

  /* Scrollbar */
  --scrollbar-track: var(--bg-tertiary);
  --scrollbar-thumb: var(--bg-quaternary);
  --scrollbar-thumb-hover: var(--border-strong);

  /* Skeleton Loading */
  --skeleton-base: var(--bg-tertiary);
  --skeleton-shine: var(--bg-quaternary);

  /* Footer */
  --footer-bg: #111118;
  --footer-text: rgba(255, 255, 255, 0.7);
  --footer-text-muted: rgba(255, 255, 255, 0.35);
  --footer-border: rgba(255, 255, 255, 0.08);
}


/* ============================================================
   3. TYPOGRAPHY TOKENS
   ============================================================
   Applied to :root so they work in both themes.
   ============================================================ */

:root {
  /* Font Families */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono',
    'Courier New', monospace;

  /* Font Sizes — Fluid Scale */
  --text-xs: 0.72rem;       /* 11.5px */
  --text-sm: 0.82rem;       /* 13px */
  --text-base: 0.92rem;     /* 14.7px */
  --text-md: 1rem;          /* 16px */
  --text-lg: 1.1rem;        /* 17.6px */
  --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 */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
  --weight-black: 900;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --leading-loose: 1.8;

  /* Letter Spacing */
  --tracking-tight: -0.03em;
  --tracking-snug: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.02em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;
}


/* ============================================================
   4. SPACING TOKENS
   ============================================================ */

:root {
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;
}


/* ============================================================
   5. BORDER RADIUS TOKENS
   ============================================================ */

:root {
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 20px;
  --radius-4xl: 24px;
  --radius-full: 9999px;
}


/* ============================================================
   6. ANIMATION TOKENS
   ============================================================ */

:root {
  /* Durations */
  --duration-instant: 50ms;
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
  --duration-slower: 600ms;

  /* Easing */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Common Transitions */
  --transition-colors: color var(--duration-fast) var(--ease-default),
    background-color var(--duration-fast) var(--ease-default),
    border-color var(--duration-fast) var(--ease-default);
  --transition-opacity: opacity var(--duration-normal) var(--ease-default);
  --transition-transform: transform var(--duration-normal) var(--ease-default);
  --transition-all: all var(--duration-normal) var(--ease-default);
}


/* ============================================================
   7. Z-INDEX SCALE
   ============================================================ */

:root {
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-drawer: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-tooltip: 700;
  --z-emergency: 800;
  --z-nav: 1000;
  --z-max: 9999;
}


/* ============================================================
   8. LAYOUT TOKENS
   ============================================================ */

:root {
  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --container-2xl: 1400px;

  /* Navigation */
  --nav-height: 64px;
  --nav-height-mobile: 56px;

  /* Bottom Navigation */
  --bottom-nav-height: 64px;

  /* Sidebar */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 68px;

  /* Content */
  --content-max-width: 800px;
  --content-padding: var(--space-6);
  --content-padding-mobile: var(--space-4);

  /* PTT Button */
  --ptt-size: 88px;
  --ptt-size-large: 120px;
  --ptt-ring-size: 104px;
  --ptt-ring-size-large: 140px;

  /* Cards */
  --card-padding: var(--space-6);
  --card-padding-compact: var(--space-4);
  --card-radius: var(--radius-2xl);

  /* Inputs */
  --input-height: 44px;
  --input-height-sm: 36px;
  --input-height-lg: 52px;
  --input-padding-x: var(--space-4);
  --input-radius: var(--radius-lg);

  /* Avatar Sizes */
  --avatar-xs: 24px;
  --avatar-sm: 32px;
  --avatar-md: 40px;
  --avatar-lg: 48px;
  --avatar-xl: 64px;
  --avatar-2xl: 80px;

  /* Touch Targets — Minimum 44px per WCAG */
  --touch-target-min: 44px;
}


/* ============================================================
   9. BREAKPOINT REFERENCE (CSS variables cannot be used
      in media queries — these are documented for reference)
   ============================================================
   
   --breakpoint-sm:  480px   (small mobile)
   --breakpoint-md:  768px   (tablet / large mobile)
   --breakpoint-lg:  1024px  (small desktop / landscape tablet)
   --breakpoint-xl:  1200px  (desktop)
   --breakpoint-2xl: 1400px  (large desktop)
   
   Usage in CSS:
   @media (max-width: 768px) { }
   @media (min-width: 769px) { }
   
   ============================================================ */


/* ============================================================
   10. REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast: 0ms;
    --duration-normal: 0ms;
    --duration-slow: 0ms;
    --duration-slower: 0ms;
  }
}