/**
 * Affilync Design System - "Financial Edge" Aesthetic
 * CSS Variables & Design Tokens
 *
 * Design Philosophy:
 * - Light-first design (professional/muted colors)
 * - Deep Electric Blue (#0066e6) as primary
 * - Theme-aware semantic colors:
 *   - Light: Success=#059669, Warning=#d97706, Error=#dc2626
 *   - Dark: Success=#00ff88, Warning=#ffcc00, Error=#ff3366
 * - DM Sans + Syne typography (NOT Inter/Roboto)
 *
 * This file provides CSS custom properties that align with:
 * @see /src/styles/design-tokens.js - JavaScript design tokens
 * @see /tailwind.config.js - Tailwind CSS configuration (source of truth)
 */

/* ============================================================================
   DESIGN TOKENS - Light Mode (Default)
   Professional/muted colors for light backgrounds
   ============================================================================ */

:root {
  /* === BREAKPOINTS (reference values, use via Tailwind classes or media queries) === */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;

  /* Layout & Spacing */
  --radius: 0.5rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  /* === PRIMARY COLOR - Deep Electric Blue (#0066e6) === */
  --primary: 210 100% 45%; /* HSL for #0066e6 */
  --primary-foreground: 0 0% 100%;
  --primary-50: #e6f1ff;
  --primary-100: #b3d7ff;
  --primary-200: #80bdff;
  --primary-300: #4da3ff;
  --primary-400: #1a8aff;
  --primary-500: #0066e6;
  --primary-600: #0052b3;
  --primary-700: #003d80;
  --primary-800: #00294d;
  --primary-900: #00141a;

  /* === ACCENT COLOR - Muted Orange for Light Mode === */
  --accent: 32 95% 44%; /* HSL for #d97706 */
  --accent-foreground: 0 0% 100%;
  --accent-50: #fef3c7;
  --accent-100: #fde68a;
  --accent-200: #fcd34d;
  --accent-300: #fbbf24;
  --accent-400: #f59e0b;
  --accent-500: #d97706;
  --accent-600: #b45309;
  --accent-700: #92400e;
  --accent-800: #78350f;
  --accent-900: #451a03;

  /* === SUCCESS - Emerald (#059669) for Light Mode === */
  --success: 160 84% 39%; /* HSL for #059669 */
  --success-foreground: 0 0% 100%;
  --success-text: 160 84% 35%;
  --success-50: #d1fae5;
  --success-500: #059669;
  --success-600: #047857;
  --success-700: #065f46;

  /* === ERROR - Standard Red (#dc2626) for Light Mode === */
  --destructive: 0 72% 51%; /* HSL for #dc2626 */
  --destructive-foreground: 0 0% 100%;
  --destructive-text: 0 72% 45%;
  --error-50: #fee2e2;
  --error-500: #dc2626;
  --error-600: #b91c1c;
  --error-700: #991b1b;

  /* === WARNING - Muted Orange (#d97706) for Light Mode === */
  --warning: 32 95% 44%; /* HSL for #d97706 */
  --warning-foreground: 0 0% 100%;
  --warning-text: 32 95% 38%;

  /* === INFO - Electric Blue (same as primary) === */
  --info: 210 100% 45%;
  --info-foreground: 0 0% 100%;
  --info-text: 210 100% 40%;

  /* === BACKGROUND - Light Mode === */
  --background: 210 40% 98%; /* HSL for #f8fafc */
  --foreground: 220 50% 7%;
  --background-default: #f8fafc;
  --background-elevated: 0 0% 100%; /* white */
  --background-panel: 210 40% 96%; /* #f1f5f9 */
  --background-overlay: 214 32% 91%; /* #e2e8f0 */

  /* === CARD / SURFACES === */
  --card: 0 0% 100%;
  --card-foreground: 220 50% 7%;

  /* === POPOVER === */
  --popover: 0 0% 100%;
  --popover-foreground: 220 50% 7%;

  /* === SECONDARY === */
  --secondary: 210 40% 96%;
  --secondary-foreground: 220 50% 7%;

  /* === MUTED === */
  --muted: 210 40% 96%;
  --muted-foreground: 217 15% 45%;

  /* === TEXT COLORS === */
  --text-primary: 222 47% 11%;
  --text-secondary: 215 16% 47%;
  --text-tertiary: 215 14% 60%;
  --text-muted: 215 20% 65%;

  /* === SURFACE COLORS (Light mode - inverted for light backgrounds) === */
  --surface-50: 215 28% 17%;
  --surface-100: 217 19% 27%;
  --surface-200: 215 19% 35%;
  --surface-300: 215 16% 47%;
  --surface-400: 215 20% 65%;
  --surface-500: 213 27% 84%;
  --surface-600: 214 32% 91%;
  --surface-700: 210 40% 96%;
  --surface-800: 210 40% 98%;

  /* === BORDER COLORS === */
  --border: 214 32% 91%;
  --border-light: 214 32% 95%;
  --border-medium: 214 32% 85%;
  --border-primary: 210 100% 45% / 0.15;
  --input: 214 32% 91%;
  --ring: 210 100% 45%;

  /* === FOCUS STATES (WCAG 2.2 Compliant) === */
  --focus-ring-color: 210 100% 45%;
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;

  /* === EFFECTS === */
  --box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  --box-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
  --box-shadow-glow: 0 0 24px rgba(0, 102, 230, 0.2);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* === MOTION TOKENS === */
  --duration-fastest: 100ms;
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 400ms;
  --duration-slowest: 500ms;
  --easing-default: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-in: cubic-bezier(0.4, 0, 1, 1);
  --easing-out: cubic-bezier(0, 0, 0.2, 1);
  --easing-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-spring: cubic-bezier(0.25, 0.1, 0.25, 1);

  /* === GLASSMORPHISM === */
  --glass-background: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(0, 102, 230, 0.15);
  --glass-blur: blur(20px);

  /* === CHART COLORS === */
  --chart-1: #0066e6;
  --chart-2: #d97706;
  --chart-3: #059669;
  --chart-4: #0284c7;
  --chart-5: #7c3aed;
  --chart-6: #dc2626;
  --chart-7: #db2777;
  --chart-8: #0d9488;
  --chart-9: #ea580c;
  --chart-10: #65a30d;
}

