/* ========================================
   ORBIT VISUALIZER APP STYLES
   Dark theme application styles
   ======================================== */

/* ========================================
   PROPAGATOR BADGES & MODEL-HONESTY NOTES
   ======================================== */

.prop-badge {
  flex-shrink: 0;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid #3d5a80;
  border-radius: 3px;
  background: #20304a;
  color: #9cc3ff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  line-height: 14px;
  white-space: nowrap;
}

.prop-badge-error {
  border-color: #8a3d3d;
  background: #4a2020;
  color: #ff9c9c;
}

.prop-warning {
  margin: 6px 0;
  padding: 6px 8px;
  border: 1px solid #6b5a20;
  border-radius: 4px;
  background: #332b10;
  color: #e8c96a;
  font-size: 11px;
  line-height: 1.4;
}

.prop-desc {
  display: block;
  margin: 2px 0 4px;
  color: #9a9a9a;
  font-size: 11px;
  line-height: 1.4;
}

.prop-validate-link {
  display: inline-block;
  margin-bottom: 4px;
  color: #7fb3ff;
  font-size: 11px;
  text-decoration: none;
}

.prop-validate-link:hover {
  text-decoration: underline;
}


html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111;
  color: #eee;
}

body {
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  height: 100%;
  width: 100%;
}

#sidebar {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  box-sizing: border-box;
  background: #181818;
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

#sidebar-content {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar-footer {
  padding: 8px 12px;
  border-top: 1px solid #333;
  font-size: 10px;
  color: #888;
  text-align: center;
  background: #181818;
}

#sidebar h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: #fff;
  letter-spacing: -0.5px;
  text-align: center;
}

#sidebar > #sidebar-content > small:first-of-type {
  line-height: 1.4;
  opacity: 0.8;
  text-align: center;
  display: block;
  margin-bottom: 8px;
}

.section-container {
  border: 1px solid #333;
  border-radius: 4px;
  background: #1a1a1a;
  margin-top: 16px;
}

#sidebar h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid #333;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 4px 4px 0 0;
  transition: background 0.2s;
}

#sidebar h2:hover {
  background: #252525;
}

#sidebar h2::after {
  content: '▼';
  font-size: 10px;
  color: #888;
}

#sidebar h2.collapsed::after {
  content: '▶';
}

#sidebar h2.collapsed {
  border-bottom: none;
  border-radius: 4px;
}

.collapsible-content {
  overflow: visible;
  transition: max-height 0.2s ease-out;
  padding: 8px;
  background: #1a1a1a;
}

.collapsible-content.collapsed {
  max-height: 0 !important;
  padding: 0;
  overflow: hidden;
}

#sidebar label {
  display: block;
  font-size: 12px;
  margin-top: 8px;
  color: #ccc;
  font-weight: 500;
}

#sidebar label input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  cursor: pointer;
  accent-color: #0b84ff;
}

#sidebar label:has(input[type="checkbox"]) {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

#sidebar label:has(input[type="checkbox"]):hover {
  color: #fff;
}

#sidebar input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  margin-top: 2px;
  background: #0d0d0d;
  border: 1px solid #444;
  color: #eee;
  font-size: 12px;
  border-radius: 4px;
  transition: border-color 0.2s, background 0.2s;
}

#sidebar input:focus {
  outline: none;
  border-color: #0b84ff;
  background: #1a1a1a;
}

#sidebar input:hover:not(:focus) {
  border-color: #555;
}

#sidebar input[readonly] {
  cursor: default;
  opacity: 0.7;
}

#currentTime {
  font-size: 14px !important;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-align: center;
}

#sidebar select {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  margin-top: 2px;
  background: #0d0d0d;
  border: 1px solid #444;
  color: #eee;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

#sidebar select:focus {
  outline: none;
  border-color: #0b84ff;
  background: #1a1a1a;
}

#sidebar select:hover {
  border-color: #555;
}

#sidebar button {
  margin-top: 10px;
  width: 100%;
  padding: 8px 12px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 4px;
  color: #eee;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

#sidebar button:hover {
  background: #333;
  border-color: #666;
  transform: translateY(-1px);
}

#sidebar button:active {
  transform: translateY(0);
}

#sidebar button.primary {
  background: #0b84ff;
  border-color: #0b84ff;
  color: white;
}

#sidebar button.primary:hover {
  background: #0a7ae6;
  border-color: #0a7ae6;
}

#sidebar small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #aaa;
}

#canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #111;
  display: flex;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Custom scrollbar styling */
