/* ═══════════════════════════════════════════════════════════════
   SUPPLYDAR — Design Tokens v2.0
   src/styles/tokens.css

   Single source of truth for all design decisions.
   Import this file once at the root of your app.
   NEVER hardcode values that exist here in component files.
═══════════════════════════════════════════════════════════════ */

:root {

  /* ─────────────────────────────────────────
     TYPOGRAPHY
  ───────────────────────────────────────── */

  --font-display: 'Sora', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;

  /*
    Usage rules:
    - --font-display → all headings, wordmark, supplier names, stat values
    - --font-body    → body text, labels, UI copy, buttons
    - --font-mono    → scores, IDs, timestamps, hex values, API strings,
                       section labels (uppercase), status badges, code
  */

  /* Type scale */
  --text-xs:   11px;   /* Mono labels, metadata, version pills */
  --text-sm:   13px;   /* Secondary body, table cells, badge text */
  --text-base: 15px;   /* Primary body text */
  --text-md:   17px;   /* Emphasized body, supplier names */
  --text-lg:   21px;   /* Section intros, large labels */
  --text-xl:   28px;   /* Heading 2, stat values */
  --text-2xl:  36px;   /* Heading 1 */
  --text-3xl:  52px;   /* Display / hero */

  /* Line heights */
  --leading-tight:  1.2;
  --leading-snug:   1.4;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Letter spacing */
  --tracking-tight:  -0.03em;  /* Display headings */
  --tracking-normal: -0.01em;  /* Headings */
  --tracking-wide:    0.06em;  /* Badge text */
  --tracking-widest:  0.12em;  /* Section labels */


  /* ─────────────────────────────────────────
     COLOR — BACKGROUNDS (Dark UI)
     Layer stack: base → surface → elevated → overlay → subtle
  ───────────────────────────────────────── */

  --bg-base:     #090C10;  /* Page background, input fills */
  --bg-surface:  #0F1318;  /* Card backgrounds, panels, sidebar */
  --bg-elevated: #161C23;  /* Hover states, dropdowns, tooltips */
  --bg-overlay:  #1D2530;  /* Modals, popovers */
  --bg-subtle:   #222C38;  /* Highlighted rows, selection states */


  /* ─────────────────────────────────────────
     COLOR — BORDERS
  ───────────────────────────────────────── */

  --border-dim:     rgba(255, 255, 255, 0.05);  /* Subtle dividers */
  --border-default: rgba(255, 255, 255, 0.09);  /* Card, input borders */
  --border-strong:  rgba(255, 255, 255, 0.15);  /* Emphasized borders */
  --border-accent:  rgba(20, 184, 166, 0.30);   /* Teal hover/active borders */
  --border-blue:    rgba(37, 99, 235, 0.30);    /* Blue focused borders */


  /* ─────────────────────────────────────────
     COLOR — TEXT
  ───────────────────────────────────────── */

  --text-primary:   #F1F5F9;  /* Headings, primary content */
  --text-secondary: #8A97A8;  /* Body text, descriptions */
  --text-tertiary:  #4E5D6E;  /* Placeholders, metadata, disabled */
  --text-inverse:   #111827;  /* Text on light/teal/white backgrounds */
  --text-accent:    #5EEAD4;  /* Teal-colored text (scores, active links) */
  --text-blue:      #93C5FD;  /* Blue-colored text */


  /* ─────────────────────────────────────────
     COLOR — PRIMARY BRAND (Blue)
     Use for: primary CTAs, active nav, primary interactive elements
     NOT for: the radar/discovery icon, supplier scores, scanning states
  ───────────────────────────────────────── */

  --brand-blue-deep:   #1E40AF;  /* Logo on brand bg, deep tones */
  --brand-blue-action: #2563EB;  /* Primary buttons, primary CTA */
  --brand-blue-light:  #3B82F6;  /* Hover state for blue buttons */
  --brand-blue-wash:   rgba(37, 99, 235, 0.12);  /* Blue tint backgrounds */


  /* ─────────────────────────────────────────
     COLOR — ACCENT (Teal / Discovery)
     Use for: radar icon, supplier scores, scan/discovery states,
              validation badges, active borders on supplier cards,
              section labels, progress bars during discovery runs
     NOT for: primary CTAs (use blue), general interactive elements
  ───────────────────────────────────────── */

  --accent-deep:    #0F766E;  /* Logo mark on light bg, deep teal */
  --accent-primary: #14B8A6;  /* Core teal — blips, badge dots */
  --accent-light:   #5EEAD4;  /* Teal on dark — scores, active text */
  --accent-wash:    rgba(20, 184, 166, 0.10);  /* Very subtle teal tint */
  --accent-glow:    rgba(20, 184, 166, 0.14);  /* Badge backgrounds, card hover bg */
  --accent-border:  rgba(20, 184, 166, 0.30);  /* Badge borders, hover card borders */


  /* ─────────────────────────────────────────
     COLOR — SIGNAL / SEMANTIC
  ───────────────────────────────────────── */

  --signal-success: #059669;
  --signal-success-text: #34D399;
  --signal-success-bg:   rgba(5, 150, 105, 0.12);
  --signal-success-border: rgba(5, 150, 105, 0.25);

  --signal-warning: #D97706;
  --signal-warning-text: #FBBF24;
  --signal-warning-bg:   rgba(217, 119, 6, 0.12);
  --signal-warning-border: rgba(217, 119, 6, 0.25);

  --signal-danger: #DC2626;
  --signal-danger-text: #F87171;
  --signal-danger-bg:   rgba(220, 38, 38, 0.12);
  --signal-danger-border: rgba(220, 38, 38, 0.25);

  --signal-info: #7C3AED;
  --signal-info-text: #A78BFA;
  --signal-info-bg:   rgba(124, 58, 237, 0.12);
  --signal-info-border: rgba(124, 58, 237, 0.25);


  /* ─────────────────────────────────────────
     SPACING
     Base unit: 4px. Always use these variables.
     NEVER use arbitrary px values in components.
  ───────────────────────────────────────── */

  --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;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;


  /* ─────────────────────────────────────────
     BORDER RADIUS
  ───────────────────────────────────────── */

  --radius-sm:   3px;    /* Tags, code snippets, small chips */
  --radius-md:   6px;    /* Inputs, buttons, table cells */
  --radius-lg:   10px;   /* Cards, panels, dropdowns */
  --radius-xl:   16px;   /* Large cards, modals */
  --radius-2xl:  20px;   /* Logo cards, feature panels */
  --radius-pill: 999px;  /* Badges, status dots, toggles */


  /* ─────────────────────────────────────────
     SHADOWS
  ───────────────────────────────────────── */

  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.40);
  --shadow-md:     0 4px 16px rgba(0, 0, 0, 0.50);
  --shadow-lg:     0 8px 40px rgba(0, 0, 0, 0.60);
  --shadow-accent: 0 0 28px rgba(20, 184, 166, 0.18);  /* Teal glow on hover */
  --shadow-blue:   0 0 24px rgba(37, 99, 235, 0.22);   /* Blue glow on hover */


  /* ─────────────────────────────────────────
     MOTION
  ───────────────────────────────────────── */

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);    /* Entrances, reveals */
  --ease-in:     cubic-bezier(0.7, 0, 0.84, 0);    /* Exits, dismissals */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* Success, confirmations */

  --dur-fast:   120ms;  /* Hover states, toggles, focus rings */
  --dur-base:   220ms;  /* Panel transitions, border changes */
  --dur-slow:   400ms;  /* Page loads, modal overlays */


  /* ─────────────────────────────────────────
     LAYOUT
  ───────────────────────────────────────── */

  --sidebar-width:       220px;
  --content-max-width:   1200px;
  --page-padding-x:      var(--space-8);   /* 32px */
  --page-padding-y:      var(--space-10);  /* 40px */
  --card-padding:        var(--space-6);   /* 24px */
  --section-gap:         var(--space-12);  /* 48px between page sections */


  /* ─────────────────────────────────────────
     Z-INDEX SCALE
  ───────────────────────────────────────── */

  --z-base:    0;
  --z-raised:  10;
  --z-dropdown: 100;
  --z-sticky:  200;
  --z-overlay: 300;
  --z-modal:   400;
  --z-toast:   500;

}


