/* AntDMA WebRadar — dark theme ported from Themes/DarkTheme.xaml. */

:root {
  /* Palette — matches the WPF app 1:1 so the two feel like the same product. */
  --bg-deep:         #070A12;
  --bg-dark:         #0B1020;
  --bg-mid:          #11182B;
  --bg-light:        #18213A;
  --surface:         #101729;
  --surface-elev:    #141D33;
  --purple-accent:   #8B5CF6;
  --purple-light:    #A78BFA;
  --purple-dim:      #5B3CB8;
  --cyan-accent:     #22D3EE;
  --green-accent:    #22C55E;
  --danger:          #F43F5E;
  --warning:         #F59E0B;
  --text-primary:    #F5F7FB;
  --text-secondary:  #A8B3CF;
  --text-muted:      #65708D;
  --border:          #26324F;
  --border-accent:   #6D4AE8;

  --panel-bg:        linear-gradient(135deg, #131B31F2 0%, #0C1222EE 100%);
  --app-bg:          linear-gradient(135deg, #070A12 0%, #0B1020 45%, #111433 100%);
  --accent-gradient: linear-gradient(135deg, #8B5CF6 0%, #22D3EE 100%);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--app-bg);
  color: var(--text-primary);
  font: 12px/1.35 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ─── Session key modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, rgba(139,92,246,0.15), transparent 60%),
              var(--app-bg);
  z-index: 100;
}
.modal-card {
  width: min(420px, 92vw);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 24px;
  box-shadow: 0 24px 44px rgba(0,0,0,0.5);
}
.modal-brand {
  text-align: center;
  margin-bottom: 8px;
}
.modal-brand .ant { color: var(--purple-light); font-size: 22px; font-weight: 900; letter-spacing: 1px; }
.modal-brand .dma { color: var(--text-primary); font-size: 22px; font-weight: 900; letter-spacing: 1px; }
.modal-brand .subtitle {
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; margin-top: 2px;
}
.modal-hint { color: var(--text-secondary); font-size: 12px; margin: 16px 0 12px; text-align: center; }
#session-form { display: flex; gap: 8px; }
#session-input {
  flex: 1;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-primary);
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}
#session-input:focus { border-color: var(--purple-light); background: var(--surface-elev); }
#session-form button {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-primary);
  padding: 10px 16px;
  font: inherit; font-weight: 600; cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
#session-form button:hover  { background: #243052; border-color: var(--purple-accent); }
#session-form button:active { background: var(--purple-dim); }
.modal-error {
  margin-top: 12px;
  color: var(--danger);
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
}

/* ─── App shell ─────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 12px 14px 14px;
  gap: 6px;
}

/* Title bar */
.titlebar {
  height: 58px;
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple-accent), var(--cyan-accent));
  border: 1px solid var(--border-accent);
  position: relative;
}
.brand .logo::after {
  content: "A";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #0B1020;
  font-weight: 900;
  font-size: 20px;
}
.wordmark { line-height: 1; }
.wordmark .ant { color: var(--purple-light); font-size: 18px; font-weight: 900; }
.wordmark .dma { color: var(--text-primary); font-size: 18px; font-weight: 900; }
.wordmark .tag { color: var(--text-muted); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; margin-top: 1px; }

