/* airan-ntn — Styles */

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

:root {
  --bg: #0a0a1a;
  --bg-panel: #111122;
  --fg: #e0e0e0;
  --fg-muted: #8888a0;
  --accent: #00ffff;
  --accent-dim: #0088aa;
  --warn: #ffaa00;
  --danger: #cc2233;
  --ok: #008855;
  --border: #2a2a4a;
  --input-bg: #181828;
  --shadow: rgba(0, 0, 0, 0.5);
}

body {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  font-size: 12px;
  line-height: 1.4;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.subtitle {
  font-size: 10px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-left: 8px;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.hdr-phase {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
}

.hdr-phase.idle { background: #2a2a4a; color: var(--fg-muted); }
.hdr-phase.upload { background: var(--warn); color: #000; }
.hdr-phase.agg { background: var(--ok); color: #000; }
.hdr-phase.training { background: var(--accent); color: #000; }

.hdr-sep { color: var(--fg-muted); }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.header-right input[type="range"] {
  width: 80px;
}

/* Main Grid */
.main-grid {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  grid-template-rows: 1fr;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

/* Controls Panel */
.controls-panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-section {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}

.control-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.ctrl-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  cursor: pointer;
}

.ctrl-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.ctrl-row select {
  width: 100%;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  font-family: inherit;
  font-size: 11px;
}

.ctrl-row input[type="checkbox"] {
  accent-color: var(--accent);
  margin-right: 8px;
}

.ctrl-row:last-child {
  margin-bottom: 0;
}

select[multiple] {
  height: 180px;
}

/* Center Panel */
.center-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
}

#topo {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* KPI Panel */
.kpi-panel {
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kpi-section {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}

.kpi-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.kpi-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.kpi-row:last-child {
  border-bottom: none;
}

.kpi-label {
  color: var(--fg-muted);
  font-size: 11px;
}

.kpi-value {
  font-weight: 600;
  font-family: inherit;
  color: var(--accent);
  font-size: 12px;
}

#chart, #snr-bars {
  width: 100%;
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  margin-bottom: 6px;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--accent);
  color: #000;
}

.btn.primary:hover {
  background: #00dddd;
}

.btn {
  background: var(--border);
  color: var(--fg);
}

.btn:hover {
  background: #3a3a5a;
}

/* Legend */
.legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Canvas */
canvas {
  display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-muted);
}

/* Responsive */
@media (max-width: 1400px) {
  .main-grid {
    grid-template-columns: 280px 1fr 280px;
  }
}

@media (max-width: 1200px) {
  .main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .controls-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 300px;
    order: 3;
  }

  .kpi-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 300px;
    order: 2;
  }

  .center-panel {
    order: 1;
  }
}