/*
 * Marvin Design Tokens
 * Semantic CSS variables for consistent theming
 * These map to Tailwind classes but provide CSS variable fallbacks
 */

:root {
  /* ========================================
     COLOR TOKENS
     ======================================== */

  /* Background colors */
  --color-bg-base: #09090b;
  --color-bg-subtle: #0c0c0f;
  --color-bg-muted: #18181b;
  --color-bg-elevated: #1f1f23;
  --color-bg-hover: #27272a;

  /* Border colors */
  --color-border-subtle: #27272a;
  --color-border-default: #3f3f46;
  --color-border-strong: #52525b;

  /* Text colors */
  --color-text-primary: #fafafa;
  --color-text-secondary: #a1a1aa;
  --color-text-muted: #71717a;
  --color-text-disabled: #52525b;

  /* Brand/Accent color */
  --color-accent: #06b6d4;
  --color-accent-hover: #22d3ee;
  --color-accent-muted: #0e7490;
  --color-accent-bg: rgba(6, 182, 212, 0.1);

  /* Semantic status colors */
  --color-success: #22c55e;
  --color-success-bg: rgba(34, 197, 94, 0.1);
  --color-warning: #eab308;
  --color-warning-bg: rgba(234, 179, 8, 0.1);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.1);
  --color-info: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.1);

  /* ========================================
     TAILWIND-FACING RGB TRIPLETS (--c-*)
     Consumed by tailwind.config.js via
     rgb(var(--c-...) / <alpha-value>).
     Raw "R G B" triplets so Tailwind alpha
     modifiers (bg-zinc-700/40) keep working.
     DARK = default; values MUST equal the
     hexes the utilities compiled to before
     the variable-backed palette.
     ======================================== */

  /* Zinc scale (Tailwind default values) */
  --c-zinc-50: 250 250 250;
  --c-zinc-100: 244 244 245;
  --c-zinc-200: 228 228 231;
  --c-zinc-300: 212 212 216;
  --c-zinc-400: 161 161 170;
  --c-zinc-500: 113 113 122;
  --c-zinc-600: 82 82 91;
  --c-zinc-700: 63 63 70;
  --c-zinc-800: 39 39 42;
  --c-zinc-900: 24 24 27;
  --c-zinc-950: 9 9 11;

  /* Surfaces (marvin-* + TailAdmin aliases) */
  --c-bg-base: 9 9 11;       /* marvin-base    #09090b */
  --c-bg-subtle: 12 12 15;   /* marvin-subtle  #0c0c0f */
  --c-bg-muted: 24 24 27;    /* marvin-muted / boxdark #18181b */
  --c-bg-elevated: 31 31 35; /* marvin-elevated / boxdark-2 #1f1f23 */
  --c-bg-hover: 39 39 42;    /* marvin-hover   #27272a */
  --c-stroke: 39 39 42;      /* stroke     #27272a */
  --c-strokedark: 63 63 70;  /* strokedark #3f3f46 */
  --c-bodydark: 161 161 170;
  --c-bodydark1: 113 113 122;
  --c-bodydark2: 82 82 91;

  /* Accent + semantic */
  --c-accent: 6 182 212;        /* #06b6d4 */
  --c-accent-hover: 34 211 238; /* #22d3ee */
  --c-accent-muted: 14 116 144; /* #0e7490 */
  --c-secondary: 100 116 139;   /* #64748b */
  --c-success: 34 197 94;
  --c-warning: 234 179 8;
  --c-danger: 239 68 68;
  --c-info: 59 130 246;

  /* Variable-backed shadows (dark defaults) */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card-2: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.6);

  /* ========================================
     TYPOGRAPHY TOKENS
     ======================================== */

  --font-family-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Font sizes (using px for precision in data-dense UI) */
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 13px;
  --font-size-lg: 14px;
  --font-size-xl: 16px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 30px;

  /* Line heights */
  --line-height-tight: 1.2;
  --line-height-snug: 1.35;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;

  /* Font weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* ========================================
     SPACING TOKENS
     ======================================== */

  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ========================================
     BORDER RADIUS TOKENS
     ======================================== */

  --radius-none: 0;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* ========================================
     SHADOW TOKENS
     ======================================== */

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.4);

  /* ========================================
     TRANSITION TOKENS
     ======================================== */

  --transition-fast: 100ms;
  --transition-default: 150ms;
  --transition-slow: 300ms;
  --transition-slower: 500ms;

  --ease-default: ease;
  --ease-in: ease-in;
  --ease-out: ease-out;
  --ease-in-out: ease-in-out;

  /* ========================================
     Z-INDEX TOKENS
     ======================================== */

  --z-dropdown: 50;
  --z-sticky: 100;
  --z-fixed: 200;
  --z-modal-backdrop: 999;
  --z-modal: 1000;
  --z-popover: 1100;
  --z-tooltip: 1200;
  --z-toast: 9999;

  /* ========================================
     COMPONENT-SPECIFIC TOKENS
     ======================================== */

  /* Sidebar */
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 72px;
  --sidebar-bg: var(--color-bg-subtle);
  --sidebar-border: var(--color-border-subtle);

  /* Header */
  --header-height: 64px;
  --header-bg: var(--color-bg-muted);
  --header-border: var(--color-border-subtle);

  /* Cards */
  --card-bg: var(--color-bg-muted);
  --card-border: var(--color-border-subtle);
  --card-radius: var(--radius-lg);
  --card-padding: var(--space-5);

  /* Tables */
  --table-header-bg: var(--color-bg-muted);
  --table-row-hover: var(--color-bg-hover);
  --table-border: var(--color-border-subtle);

  /* Forms */
  --input-bg: var(--color-bg-muted);
  --input-border: var(--color-border-subtle);
  --input-focus-border: var(--color-accent);
  --input-placeholder: var(--color-text-muted);

  /* Buttons */
  --btn-primary-bg: var(--color-accent);
  --btn-primary-hover: var(--color-accent-hover);
  --btn-secondary-bg: var(--color-bg-muted);
  --btn-secondary-hover: var(--color-bg-hover);
}