.badge {
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.badge.stats { justify-self: end; }
.badge.status .dot {
  width: 8px; height: 8px; border-radius: 999px; background: var(--danger);
  transition: background 0.15s ease;
}
.badge.status.ok    .dot { background: var(--green-accent); }
.badge.status.warn  .dot { background: var(--warning); }
.badge.status.error .dot { background: var(--danger); }

.icon-btn {
  width: 36px; height: 36px;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--purple-light);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.icon-btn:hover { background: #243052; border-color: var(--purple-accent); }

/* Content: map + panel */
.content {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}
.map-frame {
  position: absolute; inset: 0;
  background: #050812;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
/* Map image sits behind the canvas and is pan/zoomed via CSS transform.
   GPU-composited by the browser, so pan/zoom cost is ~0 vs. re-rasterising a
   4k×4k image into the canvas every frame. */
.map-img {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  display: none;
}
#radar-canvas {
  position: absolute; inset: 0;
  display: block;
  width: 100%; height: 100%;
  cursor: grab;
  /* No z-index — DOM order (img before canvas) is enough to keep the canvas
     visually above the map inside .map-frame, and leaving z-index at auto
     stops the canvas from stacking above the settings panel next to it. */
}
#radar-canvas:active { cursor: grabbing; }

.local-info {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(11, 16, 32, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text-secondary);
  font-size: 11px; font-weight: 600;
  white-space: pre-line;
  pointer-events: none;
}
.zoom-info {
  position: absolute; right: 12px; bottom: 12px;
  background: rgba(11, 16, 32, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 9px;
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  pointer-events: none;
}

/* Settings panel */
.settings-panel {
  position: absolute;
  top: 12px; right: 12px; bottom: 12px;
  width: 292px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.42);
  overflow: auto;
  padding: 14px 8px 14px 14px;
  scrollbar-gutter: stable;
}
.settings-panel[hidden] { display: none; }
.panel-header { margin: 2px 0 10px; }
.panel-title { font-size: 11px; font-weight: 900; color: var(--text-primary); opacity: 0.95; }
.panel-sub   { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* GroupBox equivalent */
.group {
  background: #B8101729;
  border: 1px solid #31405F;
  border-radius: 14px;
  padding: 12px 12px 10px;
  margin: 7px 0;
}
.group-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple-light);
  margin-bottom: 8px;
}
.group-body { display: flex; flex-direction: column; gap: 5px; }

/* Checkboxes */
.check {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  padding: 3px 0;
  font-size: 12px;
  color: var(--text-primary);
  user-select: none;
}
.check input[type="checkbox"] {
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 5px;
  background: #111827;
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.12s ease, border-color 0.12s ease;
  flex: 0 0 auto;
}
.check:hover input[type="checkbox"] { border-color: var(--purple-light); background: #17213A; }
.check input[type="checkbox"]:checked {
  background: var(--accent-gradient);
  border-color: var(--purple-light);
}
.check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute; left: 4px; top: 1px;
  width: 6px; height: 11px;
  border: solid #FFFFFF;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Rows for sliders + selects */
.row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
  font-size: 12px;
}
.label-inline { color: var(--text-secondary); width: 60px; flex: 0 0 auto; }
.tail { color: var(--text-secondary); min-width: 42px; text-align: right; }

/* Selects (teammate dropdown) */
.select {
  flex: 1;
  background: #101827;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  font: inherit;
  outline: none;
  cursor: pointer;
}
.select:focus { border-color: var(--purple-light); background: #151F36; }
.select option { background: var(--bg-dark); }

/* Range sliders */
input[type="range"] {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  appearance: none;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--purple-accent);
  border: 2px solid var(--purple-light);
  cursor: pointer;
  transition: background 0.12s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { background: var(--purple-light); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--purple-accent);
  border: 2px solid var(--purple-light);
  cursor: pointer;
}

/* Legend expander */
.legend {
  margin-top: 8px;
  background: #B8101729;
  border: 1px solid #31405F;
  border-radius: 14px;
  padding: 10px 12px;
}
.legend summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--purple-light);
  list-style: none;
}
.legend summary::-webkit-details-marker { display: none; }
.legend summary::after { content: " ▸"; color: var(--text-muted); }
.legend[open] summary::after { content: " ▾"; }
.legend-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 4px 10px;
  align-items: center;
  margin-top: 8px;
  font-size: 11px;
}
.legend-grid .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.version {
  text-align: center;
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 14px;
}

/* ─── Scrollbar (matches WPF slim modern scrollbar) ─────────────────────── */
.settings-panel::-webkit-scrollbar { width: 10px; }
.settings-panel::-webkit-scrollbar-track {
  background: rgba(20, 29, 51, 0.12);
  border-radius: 5px;
}
.settings-panel::-webkit-scrollbar-thumb {
  background: #3A4869;
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.settings-panel::-webkit-scrollbar-thumb:hover  { background: var(--purple-accent); background-clip: padding-box; border: 2px solid transparent; }
.settings-panel::-webkit-scrollbar-thumb:active { background: var(--purple-light); background-clip: padding-box; border: 2px solid transparent; }
.settings-panel { scrollbar-color: #3A4869 transparent; scrollbar-width: thin; }
