@tailwind base;
@tailwind components;
@tailwind utilities;

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

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #000;
  color: #f5f5f5;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: theme('colors.neutral.700'); border-radius: 9999px; }

/* Flight sidebar scrollbar — always visible, accent colored */
.flight-sidebar { scrollbar-width: thin; scrollbar-color: theme('colors.neutral.600') theme('colors.neutral.900'); }
.flight-sidebar::-webkit-scrollbar { width: 6px; }
.flight-sidebar::-webkit-scrollbar-track { background: theme('colors.neutral.900'); border-radius: 9999px; }
.flight-sidebar::-webkit-scrollbar-thumb { background: theme('colors.neutral.600'); border-radius: 9999px; }
.flight-sidebar::-webkit-scrollbar-thumb:hover { background: theme('colors.neutral.500'); }

/* ─── Panel ──────────────────────────────────────────────── */
.panel {
  background: theme('colors.m3-surface');
  border: 1px solid theme('colors.border-1');
  box-shadow: theme('boxShadow.panel');
  border-radius: theme('borderRadius.panel');
}

.panel-flat {
  background: theme('colors.m3-surface');
  border: 1px solid theme('colors.border-1');
  box-shadow: none;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid theme('colors.border-2');
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Label ──────────────────────────────────────────────── */
.label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: theme('colors.m3-on-surface-variant');
}

/* ─── Mono ───────────────────────────────────────────────── */
.mono { font-family: 'Space Mono', monospace; }

/* ─── Toggle Switch ──────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: theme('colors.m3-surface-container-high');
  border: 1px solid theme('colors.m3-outline');
  border-radius: 9999px;
  transition: all 0.2s ease;
}
.toggle-thumb {
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: theme('colors.m3-on-surface-variant');
  border-radius: 50%;
  transition: all 0.2s ease;
}
.toggle input:checked ~ .toggle-track {
  background: theme('colors.m3-primary');
  border-color: theme('colors.m3-primary');
}
.toggle input:checked ~ .toggle-thumb {
  left: 21px;
  background: theme('colors.m3-surface');
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ─── Status dot ─────────────────────────────────────────── */
.dot-live {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: theme('colors.blue');
  box-shadow: 0 0 6px rgba(226,232,240,0.5);
  animation: pulse-slow 3s ease-in-out infinite;
  flex-shrink: 0;
}
.dot-delayed {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: theme('colors.amber');
  flex-shrink: 0;
}
.dot-offline {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: theme('colors.surface-4');
  flex-shrink: 0;
}

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── Divider ────────────────────────────────────────────── */
.divider { height: 1px; background: theme('colors.border-2'); }

/* ─── Map grid ───────────────────────────────────────────── */
.map-grid {
  background-image:
    linear-gradient(rgba(226,232,240,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226,232,240,0.015) 1px, transparent 1px);
  background-size: 52px 52px;
}

.globe-stage {
  position: relative;
  background: #000;
}

/* ─── Classification badge ───────────────────────────────── */
.badge-ts {
  background: theme('colors.surface-2');
  border: 1px solid theme('colors.border-1');
  color: theme('colors.m3-primary');
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 4px 10px;
  border-radius: theme('borderRadius.tag');
}

/* ─── Tag ────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: theme('borderRadius.tag');
  background: theme('colors.m3-surface-container');
  border: 1px solid theme('colors.m3-outline-variant');
  color: theme('colors.m3-on-surface-variant');
  white-space: nowrap;
}

/* ─── Fade-up ────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fade-up 0.25s ease-out; }

/* recon running-state motion */
@keyframes recon-sweep {
  0% { transform: translateX(-120%); opacity: 0; }
  18% { opacity: 0.75; }
  72% { opacity: 0.45; }
  100% { transform: translateX(320%); opacity: 0; }
}

@keyframes recon-packet {
  0%, 100% { border-color: rgba(255,255,255,0.06); color: rgb(168,162,158); transform: translateY(0); }
  38% { border-color: rgba(34,211,238,0.34); color: rgb(207,250,254); transform: translateY(-1px); }
  72% { border-color: rgba(16,185,129,0.24); color: rgb(167,243,208); }
}

@keyframes recon-lock {
  0%, 100% { opacity: 0.72; text-shadow: 0 0 0 rgba(52,211,153,0); }
  50% { opacity: 1; text-shadow: 0 0 12px rgba(52,211,153,0.65); }
}

@keyframes recon-grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 32px 18px, -28px 24px; }
}

.recon-search-active {
  border-color: rgba(34,211,238,0.24) !important;
  box-shadow: 0 24px 90px rgba(0,0,0,0.72), 0 0 42px rgba(8,145,178,0.13) !important;
}

.recon-search-active::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(34,211,238,0.08), transparent),
    repeating-linear-gradient(0deg, rgba(45,212,191,0.035) 0 1px, transparent 1px 7px);
  mix-blend-mode: screen;
  animation: recon-sweep 2.35s ease-in-out infinite;
}

.recon-live-grid {
  overflow: hidden;
  background-image:
    linear-gradient(rgba(34,211,238,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,185,129,0.04) 1px, transparent 1px);
  background-size: 32px 18px, 28px 24px;
  animation: recon-grid-drift 7s linear infinite;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.85), transparent 92%);
}

.recon-live-grid::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -35%;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgba(103,232,249,0.16), rgba(167,243,208,0.08), transparent);
  animation: recon-sweep 2.1s ease-in-out infinite;
}

.recon-progress-beam {
  min-width: 12px;
  background: linear-gradient(90deg, #0891b2, #22d3ee 48%, #34d399);
  box-shadow: 0 0 16px rgba(34,211,238,0.45), inset 0 0 8px rgba(255,255,255,0.25);
  animation: recon-lock 1.45s ease-in-out infinite;
}

.recon-lock {
  animation: recon-lock 1.1s ease-in-out infinite;
}

.recon-packet-lane {
  position: relative;
  overflow: hidden;
  animation: recon-packet 1.65s ease-in-out infinite;
}

.recon-packet-lane::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 -45%;
  width: 38%;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,0.18), transparent);
  animation: recon-sweep 1.55s ease-in-out infinite;
}

.recon-live-stat {
  box-shadow: inset 0 0 18px rgba(34,211,238,0.035);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.recon-fetch-active {
  background: linear-gradient(90deg, rgba(8,145,178,0.08), transparent 58%);
}

@media (prefers-reduced-motion: reduce) {
  .recon-search-active::before,
  .recon-live-grid,
  .recon-live-grid::after,
  .recon-progress-beam,
  .recon-lock,
  .recon-packet-lane,
  .recon-packet-lane::before {
    animation: none !important;
  }
}

/* utility safeguards for fixed tactical overlays */
.pointer-events-none { pointer-events: none !important; }
.pointer-events-auto { pointer-events: auto !important; }
.z-0 { z-index: 0 !important; }
.z-10 { z-index: 10 !important; }
.z-20 { z-index: 20 !important; }
.z-30 { z-index: 30 !important; }
.z-40 { z-index: 40 !important; }
.z-50 { z-index: 50 !important; }

/* ─── Cesium Overrides ───────────────────────────────────── */
.cesium-widget-credits {
  display: none !important;
}