/* ═══════════════════════════════════════════════════════════════
   GOOGLE FONTS IMPORT
   Add this link tag to your HTML <head> instead if preferred:

   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link href="https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap" rel="stylesheet">
═══════════════════════════════════════════════════════════════ */

/* @import removed — fonts loaded via <link> in base.html to avoid double-loading */


/* ═══════════════════════════════════════════════════════════════
   BASE RESET & DEFAULTS
═══════════════════════════════════════════════════════════════ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

/* ─── Typography defaults ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-normal);
}

h1 { font-size: var(--text-2xl); font-weight: 700; letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-xl);  font-weight: 700; }
h3 { font-size: var(--text-lg);  font-weight: 600; }
h4 { font-size: var(--text-md);  font-weight: 600; }
h5 { font-size: var(--text-base); font-weight: 500; }
h6 { font-size: var(--text-sm);  font-weight: 500; }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent-light);
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--text-primary); }

hr {
  border: none;
  border-top: 1px solid var(--border-dim);
}

/* ─── Focus visible ─── */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent-primary);
}

/* ─── Selection ─── */
::selection {
  background: var(--accent-glow);
  color: var(--text-primary);
}

/* ─── Scrollbar (webkit) ─── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }


/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   Use sparingly — prefer component-scoped styles.
   These exist for convenience in layout and one-off overrides.
═══════════════════════════════════════════════════════════════ */

/* Text colors */
.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary  { color: var(--text-tertiary) !important; }
.text-accent    { color: var(--accent-light) !important; }
.text-blue      { color: var(--text-blue) !important; }

/* Font families */
.font-display { font-family: var(--font-display) !important; }
.font-body    { font-family: var(--font-body) !important; }
.font-mono    { font-family: var(--font-mono) !important; }

/* Backgrounds */
.bg-base     { background-color: var(--bg-base) !important; }
.bg-surface  { background-color: var(--bg-surface) !important; }
.bg-elevated { background-color: var(--bg-elevated) !important; }

/* Borders */
.border-dim     { border: 1px solid var(--border-dim) !important; }
.border-default { border: 1px solid var(--border-default) !important; }
.border-accent  { border: 1px solid var(--accent-border) !important; }

/* Section label style (mono, uppercase, teal) */
.label-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--accent-primary);
}

/* Visually hidden but available to screen readers */
.u-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Discovery / scanning state helper */
.is-scanning {
  cursor: wait;
  opacity: 0.75;
  pointer-events: none;
}