/* ============================================================================
   DARK MODE TOKENS
   Neon/vibrant colors for dark backgrounds
   ============================================================================ */

.dark {
  /* === ACCENT COLOR - Strategic Amber (#ffcc00) for Dark Mode === */
  --accent: 48 100% 50%; /* HSL for #ffcc00 */
  --accent-foreground: 220 50% 7%;
  --accent-50: #fffbeb;
  --accent-100: #fff3c1;
  --accent-200: #ffeb99;
  --accent-300: #ffe066;
  --accent-400: #ffd633;
  --accent-500: #ffcc00;
  --accent-600: #e6b800;
  --accent-700: #cc9900;
  --accent-800: #997300;
  --accent-900: #664d00;

  /* === SUCCESS - Neon Green (#00ff88) for Dark Mode === */
  --success: 151 100% 50%; /* HSL for #00ff88 */
  --success-foreground: 220 50% 7%;
  --success-text: 151 100% 45%;
  --success-50: #e6fff5;
  --success-500: #00ff88;
  --success-600: #00cc6e;
  --success-700: #009954;

  /* === ERROR - Sharp Red (#ff3366) for Dark Mode === */
  --destructive: 346 100% 60%; /* HSL for #ff3366 */
  --destructive-foreground: 0 0% 100%;
  --destructive-text: 346 100% 55%;
  --error-50: #ffebf0;
  --error-500: #ff3366;
  --error-600: #cc0033;
  --error-700: #990026;

  /* === WARNING - Amber (#ffcc00) for Dark Mode === */
  --warning: 48 100% 50%;
  --warning-foreground: 220 50% 7%;
  --warning-text: 40 100% 45%;

  /* === INFO - Sky Blue for Dark Mode === */
  --info: 198 93% 60%;
  --info-foreground: 0 0% 100%;
  --info-text: 198 93% 55%;

  /* === BACKGROUND - Dark Terminal === */
  --background: 220 50% 7%; /* HSL for #0a0e1a */
  --foreground: 0 0% 100%;
  --background-default: #0a0e1a;
  --background-elevated: 220 30% 12%; /* #131825 */
  --background-panel: 220 30% 15%; /* #1a2030 */
  --background-overlay: 220 30% 20%; /* #232d42 */

  /* === CARD / SURFACES === */
  --card: 220 40% 10%; /* HSL for #131825 */
  --card-foreground: 0 0% 100%;

  /* === POPOVER === */
  --popover: 220 40% 10%;
  --popover-foreground: 0 0% 100%;

  /* === SECONDARY === */
  --secondary: 220 35% 15%;
  --secondary-foreground: 0 0% 100%;

  /* === MUTED === */
  --muted: 220 30% 20%;
  --muted-foreground: 217 15% 55%;

  /* === TEXT COLORS === */
  --text-primary: 0 0% 100%;
  --text-secondary: 217 15% 55%; /* #8892a6 */
  --text-tertiary: 217 12% 45%; /* #647080 - WCAG AA 3:1 for UI components */
  --text-muted: 217 10% 28%;

  /* === SURFACE COLORS (Dark mode) === */
  --surface-50: 210 40% 98%;
  --surface-100: 210 40% 96%;
  --surface-200: 214 32% 91%;
  --surface-300: 213 27% 84%;
  --surface-400: 215 20% 65%;
  --surface-500: 215 16% 47%;
  --surface-600: 215 19% 35%;
  --surface-700: 217 33% 20%;
  --surface-800: 220 35% 15%;

  /* === BORDER COLORS === */
  --border: 0 0% 100% / 0.08;
  --border-light: 0 0% 100% / 0.04;
  --border-medium: 0 0% 100% / 0.12;
  --border-primary: 210 100% 45% / 0.2;
  --input: 220 35% 15%;
  --ring: 210 100% 45%;

  /* === FOCUS STATES === */
  --focus-ring-color: 210 100% 55%;

  /* === EFFECTS === */
  --box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --box-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --box-shadow-glow: 0 0 24px rgba(0, 102, 230, 0.4);

  /* === GLASSMORPHISM === */
  --glass-background: rgba(19, 24, 37, 0.95);
  --glass-border: rgba(0, 102, 230, 0.2);

  /* === CHART COLORS (Neon for dark mode) === */
  --chart-1: #0066e6;
  --chart-2: #ffcc00;
  --chart-3: #00ff88;
  --chart-4: #00d4ff;
  --chart-5: #8b5cf6;
  --chart-6: #ff3366;
  --chart-7: #ec4899;
  --chart-8: #14b8a6;
  --chart-9: #f97316;
  --chart-10: #84cc16;
}

