/* ═══════════════════════════════════════════════════════════════════════════
   International Conflict Studies — Live 3D Globe Geopolitical Archive CSS
   Version 4.0 (Clean Architecture, Zero Clutter, Mobile-First Responsive)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg-dark: #070a12;
  --bg-panel: #0d1322;
  --bg-card: rgba(19, 27, 46, 0.92);
  --bg-card-hover: rgba(26, 37, 64, 0.98);
  --border: #1e293b;
  --border-subtle: rgba(148, 163, 184, 0.15);
  --border-gold: #c5a059;
  --gold: #c5a059;
  --gold-hover: #dfb66d;
  --gold-glow: rgba(197, 160, 89, 0.22);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.28);
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.25);
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, 0.25);
  --blue: #3b82f6;
  --blue-glow: rgba(59, 130, 246, 0.25);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-sans);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════════════════════════════
   1. COMMAND HEADER & REAL-TIME SEARCH / TOPIC FILTER PILLS
   ═══════════════════════════════════════════════════════════════════════════ */
.cmd-header {
  height: 64px;
  background: rgba(13, 19, 34, 0.96);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
  gap: 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.cmd-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
}

.cmd-brand img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
}

.cmd-brand span {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.cmd-badge {
  background: var(--gold-glow);
  color: var(--gold);
  border: 1px solid var(--border-gold);
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Center Command Bar: Real-time Search + Topic Pills */
.header-center {
  flex: 1;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-wrap {
  display: flex;
  align-items: center;
  background: rgba(5, 8, 17, 0.95);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  gap: 0.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-wrap:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.search-icon {
  font-size: 0.75rem;
  color: var(--text-dim);
  user-select: none;
}

#live-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  outline: none;
}

#live-search-input::placeholder {
  color: var(--text-dim);
  font-size: 0.72rem;
}

/* Topic Filter Pills */
.topic-filter-bar {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1px;
}

.topic-filter-bar::-webkit-scrollbar {
  display: none;
}

.topic-pill {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.64rem;
  font-family: var(--font-mono);
  padding: 2px 9px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topic-pill:hover {
  border-color: var(--gold);
  color: var(--text);
}

.topic-pill.active {
  background: var(--gold);
  color: var(--bg-dark);
  border-color: var(--gold);
  font-weight: 700;
  box-shadow: 0 0 10px var(--gold-glow);
}

/* Header Right Trust Nav & Status */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.header-trust-nav {
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.74rem;
}

.header-trust-nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.header-trust-nav a:hover {
  color: var(--gold);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: rgba(10, 15, 29, 0.8);
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--green);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.25); }
  100% { opacity: 0.4; transform: scale(0.9); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   2. MAIN DUAL-PANE COMMAND LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */
.cmd-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 420px 1fr;
  height: calc(100vh - 64px);
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. LEFT TELEMETRY & ACTIVE DOSSIER PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.telemetry-panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.panel-sec {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.sec-title {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Target Dossier Section */
.dossier-sec {
  background: rgba(10, 15, 29, 0.95);
  border-bottom: 1px solid rgba(197, 160, 89, 0.3);
}

.dossier-top-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  gap: 0.5rem;
}

.dossier-location {
  font-size: 0.66rem;
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dossier-cat-pill {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.beta-badge {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.level-crit { background: var(--red-glow); color: var(--red); border: 1px solid var(--red); }
.level-elev { background: rgba(245, 158, 11, 0.2); color: var(--amber); border: 1px solid var(--amber); }
.level-guard { background: rgba(16, 185, 129, 0.2); color: var(--green); border: 1px solid var(--green); }

.dossier-headline {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 0.45rem;
}

.dossier-author-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.dossier-author-icon {
  color: var(--gold);
  font-size: 0.72rem;
}

.dossier-author-name {
  color: #e2e8f0;
  font-weight: 600;
}

.dossier-meta-sep {
  color: var(--text-dim);
}

.dossier-date-val {
  color: var(--gold);
}

.dossier-actors-box {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.55rem;
  padding: 0.35rem 0.55rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
  border: 1px solid var(--border);
  line-height: 1.4;
}

.dossier-brief-box {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.65rem;
}

.dossier-brief-label {
  font-size: 0.58rem;
  font-family: var(--font-mono);
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 0.25rem;
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
}

.dossier-brief-label:first-child {
  margin-top: 0;
}

.dossier-desc-text {
  font-size: 0.76rem;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 0.45rem;
}

.dossier-realist-text {
  font-size: 0.73rem;
  color: var(--gold);
  line-height: 1.4;
  font-style: italic;
}

.dossier-actions {
  display: flex;
  margin-top: 0.6rem;
}

.btn-read-analysis {
  flex: 1;
  text-align: center;
  background: linear-gradient(135deg, #c5a059, #dfb66d);
  color: #070a12;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.6rem 1rem;
  border-radius: 5px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.btn-read-analysis:hover {
  background: #f0c978;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(197, 160, 89, 0.4);
}

/* Strategic Hotspots & Feed Section */
.incident-feed-sec {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.incident-count-badge {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--gold);
  font-weight: 700;
}

.incidents-container {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow-y: auto;
  max-height: 380px;
}

.incident-feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.incident-feed-card:hover {
  border-color: var(--border-gold);
  background: var(--bg-card-hover);
  transform: translateX(2px);
}

.incident-feed-card.active-card {
  border-color: var(--gold);
  border-left: 3px solid var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
}

.incident-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.incident-card-loc {
  font-size: 0.62rem;
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
}

.incident-card-cat {
  font-size: 0.58rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 5px;
  border-radius: 3px;
}

.incident-card-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 0.3rem;
}

.incident-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.62rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.incident-card-author {
  color: #cbd5e1;
}

.incident-card-time {
  color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. RIGHT VISUALIZATION WORKSPACE (EXCLUSIVE 3D GLOBE MAP)
   ═══════════════════════════════════════════════════════════════════════════ */
.cmd-workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #03060c;
  overflow: hidden;
}

.globe-viewport-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #091325 0%, #03060c 100%);
  overflow: hidden;
}

.globe-canvas {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.globe-canvas:active {
  cursor: grabbing;
}

/* Floating Controls Overlays */
.controls-overlay-right {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 0.45rem;
  z-index: 20;
}

.globe-ctrl-btn {
  background: rgba(10, 15, 29, 0.9);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 6px 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  user-select: none;
  min-height: 32px;
}

.globe-ctrl-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.globe-ctrl-btn.active {
  border-color: var(--green);
  color: var(--green);
  background: rgba(16, 185, 129, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   5. GLOBE MAP STYLING & GLOWING PINS
   ═══════════════════════════════════════════════════════════════════════════ */
.globe-ocean {
  transition: fill 0.3s ease;
}

.globe-graticule {
  pointer-events: none;
}

.globe-land {
  pointer-events: none;
}

.globe-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: #e2e8f0;
  text-shadow: 0 1px 4px #000, 0 0 2px #000;
  pointer-events: none;
  user-select: none;
}

.globe-label.hub-label {
  font-size: 11px;
  font-weight: 700;
  fill: var(--gold);
}

/* Glowing Hotspot Pins */
.globe-point-group {
  cursor: pointer;
}

.globe-point-group:hover circle.globe-pin-core {
  transform: scale(1.3);
}

.globe-pin-core {
  transition: transform 0.2s ease, r 0.2s ease;
}

.globe-pulse-ring {
  transform-origin: center;
  animation: ringPulse 2.4s ease-out infinite;
}

@keyframes ringPulse {
  0% {
    r: 4px;
    opacity: 0.8;
    stroke-width: 2px;
  }
  70% {
    r: 14px;
    opacity: 0.1;
    stroke-width: 1px;
  }
  100% {
    r: 16px;
    opacity: 0;
    stroke-width: 0.5px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   6. HOVER TOOLTIP
   ═══════════════════════════════════════════════════════════════════════════ */
.graph-tooltip {
  position: fixed;
  display: none;
  width: 340px;
  background: rgba(10, 15, 29, 0.98);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  color: var(--text);
  font-family: var(--font-sans);
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.graph-tooltip.active {
  display: block;
}

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

.tip-loc {
  font-size: 0.64rem;
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 700;
}

.tip-title {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 0.45rem;
}

.tip-author-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.64rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.tip-section-label {
  font-size: 0.58rem;
  font-family: var(--font-mono);
  color: var(--gold);
  font-weight: 700;
  margin-top: 0.35rem;
  margin-bottom: 0.15rem;
}

.tip-backup-brief {
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

.tip-actors {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.tip-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
  font-size: 0.64rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* Mobile collapse toggle — hidden on desktop */
.mobile-collapse-toggle {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   7. RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tablet (769px to 1024px) ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .cmd-layout {
    grid-template-columns: 350px 1fr;
  }
  .header-trust-nav {
    display: none;
  }
}

/* ── Mobile (<= 768px: Map-First Layout) ──────────────────────────────── */
@media (max-width: 768px) {
  html, body {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .cmd-header {
    height: auto;
    padding: 0.5rem 0.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .header-left {
    justify-content: space-between;
    width: 100%;
  }

  .header-actions {
    display: none;
  }

  .header-center {
    max-width: 100%;
  }

  .search-wrap {
    padding: 0.25rem 0.5rem;
  }

  #live-search-input {
    font-size: 0.72rem;
  }

  .topic-filter-bar {
    gap: 0.25rem;
  }

  .topic-pill {
    padding: 3px 8px;
    font-size: 0.6rem;
    min-height: 26px;
  }

  .cmd-layout {
    display: flex;
    flex-direction: column-reverse;
    grid-template-columns: unset;
    height: auto;
    min-height: calc(100dvh - 90px);
    overflow: visible;
  }

  .cmd-workspace {
    height: 55vh;
    min-height: 300px;
    flex-shrink: 0;
  }

  .globe-viewport-container {
    height: 100%;
  }

  .telemetry-panel {
    height: auto;
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border);
    overflow-y: visible;
  }

  .mobile-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 34px;
    background: #0a0f1d;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    min-height: 36px;
  }

  .dossier-sec.collapsed #selected-target-content {
    display: none;
  }

  .controls-overlay-right {
    bottom: 10px;
    right: 10px;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .globe-ctrl-btn {
    padding: 6px 10px;
    font-size: 0.62rem;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .panel-sec {
    padding: 0.65rem 0.8rem;
  }

  .incidents-container {
    max-height: 240px;
  }

  .graph-tooltip {
    width: min(90vw, 300px);
  }
}

/* ── Small Phone (<= 480px) ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .cmd-workspace {
    height: 48vh;
    min-height: 260px;
  }

  .cmd-brand span {
    font-size: 0.8rem;
  }

  .cmd-badge {
    font-size: 0.55rem;
    padding: 1px 5px;
  }

  .dossier-headline {
    font-size: 0.84rem;
  }
}
