/* Reset — globe fills entire viewport */
html, body, #cesiumContainer {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Dark, minimal scrollbars on the overlay panels so they match the theme
   (Firefox: thin + grey; WebKit/Chrome: a slim grey thumb on a clear track). */
#conjunction-list,
#conjunction-detail,
#info-panel {
  scrollbar-width: thin;
  scrollbar-color: #3a3a44 transparent;
}
#conjunction-list::-webkit-scrollbar,
#conjunction-detail::-webkit-scrollbar,
#info-panel::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#conjunction-list::-webkit-scrollbar-track,
#conjunction-detail::-webkit-scrollbar-track,
#info-panel::-webkit-scrollbar-track {
  background: transparent;
}
#conjunction-list::-webkit-scrollbar-thumb,
#conjunction-detail::-webkit-scrollbar-thumb,
#info-panel::-webkit-scrollbar-thumb {
  background: #3a3a44;
  border-radius: 4px;
}
#conjunction-list::-webkit-scrollbar-thumb:hover,
#conjunction-detail::-webkit-scrollbar-thumb:hover,
#info-panel::-webkit-scrollbar-thumb:hover {
  background: #55555f;
}

/* --- Info Panel (bottom-left overlay) --- */
#info-panel {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 240px;
  max-height: 70vh;
  overflow-y: auto;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid #4fc3f7;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
  color: #ccc;
  z-index: 100;
}

#info-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* keep the × at top-right when the title wraps */
  padding: 8px 10px;
  border-bottom: 1px solid #333;
}

#info-panel-title {
  color: #4fc3f7;
  font-weight: bold;
  font-size: 14px;
  /* Wrap long names onto new lines instead of truncating with an ellipsis. */
  white-space: normal;
  overflow-wrap: anywhere;
  flex: 1;
  margin-right: 8px;
}

#info-panel-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
#info-panel-close:hover {
  color: #fff;
}

#info-panel-table {
  width: 100%;
  border-collapse: collapse;
}

#info-panel-table td {
  padding: 4px 10px;
  border-bottom: 1px solid #1a1a2e;
}

.info-label {
  color: #888;
  white-space: nowrap;
}

.info-value {
  color: #e0e0e0;
  text-align: right;
}

#info-panel-trail-toggle {
  display: block;
  padding: 8px 10px;
  border-top: 1px solid #333;
  color: #4fc3f7;
  font-size: 12px;
  cursor: pointer;
}

#trail-checkbox {
  margin-right: 6px;
  accent-color: #4fc3f7;
}

/* --- Controls Panel (top-right overlay) --- */
#controls-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  min-width: 140px;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid #4fc3f7;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  color: #ccc;
  z-index: 100;
}

#controls-header {
  padding: 6px 10px;
  color: #4fc3f7;
  font-weight: bold;
  font-size: 13px;
  border-bottom: 1px solid #333;
}

.control-toggle {
  display: block;
  padding: 4px 10px;
  color: #ccc;
  cursor: pointer;
}

.control-toggle:last-child {
  padding-bottom: 8px;
}

.control-toggle input {
  margin-right: 6px;
  accent-color: #4fc3f7;
}

/* Group filters — colored swatch + right-aligned count (9.x display rework) */
.group-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  cursor: pointer;
}
.group-toggle input {
  accent-color: #4fc3f7;
  margin: 0;
}
.group-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.group-name {
  flex: 1;
}
.group-count {
  color: #888;
  font-variant-numeric: tabular-nums;
}
#controls-section-label {
  padding: 6px 10px 2px;
  color: #666;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- Time Bar (bottom-center overlay) --- */
#time-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid #4fc3f7;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
  color: #ccc;
  padding: 6px 14px;
  z-index: 100;
  user-select: none;
}

#time-pause {
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #4fc3f7;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 8px;
  line-height: 1;
}
#time-pause:hover {
  border-color: #4fc3f7;
}

#time-display {
  color: #e0e0e0;
  min-width: 160px;
  text-align: center;
}

#time-speed-group {
  display: flex;
  gap: 4px;
}

.time-speed {
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #888;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 8px;
}
.time-speed:hover {
  border-color: #4fc3f7;
  color: #ccc;
}
.time-speed.active {
  border-color: #4fc3f7;
  color: #4fc3f7;
  background: rgba(79, 195, 247, 0.1);
}

#time-live {
  background: none;
  border: 1px solid #ff9800;
  border-radius: 4px;
  color: #ff9800;
  font-family: monospace;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  padding: 2px 10px;
}
#time-live:hover {
  background: rgba(255, 152, 0, 0.12);
}

/* --- Conjunction list (top-left; orange accent matches the on-globe lines) --- */
#conjunction-list {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 260px;
  max-height: 45vh;
  overflow-y: auto;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid #ff9800;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  color: #ccc;
  z-index: 100;
}

#conjunction-header {
  /* Hanging header — stays pinned at the top while the list scrolls under it. */
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px;
  border-bottom: 1px solid #333;
  background: rgba(10, 10, 20, 0.97);
  color: #ff9800;
  font-weight: bold;
  font-size: 13px;
}

#conjunction-body {
  padding: 4px 0;
}

