/* =============================================================
   DESIGN SYSTEM — Premium SaaS UI
   Variables & Tokens only
   Components are in components.css
   ============================================================= */

:root {
  /* Light theme (default) */
  --color-white: #ffffff;
  --color-black: #000000;

  /* Light theme surfaces */
  --color-surface-0: #fafafa;
  --color-surface-1: #ffffff;
  --color-surface-2: #f5f5f5;
  --color-surface-3: #eeeeee;
  --color-surface-4: #e5e5e5;

  --color-bg-primary: var(--color-surface-1);
  --color-bg-secondary: var(--color-surface-0);
  --color-bg-tertiary: var(--color-surface-2);

  /* Light theme text */
  --color-text: #1a1a1a;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --color-text-dim: #9ca3af;
  --color-text-disabled: #d1d5db;
  --color-text-inverse: #ffffff;

  /* Light theme borders */
  --color-border: #e5e7eb;
  --color-border-hover: #d1d5db;
  --color-border-focus: var(--color-accent);
  --color-border-muted: #f3f4f6;

  /* Accent colors — rich, vibrant */
  --color-accent-primary: #3b82f6;
  --color-accent-secondary: #8b5cf6;
  --color-accent-tertiary: #06b6d4;

  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;

  /* Hover states */
  --color-accent-hover: #2563eb;
  --color-accent-active: #1d4ed8;
  --color-success-hover: #059669;
  --color-success-active: #047857;
  --color-danger-hover: #dc2626;
  --color-danger-active: #b91c1c;
  --color-warning-hover: #d97706;

  /* Soft backgrounds */
  --color-accent-soft: rgba(59, 130, 246, 0.08);
  --color-accent-soft-hover: rgba(59, 130, 246, 0.12);
  --color-success-soft: rgba(16, 185, 129, 0.08);
  --color-danger-soft: rgba(239, 68, 68, 0.08);
  --color-purple-soft: rgba(139, 92, 246, 0.08);
  --color-warning-soft: rgba(245, 158, 11, 0.08);
  --color-info-soft: rgba(59, 130, 246, 0.08);

  /* Border colors for badges */
  --color-accent-border: rgba(59, 130, 246, 0.3);
  --color-success-border: rgba(16, 185, 129, 0.3);
  --color-danger-border: rgba(239, 68, 68, 0.3);
  --color-warning-border: rgba(245, 158, 11, 0.3);
  --color-info-border: rgba(59, 130, 246, 0.3);
  --color-purple-border: rgba(139, 92, 246, 0.3);

  /* Glass effects */
  --color-glass: rgba(255, 255, 255, 0.7);
  --color-glass-light: rgba(255, 255, 255, 0.5);
  --color-glass-heavy: rgba(255, 255, 255, 0.9);

  /* Category gradients */
  --gradient-photo: linear-gradient(135deg, #1e3a8a, var(--color-accent-primary));
  --gradient-scheme: linear-gradient(135deg, #b45309, var(--color-warning));
  --gradient-act: linear-gradient(135deg, #065f46, var(--color-success));
  --gradient-file: linear-gradient(135deg, #5b21b6, var(--color-accent-secondary));
  --gradient-overview: linear-gradient(135deg, #86198f, var(--color-info));

  /* Shadows — premium depth */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-2xl: 0 24px 48px rgba(0, 0, 0, 0.16);

  --shadow-card: var(--shadow-md);
  --shadow-btn: var(--shadow-sm);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-focus-ring: 0 0 0 3px var(--color-accent-soft);

  /* Glow effects */
  --color-accent-glow: rgba(59, 130, 246, 0.25);
  --color-accent-glow-strong: rgba(59, 130, 246, 0.4);
  --color-success-glow: rgba(16, 185, 129, 0.25);
  --color-success-glow-strong: rgba(16, 185, 129, 0.4);
  --color-danger-glow: rgba(239, 68, 68, 0.25);
  --color-danger-glow-strong: rgba(239, 68, 68, 0.4);
  --color-warning-glow: rgba(245, 158, 11, 0.25);
  --color-info-glow: rgba(59, 130, 246, 0.25);

  --shadow-accent: 0 0 10px var(--color-accent-glow);
  --shadow-accent-strong: 0 0 12px var(--color-accent-glow-strong);
  --shadow-success: 0 0 10px var(--color-success-glow);
  --shadow-danger: 0 0 10px var(--color-danger-glow);

  /* Border radius — modern, rounded */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Spacing — consistent scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --space-8: 2.5rem;
  --space-9: 3rem;
  --space-10: 4rem;
  --space-11: 5rem;
  --space-12: 6rem;

  --space-xs: var(--space-2);
  --space-sm: var(--space-3);
  --space-md: var(--space-4);
  --space-lg: var(--space-6);
  --space-xl: var(--space-8);
  --space-2xl: var(--space-10);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.875rem;
  --text-3xl: 2.25rem;

  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;

  /* Transitions — smooth, explicit properties */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index layers */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-header: 30;
  --z-modal: 100;
  --z-tooltip: 150;
  --z-toast: 200;

  /* Semantic aliases (light theme) */
  --color-accent: var(--color-accent-primary);
  --color-purple: var(--color-accent-secondary);
  --color-green: var(--color-success);
  --color-red: var(--color-danger);
  --color-orange: var(--color-warning);

  --color-surface: var(--color-surface-1);
  --color-surface-hover: var(--color-surface-2);

  --color-text-primary: var(--color-text);

  /* Legacy compatibility shims (admin templates use short names) */
  --accent: var(--color-accent);
  --accent-green: var(--color-success);
  --accent-red: var(--color-danger);
  --accent-orange: var(--color-warning);
  --accent-purple: var(--color-accent-secondary);
  --text: var(--color-text);
  --text-muted: var(--color-text-muted);
  --surface: var(--color-surface-1);
  --surface-hover: var(--color-surface-2);
  --border: var(--color-border);
  --bg: var(--color-bg-primary);
  --shadow: var(--shadow-md);
}

/* =============================================================
   DARK THEME — Premium dark blue-slate
   ============================================================= */
[data-theme="dark"] {
  /* Dark surfaces — rich dark blue-slate */
  --color-surface-0: #0b0f19;
  --color-surface-1: #0f1623;
  --color-surface-2: #141d2e;
  --color-surface-3: #1a2540;
  --color-surface-4: #1f2d4d;

  --color-bg-primary: var(--color-surface-0);
  --color-bg-secondary: var(--color-surface-1);
  --color-bg-tertiary: var(--color-surface-2);

  /* Dark text — high contrast */
  --color-text: #e8edf5;
  --color-text-secondary: #8fa3c4;
  --color-text-muted: #5a7499;
  --color-text-dim: #4a6380;
  --color-text-disabled: #2a3d55;
  --color-text-inverse: #0b0f19;

  /* Dark borders — subtle blue-tinted */
  --color-border: #1e2d45;
  --color-border-hover: #2a3f60;
  --color-border-focus: var(--color-accent);
  --color-border-muted: #172236;

  /* Accent colors — vibrant against dark */
  --color-accent-primary: #3b82f6;
  --color-accent-secondary: #8b5cf6;
  --color-accent-tertiary: #06b6d4;

  /* Soft backgrounds for dark theme */
  --color-accent-soft: rgba(59, 130, 246, 0.12);
  --color-accent-soft-hover: rgba(59, 130, 246, 0.18);
  --color-success-soft: rgba(16, 185, 129, 0.12);
  --color-danger-soft: rgba(239, 68, 68, 0.12);
  --color-purple-soft: rgba(139, 92, 246, 0.12);
  --color-warning-soft: rgba(245, 158, 11, 0.12);
  --color-info-soft: rgba(59, 130, 246, 0.12);

  /* Border colors for badges — dark theme */
  --color-accent-border: rgba(59, 130, 246, 0.4);
  --color-success-border: rgba(16, 185, 129, 0.4);
  --color-danger-border: rgba(239, 68, 68, 0.4);
  --color-warning-border: rgba(245, 158, 11, 0.4);
  --color-info-border: rgba(59, 130, 246, 0.4);
  --color-purple-border: rgba(139, 92, 246, 0.4);

  /* Glass effect for dark theme */
  --color-glass: rgba(11, 15, 25, 0.85);
  --color-glass-light: rgba(20, 29, 46, 0.75);
  --color-glass-heavy: rgba(9, 12, 20, 0.95);

  /* Glow effects — more visible on dark */
  --color-accent-glow: rgba(59, 130, 246, 0.35);
  --color-accent-glow-strong: rgba(59, 130, 246, 0.55);
  --color-success-glow: rgba(16, 185, 129, 0.35);
  --color-danger-glow: rgba(239, 68, 68, 0.35);
  --color-warning-glow: rgba(245, 158, 11, 0.35);
  --color-info-glow: rgba(59, 130, 246, 0.35);

  /* Shadows on dark — deeper, more dramatic */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.7);
  --shadow-2xl: 0 24px 48px rgba(0, 0, 0, 0.8);

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.25);

  --shadow-accent: 0 0 12px var(--color-accent-glow);
  --shadow-success: 0 0 12px var(--color-success-glow);
  --shadow-danger: 0 0 12px var(--color-danger-glow);
}

/* =============================================================
   GLOBAL STYLES (non-component)
   ============================================================= */

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-hover);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* Selection */
::selection {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

/* Focus visible for all interactive elements */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}