/* ==========================================================================
   catknows. — Design Tokens
   Warm & Friendly Design System

   Layer 1: Foundation Tokens (Colors, Typography, Spacing, Radius, Shadows, Motion)
   Layer 2: Semantic Tokens (Brand, Status, Neutral surfaces)
   Layer 3: Component Tokens (Button, Card, Input, Table, Header, Sidebar, Modal, Navbar)

   Dark Mode = default (:root)
   Light Mode = :root[data-theme="light"]

   Brand color is overridden dynamically by lib.setTheme()
   ========================================================================== */

/* --- Dark Mode (Default) --- */
:root {
  color-scheme: dark;

  /* Brand — set dynamically by lib.setTheme(), these are CSS fallbacks */
  --brand-primary: #FF5C8A;
  --brand-primary-rgb: 255, 92, 138;
  --brand-primary-hover: #FF4F7E;
  --brand-primary-active: #E04570;
  --brand-accent: #1C7ED6;

  /* Semantic Status */
  --color-success: #2F9E44;
  --color-success-rgb: 47, 158, 68;
  --color-warning: #F08C00;
  --color-warning-rgb: 240, 140, 0;
  --color-error: #E03131;
  --color-error-rgb: 224, 49, 49;
  --color-info: #1971C2;
  --color-info-rgb: 25, 113, 194;
  --color-chart-neutral: #9ca3af;
  --color-chart-neutral-rgb: 156, 163, 175;

  /* Neutral Surfaces (Dark — warm-tinted) */
  --color-bg-primary: #131210;
  --color-bg-secondary: #1C1A18;
  --color-bg-tertiary: #252320;
  --color-border: #302D28;
  --color-text-primary: #F3F4F6;
  --color-text-secondary: #9CA3AF;
  --color-text-disabled: #6B7280;

  /* Shadows (Dark — soft, diffused) */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.35);

  /* Radius (friendly, rounded) */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Spacing (4px base unit) */
  --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;

  /* Typography (generous) */
  --font-family: 'font', 'Inter', -apple-system, system-ui, sans-serif;
  --font-size-h1: 28px;
  --font-size-h2: 22px;
  --font-size-h3: 18px;
  --font-size-body: 15px;
  --font-size-small: 12px;
  --font-weight-normal: 400;
  --font-weight-semibold: 600;
  --line-height-base: 1.55;

  /* Motion (calm, eased) */
  --motion-fast: 120ms ease;
  --motion-base: 200ms ease;
  --motion-slow: 300ms ease;

  /* ---------- Component Tokens ---------- */

  /* Buttons */
  --btn-height-default: 42px;
  --btn-height-small: 34px;
  --btn-height-xs: 28px;
  --btn-padding-default: 0 18px;
  --btn-padding-small: 0 14px;
  --btn-padding-xs: 0 10px;

  /* Cards */
  --card-padding: 24px;
  --card-radius: var(--radius-lg);
  --card-bg: var(--color-bg-secondary);
  --card-border: var(--color-border);

  /* Inputs */
  --input-height: 44px;
  --input-radius: var(--radius-md);
  --input-border-default: var(--color-border);
  --input-border-focus: var(--brand-primary);
  --input-border-error: var(--color-error);

  /* Tables */
  --table-row-height: 52px;
  --table-header-height: 48px;
  --table-border: var(--color-border);
  --table-row-hover-bg: var(--color-bg-tertiary);

  /* Header / Navbar */
  --header-height: 56px;
  --header-bg: var(--color-bg-secondary);
  --header-border: var(--color-border);

  /* Navbar */
  --navbar-bg: var(--color-bg-secondary);
  --navbar-border: var(--color-border);
  --navbar-link-color: var(--color-text-secondary);
  --navbar-link-active-color: var(--brand-primary);
  --navbar-link-hover-bg: var(--color-bg-tertiary);
  --navbar-link-radius: var(--radius-sm);
  --navbar-link-gap: 4px;
  --navbar-link-padding: 8px 14px;

  /* Sidebar */
  --sidebar-width-expanded: 280px;
  --sidebar-width-collapsed: 72px;
  --sidebar-bg: var(--color-bg-secondary);
  --sidebar-border: var(--color-border);

  /* Modal */
  --modal-radius: var(--radius-lg);
  --modal-padding: 28px;
  --modal-shadow: var(--shadow-lg);
  --modal-backdrop: rgba(0,0,0,0.4);

  /* Member Card */
  --member-card-padding: 16px;
  --member-card-gap: 12px;
  --member-card-avatar-size: 40px;

}

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

  /* Brand — not overridden here; lib.setTheme() sets these dynamically.
     The accent colors work well on both dark and light backgrounds. */

  /* Semantic Status (slightly darker for light backgrounds) */
  --color-success: #1B7F30;
  --color-success-rgb: 27, 127, 48;
  --color-warning: #C27400;
  --color-warning-rgb: 194, 116, 0;
  --color-error: #C92A2A;
  --color-error-rgb: 201, 42, 42;
  --color-info: #1864AB;
  --color-info-rgb: 24, 100, 171;
  --color-chart-neutral: #6B7280;
  --color-chart-neutral-rgb: 107, 114, 128;

  /* Neutral Surfaces (Light — warm cream) */
  --color-bg-primary: #FDFCFA;
  --color-bg-secondary: #F7F5F2;
  --color-bg-tertiary: #EFECE7;
  --color-border: #DDD8D0;
  --color-text-primary: #1F1B16;
  --color-text-secondary: #6B7280;
  --color-text-disabled: #9CA3AF;

  /* Shadows (Light — very soft) */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10);

  /* Modal backdrop (lighter in light mode) */
  --modal-backdrop: rgba(0,0,0,0.2);
}