/* ============================================================================
   UTILITY CLASSES - Text Colors
   ============================================================================ */

.text-primary {
  color: hsl(var(--text-primary));
}

.text-secondary {
  color: hsl(var(--text-secondary));
}

.text-tertiary {
  color: hsl(var(--text-tertiary));
}

.text-muted {
  color: hsl(var(--text-muted));
}

/* Semantic text colors (WCAG 2.1 AA compliant) */
.text-success-safe {
  color: hsl(var(--success-text));
}

.text-warning-safe {
  color: hsl(var(--warning-text));
}

.text-error-safe,
.text-destructive-safe {
  color: hsl(var(--destructive-text));
}

.text-info-safe {
  color: hsl(var(--info-text));
}

/* ============================================================================
   UTILITY CLASSES - Background Colors
   ============================================================================ */

.bg-content {
  background-color: var(--background-default);
}

.bg-elevated {
  background-color: var(--background-elevated);
}

.bg-panel {
  background-color: var(--background-panel);
}

.bg-overlay {
  background-color: var(--background-overlay);
}

/* Semantic background colors */
.bg-success-safe {
  background-color: hsl(var(--success));
  color: hsl(var(--success-foreground));
}

.bg-warning-safe {
  background-color: hsl(var(--warning));
  color: hsl(var(--warning-foreground));
}

