/* ═══════════════════════════════════════════════════════════════
   STRATOS TACTICAL — Design System v5.1
   Re-skin: black backgrounds, white body text, blue accent (#0C6FFF),
   IBM Plex Sans + IBM Plex Mono pairing (display/body share Sans;
   telemetry/code uses Mono). Inter retained as fallback for legacy
   inline `font-family:'Inter'` references still in templates.
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ── Backgrounds — every surface collapses to pure black (#010101).
     Map container is special-cased to background:transparent so the
     Leaflet tiles cover whatever colour sits behind them. ── */
  --bg-base:      #010101;
  --bg-surface:   #010101;
  --bg-surface-2: #010101;
  --bg-surface-3: #010101;
  --bg-overlay:   rgba(1, 1, 1, 0.94);
  --bg-glass:     rgba(1, 1, 1, 0.88);

  /* ── Borders ─────────────────────────────────── */
  --border-dim:    #1a1a1a;
  --border-med:    #2e2e2e;
  --border-bright: #4a4a4a;

  /* ── Brand / Accent — amber tokens REDIRECTED to brand blue ──
     The amber family is the legacy name; values now resolve to the
     blue accent so every "amber" component (titles, dots, borders,
     active states) becomes blue without renaming every consumer. */
  --amber:         #0C6FFF;
  --amber-bright:  #2480f0;
  --amber-dim:     rgba(12, 111, 255, 0.12);
  --amber-glow:    rgba(12, 111, 255, 0.04);
  --blue:          #0C6FFF;
  --blue-bright:   #2480f0;
  --blue-dim:      rgba(12, 111, 255, 0.12);

  /* ── Legacy / compat aliases ─────────────────── */
  --brand-primary:  #0C6FFF;
  --brand-accent:   #0C6FFF;
  --tac-accent:     #0C6FFF;
  --tac-border:     #2e2e2e;
  --tac-surface:    #010101;

  /* ── Text — all body / heading text resolves to pure white ── */
  --text-primary:   #FFFFFF;
  --text-pri:       #FFFFFF;
  --text-secondary: #FFFFFF;
  --text-sec:       #FFFFFF;
  --text-tertiary:  #FFFFFF;
  --text-ter:       #FFFFFF;
  --text-accent:    #0C6FFF;
  --text-white:     #FFFFFF;

  /* ── Status ──────────────────────────────────── */
  --color-success: #00cc66;
  --color-warning: #0C6FFF;
  --color-danger:  #d83030;
  --color-info:    #0C6FFF;

  /* ── Typography — IBM Plex system (display/body share Plex Sans; mono uses
     Plex Mono for telemetry, coordinates, log streams). Plex pairing is
     designed by the same team so metrics align across the two families. ── */
  --font-display: 'IBM Plex Sans', 'Inter', sans-serif;
  --font-body:    'IBM Plex Sans', 'Inter', sans-serif;
  --font-mono:    'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace;
  --font-sans:    'IBM Plex Sans', 'Inter', sans-serif;

  /* ── Font sizes ──────────────────────────────── */
  --fs-xxs:  0.60rem;
  --fs-xs:   0.70rem;
  --fs-sm:   0.82rem;
  --fs-base: 0.95rem;
  --fs-md:   1.05rem;
  --fs-lg:   1.3rem;
  --fs-xl:   1.6rem;
  --fs-2xl:  2.1rem;

  /* ── Font weights ────────────────────────────── */
  --fw-light:    300;
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* ── Spacing ─────────────────────────────────── */
  --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;

  /* ── Layout ──────────────────────────────────── */
  --sidebar-width:     248px;
  --sidebar-collapsed:  56px;
  --topbar-height:      44px;
  --content-max:      1440px;

  /* ── Shape — zero radius for military aesthetic ── */
  --radius:    0px;
  --radius-sm: 0px;
  --radius-lg: 0px;

  /* ── Shadows ─────────────────────────────────── */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.6);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.7);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.8);

  /* ── Transitions ─────────────────────────────── */
  --transition-fast: 110ms ease;
  --transition-med:  220ms ease;
  --transition-slow: 380ms ease;

  /* ── Z-index ─────────────────────────────────── */
  --z-dropdown: 1000;
  --z-sticky:   1100;
  --z-overlay:  1200;
  --z-modal:    1300;
  --z-tooltip:  9000;

  /* ── Form inputs — black bg, white text ── */
  --input-bg:          #010101;
  --input-bg-focus:    #010101;
  --input-border:      #2e2e2e;
  --input-border-hover:#4a4a4a;
  --input-text:        #FFFFFF;
  --input-placeholder: rgba(255,255,255,0.45);
  --input-min-height:  36px;

  /* ── Status backgrounds (alerts, badges, buttons) ── */
  --success-bg:        rgba(0,204,102,0.10);
  --success-bg-strong: rgba(0,204,102,0.18);
  --success-border:    rgba(0,204,102,0.45);
  --danger-bg:         rgba(216,48,48,0.10);
  --danger-bg-strong:  rgba(216,48,48,0.18);
  --danger-border:     rgba(216,48,48,0.45);
  --warning-bg:        rgba(12,111,255,0.10);
  --warning-bg-strong: rgba(12,111,255,0.18);
  --warning-border:    rgba(12,111,255,0.45);
  --info-bg:           rgba(36,128,240,0.10);
  --info-bg-strong:    rgba(36,128,240,0.18);
  --info-border:       rgba(36,128,240,0.45);

  /* ── Overlays & map ──────────────────────────── */
  --overlay-dark:      rgba(5,10,20,0.88);
  --map-bg:            rgba(14,26,44,0.94);
  --map-bg-strong:     rgba(14,26,44,0.98);
  --table-hover:       rgba(232,160,48,0.08);

  /* ── Component-specific overrides ────────────── */
  --btn-primary-fg:    #010101;
  --select-arrow:      %234a6080;

  /* ── Theme-scoped surfaces used by chrome (sidebar border,
     edge tabs, mobile overlay) so the light theme can invert
     them without touching layout.css. ── */
  --sidebar-divider:   rgba(255, 255, 255, 0.12);
  --edge-tab-border:   rgba(255, 255, 255, 0.14);
  --sidebar-overlay:   rgba(0, 0, 0, 0.80);
}

