/**
 * CSS Custom Properties (Variables)
 * Design tokens following atomic design principles
 * @reference: https://bradfrost.com/blog/post/atomic-web-design/
 */

:root {
    /* ========================================
       Typography
       ======================================== */
    --font-family-base: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif;
    --font-family-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
    
    /* Font Sizes */
    --font-size-2xs: 0.6875rem;   /* 11px — table headers, compact labels */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 1.875rem;    /* 30px */
    --font-size-4xl: 2.25rem;     /* 36px */
    
    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Line Heights */
    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.6;
    --line-height-base: 1.65;
    
    /* ========================================
       Colors - Brand
       ======================================== */
    --color-primary: #ba002b;
    --color-primary-light: #d62e4f;
    --color-primary-lighter: #ff6b9d;
    --color-primary-dark: #a00026;
    --color-primary-rgb: 186, 0, 43;

    /* Bootstrap primary override — align Bootstrap's "primary" with brand crimson */
    --bs-primary: #ba002b;
    --bs-primary-rgb: 186, 0, 43;
    --bs-primary-bg-subtle: #f5ccd4;
    --bs-primary-border-subtle: #e899a9;
    --bs-primary-text-emphasis: #6e0019;
    
    /* ========================================
       Colors - Neutral Palette
       ======================================== */
    --color-white: #ffffff;
    --color-black: #000000;
    
    --color-gray-50: #f8f9fa;
    --color-gray-100: #f1f3f5;
    --color-gray-200: #e9ecef;
    --color-gray-300: #dee2e6;
    --color-gray-400: #ced4da;
    --color-gray-500: #adb5bd;
    --color-gray-600: #6c757d;
    --color-gray-700: #495057;
    --color-gray-800: #343a40;
    --color-gray-900: #212529;
    
    --color-dark: #1a1d23;
    --color-dark-rgb: 26, 29, 35;
    --color-darker: #2d3238;
    
    /* ========================================
       Colors - Semantic
       ======================================== */
    --color-success: #198754;
    --color-success-light: #20c997;
    --color-success-bg: #d1e7dd;
    --color-success-subtle: #a3cfbb;
    --color-success-rgb: 25, 135, 84;
    
    --color-danger: #dc3545;

    /* Chart palette — categorical series colours, defined once. Keep these as
       6-digit hex: chart scripts append 2-digit alpha (e.g. c + '55'). Read in
       JS via cssVar('--chart-1') (base.html). */
    --chart-1: #185FA5;   /* blue */
    --chart-2: #0F6E56;   /* green */
    --chart-3: #993C1D;   /* rust */
    --chart-4: #993556;   /* plum */
    --chart-5: #534AB7;   /* violet */
    --chart-6: #BA7517;   /* amber */
    --chart-7: #639922;   /* lime */
    --chart-8: #3C3489;   /* indigo */
    --chart-9: #D85A30;   /* orange */
    --chart-10: #0C447C;  /* navy */
    --chart-11: #1D9E75;  /* teal */
    --chart-12: #EF9F27;  /* gold */
    --chart-13: #1A7A4A;  /* deep green */
    --chart-14: #7A1A4A;  /* deep plum */
    --chart-15: #4A1A7A;  /* deep violet */
    --chart-16: #7A4A1A;  /* deep brown */
    --chart-text: #212529;  /* = gray-900; axis labels, data labels */
    --chart-muted: #6c757d; /* = gray-600; secondary ticks */
    --chart-brand: #ba002b; /* = --color-primary, as hex for alpha suffixing */
    --chart-grid: rgba(136, 135, 128, 0.1); /* axis grid lines */

    /* Calendar event types. FullCalendar gets these as hex from
       apps/dashboard/views.py (calendar feed) — keep both in sync. */
    --event-appointment: #2563eb;
    --event-goal: #d97706;
    --color-danger-light: #e63946;
    --color-danger-dark: #c82333;
    --color-danger-bg: #f8d7da;
    --color-danger-rgb: 220, 53, 69;
    
    --color-warning: #ffc107;
    --color-warning-light: #ffb300;
    --color-warning-dark: #e0a800;
    --color-warning-text: #8a6500;     /* WCAG AA on white (~5.0:1) — use for warning text */
    --color-warning-rgb: 255, 193, 7;
    
    --color-info: #0dcaf0;
    --color-info-dark: #0aa2c0;
    --color-info-rgb: 13, 202, 240;

    --color-blue: #4a6fa5;
    --color-blue-dark: #3a5a8c;
    --color-blue-rgb: 74, 111, 165;

    /* Appointment color — intentionally distinct from brand red to
       differentiate appointments (blue) from events (primary/red)
       in schedule/calendar UI */
    --color-appointment: #1a73e8;
    --color-appointment-rgb: 26, 115, 232;
    
    /* ========================================
       Spacing System (8px base)
       ======================================== */
    --space-0: 0;
    --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-7: 1.75rem;   /* 28px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    --space-20: 5rem;     /* 80px */
    
    /* ========================================
       Border Radius
       ======================================== */
    --radius-sm: 6px;
    --radius-base: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --radius-2xl: 16px;
    --radius-3xl: 20px;
    --radius-full: 9999px;
    
    /* ========================================
       Shadows
       ======================================== */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 20px 40px rgba(0, 0, 0, 0.2), 0 12px 24px rgba(0, 0, 0, 0.15);
    
    /* Colored Shadows */
    --shadow-primary: 0 4px 12px rgba(var(--color-primary-rgb), 0.3);
    --shadow-primary-lg: 0 8px 20px rgba(var(--color-primary-rgb), 0.4);
    --shadow-success: 0 4px 12px rgba(var(--color-success-rgb), 0.3);
    --shadow-danger: 0 4px 12px rgba(var(--color-danger-rgb), 0.3);
    
    /* ========================================
       Transitions & Animations
       ======================================== */
    --transition-fast: 0.15s;
    --transition-base: 0.2s;
    --transition-slow: 0.3s;
    --transition-slower: 0.5s;
    
    --ease-in: ease-in;
    --ease-out: ease-out;
    --ease-in-out: ease-in-out;
    --ease-custom: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);  /* settles, never overshoots */
    
    /* ========================================
       Z-Index Scale
       ======================================== */
    --z-index-dropdown: 1000;
    --z-index-sticky: 1020;
    --z-index-fixed: 1030;
    --z-index-navbar-search: 1200;
    --z-index-modal-backdrop: 1040;
    --z-index-modal: 1050;
    --z-index-popover: 1060;
    --z-index-tooltip: 1070;

    /* ========================================
       Layout Dimensions
       ======================================== */
    --sidebar-width: 250px;
    --navbar-height: 117px;   /* sticky top navbar height — matches sidebar header (space-8 + 60px logo + space-6 + 1px border) */
    
    /* ========================================
       Breakpoints (for reference in JS)
       ======================================== */
    --breakpoint-xs: 0;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1400px;
}

/* Navbar height resets to compact size on mobile (sidebar is hidden) */
@media (max-width: 767.98px) {
    :root {
        --navbar-height: 60px;
    }
}
