/**
 * Tournament OS — Theme tokens
 * All colors, shadows, and brand values are controlled here.
 * White-label: override --brand-* via JS from organization branding API.
 */

:root,
[data-theme="light"] {
    color-scheme: light;

    /* Brand (white-label) */
    --brand-primary: #5b6cff;
    --brand-primary-hover: #4a59e8;
    --brand-primary-soft: rgba(91, 108, 255, 0.12);
    --brand-primary-muted: rgba(91, 108, 255, 0.08);
    --brand-accent: #14b8a6;
    --brand-accent-soft: rgba(20, 184, 166, 0.12);
    --brand-gradient: linear-gradient(135deg, #5b6cff 0%, #8b5cf6 50%, #14b8a6 100%);
    --brand-logo-url: none;

    /* Surfaces */
    --color-bg: #f4f6fb;
    --color-bg-elevated: #ffffff;
    --color-bg-subtle: #eef1f8;
    --color-bg-muted: #e4e9f4;
    --color-bg-inverse: #0f1424;

    --color-surface: #ffffff;
    --color-surface-hover: #f8faff;
    --color-surface-active: #eef2ff;
    --color-surface-glass: rgba(255, 255, 255, 0.72);

    /* Text */
    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;
    --color-text-inverse: #f8fafc;
    --color-text-brand: var(--brand-primary);

    /* Borders */
    --color-border: rgba(15, 23, 42, 0.08);
    --color-border-strong: rgba(15, 23, 42, 0.14);
    --color-border-focus: var(--brand-primary);

    /* Semantic */
    --color-success: #10b981;
    --color-success-soft: rgba(16, 185, 129, 0.12);
    --color-warning: #f59e0b;
    --color-warning-soft: rgba(245, 158, 11, 0.12);
    --color-danger: #ef4444;
    --color-danger-soft: rgba(239, 68, 68, 0.12);
    --color-info: #3b82f6;
    --color-info-soft: rgba(59, 130, 246, 0.12);

    /* Sidebar */
    --sidebar-bg: rgba(255, 255, 255, 0.86);
    --sidebar-border: var(--color-border);
    --sidebar-item-hover: var(--brand-primary-muted);
    --sidebar-item-active: var(--brand-primary-soft);
    --sidebar-item-active-text: var(--brand-primary);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-xl: 0 24px 64px rgba(15, 23, 42, 0.16);
    --shadow-brand: 0 8px 32px rgba(91, 108, 255, 0.24);
    --shadow-inner: inset 0 1px 2px rgba(15, 23, 42, 0.06);

    /* Overlay */
    --overlay: rgba(15, 20, 36, 0.45);
    --overlay-blur: blur(12px);

    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(91, 108, 255, 0.35);
}

[data-theme="dark"] {
    color-scheme: dark;

    --brand-primary: #7c8cff;
    --brand-primary-hover: #929fff;
    --brand-primary-soft: rgba(124, 140, 255, 0.18);
    --brand-primary-muted: rgba(124, 140, 255, 0.1);
    --brand-accent: #2dd4bf;
    --brand-accent-soft: rgba(45, 212, 191, 0.14);

    --color-bg: #0b0f1a;
    --color-bg-elevated: #121827;
    --color-bg-subtle: #161d2e;
    --color-bg-muted: #1c2438;
    --color-bg-inverse: #f8fafc;

    --color-surface: #121827;
    --color-surface-hover: #161d2e;
    --color-surface-active: #1a2236;
    --color-surface-glass: rgba(18, 24, 39, 0.82);

    --color-text: #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-text-inverse: #0f172a;

    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-strong: rgba(255, 255, 255, 0.14);

    --sidebar-bg: rgba(18, 24, 39, 0.92);
    --sidebar-item-hover: rgba(255, 255, 255, 0.05);
    --sidebar-item-active: var(--brand-primary-soft);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.55);
    --shadow-brand: 0 8px 32px rgba(124, 140, 255, 0.2);
    --shadow-inner: inset 0 1px 2px rgba(0, 0, 0, 0.2);

    --overlay: rgba(0, 0, 0, 0.6);
    --focus-ring: 0 0 0 3px rgba(124, 140, 255, 0.4);
}

/* Shared design tokens */
:root {
    /* Typography */
    --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
    --font-display: "Instrument Sans", var(--font-sans);
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed: 72px;
    --topbar-height: 72px;
    --content-max: 1440px;
    --layout-gutter: clamp(var(--space-5), 4vw, var(--space-10));
    --content-padding-y: clamp(var(--space-6), 2.5vw, var(--space-10));

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Z-index */
    --z-sidebar: 100;
    --z-topbar: 110;
    --z-drawer: 200;
    --z-modal: 300;
    --z-toast: 400;
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --duration-fast: 0ms;
        --duration-normal: 0ms;
        --duration-slow: 0ms;
    }
}