/* ═════════════════════════ LIGHT THEME ═════════════════════════
   Activated by <html data-theme="light">. The blue accent, spacing,
   typography and radii stay identical — only surface/text/border
   tokens flip so the whole app re-skins from these overrides. ── */
[data-theme="light"] {
  --bg-base:      #f4f6f9;
  --bg-surface:   #ffffff;
  --bg-surface-2: #eef1f5;
  --bg-surface-3: #e4e8ee;
  --bg-overlay:   rgba(255, 255, 255, 0.94);
  --bg-glass:     rgba(255, 255, 255, 0.88);

  --border-dim:    #e4e7ec;
  --border-med:    #cdd2da;
  --border-bright: #9aa2ae;

  --tac-border:    #cdd2da;
  --tac-surface:   #ffffff;

  --amber-dim:     rgba(12, 111, 255, 0.10);
  --amber-glow:    rgba(12, 111, 255, 0.03);
  --blue-dim:      rgba(12, 111, 255, 0.10);

  --text-primary:   #0d1117;
  --text-pri:       #0d1117;
  --text-secondary: #3b4351;
  --text-sec:       #3b4351;
  --text-tertiary:  #6b7280;
  --text-ter:       #6b7280;
  --text-white:     #0d1117;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 24px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 8px 48px rgba(15, 23, 42, 0.14);

  --input-bg:          #ffffff;
  --input-bg-focus:    #ffffff;
  --input-border:      #cdd2da;
  --input-border-hover:#9aa2ae;
  --input-text:        #0d1117;
  --input-placeholder: rgba(13, 17, 23, 0.45);

  --overlay-dark:      rgba(240, 244, 250, 0.92);
  --map-bg:            rgba(240, 244, 250, 0.94);
  --map-bg-strong:     rgba(240, 244, 250, 0.98);
  --table-hover:       rgba(12, 111, 255, 0.06);

  --btn-primary-fg:    #ffffff;
  --select-arrow:      %236b7280;

  --sidebar-divider:   #cdd2da;
  --edge-tab-border:   #cdd2da;
  --sidebar-overlay:   rgba(15, 23, 42, 0.32);
}

/* Chrome details that use hardcoded rgba() in layout.css need a nudge
   in light mode so they don't disappear on white surfaces. */
[data-theme="light"] .sidebar         { border-right-color: var(--sidebar-divider); }
[data-theme="light"] .sidebar-edge-tab{ border-color: var(--edge-tab-border); }
[data-theme="light"] .sidebar-overlay { background: var(--sidebar-overlay); }
[data-theme="light"] .sidebar::after  { display: none; }

/* Smooth cross-fade on theme swap — restricted to <body> so we don't
   fight the sidebar's own `transition: width` (defined in layout.css)
   or add a per-hover tax to every interactive element. */
body {
  transition: background-color 220ms ease, color 220ms ease;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-base);
  color: var(--text-pri);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Tactical scrollbar */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-bright); }
::-webkit-scrollbar-thumb:hover { background: var(--amber); }

/* Headings */
h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-white);
}

a { color: var(--amber); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--amber-bright); }
p { font-family: var(--font-body); }
code,kbd,samp,pre { font-family: var(--font-mono); font-size: 0.88em; }

::selection { background: var(--amber-dim); color: var(--amber-bright); }
:focus-visible { outline: 1px solid var(--amber); outline-offset: 2px; }

input,select,textarea,button { font-family: inherit; font-size: inherit; }
img,svg { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }

