/* ==========================================================================
   N0CVP HAM RADIO QSO EXPLORER — REFINED TACTICAL THEME
   Dark Instrument Console Aesthetic (Zero Neon Glare / No Tron Effect)
   ========================================================================== */

:root {
  --bg-deep: #07090e;
  --bg-panel: #0d121c;
  --bg-card: #131a26;
  --bg-input: #0a0d14;
  
  --border-line: rgba(255, 255, 255, 0.08);
  --border-focus: #f59e0b;
  
  --text-bright: #f8fafc;
  --text-main: #cbd5e1;
  --text-dim: #64748b;
  
  /* Tactical Radio Console Palette */
  --amber: #f59e0b;
  --gold: #fbbf24;
  --steel: #38bdf8;
  --green: #10b981;
  --crimson: #ef4444;
  
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.val-amber { color: var(--amber) !important; }
.val-gold { color: var(--gold) !important; }
.val-green { color: var(--green) !important; }
.mt-4 { margin-top: 1rem; }

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* ==========================================================================
   CONSOLE HEADER
   ========================================================================== */
.console-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.console-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tx-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green);
}

.console-call {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.04em;
}

.badge-sub {
  font-size: 0.62rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.console-qth {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.console-qth strong {
  color: var(--text-bright);
}

/* Metrics */
.console-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-line);
}

.metric-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.m-lbl {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.m-val {
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-bright);
}

.metric-sep {
  width: 1px;
  height: 18px;
  background: var(--border-line);
}

/* Header Actions */
.console-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seg-group {
  display: flex;
  background: var(--bg-input);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-line);
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.1s;
}

.seg-btn:hover {
  color: var(--text-bright);
}

.seg-btn.active {
  background: #1e293b;
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.action-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-line);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
}

.action-btn:hover {
  background: var(--bg-card);
  color: var(--text-bright);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   VIEWPORT
   ========================================================================== */
.viewport-wrapper {
  position: absolute;
  top: 56px;
  bottom: 76px;
  left: 0;
  right: 0;
  overflow: hidden;
  background: var(--bg-deep);
}

.map-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.map-view.active {
  opacity: 1;
  pointer-events: auto;
}

/* Leaflet Map */
#map-container {
  background: #080b11;
}
.leaflet-container {
  background: #080b11 !important;
}
.tactical-tooltip {
  background: rgba(13, 18, 28, 0.95) !important;
  border: 1px solid var(--amber) !important;
  color: var(--text-bright) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.72rem !important;
  padding: 6px 8px !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7) !important;
}
.tactical-tooltip::before {
  border-top-color: var(--amber) !important;
}

/* ==========================================================================
   PERMANENT ORIGIN BOX (Top Left)
   ========================================================================== */
.qth-origin-box {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(13, 18, 28, 0.92);
  border: 1px solid var(--border-line);
  border-left: 3px solid var(--amber);
  border-radius: 6px;
  padding: 8px 12px;
  z-index: 1010;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.qth-origin-hdr {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--amber);
}

.qth-origin-call {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-bright);
}

.qth-origin-loc {
  font-size: 0.72rem;
  color: var(--text-main);
}

.qth-origin-coords {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* ==========================================================================
   ROUTE & DISTANCE INSTRUMENT PANEL (Bottom Left)
   ========================================================================== */
.route-instrument-panel {
  position: absolute;
  bottom: 14px;
  left: 14px;
  width: 520px;
  max-width: calc(100vw - 420px);
  background: rgba(13, 18, 28, 0.95);
  border: 1px solid var(--border-line);
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 1010;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.7);
}

.rip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rip-title {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.rip-band-mode {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  background: #1e293b;
  color: var(--gold);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-line);
}

.rip-flow {
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-line);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.rip-station.origin {
  text-align: left;
}
.rip-station.dest {
  text-align: right;
}

.rip-role {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.rip-call {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-bright);
}

.rip-place {
  font-size: 0.7rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rip-grid {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

.rip-vector {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 8px;
}

.rip-distance-big {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.rip-km {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.rip-beam-line {
  position: relative;
  width: 100%;
  height: 2px;
  background: #334155;
  margin: 4px 0;
  overflow: hidden;
}

.rip-pulse {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 30%;
  background: var(--amber);
  animation: pulse-slide 1.6s infinite linear;
}

@keyframes pulse-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.rip-azimuth {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-main);
  font-weight: 600;
}

.rip-specs-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.spec-item {
  display: flex;
  flex-direction: column;
}

.sp-lbl {
  font-size: 0.52rem;
  font-weight: 700;
  color: var(--text-dim);
}

.sp-val {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rip-hint {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.btn-qrz-dossier {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #1e293b;
  border: 1px solid var(--border-line);
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.1s;
}

.btn-qrz-dossier:hover {
  background: var(--amber);
  color: #000;
  border-color: var(--amber);
}

/* ==========================================================================
   CONSOLE SIDEBAR
   ========================================================================== */
.console-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-line);
  z-index: 1020;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.console-sidebar.collapsed {
  transform: translateX(100%);
}

.sidebar-tab-strip {
  display: flex;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-line);
}

.sb-tab {
  flex: 1;
  padding: 10px 4px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
  text-align: center;
}

.sb-tab:hover {
  color: var(--text-bright);
}

.sb-tab.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
  background: rgba(245, 158, 11, 0.05);
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
}

.tab-view {
  display: none;
}
.tab-view.active {
  display: block;
}

.sb-section {
  margin-bottom: 1rem;
}

.sb-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.sb-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-line);
  border-radius: 4px;
  padding: 0 8px;
}

