/* Apollo Fire Command — Design System Stylesheet */
/* Authoritative Visual Specification: DESIGN.md */

:root {
  --surface: #000000;
  --surface-low: #0a0a0a;
  --surface-container: #0e0e0e;
  --surface-high: #151515;
  --surface-highest: #222222;
  --outline: #222222;
  --outline-variant: #1a1a1a;
  --outline-hover: #333333;
  --on-surface: #e5e5e5;
  --on-surface-muted: #888888;
  --on-surface-subtle: #555555;
  --primary: #4ade80;
  --secondary: #fb923c;
  --caution: #fbbf24;
  --hazard: #ef4444;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Base Terminal Resets */
*, *::before, *::after {
  box-sizing: border-box;
  border-radius: 0px !important; /* Strict 0px border radius across all elements */
}

/* Hide default spin-buttons across all number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

html {
  margin: 0;
  padding: 0;
  background-color: #000000;
  font-size: 18.5px; /* Clean 125% responsive UI scaling without breaking SVG/Canvas mouse coordinates */
}

@media (max-width: 1280px) {
  html {
    font-size: 17px;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  margin: 0;
  padding: 0;
  background-color: transparent !important;
  color: var(--on-surface);
  font-family: var(--font-mono);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::-webkit-scrollbar-track {
  background: #000000;
}

::-webkit-scrollbar-thumb {
  background: #222222;
}

::-webkit-scrollbar-thumb:hover {
  background: #333333;
}

/* Input & Select Styling - High Specificity Dark Theme Overrides */
input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
input:not([type]),
select,
textarea {
  font-family: var(--font-mono) !important;
  background-color: #0e0e0e !important;
  border: 1px solid #262626 !important;
  color: #e5e5e5 !important;
  font-size: 13px !important;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input:not([type]):focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  background-color: #151515 !important;
  color: #ffffff !important;
  outline: none !important;
  box-shadow: 0 0 0 1px var(--primary) !important;
}

input::placeholder,
textarea::placeholder {
  color: #555555 !important;
}

select option {
  background-color: #0e0e0e !important;
  color: #e5e5e5 !important;
}

/* Range input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #1f1f1f;
  outline: none;
  border: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--primary);
  cursor: pointer;
  border: 1px solid #000000;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--primary);
  cursor: pointer;
  border: 1px solid #000000;
}

/* Navigation Link Styling & Active State Management */
.nav-link {
  color: #737373 !important;
  background-color: transparent !important;
  border: 1px solid transparent !important;
  font-weight: 500;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  color: #e5e5e5 !important;
  border-color: #333333 !important;
  background-color: #0a0a0a !important;
}

.nav-link.active {
  background-color: #151515 !important;
  border-color: #262626 !important;
  color: var(--primary) !important;
  font-weight: 600 !important;
}

.nav-link .nav-indicator {
  background-color: transparent !important;
  transition: background-color 0.15s ease;
}

.nav-link.active .nav-indicator {
  background-color: var(--primary) !important;
}

/* Section transitions & subtle animations */
section {
  animation: sectionEntrance 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sectionEntrance {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

button, a {
  transition: all 0.15s ease-in-out;
}

details[open] summary ~ * {
  animation: detailsExpand 0.2s ease-out;
}

@keyframes detailsExpand {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Details & Summary */
details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

/* Notification Toast */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.apollo-toast {
  pointer-events: auto;
  background-color: #0a0a0a;
  border: 1px solid #262626;
  border-left: 3px solid var(--primary);
  padding: 10px 16px;
  color: #e5e5e5;
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.2s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Data Table Action Column No-Wrap Enforcement */
table th:last-child,
table td:last-child {
  white-space: nowrap !important;
  min-width: 90px;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* RETRO-FUTURISTIC AEROSPACE MOTION DESIGN SYSTEM                         */
/* ═══════════════════════════════════════════════════════════════════════ */

/* 1. Dynamic Mouse Tracking Glow */
.glow-surface {
  position: relative;
  overflow: hidden;
}

.glow-surface::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    500px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(74, 222, 128, 0.055),
    rgba(255, 255, 255, 0.012) 35%,
    transparent 70%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 1;
}

.glow-surface:hover::before {
  opacity: 1;
}

.glow-surface > * {
  position: relative;
  z-index: 2;
}

/* 2. Initial Load Sequence (Border Drawing & Dark Fade-in) */
@keyframes terminalPanelEnter {
  0% {
    opacity: 0;
    border-color: rgba(74, 222, 128, 0.35);
    background-color: transparent;
    transform: translateY(2px);
  }
  30% {
    opacity: 0.65;
    border-color: #333333;
    background-color: transparent;
  }
  65% {
    opacity: 0.88;
    border-color: #222222;
    background-color: rgba(14, 14, 14, 0.45);
  }
  100% {
    opacity: 1;
    border-color: #222222;
    background-color: inherit;
    transform: translateY(0);
  }
}

.terminal-panel-enter {
  animation: terminalPanelEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. Bracket Button Dynamics */
.bracket-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: #737373;
  transition: letter-spacing 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
  user-select: none;
}

.bracket-btn:hover {
  letter-spacing: 0.13em !important;
  color: var(--primary) !important;
}

/* 4. Primary CTA Inversion with Micro-Flash Feedback (<100ms) */
.primary-cta-haptic {
  position: relative;
  background-color: var(--primary) !important;
  color: #000000 !important;
  border: 1px solid var(--primary) !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: background-color 70ms ease, color 70ms ease, border-color 70ms ease, box-shadow 70ms ease, transform 50ms ease !important;
}

.primary-cta-haptic:hover {
  background-color: #000000 !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: inset 0 0 16px rgba(74, 222, 128, 0.25), 0 0 8px rgba(74, 222, 128, 0.25) !important;
}

.primary-cta-haptic:active {
  transform: scale(0.99);
  background-color: var(--primary) !important;
  color: #000000 !important;
}

/* 5. Hazard Breathing Pulse (~4.5s period) */
@keyframes hazardBreatheYellow {
  0%, 100% {
    opacity: 1;
    border-color: rgba(251, 191, 36, 0.6);
    background-color: rgba(13, 11, 4, 0.95);
  }
  50% {
    opacity: 0.65;
    border-color: rgba(251, 191, 36, 0.25);
    background-color: rgba(13, 11, 4, 0.5);
  }
}

@keyframes hazardBreatheRed {
  0%, 100% {
    opacity: 1;
    border-color: rgba(239, 68, 68, 0.7);
    background-color: rgba(26, 5, 5, 0.95);
  }
  50% {
    opacity: 0.65;
    border-color: rgba(239, 68, 68, 0.25);
    background-color: rgba(26, 5, 5, 0.5);
  }
}

.hazard-pulse-yellow {
  animation: hazardBreatheYellow 4.5s ease-in-out infinite !important;
}

.hazard-pulse-red {
  animation: hazardBreatheRed 4.5s ease-in-out infinite !important;
}

/* 7. CRT Horizontal Sweep Scanline */
@keyframes scanlineSweep {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  15% {
    opacity: 0.16;
  }
  85% {
    opacity: 0.16;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

.crt-scanline {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: linear-gradient(180deg, transparent, rgba(74, 222, 128, 0.22), transparent);
  pointer-events: none;
  z-index: 9999;
  animation: scanlineSweep 8.5s linear infinite;
}

/* 8. Card Tactile Hover Elevation & Glow */
.glow-surface {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease, box-shadow 0.22s ease !important;
}

.glow-surface:hover {
  border-color: #383838 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 16px rgba(74, 222, 128, 0.08) !important;
  transform: translateY(-2px);
}

/* 10. Smooth Section Glitch & Tab Entrance */
section {
  animation: sectionGlitchEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sectionGlitchEnter {
  0% {
    opacity: 0;
    transform: translateY(6px);
    filter: brightness(1.25);
  }
  60% {
    opacity: 0.95;
    transform: translateY(0);
    filter: brightness(1.06);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: brightness(1);
  }
}

/* 11. Button Active Micro-Press Feedback */
button:active,
.bracket-btn:active {
  transform: scale(0.97) !important;
}

/* 12. Input & Dropdown Interactive Focus Glow */
input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  background-color: #141414 !important;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.28), inset 0 0 6px rgba(74, 222, 128, 0.08) !important;
  transition: all 0.18s ease-in-out !important;
}

/* 13. Data Table Row Scanning Highlight */
table tbody tr {
  transition: background-color 0.16s ease, box-shadow 0.16s ease !important;
}

table tbody tr:hover {
  background-color: #121212 !important;
  box-shadow: inset 3px 0 0 var(--primary) !important;
}

/* 14. Drilldown Modal Teleport Expand */
#drilldownModal > div {
  animation: modalTerminalIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalTerminalIn {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 15. Telemetry Gauge Bar Transition */
.hud-gauge-bar {
  transition: width 0.85s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* 16. BACKGROUND SHADER, TRANSLUCENT TOP BAR & 3D WORLD GLOBE             */
/* ═══════════════════════════════════════════════════════════════════════ */

/* Background Triangle Mesh WebGL Canvas (Calibrated Dimmer Shading) */
#bg-shader-canvas {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 0 !important;
  pointer-events: none !important;
  opacity: 0.88 !important;
}

/* Semi-Transparent Top Header ("the top bar should be somewhat transparent and all the objects of the website should be behind it") */
header, #topHeader {
  background-color: rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid rgba(34, 34, 34, 0.75) !important;
  z-index: 50 !important;
}

/* Persistent Navigation Sidebar Translucency */
aside#appSidebar {
  background-color: rgba(6, 6, 6, 0.72) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-right: 1px solid rgba(34, 34, 34, 0.75) !important;
  z-index: 40 !important;
}

/* Main Workspace Content (flows behind the top bar when scrolled) */
main {
  background-color: transparent !important;
  position: relative !important;
  z-index: 10 !important;
}

/* Translucent Dark Theme Panels letting the mesh shine through subtle gaps & backplanes */
.glow-surface {
  background-color: rgba(14, 14, 14, 0.82) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* 17. PROFESSIONAL PRINT & PDF EXPORT STYLESHEET                          */
/* ═══════════════════════════════════════════════════════════════════════ */

@page {
  size: A4 auto;
  margin: 10mm 12mm 10mm 12mm;
}

@media print {
  /* 1. Global Reset & Print Base */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #111111 !important;
    font-size: 8.5pt !important;
    line-height: 1.35 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
    overflow: visible !important;
  }

  /* 2. Hide Non-Print Elements */
  header,
  #topHeader,
  aside,
  #appSidebar,
  #sidebarBackdrop,
  #bg-shader-canvas,
  .crt-scanline,
  #formSection,
  #loadingIndicator,
  #toastContainer,
  #drilldownModal,
  button,
  .no-print,
  .no-print-area,
  input[type="range"],
  .bracket-btn {
    display: none !important;
  }

  /* 3. Remove Navigation Layout Offsets */
  .flex {
    display: block !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    min-height: 0 !important;
  }

  main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }

  .max-w-7xl {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 4. Ensure Clean Section Visibility */
  section {
    display: block !important;
    animation: none !important;
    transform: none !important;
    overflow: visible !important;
    height: auto !important;
  }

  section.hidden {
    display: none !important;
  }

  /* 5. STRICT BREAK-INSIDE RULES: PREVENT SLICING IN HALF */
  #resultsSection,
  #assessmentReportContainer,
  #reportSectionsContainer {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .grid,
  .grid > *,
  .glow-surface,
  .border,
  [class*="border-"],
  article,
  fieldset,
  figure,
  table,
  tr,
  .js-plotly-plot,
  .plotly,
  #hudCardsContainer,
  #hudCardsContainer > *,
  details {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* 6. Typography & Page Break Hygiene */
  h1, h2, h3, h4, h5, h6 {
    color: #000000 !important;
    font-weight: 700 !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
    text-shadow: none !important;
  }

  p, span, div, li, td, th {
    color: #1a1a1a !important;
    text-shadow: none !important;
  }

  /* 7. High-Contrast Surface Inversion for Paper */
  .bg-black,
  .bg-[#000000],
  .bg-[#050505],
  .bg-[#080808],
  .bg-[#0a0a0a],
  .bg-[#0e0e0e],
  .bg-[#151515],
  .bg-[#222222],
  [class*="bg-"] {
    background-color: #ffffff !important;
    background: #ffffff !important;
  }

  /* Crisp hairline borders */
  .border,
  [class*="border-"],
  .glow-surface {
    border: 1px solid #999999 !important;
    box-shadow: none !important;
    background-color: #ffffff !important;
    color: #111111 !important;
  }

  /* Warning Banners in Print */
  .border-[#fbbf24], .border-amber-500, .border-yellow-500 {
    border: 1.5px solid #b45309 !important;
    background-color: #fffbeb !important;
  }

  .border-[#ef4444], .border-red-500 {
    border: 1.5px solid #b91c1c !important;
    background-color: #fef2f2 !important;
  }

  /* High-Contrast Signal Colors on Paper */
  .text-[#4ade80],
  .text-primary,
  [class*="text-[#4ade80]"] {
    color: #15803d !important;
    font-weight: 700 !important;
  }

  .text-[#fb923c],
  .text-[#fbbf24] {
    color: #b45309 !important;
    font-weight: 700 !important;
  }

  .text-[#ef4444] {
    color: #b91c1c !important;
    font-weight: 700 !important;
  }

  .text-[#737373],
  .text-[#888888],
  .text-[#555555],
  .text-[#a3a3a3] {
    color: #333333 !important;
  }

  /* 8. Telemetry HUD Cards Grid in Print */
  .grid-cols-1,
  .grid-cols-2,
  .md\:grid-cols-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .grid > div {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    min-height: auto !important;
    height: auto !important;
    padding: 10px 14px !important;
    border: 1px solid #777777 !important;
    background-color: #ffffff !important;
  }

  /* 9. Data Tables in Print */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    margin-top: 8px !important;
  }

  thead {
    display: table-header-group !important;
  }

  tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  th, td {
    border: 1px solid #cccccc !important;
    padding: 5px 8px !important;
    font-size: 8pt !important;
    color: #000000 !important;
    background-color: #ffffff !important;
  }

  th {
    background-color: #f3f4f6 !important;
    font-weight: 700 !important;
  }

  /* 10. Plotly Visualizations in Print */
  .js-plotly-plot,
  .plotly {
    max-width: 100% !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}
