/* ============================================================
   Design Tokens — Hosting CRM Theme
   ============================================================
   All visual decisions live here. Import this file FIRST.
   Override via [data-theme="dark"] or component-scoped vars.
   ============================================================ */

:root {
    /* ── Color Palette ─────────────────────────────────────── */
    /* Brand */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: rgba(37, 99, 235, 0.08);
    --color-primary-glow: 0 0 20px rgba(37, 99, 235, 0.25);

    --color-secondary: #64748b;
    --color-secondary-hover: #475569;
    --color-secondary-light: rgba(100, 116, 139, 0.08);

    /* Semantic */
    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-success-light: rgba(16, 185, 129, 0.08);

    --color-warning: #f59e0b;
    --color-warning-hover: #d97706;
    --color-warning-light: rgba(245, 158, 11, 0.08);

    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-danger-light: rgba(239, 68, 68, 0.08);

    --color-info: #3b82f6;
    --color-info-hover: #2563eb;
    --color-info-light: rgba(59, 130, 246, 0.08);

    /* Backgrounds */
    --bg-base: #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f5f5f5;
    --bg-elevated: #ffffff;
    --bg-muted: #f8fafc;
    --bg-subtle: #f1f5f9;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --text-link: var(--color-primary);
    --text-link-hover: var(--color-primary-hover);

    /* Borders */
    --border-default: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-strong: #cbd5e1;

    /* Sidebar (preserved from existing) */
    --sidebar-bg: #1b1b1b;
    --sidebar-bg-hover: #2d2d2d;
    --sidebar-bg-active: rgba(37, 99, 235, 0.15);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #9e9e9e;
    --sidebar-text-active: #ffffff;

    /* Header */
    --header-bg: var(--color-primary);
    --header-text: var(--text-inverse);

    /* ── Typography ────────────────────────────────────────── */
    --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

    /* Type Scale (major third — 1.250) */
    --text-xs: 0.75rem;     /* 12px */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-lg: 1.125rem;    /* 18px */
    --text-xl: 1.25rem;     /* 20px */
    --text-2xl: 1.5rem;     /* 24px */
    --text-3xl: 1.875rem;   /* 30px */
    --text-4xl: 2.25rem;    /* 36px */

    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;

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

    /* Letter Spacing */
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;

    /* ── Spacing (4px base) ────────────────────────────────── */
    --space-0: 0;
    --space-px: 1px;
    --space-0\.5: 0.125rem;   /* 2px */
    --space-1: 0.25rem;       /* 4px */
    --space-1\.5: 0.375rem;   /* 6px */
    --space-2: 0.5rem;        /* 8px */
    --space-2\.5: 0.625rem;   /* 10px */
    --space-3: 0.75rem;       /* 12px */
    --space-3\.5: 0.875rem;   /* 14px */
    --space-4: 1rem;          /* 16px */
    --space-5: 1.25rem;       /* 20px */
    --space-6: 1.5rem;        /* 24px */
    --space-7: 1.75rem;       /* 28px */
    --space-8: 2rem;          /* 32px */
    --space-9: 2.25rem;       /* 36px */
    --space-10: 2.5rem;       /* 40px */
    --space-12: 3rem;         /* 48px */
    --space-14: 3.5rem;       /* 56px */
    --space-16: 4rem;         /* 64px */
    --space-20: 5rem;         /* 80px */
    --space-24: 6rem;         /* 96px */

    /* ── Border Radius ─────────────────────────────────────── */
    --radius-none: 0;
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* ── Shadows ───────────────────────────────────────────── */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-none: 0 0 0 0 transparent;

    /* ── Transitions ───────────────────────────────────────── */
    --ease: 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);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    --duration-fast: 0.1s;
    --duration: 0.2s;
    --duration-slow: 0.35s;
    --duration-slower: 0.5s;

    /* ── Layout ────────────────────────────────────────────── */
    --header-height: 60px;
    --sidebar-width: 48px;
    --sidebar-expanded-width: 220px;
    --content-max-width: 1400px;

    /* ── Z-Index Scale ─────────────────────────────────────── */
    --z-base: 0;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-sidebar: 1040;
    --z-modal-backdrop: 1050;
    --z-modal: 1060;
    --z-popover: 1070;
    --z-tooltip: 1080;

    /* ── Button Tokens ─────────────────────────────────────── */
    --btn-shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.15);
    --btn-translate-y: -1px;
    --btn-font-weight: var(--font-medium);
    --btn-border-radius: var(--radius-sm);
    --btn-transition: all var(--duration) var(--ease);

    /* ── Breakpoints (for reference — use in media queries) ── */
    /* --bp-sm: 640px; */
    /* --bp-md: 768px; */
    /* --bp-lg: 1024px; */
    /* --bp-xl: 1280px; */
    /* --bp-2xl: 1536px; */
}

/* ============================================================
   Dark Mode
   ============================================================ */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-base: #0f1117;
    --bg-surface: #161822;
    --bg-surface-hover: #1e2030;
    --bg-elevated: #1e2030;
    --bg-muted: #1a1d2e;
    --bg-subtle: #252838;

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Borders */
    --border-default: #2e3348;
    --border-subtle: #252838;
    --border-strong: #475569;

    /* Primary (slightly desaturated for dark) */
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-primary-light: rgba(59, 130, 246, 0.12);

    /* Semantic (brighter for contrast) */
    --color-success: #34d399;
    --color-success-light: rgba(52, 211, 153, 0.12);

    --color-warning: #fbbf24;
    --color-warning-light: rgba(251, 191, 36, 0.12);

    --color-danger: #f87171;
    --color-danger-light: rgba(248, 113, 113, 0.12);

    --color-info: #60a5fa;
    --color-info-light: rgba(96, 165, 250, 0.12);

    /* Shadows (heavier for dark) */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);

    /* Button hover shadow adjusted for dark */
    --btn-shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.3);
}