#sidebar-content::-webkit-scrollbar,
#scenarioObjectsList::-webkit-scrollbar {
  width: 8px;
}

#sidebar-content::-webkit-scrollbar-track,
#scenarioObjectsList::-webkit-scrollbar-track {
  background: #1a1a1a;
}

#sidebar-content::-webkit-scrollbar-thumb,
#scenarioObjectsList::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

#sidebar-content::-webkit-scrollbar-thumb:hover,
#scenarioObjectsList::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.axis-label {
  position: absolute;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: bold;
  pointer-events: none;
  text-shadow: 
    0 0 4px rgba(0,0,0,0.9),
    0 0 8px rgba(0,0,0,0.7),
    0 0 12px rgba(0,0,0,0.5),
    1px 1px 2px rgba(0,0,0,1);
  letter-spacing: 1px;
}

.object-data-label {
  position: absolute;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 400;
  pointer-events: none;
  text-shadow: 
    0 0 3px rgba(0,0,0,0.9),
    0 0 6px rgba(0,0,0,0.7),
    1px 1px 2px rgba(0,0,0,1);
  color: #0f0;
  white-space: nowrap;
  line-height: 1.4;
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 3px;
}

.input-type-section {
  display: none;
}

.input-type-section.active {
  display: block;
}

#tleInput {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  margin-top: 2px;
  background: #0d0d0d;
  border: 1px solid #444;
  color: #eee;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  border-radius: 4px;
  resize: vertical;
  min-height: 70px;
  transition: border-color 0.2s, background 0.2s;
  line-height: 1.4;
}

#tleInput:focus {
  outline: none;
  border-color: #0b84ff;
  background: #1a1a1a;
}

#tleInput:hover:not(:focus) {
  border-color: #555;
}

.sim-obj-item {
  border: 1px solid #333;
  border-radius: 4px;
  margin-bottom: 8px;
  background: #1e1e1e;
  transition: all 0.2s;
  overflow: hidden;
}

.sim-obj-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.sim-obj-header:hover {
  background: #252525;
}

.sim-obj-header span {
  flex: 1;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: #eee;
}

.sim-obj-header::before {
  content: '▶';
  font-size: 9px;
  color: #888;
  margin-right: 4px;
  transition: transform 0.2s;
}

.sim-obj-item.expanded .sim-obj-header::before {
  transform: rotate(90deg);
}

.sim-obj-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  padding: 0 10px;
  background: #1a1a1a;
}

.sim-obj-item.expanded .sim-obj-content {
  max-height: 200px;
  padding: 8px 10px;
  border-top: 1px solid #333;
}

.sim-obj-item button {
  padding: 4px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  max-width: 24px;
  font-size: 13px;
  line-height: 1;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 4px;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  margin: 0;
}

.sim-obj-item button:hover {
  background: #333;
  border-color: #666;
  color: #fff;
}

.sim-obj-item button.danger {
  color: #ff6b6b;
}

.sim-obj-item button.danger:hover {
  background: #d32f2f;
  border-color: #d32f2f;
  color: white;
}

.icon-btn {
  margin: 0 !important;
}

/* Full-width action button inside object cards (overrides the 24px icon-button
   sizing applied to all .sim-obj-item buttons). */
.sim-obj-item button.maneuver-add-btn {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: auto;
  white-space: nowrap;
}.icon-btn.danger {
  margin: 0 !important;
}

/* Modal dialog styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
  background-color: #1a1a1a;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #444;
  border-radius: 8px;
  width: 700px;
  max-width: 95%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #333;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: #eee;
}

.modal-close {
  font-size: 28px;
  font-weight: bold;
  color: #888;
  cursor: pointer;
  line-height: 20px;
}

.modal-close:hover {
  color: #eee;
}

.modal-section {
  margin-bottom: 16px;
}

.modal-section h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #aaa;
  text-transform: uppercase;
}

.color-picker-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.color-swatch:hover {
  border-color: #0b84ff;
}

.color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: #2a2a2a;
  color: #eee;
  font-size: 11px;
  white-space: nowrap;
  border-radius: 4px;
  margin-bottom: 5px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  border: 1px solid #444;
  pointer-events: none;
}

[data-tooltip]:hover::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #2a2a2a;
  z-index: 1000;
  pointer-events: none;
}

/* Improved status indicator */
#status {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 6px 12px;
  background: rgba(0,0,0,0.7);
  border-radius: 4px;
  font-size: 11px;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255,255,255,0.1);
  display: none; /* Hidden by default */
}

/* Loading Screen */
#loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease-out;
}