.sb-search-box:focus-within {
  border-color: var(--amber);
}

.sb-search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-bright);
  font-size: 0.8rem;
  padding: 6px 6px;
  outline: none;
  font-family: var(--font-mono);
}

.sb-search-box input::placeholder {
  color: var(--text-dim);
}

.search-count-txt {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Table */
.table-container {
  overflow-y: auto;
  max-height: calc(100vh - 270px);
  border: 1px solid var(--border-line);
  border-radius: 4px;
  background: var(--bg-input);
}

.qso-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.qso-table th {
  position: sticky;
  top: 0;
  background: #1e293b;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-line);
  letter-spacing: 0.05em;
  z-index: 10;
}

.qso-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
}

.qso-table tr {
  cursor: pointer;
  transition: background 0.1s;
}

.qso-table tr:hover {
  background: rgba(245, 158, 11, 0.12);
}

.qso-table tr.active-row {
  background: rgba(245, 158, 11, 0.22);
  outline: 1px solid rgba(245, 158, 11, 0.6);
}

.tbl-call {
  font-weight: 800;
  color: var(--text-bright);
}

.tbl-qth {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
}

.tbl-dist {
  color: var(--gold);
}

.tbl-band {
  font-size: 0.62rem;
  color: var(--text-dim);
}

/* Filter Pills */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  background: var(--bg-input);
  border: 1px solid var(--border-line);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s;
}

.pill:hover {
  background: var(--bg-card);
  color: var(--text-bright);
}

.pill.active {
  background: #1e293b;
  border-color: var(--amber);
  color: var(--amber);
}

.chk-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-main);
  margin-bottom: 6px;
  cursor: pointer;
}

.chk-label input[type="checkbox"] {
  accent-color: var(--amber);
}

.btn-clear-filters {
  width: 100%;
  padding: 6px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--crimson);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
}

.btn-clear-filters:hover {
  background: var(--crimson);
  color: #fff;
}

/* Meters & Leaderboards */
.sb-subhdr {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.meter-item {
  margin-bottom: 0.55rem;
  cursor: pointer;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  margin-bottom: 3px;
}

.meter-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--amber);
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: var(--bg-input);
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.1s;
}

.rank-row:hover {
  background: var(--bg-card);
  border-color: rgba(245, 158, 11, 0.3);
}

.rank-num {
  font-size: 0.62rem;
  color: var(--text-dim);
  width: 20px;
}

.rank-entity {
  flex: 1;
  color: var(--text-bright);
}

.rank-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold);
}

/* ==========================================================================
   CONSOLE TIMELINE (Bottom)
   ========================================================================== */
.console-timeline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 76px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-line);
  display: flex;
  flex-direction: column;
  padding: 0.45rem 1rem;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}

.timeline-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.timeline-playback {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-play-btn {
  background: var(--amber);
  border: none;
  color: #000;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s;
}

.ctrl-play-btn:hover {
  transform: scale(1.05);
}

.ctrl-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-line);
  color: var(--text-dim);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ctrl-btn:hover {
  color: var(--text-bright);
}

.speed-cluster, .pmode-cluster {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-input);
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--border-line);
}

.speed-caption {
  font-size: 0.58rem;
  color: var(--text-dim);
  margin-right: 2px;
}

.spd-btn, .pmode-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
}

.spd-btn.active, .pmode-btn.active {
  background: #1e293b;
  color: var(--amber);
}

.active-date-stamp {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

.dt-caption {
  font-size: 0.58rem;
  color: var(--text-dim);
}

.dt-value {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--gold);
}

.dt-count {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Scrubber */
.scrubber-container {
  position: relative;
  display: flex;
  flex-direction: column;
}

.histogram-layer {
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  pointer-events: none;
  opacity: 0.35;
}

.hist-bar {
  flex: 1;
  background: var(--amber);
  border-radius: 1px 1px 0 0;
}

.timeline-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.timeline-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
  transition: transform 0.1s;
}

.timeline-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.timeline-date-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-top: 2px;
}

/* Responsive */
@media (max-width: 1050px) {
  .route-instrument-panel { width: 420px; }
  .rip-specs-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .console-metrics { display: none; }
  .console-sidebar { width: 100%; }
  .route-instrument-panel { display: none; }
}