.bg-error-safe,
.bg-destructive-safe {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.bg-info-safe {
  background-color: hsl(var(--info));
  color: hsl(var(--info-foreground));
}

/* ============================================================================
   UTILITY CLASSES - Glassmorphism (Theme-Aware)
   ============================================================================ */

.glass-card {
  background: var(--glass-background);
  -webkit-backdrop-filter: var(--glass-blur);
          backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.glass-panel {
  background: var(--glass-background);
  -webkit-backdrop-filter: var(--glass-blur);
          backdrop-filter: var(--glass-blur);
  border: 1px solid hsl(var(--border));
}

.glass-overlay {
  background: hsl(var(--background) / 0.95);
  -webkit-backdrop-filter: blur(24px);
          backdrop-filter: blur(24px);
  border: 1px solid hsl(var(--ring) / 0.3);
}

/* ============================================================================
   UTILITY CLASSES - Effects
   ============================================================================ */

.shadow-custom {
  box-shadow: var(--box-shadow);
}

.shadow-custom-lg {
  box-shadow: var(--box-shadow-lg);
}

.shadow-glow {
  box-shadow: var(--box-shadow-glow);
}

.shadow-glow-accent {
  box-shadow: 0 0 32px hsl(var(--warning) / 0.3);
}

.shadow-glow-success {
  box-shadow: 0 0 20px hsl(var(--success) / 0.4);
}

.shadow-glow-error {
  box-shadow: 0 0 20px hsl(var(--destructive) / 0.4);
}

.transition-custom {
  transition: var(--transition);
}

.transition-fast {
  transition: var(--transition-fast);
}

/* ============================================================================
   UTILITY CLASSES - Font Families (Financial Edge)
   Must match tailwind.config.js fontFamily settings
   ============================================================================ */

.font-sans {
  font-family:
    'DM Sans',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

.font-display {
  font-family:
    'Syne',
    'DM Sans',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, 'Courier New', monospace;
}

/* Global font family application */
.font-family-dm-sans {
  font-family:
    'DM Sans',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

.font-family-dm-sans * {
  font-family: inherit;
}

.font-family-syne {
  font-family:
    'Syne',
    'DM Sans',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

.font-family-syne * {
  font-family: inherit;
}

/* ============================================================================
   GLOBAL TEXT COLOR INHERITANCE
   Ensure headings and body text use theme-aware colors by default
   ============================================================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: hsl(var(--text-primary));
}

p,
span,
div {
  /* Inherit color by default, but ensure text-text-* classes override */
}

/* Theme-aware foreground for all text that doesn't have explicit color */
.text-foreground {
  color: hsl(var(--foreground));
}

/* Override hover:text-white to be theme-aware */
.hover\:text-foreground:hover {
  color: hsl(var(--foreground));
}

/* ============================================================================
   COMPONENT PATTERNS - Theme-Aware Cards
   ============================================================================ */

.card-financial {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  -webkit-backdrop-filter: var(--glass-blur);
          backdrop-filter: var(--glass-blur);
  box-shadow: var(--box-shadow);
  transition: var(--transition);
}

.card-financial:hover {
  border-color: hsl(var(--ring) / 0.3);
  box-shadow: var(--box-shadow-lg);
  transform: translateY(-4px);
}

/* Metric card with top accent line */
.metric-card {
  background: hsl(var(--card) / 0.6);
  border: 1px solid hsl(var(--ring) / 0.2);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, hsl(var(--primary)), transparent);
}

/* Amber/Warning accent variant */
.metric-card--accent::before {
  background: linear-gradient(90deg, transparent, hsl(var(--warning)), transparent);
}

/* Success accent variant */
.metric-card--success::before {
  background: linear-gradient(90deg, transparent, hsl(var(--success)), transparent);
}

/* ============================================================================
   BUTTON PATTERNS - Financial Edge
   ============================================================================ */

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: hsl(var(--primary-foreground));
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 16px hsl(var(--primary) / 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-400) 0%, var(--primary-500) 100%);
  transform: translateY(-2px);
  box-shadow: var(--box-shadow-glow);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
  color: hsl(var(--accent-foreground));
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 16px hsl(var(--warning) / 0.3);
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--accent-300) 0%, var(--accent-500) 100%);
  transform: translateY(-2px);
  box-shadow: 0 0 32px hsl(var(--warning) / 0.4);
}

.btn-ghost {
  background: transparent;
  color: hsl(var(--text-primary));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  transition: var(--transition);
}

.btn-ghost:hover {
  background: hsl(var(--primary) / 0.1);
  border-color: hsl(var(--ring) / 0.4);
}

/* ============================================================================
   INPUT PATTERNS - Financial Edge
   ============================================================================ */