/* Freshness line — snapshot age + validation-report link (9.3) */
#conjunction-freshness {
  padding: 6px 10px;
  border-top: 1px solid #333;
  font-size: 11px;
  color: #888;
}
#conjunction-freshness a {
  color: #4fc3f7;
  text-decoration: none;
}
#conjunction-freshness a:hover {
  text-decoration: underline;
}

.conjunction-row {
  padding: 6px 10px;
  border-bottom: 1px solid #222;
  cursor: pointer;
}

.conjunction-row:hover {
  background: rgba(255, 152, 0, 0.08);
}

.conjunction-row.focused,
.cd-row.focused {
  background: rgba(255, 152, 0, 0.18);
  border-left: 2px solid #ff9800;
}

.conjunction-pair {
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conjunction-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: #888;
}

.conjunction-miss {
  color: #ff9800;
}

/* Conjunction time — red to flag "this is the moment to watch" (list + detail). */
.conjunction-tca {
  color: #ff5252;
}

.conjunction-empty {
  padding: 10px;
  color: #888;
}

/* --- Conjunction detail (bottom-right; selected satellite's conjunctions) --- */
#conjunction-detail {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 280px;
  max-height: 55vh;
  overflow-y: auto;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid #ff9800;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  color: #ccc;
  z-index: 100;
}

#conjunction-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid #333;
  color: #ff9800;
  font-weight: bold;
  font-size: 13px;
}
/* Satellite name on its own line, conjunction count underneath. */
.cd-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cd-satname {
  color: #ff9800;
  font-weight: bold;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.cd-count {
  color: #888;
  font-weight: normal;
  font-size: 11px;
}

/* "Jump to TCA" — jumps the clock to the selected sat's closest approach. */
#jump-to-tca {
  flex: none;
  background: none;
  border: 1px solid #ff5252;
  border-radius: 4px;
  color: #ff5252;
  font-family: monospace;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  padding: 2px 8px;
  white-space: nowrap;
}
#jump-to-tca:hover {
  background: rgba(255, 82, 82, 0.14);
}

/* "Show more" — reveals the next batch of conjunctions in the list. */
#conj-show-more {
  display: block;
  width: calc(100% - 20px);
  margin: 6px 10px 8px;
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #aaa;
  font-family: monospace;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 6px;
}
#conj-show-more:hover {
  border-color: #ff9800;
  color: #ccc;
}

.cd-row {
  padding: 7px 10px;
  border-bottom: 1px solid #222;
  cursor: pointer;
}

.cd-row:hover {
  background: rgba(255, 152, 0, 0.08);
}

.cd-partner {
  color: #e0e0e0;
}

.cd-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: #888;
}

.cd-rtn {
  margin-top: 2px;
  color: #6aa6c8;
}

/* --- "Only display conjunctions" buttons (in the Display panel) --- */
#conj-only-buttons {
  display: flex;
  gap: 6px;
  padding: 2px 10px 8px;
}
.conj-only-btn {
  flex: 1;
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #888;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 6px;
}
.conj-only-btn:hover {
  border-color: #ff9800;
  color: #ccc;
}
.conj-only-btn.active {
  border-color: #ff9800;
  color: #ff9800;
  background: rgba(255, 152, 0, 0.12);
}

/* --- Editable HH:MM:SS in the time bar --- */
#time-date {
  color: #e0e0e0;
}
#time-utc {
  color: #888;
  margin-left: 4px;
}
.time-colon {
  color: #e0e0e0;
}
.time-edit {
  color: #e0e0e0;
  padding: 0 1px;
  border-radius: 3px;
  cursor: text;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.time-edit:hover {
  background: rgba(79, 195, 247, 0.15);
}
.time-edit:focus {
  background: rgba(79, 195, 247, 0.25);
  color: #fff;
}

/* --- Search bar (top-center overlay) --- */
#search-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  max-width: 40vw;
  z-index: 100;
  font-family: monospace;
}
#search-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid #4fc3f7;
  border-radius: 6px;
  color: #e0e0e0;
  font-family: monospace;
  font-size: 13px;
  padding: 7px 12px;
  outline: none;
}
#search-input::placeholder {
  color: #778;
}
#search-input:focus {
  border-color: #7fd4ff;
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.2);
}
#search-results {
  display: none;
  margin-top: 4px;
  background: rgba(10, 10, 20, 0.96);
  border: 1px solid #4fc3f7;
  border-radius: 6px;
  overflow: hidden;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  color: #ccc;
}
.search-result:hover,
.search-result.highlighted {
  background: rgba(79, 195, 247, 0.15);
}
.search-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.search-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e0e0e0;
}
.search-id {
  color: #888;
  font-variant-numeric: tabular-nums;
}

/* --- POV indicator (10.6): current zoom level + what Escape does next.
   Top-center, just under the search bar. --- */
#pov-indicator {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  background: rgba(10, 10, 20, 0.82);
  border: 1px solid #333;
  border-radius: 999px;
  font-family: monospace;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none; /* purely informational — never eats a globe click */
}
#pov-indicator .pov-level {
  color: #4fc3f7;
  font-weight: 600;
  letter-spacing: 0.02em;
}
#pov-indicator .pov-ctx {
  color: #e0e0e0;
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 1px solid #333;   /* "TCA View | context" divider */
  padding-left: 10px;
}
#pov-indicator .pov-esc {
  color: #888;
  border-left: 1px solid #333;
  padding-left: 10px;
}
