/* ==========================================================================
   Design System — Tokens
   Yii2 Basic Modern Minimalist Enterprise UI
   ========================================================================== */

:root {
    /* Color palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;

    --background: #f8fafc;
    --surface: #ffffff;
    --surface-secondary: #f1f5f9;

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #64748b;

    --border: #e2e8f0;

    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;

    /* Layout dimensions */
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 76px;
    --navbar-height: 68px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.05);

    /* Transitions */
    --transition: all 0.2s ease;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-md: 14px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;

    /* Bridge custom tokens into Bootstrap components */
    --bs-primary: var(--primary);
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: var(--primary-hover);
    --bs-link-color-rgb: 29, 78, 216;
    --bs-link-hover-color: #1e40af;
    --bs-link-hover-color-rgb: 30, 64, 175;

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

/* Base reset / typography */
html {
    font-size: 14px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, .h1 { font-size: var(--font-size-xl); font-weight: 700; }
h2, .h2 { font-size: var(--font-size-lg); font-weight: 600; }
h3, .h3, .card-title { font-size: var(--font-size-md); font-weight: 600; }

.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }

/* Accessibility: visible focus */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Dark mode overrides for tokens (preserve existing toggle) */
[data-bs-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --surface-secondary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #cbd5e1;
    --border: #334155;

    --primary-light: rgba(37, 99, 235, 0.18);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;

    --bs-link-color: #bfdbfe;
    --bs-link-color-rgb: 191, 219, 254;
    --bs-link-hover-color: #dbeafe;
    --bs-link-hover-color-rgb: 219, 234, 254;
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}