/* ==========================================================================
   SparkHub Admin Theme Tokens
   - Tailwind via CDN handles utilities
   - This file centralizes brand + UI tokens using CSS variables
   - Always reference variables in custom CSS to keep branding consistent
   ========================================================================== */

:root {
  /* -----------------------------
     Brand Colors (do not hardcode elsewhere)
     ----------------------------- */
  --color-primary: #2563eb;      /* Brand primary: buttons, links, active states */
  --color-accent:  #22c55e;      /* Brand accent: success, highlights, confirmations */

  /* -----------------------------
     Core Surfaces (dark theme)
     ----------------------------- */
  --color-bg:      #0b1220;      /* App background */
  --color-surface: #0f172a;      /* Page surface (layout sections) */
  --color-card:    #111c34;      /* Cards, panels */

  /* -----------------------------
     Borders & Dividers
     ----------------------------- */
  --color-border: rgba(255, 255, 255, 0.08); /* Subtle borders in dark UI */
  --color-divider: rgba(255, 255, 255, 0.06);

  /* -----------------------------
     Text Colors
     ----------------------------- */
  --color-text:  rgba(255, 255, 255, 0.92);  /* Primary text */
  --color-muted: rgba(255, 255, 255, 0.70);  /* Secondary text */
  --color-faint: rgba(255, 255, 255, 0.55);  /* Helper text */

  /* -----------------------------
     State Colors (semantic tokens)
     - keep these separate so you can tweak them globally later
     ----------------------------- */
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger:  #ef4444;
  --color-info:    #38bdf8;

  /* -----------------------------
     Focus Ring & Glow
     - consistent focus for accessibility and premium feel
     ----------------------------- */
  --focus-ring: rgba(37, 99, 235, 0.55);    /* primary @ ~55% */
  --glow-primary: rgba(37, 99, 235, 0.22);  /* subtle shadow/glow */

  /* -----------------------------
     Radius & Spacing (optional but useful)
     ----------------------------- */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  /* -----------------------------
     Shadows (dark UI friendly)
     ----------------------------- */
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, 0.35);

  /* -----------------------------
     ✨ NEW: Font families (for consistency)
     ----------------------------- */
  --font-sans: 'Inter', 'ui-sans-serif', 'system-ui', '-apple-system', 'sans-serif';
  --font-display: 'Poppins', 'Inter', 'system-ui', 'sans-serif';

  /* -----------------------------
     ✨ NEW: Z-index layers (prevents z-index conflicts)
     ----------------------------- */
  --z-dropdown: 40;
  --z-sticky: 30;
  --z-modal-backdrop: 50;
  --z-modal: 50;
  --z-mobile-overlay: 40;
  --z-mobile-sidebar: 50;
  --z-toast: 9999;
}

/* ==========================================================================
   Base Layout Defaults
   ========================================================================== */

html, body {
  height: 100%;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans); /* ✨ NEW: Use CSS variable */

  /* improves typography rendering across platforms */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* prevents iOS font scaling surprises */
  text-size-adjust: 100%;
}

/* Make links look modern and consistent */
a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Premium-feel selection */
::selection {
  background: rgba(37, 99, 235, 0.30);
  color: var(--color-text);
}

/* Consistent focus outline (accessibility) */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Inputs/controls baseline (Tailwind will still style heavily) */
input, select, textarea, button {
  color: inherit;
}

/* Scrollbar (optional): subtle + consistent in dark mode */
* {
  scrollbar-color: rgba(255,255,255,0.18) rgba(255,255,255,0.04);
}
*::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}
*::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
}

/* ==========================================================================
   Optional Light Theme Support (future-ready)
   - You can enable by setting <html data-theme="light">
   ========================================================================== */

html[data-theme="light"] {
  --color-bg:      #f8fafc;
  --color-surface: #ffffff;
  --color-card:    #ffffff;

  --color-border: rgba(2, 6, 23, 0.10);
  --color-divider: rgba(2, 6, 23, 0.08);

  --color-text:  rgba(2, 6, 23, 0.92);
  --color-muted: rgba(2, 6, 23, 0.70);
  --color-faint: rgba(2, 6, 23, 0.55);

  --shadow-sm: 0 8px 18px rgba(2, 6, 23, 0.08);
  --shadow-md: 0 14px 36px rgba(2, 6, 23, 0.12);
}

/* ==========================================================================
   ✨ NEW: Smooth theme transitions (optional but nice)
   ========================================================================== */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.3s ease, 
              border-color 0.3s ease, 
              color 0.3s ease,
              box-shadow 0.3s ease !important;
}