/*
 * TropicalInfo Design System — Tokens
 * ====================================
 * Source of truth for colors, spacing, typography, and shadows used by the
 * redesigned UI. Page-specific stylesheets (app-shell.css, reader.css)
 * reference these tokens; never hardcode color values in those files.
 *
 * Tokens follow a "semantic name → raw value" pattern so we can re-skin
 * (e.g., switch to a light mode) by changing this file alone.
 */

:root {
  /* --- Surface / background colors (dark theme baseline) --- */
  --bg:           #0d1117;   /* page background */
  --surface-1:    #161b22;   /* cards, top bar, rail */
  --surface-2:    #1c2230;   /* hover state, slightly raised */
  --surface-3:    #232a39;   /* pressed / active surface */

  /* --- Borders --- */
  --border:       #30363d;   /* primary borders (dividers, card edges) */
  --border-soft:  #21262d;   /* subtle dividers within cards */

  /* --- Text --- */
  --text:         #e6edf3;   /* primary text */
  --text-2:       #9da7b3;   /* secondary / muted text */
  --text-muted:   #6e7681;   /* most muted: labels, hints */

  /* --- Brand / accent --- */
  --accent:       #2f81f7;   /* primary brand accent (links, focus, active) */
  --accent-soft:  rgba(47,129,247,0.15);  /* accent background tint */

  /* --- Semantic colors --- */
  --warn:         #d29922;   /* warning yellow (caution alerts) */
  --danger:       #f85149;   /* hurricane red, error state */
  --success:      #3fb950;   /* success green */
  --purple:       #a371f7;   /* premium / pro tier */

  /* --- Typography --- */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --fs-xs:    11px;
  --fs-sm:    12px;
  --fs-base:  14px;
  --fs-md:    16px;
  --fs-lg:    18px;
  --fs-xl:    22px;
  --fs-2xl:   28px;
  --lh-tight: 1.3;
  --lh-base:  1.5;
  --lh-loose: 1.7;

  /* --- Spacing scale (4px grid) --- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;

  /* --- Border radii --- */
  --radius-sm:  4px;
  --radius:     6px;
  --radius-md:  8px;
  --radius-lg:  10px;
  --radius-xl:  12px;
  --radius-pill: 9999px;

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow:    0 2px 6px rgba(0,0,0,0.25);
  --shadow-lg: 0 6px 24px rgba(0,0,0,0.5);

  /* --- Z-layers --- */
  --z-rail:    50;
  --z-topbar:  60;
  --z-tooltip: 100;
  --z-modal:   1000;

  /* --- Layout constants --- */
  --topbar-height: 64px;     /* needs to hold the TropicalInfo wordmark legibly */
  --rail-width:    240px;    /* collapsed single-rail width (Option B from mockup review) */
  --rail-icons-height: 44px; /* horizontal strip at top of rail showing primary icons */
}

/* ---------- Base reset / element defaults ---------- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
}

img { max-width: 100%; }

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* ---------- Hurricane icon utility ---------- */
/* Behaves like an icon-font glyph: scales with font-size, inherits color. */
.hurricane-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: currentColor;
}

/* ---------- Common utility classes ---------- */

.muted { color: var(--text-muted); }
.text-2 { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }

.pill {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.pill-pro     { background: rgba(163,113,247,0.18); color: var(--purple); }
.pill-danger  { background: rgba(248,81,73,0.18);  color: var(--danger); }
.pill-warn    { background: rgba(210,153,34,0.18); color: var(--warn); }
.pill-success { background: rgba(63,185,80,0.18);  color: var(--success); }
.pill-accent  { background: var(--accent-soft);    color: var(--accent); }

.badge-cat {
  font-size: var(--fs-xs);
  padding: 3px 9px;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-cat.cat-5 { background: #7e22ce; }
.badge-cat.cat-4 { background: #dc2626; }
.badge-cat.cat-3 { background: #ea580c; }
.badge-cat.cat-2 { background: #d97706; }
.badge-cat.cat-1 { background: #ca8a04; }
.badge-cat.cat-ts { background: #0284c7; }
.badge-cat.cat-td { background: #64748b; }

/* ---------- Form controls (used by auth shell + any inline form) ---------- */

.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-bottom: var(--space-1);
  font-weight: 500;
}

.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px var(--space-3);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-family: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-help {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--fs-sm);
  color: var(--danger);
  margin-top: var(--space-1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-4);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: #4493f8; border-color: #4493f8; color: white; text-decoration: none; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-3); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.btn-block { width: 100%; }
.btn-lg { padding: 12px var(--space-5); font-size: var(--fs-md); }

/* Provider sign-in button (Google etc.) */
.btn-provider {
  background: white;
  color: #1f2937;
  border-color: var(--border);
}
.btn-provider:hover { background: #f3f4f6; color: #1f2937; text-decoration: none; }

/* Alerts (flash messages) */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: var(--fs-sm);
  border: 1px solid transparent;
}
.alert-warning { background: rgba(210,153,34,0.10); color: var(--warn); border-color: rgba(210,153,34,0.3); }
.alert-error   { background: rgba(248,81,73,0.10);  color: var(--danger); border-color: rgba(248,81,73,0.3); }
.alert-success { background: rgba(63,185,80,0.10);  color: var(--success); border-color: rgba(63,185,80,0.3); }
.alert-info    { background: var(--accent-soft);    color: var(--accent); border-color: rgba(47,129,247,0.3); }

/* Divider with center label ("or") */
.divider-or {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.divider-or::before,
.divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}
