/* ==========================================================================
   RegWatch Design System — Variables
   Linear-sharp aesthetic: clean, minimal, information-dense
   ========================================================================== */

/* Dark Theme (default) */
:root,
[data-theme="dark"] {
  /* Background layers */
  --bg-base: #0a0a0b;
  --bg-surface: #111113;
  --bg-elevated: #18181b;
  --bg-hover: #1f1f23;
  --bg-active: #27272a;
  --bg-overlay: rgba(0, 0, 0, 0.6);

  /* Borders */
  --border: #27272a;
  --border-hover: #3f3f46;
  --border-focus: #6366f1;
  --border-subtle: #1f1f23;

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-disabled: #52525b;
  --text-inverse: #09090b;

  /* Accent — Indigo */
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-muted: rgba(99, 102, 241, 0.15);
  --accent-text: #a5b4fc;

  /* Status */
  --status-success: #22c55e;
  --status-success-muted: rgba(34, 197, 94, 0.15);
  --status-warning: #f59e0b;
  --status-warning-muted: rgba(245, 158, 11, 0.15);
  --status-error: #ef4444;
  --status-error-muted: rgba(239, 68, 68, 0.15);
  --status-info: #3b82f6;
  --status-info-muted: rgba(59, 130, 246, 0.15);

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

  --text-2xs: 0.8125rem;   /* 13px — default = old "large" which Sam says looks best */
  --text-xs: 0.875rem;     /* 14px */
  --text-sm: 0.9375rem;    /* 15px */
  --text-base: 1rem;       /* 16px */
  --text-md: 1.125rem;     /* 18px */
  --text-lg: 1.25rem;      /* 20px */
  --text-xl: 1.5rem;       /* 24px */
  --text-2xl: 2rem;        /* 32px */

  --leading-tight: 1.2;
  --leading-normal: 1.5;

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

  /* Spacing */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-focus: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--accent);

  /* Layout */
  --sidebar-width: 220px;
  --sidebar-collapsed: 56px;
  --header-height: 52px;
  --content-max-width: 1200px;
  --tab-bar-height: 56px;

  /* 3D Glassmorphism Cards */
  --card-bg: rgba(30, 32, 48, 0.7);
  --card-border: 1px solid rgba(255, 255, 255, 0.06);
  --card-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 12px 32px rgba(0, 0, 0, 0.2);
  --card-shadow-hover:
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 20px 48px rgba(0, 0, 0, 0.3);
  --card-inner-glow: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.04) 100%);
  --item-hover-bg: rgba(255, 255, 255, 0.04);

  /* Transitions */
  --duration-fast: 100ms;
  --duration-normal: 150ms;
  --duration-slow: 250ms;
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);

  /* Z-index scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-tooltip: 600;
}

/*
 * Font size preferences — S/M/L
 * Default = M (medium). S shrinks by 2px per level. L grows by 1px.
 * Sidebar uses fixed px values (see layout.css) and is immune to these changes.
 */
[data-fontsize="compact"] {
  --text-2xs: 0.6875rem;   /* 11px (-2) */
  --text-xs: 0.75rem;      /* 12px (-2) */
  --text-sm: 0.8125rem;    /* 13px (-2) */
  --text-base: 0.875rem;   /* 14px (-2) */
  --text-md: 1rem;         /* 16px (-2) */
}
[data-fontsize="large"] {
  --text-2xs: 0.875rem;    /* 14px (+1) */
  --text-xs: 0.9375rem;    /* 15px (+1) */
  --text-sm: 1rem;         /* 16px (+1) */
  --text-base: 1.0625rem;  /* 17px (+1) */
  --text-md: 1.1875rem;    /* 19px (+1) */
}

/* Mobile: always use M (default) font size — ignore S/L preference */
@media (max-width: 768px) {
  [data-fontsize="compact"],
  [data-fontsize="large"] {
    --text-2xs: 0.8125rem;
    --text-xs: 0.875rem;
    --text-sm: 0.9375rem;
    --text-base: 1rem;
    --text-md: 1.125rem;
  }
}

/* Light Theme */
[data-theme="light"] {
  --bg-base: #ffffff;
  --bg-surface: #f9fafb;
  --bg-elevated: #f3f4f6;
  --bg-hover: #e5e7eb;
  --bg-active: #d1d5db;
  --bg-overlay: rgba(0, 0, 0, 0.4);

  --border: #e5e7eb;
  --border-hover: #d1d5db;
  --border-focus: #6366f1;
  --border-subtle: #f3f4f6;

  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-disabled: #d1d5db;
  --text-inverse: #fafafa;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-muted: rgba(99, 102, 241, 0.1);
  --accent-text: #4338ca;

  --status-success: #16a34a;
  --status-success-muted: rgba(22, 163, 74, 0.1);
  --status-warning: #d97706;
  --status-warning-muted: rgba(217, 119, 6, 0.1);
  --status-error: #dc2626;
  --status-error-muted: rgba(220, 38, 38, 0.1);
  --status-info: #2563eb;
  --status-info-muted: rgba(37, 99, 235, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-focus: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--accent);

  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: 1px solid rgba(0, 0, 0, 0.06);
  --card-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 12px 32px rgba(0, 0, 0, 0.06);
  --card-shadow-hover:
    0 2px 4px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.12),
    0 20px 48px rgba(0, 0, 0, 0.08);
  --card-inner-glow: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.4) 100%);
  --item-hover-bg: rgba(0, 0, 0, 0.03);
}
