/* Betfaros design tokens, in three layers (see docs/DESIGN_SYSTEM.md):
   1. primitives: raw values, named for what they are (only this file holds hex codes)
   2. semantic:   what a value is for; the light theme overrides only this layer
   3. component:  per component, built from the semantic layer
   The colours are betfaros.gr's own; dark first, light when the device asks for it. */

/* ---------- 1. Primitives ---------- */
:root {
  /* ink (dark surfaces) and slate (text, lines, light surfaces) */
  --ink-950: #11141B; --ink-900: #151821; --ink-850: #1D212C; --ink-700: #2A2F3C;
  --slate-600: #5A6475; --slate-500: #6B7488; --slate-450: #7C8698; --slate-400: #9AA3B5;
  --slate-200: #E2E8F0; --slate-100: #EEF1F6; --slate-50: #F8FAFC; --white: #FFFFFF;
  /* radar violet: the brand accent */
  --violet-100: #EDE9FE; --violet-300: #C4B5FD; --violet-400: #A78BFA; --violet-500: #8F6CF6;
  --violet-600: #6D4FD8; --violet-900: #2A2342;
  /* value green and loss coral */
  --green-100: #DDF2EC; --green-400: #3DD6A3; --green-700: #0A6F5A; --green-950: #12332A;
  --coral-100: #F8E1DC; --coral-400: #FF8B76; --coral-700: #B23A2A; --coral-950: #3D1A15;

  /* spacing, 2px steps up to 20, then 4px-grid */
  --space-0-5: 2px; --space-1: 4px; --space-1-5: 6px; --space-2: 8px; --space-2-5: 10px;
  --space-3: 12px; --space-3-5: 14px; --space-4: 16px; --space-4-5: 18px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-16: 64px;

  /* type */
  --font-sans: "Commissioner", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --text-2xs: 11px; --text-xs: 12px; --text-sm: 13px; --text-md: 14px; --text-base: 15px;
  --text-lg: 18px; --text-2xl: 24px;
  --weight-regular: 400; --weight-medium: 500; --weight-semibold: 600;
  --leading-tight: 1.2; --leading-normal: 1.5; --leading-label: 16px;
  --tracking-tight: -.02em; --tracking-caps: .12em;

  /* shape and motion */
  --radius-md: 8px; --radius-pill: 999px;
  --shadow-lg: 0 12px 24px rgb(0 0 0 / .25);
  --border-width: 1px; --ring-width: 2px; --ring-offset: 2px;
  --duration-fast: 150ms; --ease: ease-in-out;
  --opacity-muted: .75; --opacity-disabled: .5;
  --content-max: 1680px;  /* wide enough for the bet tables without a sideways scroll (4/11) */
}

/* ---------- 2. Semantic (dark) ---------- */
:root {
  --color-bg: var(--ink-900);
  --color-surface: var(--ink-850);
  --color-surface-sunken: var(--ink-950);
  --color-border: var(--ink-700);
  --color-border-strong: var(--slate-500);
  --color-fg: var(--slate-50);
  --color-fg-muted: var(--slate-400);
  --color-primary: var(--violet-400);          /* filled buttons */
  --color-primary-hover: var(--violet-300);
  --color-primary-active: var(--violet-500);
  --color-on-primary: var(--ink-900);
  --color-primary-ink: var(--violet-400);      /* primary as text on the page */
  --color-primary-soft: var(--violet-900);
  --color-positive: var(--green-400);
  --color-positive-soft: var(--green-950);
  --color-negative: var(--coral-400);
  --color-negative-soft: var(--coral-950);
  --color-ring: var(--violet-400);
  --color-logo-fg: var(--slate-50);
  --color-logo-accent: var(--violet-400);
  color-scheme: dark;
}