/* ── KEYFRAMES ──────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}
@keyframes amberPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(232,160,48,0.35); }
  50%      { box-shadow: 0 0 0 5px rgba(232,160,48,0); }
}
@keyframes slideUpIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scanBar {
  0%   { top: 0; opacity: 0; }
  5%   { opacity: 0.4; }
  95%  { opacity: 0.4; }
  100% { top: 100%; opacity: 0; }
}

/* ── ANIMATION CLASSES ──────────────────────────────────────── */
.animate-in   { animation: fadeSlideUp 0.32s ease both; }
.animate-in-1 { animation-delay: 0.04s; }
.animate-in-2 { animation-delay: 0.08s; }
.animate-in-3 { animation-delay: 0.12s; }
.animate-in-4 { animation-delay: 0.16s; }
.animate-in-5 { animation-delay: 0.20s; }
.blink        { animation: blink 1.4s step-end infinite; }
.pulse-amber  { animation: amberPulse 2s ease-in-out infinite; }

/* ── STATUS DOTS ────────────────────────────────────────────── */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green  { background: var(--color-success); box-shadow: 0 0 5px rgba(0,204,102,0.6); }
.dot-amber  { background: var(--amber);         box-shadow: 0 0 5px rgba(232,160,48,0.6); }
.dot-red    { background: var(--color-danger);  box-shadow: 0 0 5px rgba(216,48,48,0.6); }
.dot-blue   { background: var(--blue-bright); }
.dot-dim    { background: var(--text-ter); }

/* ── TACTICAL CORNER CARD ───────────────────────────────────── */
.tac-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-med);
  padding: var(--space-5);
}
.tac-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 10px; height: 10px;
  border-top: 1px solid var(--amber);
  border-left: 1px solid var(--amber);
  opacity: 0.5;
}
.tac-card::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-bottom: 1px solid var(--amber);
  border-right: 1px solid var(--amber);
  opacity: 0.5;
}

/* ── STATUS BADGE ───────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid;
}
.status-badge.ok   { color: var(--color-success); border-color: var(--success-border); background: var(--success-bg); }
.status-badge.warn { color: var(--color-warning); border-color: var(--warning-border); background: var(--warning-bg); }
.status-badge.err  { color: var(--color-danger);  border-color: var(--danger-border);  background: var(--danger-bg); }
.status-badge.idle { color: var(--text-sec); border-color: var(--border-med); }

/* ── UTILITY CLASSES ────────────────────────────────────────── */
.text-amber   { color: var(--amber); }
.text-blue    { color: var(--blue-bright); }
.text-dim     { color: var(--text-sec); }
.text-white   { color: var(--text-white); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-upper   { text-transform: uppercase; letter-spacing: 0.1em; }
.text-mono    { font-family: var(--font-mono); }
.text-display { font-family: var(--font-display); }
.text-xs      { font-size: var(--fs-xs); }
.text-sm      { font-size: var(--fs-sm); }
.font-mono    { font-family: var(--font-mono); }
.d-flex       { display: flex; }
.items-center { align-items: center; }
.gap-2        { gap: var(--space-2); }
.gap-3        { gap: var(--space-3); }
.gap-4        { gap: var(--space-4); }
.flex-1       { flex: 1; }
.mt-auto      { margin-top: auto; }
.mb-4         { margin-bottom: var(--space-4); }
.mb-6         { margin-bottom: var(--space-6); }
.mb-8         { margin-bottom: var(--space-8); }

/* ═══════════════════════════════════════════════════════════════
   EMBEDDED — pages shown inside the public simulator's iframe modal
   (Balloon Designer). base.html sets html[data-embed="1"] + forces the
   dark theme there; these tokens swap the pure-black surfaces for the
   simulator panels' navy + blue-tinted borders so the modal reads as
   part of the same UI. Stand-alone pages are unaffected.
═══════════════════════════════════════════════════════════════ */
html[data-embed="1"] {
  --bg-base:      #0d1421;
  --bg-surface:   #101a2b;
  --bg-surface-2: #132034;
  --bg-surface-3: #17263d;
  --bg-overlay:   rgba(13, 20, 33, 0.95);
  --bg-glass:     rgba(13, 20, 33, 0.88);

  --border-dim:    rgba(96, 165, 250, 0.14);
  --border-med:    rgba(96, 165, 250, 0.28);
  --border-bright: rgba(96, 165, 250, 0.45);

  --tac-surface:   #0d1421;
  --tac-border:    rgba(96, 165, 250, 0.28);

  --input-bg:           rgba(255, 255, 255, 0.04);
  --input-bg-focus:     rgba(96, 165, 250, 0.08);
  --input-border:       rgba(96, 165, 250, 0.30);
  --input-border-hover: #60a5fa;

  --text-secondary: rgba(255, 255, 255, 0.78);
  --text-sec:       rgba(255, 255, 255, 0.78);
  --text-tertiary:  rgba(255, 255, 255, 0.55);
  --text-ter:       rgba(255, 255, 255, 0.55);
}
html[data-embed="1"] body { background: var(--bg-base); }
/* No sidebar inside the modal: drop its reserved gutter and centre the
   (max --content-max wide) page so the modal can be sized to it. */
html[data-embed="1"] .main-content { margin-left: 0; }
html[data-embed="1"] .page-content { margin: 0 auto; }