/* ========================================
   THEME OVERRIDES
   Dark is the default (:root above); .light
   on <html> flips every color-carrying token.
   Hues stay zinc-neutral so cards do not look
   bluish next to the inverted zinc grays.
   ======================================== */
.dark {
  /* Dark mode is the default — no overrides needed. */
}

.light {
  /* Semantic tokens (inline style= / var() consumers).
     Page bg is a decisive gray so white cards clearly separate;
     borders strong enough to read boxes as boxes. */
  --color-bg-base: #e0e0e5;
  --color-bg-subtle: #ffffff;
  --color-bg-muted: #ffffff;
  --color-bg-elevated: #f1f1f4;
  --color-bg-hover: #d6d6dc;

  --color-border-subtle: #cdcdd4;
  --color-border-default: #a1a1aa;
  --color-border-strong: #71717a;

  --color-text-primary: #18181b;
  --color-text-secondary: #52525b;
  --color-text-muted: #71717a;
  --color-text-disabled: #a1a1aa;

  --color-accent: #0891b2;        /* cyan-600: #06b6d4 fails contrast on white */
  --color-accent-hover: #06b6d4;
  --color-accent-muted: #155e75;
  --color-accent-bg: rgba(8, 145, 178, 0.1);

  --color-success: #16a34a;
  --color-success-bg: rgba(22, 163, 74, 0.1);
  --color-warning: #ca8a04;
  --color-warning-bg: rgba(202, 138, 4, 0.12);
  --color-danger: #dc2626;
  --color-danger-bg: rgba(220, 38, 38, 0.1);
  --color-info: #2563eb;
  --color-info-bg: rgba(37, 99, 235, 0.1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.08);

  /* Tailwind-facing triplets: zinc scale mirrored around 500 */
  --c-zinc-50: 24 24 27;
  --c-zinc-100: 39 39 42;
  --c-zinc-200: 63 63 70;
  --c-zinc-300: 82 82 91;
  --c-zinc-400: 113 113 122;
  /* --c-zinc-500 unchanged (works on both) */
  --c-zinc-600: 161 161 170;
  --c-zinc-700: 212 212 216;
  --c-zinc-800: 228 228 231;
  --c-zinc-900: 244 244 245;
  --c-zinc-950: 250 250 250;

  /* Surfaces: decisive gray body, white cards/sidebar/header
     (base darker + stroke stronger so boxes read as boxes) */
  --c-bg-base: 224 224 229;
  --c-bg-subtle: 255 255 255;
  --c-bg-muted: 255 255 255;
  --c-bg-elevated: 241 241 244;
  --c-bg-hover: 214 214 220;
  --c-stroke: 205 205 212;
  --c-strokedark: 161 161 170;
  --c-bodydark: 82 82 91;
  --c-bodydark1: 113 113 122;
  --c-bodydark2: 161 161 170;

  --c-accent: 8 145 178;
  --c-accent-hover: 6 182 212;
  --c-accent-muted: 21 94 117;
  --c-success: 22 163 74;
  --c-warning: 202 138 4;
  --c-danger: 220 38 38;
  --c-info: 37 99 235;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-card-2: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.16);
}