/* ---------- 2b. Semantic (light) ----------
   The device's light mode, unless the toggle chose dark (data-theme="dark" on <html>),
   and the toggle's light on any device. Keep the two lists the same. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --color-bg: var(--slate-50);
    --color-surface: var(--white);
    --color-surface-sunken: var(--slate-100);
    --color-border: var(--slate-200);
    --color-border-strong: var(--slate-450);
    --color-fg: var(--ink-900);
    --color-fg-muted: var(--slate-600);
    --color-primary-hover: var(--violet-500);
    --color-primary-active: var(--violet-600);
    --color-primary-ink: var(--violet-600);
    --color-primary-soft: var(--violet-100);
    --color-positive: var(--green-700);
    --color-positive-soft: var(--green-100);
    --color-negative: var(--coral-700);
    --color-negative-soft: var(--coral-100);
    --color-ring: var(--violet-600);
    --color-logo-fg: var(--ink-900);
    --color-logo-accent: var(--violet-600);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --color-bg: var(--slate-50);
  --color-surface: var(--white);
  --color-surface-sunken: var(--slate-100);
  --color-border: var(--slate-200);
  --color-border-strong: var(--slate-450);
  --color-fg: var(--ink-900);
  --color-fg-muted: var(--slate-600);
  --color-primary-hover: var(--violet-500);
  --color-primary-active: var(--violet-600);
  --color-primary-ink: var(--violet-600);
  --color-primary-soft: var(--violet-100);
  --color-positive: var(--green-700);
  --color-positive-soft: var(--green-100);
  --color-negative: var(--coral-700);
  --color-negative-soft: var(--coral-100);
  --color-ring: var(--violet-600);
  --color-logo-fg: var(--ink-900);
  --color-logo-accent: var(--violet-600);
  color-scheme: light;
}

/* ---------- 3. Component ---------- */
:root {
  /* page */
  --page-bg: var(--color-bg);
  --page-fg: var(--color-fg);
  --page-font: var(--weight-regular) var(--text-base)/var(--leading-normal) var(--font-sans);
  --page-max-width: var(--content-max);
  --page-padding-y: var(--space-5);
  --page-gutter: max(var(--space-4), env(safe-area-inset-left, 0px));
  --login-max-width: 380px;
  --bp-sm: 600px;  /* documentation only: media queries can't read custom properties */
  --bp-menu: 760px;  /* below it the menu goes behind the ☰ button (documentation only) */

  /* header and navigation */
  --header-bg: var(--color-surface-sunken);
  --header-border: var(--color-border);
  --header-padding-y: var(--space-3-5);
  --nav-link-fg: var(--color-fg-muted);
  --nav-link-fg-hover: var(--color-fg);
  --nav-link-bg-hover: var(--color-surface);
  --nav-link-fg-current: var(--color-primary-ink);
  --nav-link-bg-current: var(--color-primary-soft);
  --nav-link-padding: 7px var(--space-3);
  --nav-link-radius: var(--radius-md);
  --tag-padding: 3px var(--space-2);

  /* card and KPI tiles */
  --card-bg: var(--color-surface);
  --card-border: var(--color-border);
  --card-radius: var(--radius-md);
  --card-padding: var(--space-4-5);
  --card-gap: var(--space-4);
  --kpi-padding: var(--space-3-5) var(--space-4);
  --kpi-value-font: var(--weight-semibold) var(--text-2xl)/var(--leading-tight) var(--font-mono);
  --kpi-min-width: 170px;

  /* headings and labels */
  --heading-font: var(--weight-semibold) var(--text-lg)/var(--leading-tight) var(--font-sans);
  --label-font: var(--weight-semibold) var(--text-2xs)/var(--leading-label) var(--font-sans);
  --label-fg: var(--color-fg-muted);

  /* table */
  --table-font: var(--weight-medium) var(--text-md) var(--font-sans);
  --table-cell-padding: 9px var(--space-2-5);
  --table-head-padding: 0 var(--space-2-5) var(--space-2-5);
  --table-border: var(--color-border);
  --table-row-bg-hover: var(--color-surface-sunken);

  /* inputs */
  --input-bg: var(--color-bg);
  --input-fg: var(--color-fg);
  --input-border: var(--color-border);
  --input-border-hover: var(--color-border-strong);
  --input-border-focus: var(--color-ring);
  --input-radius: var(--radius-md);
  --input-padding: 9px var(--space-2-5);
  --input-font: var(--weight-medium) var(--text-base) var(--font-sans);

  /* buttons: primary (filled) and ghost (the link-looking ones) */
  --button-bg: var(--color-primary);
  --button-bg-hover: var(--color-primary-hover);
  --button-bg-active: var(--color-primary-active);
  --button-fg: var(--color-on-primary);
  --button-radius: var(--radius-md);
  --button-padding: 11px var(--space-4-5);
  --button-font: var(--weight-semibold) var(--text-base) var(--font-sans);
  --button-ghost-fg: var(--nav-link-fg);
  --button-ghost-fg-hover: var(--nav-link-fg-hover);
  --button-ghost-bg-hover: var(--nav-link-bg-hover);

  /* bookmaker logo next to its name; a light tile so a logo on a transparent ground
     (Stoiximan's blue S) reads on the dark theme too */
  --book-logo-size: 18px;
  --book-logo-radius: 4px;
  --book-logo-bg: var(--white);
  --book-gap: var(--space-1-5);

  /* calendar of daily profit */
  --cal-gap: var(--space-1-5);
  --cal-cell-height: 76px;
  --cal-cell-height-sm: 54px;
  --cal-cell-radius: var(--radius-md);
  --cal-cell-padding: var(--space-2);
  --cal-up-bg: var(--color-positive-soft);
  --cal-up-fg: var(--color-positive);
  --cal-down-bg: var(--color-negative-soft);
  --cal-down-fg: var(--color-negative);
  --cal-flat-bg: var(--color-surface-sunken);
  --cal-empty-fg: var(--color-fg-muted);
  --cal-ring: var(--color-primary-ink);
  --cal-amount-font: var(--weight-semibold) var(--text-base)/var(--leading-tight) var(--font-mono);
  --cal-amount-font-sm: var(--weight-semibold) var(--text-2xs)/var(--leading-tight) var(--font-mono);
  --cal-title-font: var(--weight-semibold) var(--text-2xl)/var(--leading-tight) var(--font-sans);

  /* page numbers under a list */
  --pager-size: 34px;
  --pager-fg: var(--color-fg-muted);
  --pager-fg-hover: var(--color-fg);
  --pager-bg-hover: var(--color-surface-sunken);
  --pager-fg-current: var(--color-on-primary);
  --pager-bg-current: var(--color-primary);

  /* side menu */
  --side-width: 228px;
  --side-bg: var(--color-surface-sunken);
  --side-link-padding: var(--space-2-5) var(--space-3);

  /* icon button (theme toggle) */
  --icon-button-size: 36px;
  --menu-shadow: var(--shadow-lg);  /* the dropped-down menu over the page */
  --icon-size: 18px;

  /* focus ring, on every interactive element */
  --focus-ring: 0 0 0 var(--ring-offset) var(--color-bg),
                0 0 0 calc(var(--ring-offset) + var(--ring-width)) var(--color-ring);

  /* badges: a word of status next to a figure */
  --badge-font: var(--weight-semibold) var(--text-2xs)/var(--leading-label) var(--font-sans);
  --badge-padding: 1px var(--space-2);
  --badge-radius: var(--radius-pill);
  --badge-neutral-bg: var(--color-border);  /* stays visible on a hovered row (surface-sunken) */
  --badge-neutral-fg: var(--color-fg-muted);
  --badge-positive-bg: var(--color-positive-soft);
  --badge-positive-fg: var(--color-positive);
  --badge-negative-bg: var(--color-negative-soft);
  --badge-negative-fg: var(--color-negative);
  --badge-accent-bg: var(--color-primary-soft);
  --badge-accent-fg: var(--color-primary-ink);

  /* alerts (login error) */
  --alert-error-bg: var(--color-negative-soft);
  --alert-error-fg: var(--color-negative);
  --alert-padding: 9px var(--space-3);

  /* profit chart */
  --chart-line: var(--color-positive);
  --chart-line-width: 2.5;
  --chart-area: var(--color-positive-soft);
  --chart-zero: var(--color-border-strong);
  --chart-exp: var(--color-fg-muted);            /* the profit the EV promised: dashed */
  --chart-band: var(--color-primary-soft);       /* the band luck alone keeps the profit in */
  --chart-height: 240px;
  --chart-label-height: 18px;
  --chart-label-space: 22px;
  --chart-label-font: var(--weight-medium) var(--text-2xs) var(--font-mono);
}
