/* ==========================================================================
   LabelLove - Design System & Theme Tokens
   ========================================================================== */

:root {
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, monospace;

  /* Transitions & Animation */
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-smooth);
  --transition-normal: 250ms var(--ease-smooth);

  /* Dimensions & Spacing */
  --header-height: 54px;
  --ribbon-width: 60px;
  --inspector-width: 320px;
  --drawer-height: 220px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;
}

/* ==========================================================================
   Dark Theme (Default)
   ========================================================================== */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* Brand & Core Palette */
  --bg-app: #0c0f17;
  --bg-surface: #141824;
  --bg-surface-elevated: #1a2030;
  --bg-surface-subtle: #21283c;
  --bg-glass: rgba(20, 24, 36, 0.85);
  --bg-glass-elevated: rgba(26, 32, 48, 0.92);

  /* Canvas Drafting Environment */
  --bg-canvas-viewport: #080a10;
  --canvas-grid-dot: rgba(255, 255, 255, 0.06);
  --canvas-scrollbar-track: #090d16;
  --canvas-scrollbar-thumb: rgba(148, 163, 184, 0.25);
  --canvas-scrollbar-border: #090d16;
  --label-stage-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 40px rgba(99, 102, 241, 0.08);

  /* Accents */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-primary-subtle: rgba(99, 102, 241, 0.15);
  --accent-primary-glow: rgba(99, 102, 241, 0.35);

  --accent-success: #10b981;
  --accent-success-subtle: rgba(16, 185, 129, 0.15);
  
  --accent-warning: #f59e0b;
  --accent-warning-subtle: rgba(245, 158, 11, 0.15);
  
  --accent-danger: #ef4444;
  --accent-danger-subtle: rgba(239, 68, 68, 0.15);

  --accent-cyan: #06b6d4;
  --accent-cyan-subtle: rgba(6, 182, 212, 0.15);

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-default: rgba(255, 255, 255, 0.14);
  --border-focus: #6366f1;
  --border-active: rgba(99, 102, 241, 0.6);

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --text-inverse: #0f172a;

  /* Shadows & Depth */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.65), 0 4px 8px -2px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px -4px var(--accent-primary-glow);
  --shadow-glow-cyan: 0 0 20px -3px rgba(6, 182, 212, 0.3);

  --modal-backdrop-bg: rgba(0, 0, 0, 0.7);
  --bg-table-hover: rgba(255, 255, 255, 0.03);
}

/* ==========================================================================
   Light Theme
   ========================================================================== */
[data-theme="light"] {
  color-scheme: light;

  /* Brand & Core Palette */
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-surface-subtle: #edf2f7;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --bg-glass-elevated: rgba(248, 250, 252, 0.95);

  /* Canvas Drafting Environment */
  --bg-canvas-viewport: #e2e8f0;
  --canvas-grid-dot: rgba(15, 23, 42, 0.12);
  --canvas-scrollbar-track: #cbd5e1;
  --canvas-scrollbar-thumb: rgba(100, 116, 139, 0.35);
  --canvas-scrollbar-border: #cbd5e1;
  --label-stage-shadow: 0 15px 40px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.1), 0 0 30px rgba(79, 70, 229, 0.06);

  /* Accents */
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-primary-subtle: rgba(79, 70, 229, 0.12);
  --accent-primary-glow: rgba(79, 70, 229, 0.25);

  --accent-success: #059669;
  --accent-success-subtle: rgba(5, 150, 105, 0.12);
  
  --accent-warning: #d97706;
  --accent-warning-subtle: rgba(217, 119, 6, 0.12);
  
  --accent-danger: #dc2626;
  --accent-danger-subtle: rgba(220, 38, 38, 0.12);

  --accent-cyan: #0891b2;
  --accent-cyan-subtle: rgba(8, 145, 178, 0.12);

  /* Borders & Dividers */
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-default: rgba(15, 23, 42, 0.14);
  --border-focus: #4f46e5;
  --border-active: rgba(79, 70, 229, 0.6);

  /* Typography */
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-faint: #94a3b8;
  --text-inverse: #f8fafc;

  /* Shadows & Depth */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 16px 36px -4px rgba(0, 0, 0, 0.14), 0 6px 12px -2px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 24px -4px rgba(79, 70, 229, 0.2);
  --shadow-glow-cyan: 0 0 20px -3px rgba(8, 145, 178, 0.2);

  --modal-backdrop-bg: rgba(15, 23, 42, 0.45);
  --bg-table-hover: rgba(0, 0, 0, 0.035);
}

/* Base Reset & Core Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* Form inputs & buttons reset */
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
  border: none;
  background: none;
}

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

button:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}