#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #333;
  border-top-color: #0b84ff;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  color: #eee;
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
  opacity: 0.9;
}

#loading-subtext {
  color: #888;
  font-size: 12px;
  margin-top: 4px;
}

/* ========================================
   ANALYSIS PANEL (Ground Track / Access / Conjunction)
   ======================================== */

#analysis-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32vh;
  min-height: 220px;
  background: #141414;
  border-top: 1px solid #333;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: transform 0.25s ease;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}

/* Suppress height transition while the user is actively dragging */
#analysis-panel.is-resizing {
  transition: none;
}

/* Resize handle — sits flush at the very top of the panel */
#analysis-resize-handle {
  flex: 0 0 8px;
  width: 100%;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  touch-action: none;
  user-select: none;
}

/* Hidden when the panel is collapsed */
#analysis-panel.collapsed #analysis-resize-handle {
  display: none;
}

/* Three-line grip pip */
#analysis-resize-handle::before {
  content: '';
  display: block;
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: #3a3a3a;
  box-shadow: 0 -4px 0 #3a3a3a, 0 4px 0 #3a3a3a;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

#analysis-resize-handle:hover::before,
#analysis-resize-handle.dragging::before {
  background: #7fb3ff;
  box-shadow: 0 -4px 0 #7fb3ff, 0 4px 0 #7fb3ff;
}

#analysis-panel.collapsed {
  transform: translateY(calc(100% - 34px));
}

#analysis-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  min-height: 34px;
  padding: 0 8px;
  background: #1b1b1b;
  border-bottom: 1px solid #2c2c2c;
}

#analysis-tabs {
  display: flex;
  gap: 4px;
}

.analysis-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #aaa;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  min-width: auto;
}

.analysis-tab:hover { color: #eee; }
.analysis-tab.active { color: #7fb3ff; border-bottom-color: #7fb3ff; }

#analysis-toggle {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #eee;
  border-radius: 4px;
  width: 28px;
  height: 22px;
  min-width: 28px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

#analysis-panel.collapsed #analysis-toggle { transform: rotate(180deg); }

#analysis-panel-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.analysis-tab-content {
  display: none;
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 10px 12px;
}

.analysis-tab-content.active { display: block; }

.analysis-layout {
  display: flex;
  gap: 12px;
  height: 100%;
  align-items: stretch;
}

.analysis-controls {
  flex: 0 0 220px;
  overflow-y: auto;
  font-size: 12px;
}

.analysis-controls label { display: block; margin-bottom: 6px; }
.analysis-controls select,
.analysis-controls input[type="text"],
.analysis-controls input[type="number"] { width: 100%; box-sizing: border-box; }

.analysis-canvas-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #0a0a12;
  border: 1px solid #2c2c2c;
  border-radius: 4px;
  overflow: hidden;
}

.analysis-canvas-wrap canvas { display: block; width: 100%; height: 100%; }

.gt-checkbox-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 12px; }
.gt-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.analysis-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 6px; }
.analysis-table th, .analysis-table td { border: 1px solid #2c2c2c; padding: 3px 6px; text-align: left; white-space: nowrap; }
.analysis-table th { background: #1e1e1e; position: sticky; top: 0; }
.analysis-table tr.subthreshold { background: #3a1414; }

.analysis-disclaimer {
  margin-top: 8px;
  padding: 6px 8px;
  border-left: 3px solid #6b5a20;
  background: #1d1a10;
  color: #e8c96a;
  font-size: 10px;
  line-height: 1.4;
}

.analysis-progress {
  height: 4px;
  background: #2a2a2a;
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0;
}
.analysis-progress > div { height: 100%; width: 0; background: #7fb3ff; transition: width 0.1s linear; }

.analysis-btn {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #eee;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  margin-top: 6px;
}
.analysis-btn.primary { background: #0b84ff; border-color: #0b84ff; }
.analysis-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========================================
   GROUND SITES + MANEUVERS + PRO PILL
   ======================================== */

.site-row, .maneuver-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  margin: 4px 0;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 4px;
  font-size: 12px;
}
.site-row .site-name, .maneuver-row .mv-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.maneuver-note {
  font-size: 10px;
  color: #e8c96a;
  margin: 2px 0 6px;
}
.dv-budget { font-size: 11px; color: #9cc3ff; margin: 4px 0; }

.pro-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffcf6a;
  border: 1px solid #6b5a20;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.upsell-cta {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  background: #0b84ff;
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  background: #222;
  border: 1px solid #444;
  color: #eee;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 2000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  max-width: 80%;
}

