/* ==========================================================================
   base.css — design tokens, reset, typography
   Fonts: Oswald (display) · Montserrat (UI) · Roboto (body)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700;800&family=Roboto:wght@300;400;500&display=swap');

/* --------------------------------------------------------------------------
   Design tokens — light theme (default)
   -------------------------------------------------------------------------- */

:root {
    /* Fonts */
    --font-display: 'Oswald', sans-serif;
    --font-ui:      'Montserrat', sans-serif;
    --font-body:    'Roboto', sans-serif;

    /* Primary palette (brand navy) */
    --primary:          #051f40;
    --primary-dim:      #03142a;
    --primary-hi:       #0d3570;
    --primary-wash:     rgba(5, 31, 64, 0.08);
    --primary-glow:     rgba(5, 31, 64, 0.18);

    /* Primary fill — solid backgrounds; always stays navy (no dark-mode override) */
    --primary-fill:     #051f40;
    --primary-fill-dim: #03142a;
    --primary-fill-hi:  #0d3570;

    /* Semantic — light (default) */
    --bg:           #FFFFFF;
    --bg-alt:       #F4F6FA;
    --surface:      #FFFFFF;
    --surface-hi:   #EEF2F8;
    --border:       #D0D8E8;
    --border-hi:    #A8B8D0;

    --text:         #0F1115;
    --text-2:       #4A5568;
    --text-3:       #8898AA;
    --text-on-primary: #FFFFFF;

    /* Status */
    --green:  #2D9E5A;
    --red:    #98000f;
    --amber:  #E89B0A;
    --blue:   #051f40;

    --green-wash: rgba(45, 158, 90, 0.10);
    --red-wash:   rgba(152, 0, 15, 0.10);
    --amber-wash: rgba(232, 155, 10, 0.10);
    --blue-wash:  rgba(5, 31, 64, 0.10);

    /* Typography scale */
    --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;
    --text-5xl:  3rem;

    /* Spacing scale (4px base) */
    --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;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Layout */
    --container-sm:  640px;
    --container-md:  768px;
    --container-lg:  1024px;
    --container-xl:  1280px;
    --container-2xl: 1440px;

    --sidebar-width: 220px;
    --sidebar-collapsed-width: 60px;
    --mobile-topbar-height: 40px;

    /* Effects */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-pill: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.10);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.14);
    --shadow-primary: 0 0 20px rgba(5, 31, 64, 0.20);

    --transition-fast:   120ms ease;
    --transition-base:   200ms ease;
    --transition-slow:   350ms ease;

    --z-base:    1;
    --z-raised:  10;
    --z-dropdown: 100;
    --z-overlay: 200;
    --z-modal:   300;
    --z-nav:     400;
    --z-toast:   500;
}

/* --------------------------------------------------------------------------
   Dark theme overrides
   -------------------------------------------------------------------------- */

[data-theme="dark"] {
    --bg:          #0F1115;
    --bg-alt:      #161920;
    --surface:     #1C2028;
    --surface-hi:  #232830;
    --border:      #2C3240;
    --border-hi:   #3A4255;

    --text:        #EBE8E2;
    --text-2:      #8E9AAA;
    --text-3:      #505A68;

    /* primary → white in dark mode so text/borders are readable */
    --primary:      #FFFFFF;
    --primary-dim:  #B0B8C8;
    --primary-hi:   #FFFFFF;
    --primary-wash: rgba(255, 255, 255, 0.07);
    --primary-glow: rgba(255, 255, 255, 0.14);
    /* --primary-fill tokens intentionally not overridden — stays navy for solid fills */

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-primary: 0 0 20px rgba(5, 31, 64, 0.30);
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--border-hi) transparent;
}

/* WebKit / Blink */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-hi);
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
::-webkit-scrollbar-corner { background: transparent; }

[data-theme="dark"] {
    scrollbar-color: var(--border-hi) transparent;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video, svg {
    display: block;
    max-width: 100%;
}

button, input, select, textarea {
    font: inherit;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hi);
}

ul, ol {
    list-style: none;
}

/* --------------------------------------------------------------------------
   Headings
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--text);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

@media (max-width: 500px) {
    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    h3 { font-size: var(--text-xl); }
}

/* --------------------------------------------------------------------------
   Body text
   -------------------------------------------------------------------------- */

p {
    line-height: 1.7;
    color: var(--text-2);
}

p + p {
    margin-top: var(--space-4);
}

small {
    font-size: var(--text-sm);
    color: var(--text-3);
}

strong {
    font-weight: 700;
    color: var(--text);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-8) 0;
}

/* --------------------------------------------------------------------------
   Utility classes
   -------------------------------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-3); }
.text-secondary { color: var(--text-2); }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }

.font-display { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; }
.font-ui      { font-family: var(--font-ui); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Amount display — Oswald looks sharp for dollar values */
.amount {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.amount--primary { color: var(--primary); }
.amount--green { color: var(--green); }
.amount--red  { color: var(--red); }