.input-financial {
  background: hsl(var(--input));
  border: 1px solid hsl(var(--border-primary));
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: hsl(var(--text-primary));
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  transition: var(--transition);
}

.input-financial::placeholder {
  color: hsl(var(--text-tertiary));
}

.input-financial:hover {
  border-color: hsl(var(--ring) / 0.4);
}

.input-financial:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.2);
}

/* ============================================================================
   BADGE PATTERNS - Theme-Aware
   ============================================================================ */

.badge-primary {
  background: rgba(0, 102, 230, 0.15);
  color: var(--primary-500);
  border: 1px solid rgba(0, 102, 230, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-accent {
  background: hsl(var(--warning) / 0.15);
  color: hsl(var(--warning));
  border: 1px solid hsl(var(--warning) / 0.25);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: hsl(var(--success) / 0.15);
  color: hsl(var(--success));
  border: 1px solid hsl(var(--success) / 0.25);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-error {
  background: hsl(var(--destructive) / 0.15);
  color: hsl(var(--destructive));
  border: 1px solid hsl(var(--destructive) / 0.25);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============================================================================
   GLOBAL TEXT COLOR ENFORCEMENT
   Override hardcoded text colors to use theme-aware CSS variables.
   This fixes 3,417 instances of text-white across 556 component files
   without modifying each file individually.
   ============================================================================ */

/* Primary text: white in dark mode hardcodes → theme-aware */
.text-white:not(.btn-primary):not(.btn-accent):not(.badge-primary):not(.badge-success):not(
    .badge-error
  ):not(.badge-warning):not([class*='bg-primary']):not([class*='bg-success']):not(
    [class*='bg-error']
  ):not([class*='bg-accent']) {
  color: hsl(var(--text-primary)) !important;
}

/* Gray scale overrides for light mode compatibility */
.text-gray-900,
.text-gray-950,
.text-slate-900,
.text-slate-950 {
  color: hsl(var(--text-primary)) !important;
}

.text-gray-700,
.text-gray-800,
.text-slate-700,
.text-slate-800 {
  color: hsl(var(--text-secondary)) !important;
}

.text-gray-500,
.text-gray-600,
.text-slate-500,
.text-slate-600 {
  color: hsl(var(--text-tertiary)) !important;
}

.text-gray-400,
.text-slate-400 {
  color: hsl(var(--text-muted)) !important;
}

/* Preserve white text on colored backgrounds (buttons, badges, gradients) */
.bg-primary-500 .text-white,
.bg-success-500 .text-white,
.bg-error-500 .text-white,
.bg-accent-500 .text-white,
[class*='bg-gradient'] .text-white,
button .text-white,
.btn-primary,
.btn-accent,
.badge-primary,
.badge-success,
.badge-error,
.badge-warning {
  color: white !important;
}

/* ============================================================================
   GLOBAL BACKGROUND COLOR ENFORCEMENT (Light Mode)
   Override hardcoded dark backgrounds to use theme-aware colors in light mode.
   These rules only apply in light mode (when .dark class is NOT present).
   ============================================================================ */

/* Light mode: Override dark backgrounds for sidebar, navbar, panels */
:root:not(.dark) [class*='bg-dark-950'],
:root:not(.dark) [class*='bg-dark-900'],
:root:not(.dark) [class*='bg-dark-800'],
:root:not(.dark) [class*='bg-dark-700'] {
  background-color: hsl(var(--card)) !important;
}

/* Light mode: Override border colors */
:root:not(.dark) [class*='border-dark-700'],
:root:not(.dark) [class*='border-dark-600'],
:root:not(.dark) [class*='border-dark-500'] {
  border-color: hsl(var(--border)) !important;
}

/* Light mode: Override text colors in navigation */
:root:not(.dark) .text-dark-300,
:root:not(.dark) .text-dark-400 {
  color: hsl(var(--text-secondary)) !important;
}

:root:not(.dark) .text-dark-500 {
  color: hsl(var(--text-tertiary)) !important;
}

/* Light mode: Override hover backgrounds */
:root:not(.dark) [class*='hover:bg-dark-700']:hover,
:root:not(.dark) [class*='hover:bg-dark-600']:hover {
  background-color: hsl(var(--muted)) !important;
}

/* Light mode: Dropdown and popover backgrounds */
:root:not(.dark) [class*='bg-dark-700'][class*='backdrop-blur'],
:root:not(.dark) [class*='bg-dark-800'][class*='backdrop-blur'],
:root:not(.dark) [class*='bg-dark-900'][class*='backdrop-blur'] {
  background-color: hsl(var(--popover)) !important;
  border-color: hsl(var(--border)) !important;
}

/* ============================================================================
   DATA-THEME ATTRIBUTE SUPPORT
   Mirror .dark class tokens for [data-theme="dark"] attribute selector.
   This enables theme switching via either mechanism.
   ============================================================================ */

[data-theme='dark'] {
  /* Inherits all .dark tokens - applied via themeStore.ts applyThemeToDocument */
}

[data-theme='light'] {
  /* Inherits all :root tokens - light is default */
}

/* ============================================================================
   LIGHT MODE: SUCCESS COLOR OVERRIDES
   Override neon green (#00ff88) with muted green (#059669) in light mode
   ============================================================================ */

/* Light mode: Override success text colors */
:root:not(.dark) .text-success {
  color: #059669 !important;
}

:root:not(.dark) .text-success-400,
:root:not(.dark) .text-success-500 {
  color: #059669 !important;
}

/* Light mode: Override success borders */
:root:not(.dark) .border-success,
:root:not(.dark) .border-success-500,
:root:not(.dark) [class*='border-success-500'] {
  border-color: #059669 !important;
}

/* Light mode: Override success backgrounds */
:root:not(.dark) .bg-success,
:root:not(.dark) .bg-success-500 {
  background-color: #059669 !important;
}

:root:not(.dark) [class*='from-success-500'] {
  --tw-gradient-from: #059669 !important;
}

:root:not(.dark) [class*='to-success-600'] {
  --tw-gradient-to: #047857 !important;
}

/* Light mode: Override success glow shadows */
:root:not(.dark) .shadow-glow-success,
:root:not(.dark) [class*='shadow-glow-success'] {
  box-shadow: 0 0 20px rgba(5, 150, 105, 0.3) !important;
}

/* Light mode: Override gradient-success backgrounds */
:root:not(.dark) .bg-gradient-success {
  background-image: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

/* ============================================================================
   REDUCED MOTION - Global Override
   Respects user's prefers-reduced-motion preference.
   Individual animation files also declare their own @media blocks.
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fastest: 0ms;
    --duration-fast: 0ms;
    --duration-normal: 0ms;
    --duration-slow: 0ms;
    --duration-slower: 0ms;
    --duration-slowest: 0ms;
    --transition: none;
    --transition-fast: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   FOCUS VISIBLE - Global Accessible Focus Indicator
   Uses the --focus-ring-color token for theme-aware focus states.
   ============================================================================ */

:focus-visible {
  outline: var(--focus-ring-width) solid hsl(var(--focus-ring-color));
  outline-offset: var(--focus-ring-offset);
}

/* Remove focus outline for mouse interaction, preserve for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================================
   NOISE TEXTURE OVERLAY
   Adds organic film-grain depth to the entire viewport. This subtle effect
   breaks up flat digital surfaces, creating a tactile quality that
   distinguishes hand-crafted design from AI-generated slop.

   Uses an inline SVG with feTurbulence for a resolution-independent
   noise pattern. The overlay is non-interactive (pointer-events: none)
   and sits above all content at very low opacity.
   ============================================================================ */

.noise-overlay::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  z-index: 9999;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27300%27 height=%27300%27%3E%3Cfilter id=%27noise%27%3E%3CfeTurbulence type=%27fractalNoise%27 baseFrequency=%270.65%27 numOctaves=%273%27 stitchTiles=%27stitch%27/%3E%3C/filter%3E%3Crect width=%27100%25%27 height=%27100%25%27 filter=%27url%28%23noise%29%27/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 300px 300px;
}

/* Slightly stronger noise for dark mode where surfaces are flatter */
.dark .noise-overlay::before {
  opacity: 0.04;
}

/* Disable noise overlay when reduced motion is preferred */
@media (prefers-reduced-motion: reduce) {
  .noise-overlay::before {
    display: none;
  }
}

