/* Sky Mapping Frontend Styles */

/* ============================================================================
   Theme Variables - Dark Theme (Default)
   ============================================================================ */
:root {
  /* Core Brand Colors */
  --primary-color: #4a90e2;
  --secondary-color: #7b68ee;
  --success-color: #50c878;
  --error-color: #e74c3c;
  --warning-color: #f39c12;
  
  /* Dark Theme Colors */
  --bg-dark: #1a1a1a;
  --bg-darker: #0f0f0f;
  --bg-light: #2a2a2a;
  --bg-surface: #222222;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --border-color: #3a3a3a;
  --muted: #666;
  
  /* Additional Theme Variables */
  --header-bg: #1a1a1a;
  --card-bg: #1a1a1a;
  --input-bg: #2a2a2a;
  --modal-bg: #1a1a1a;
  --modal-overlay: rgba(0, 0, 0, 0.7);
  --dropdown-bg: #1a1a1a;
  --dropdown-hover: #2a2a2a;
  --table-header-bg: #2a2a2a;
  --table-row-hover: rgba(255, 255, 255, 0.05);
  --scrollbar-track: #1a1a1a;
  --scrollbar-thumb: #2a2a2a;
  --scrollbar-thumb-hover: #3a3a3a;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --focus-ring: rgba(74, 144, 226, 0.5);
  
  /* Charts/Plots */
  --plot-bg: #1a1a1a;
  --plot-grid: #2a2a2a;
  
  /* Status Colors (adjusted for theme) */
  --status-success-bg: rgba(80, 200, 120, 0.15);
  --status-error-bg: rgba(231, 76, 60, 0.15);
  --status-warning-bg: rgba(243, 156, 18, 0.15);
  --status-info-bg: rgba(74, 144, 226, 0.1);
  
  /* Alias variables for inline styles */
  --panel: #1a1a1a;
  --border: #3a3a3a;
  --accent-color: #2979ff;
}

/* ============================================================================
   Light Theme
   ============================================================================ */
[data-theme="light"] {
  /* Light Theme Colors */
  --bg-dark: #ffffff;
  --bg-darker: #f5f5f5;
  --bg-light: #e8e8e8;
  --bg-surface: #fafafa;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #d0d0d0;
  --muted: #888;
  
  /* Additional Theme Variables */
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --input-bg: #f5f5f5;
  --modal-bg: #ffffff;
  --modal-overlay: rgba(0, 0, 0, 0.4);
  --dropdown-bg: #ffffff;
  --dropdown-hover: #f0f0f0;
  --table-header-bg: #f0f0f0;
  --table-row-hover: rgba(0, 0, 0, 0.03);
  --scrollbar-track: #f0f0f0;
  --scrollbar-thumb: #c0c0c0;
  --scrollbar-thumb-hover: #a0a0a0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --focus-ring: rgba(74, 144, 226, 0.3);
  
  /* Charts/Plots */
  --plot-bg: #ffffff;
  --plot-grid: #e0e0e0;
  
  /* Status Colors (adjusted for light theme) */
  --status-success-bg: rgba(80, 200, 120, 0.12);
  --status-error-bg: rgba(231, 76, 60, 0.12);
  --status-warning-bg: rgba(243, 156, 18, 0.12);
  --status-info-bg: rgba(74, 144, 226, 0.08);
  
  /* Alias variables for inline styles */
  --panel: #ffffff;
  --border: #d0d0d0;
  --accent-color: #2979ff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-darker);
  color: var(--text-primary);
  overflow: hidden;
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Header */
header.header-container {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 0.5rem 1rem;
  gap: 1rem;
}

/* Logos Section (Left) */
.header-logos {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-right: 1rem;
  border-right: 1px solid var(--border-color);
}

.header-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

/* Logo theme switching */
.header-logo-light {
  display: none;
}

.header-logo-dark {
  display: block;
}

[data-theme="light"] .header-logo-light {
  display: block;
}

[data-theme="light"] .header-logo-dark {
  display: none;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

/* Center Content (Two Rows) */
.header-center-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 0.5rem;
  justify-content: center;
}

/* Top Row: Session + Terminal Connection */
.header-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

/* User Section (Right) */
.header-user {
  display: flex;
  align-items: center;
  padding-left: 1rem;
  border-left: 1px solid var(--border-color);
}

/* Help button in tab bar */
.help-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.help-button:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.help-button svg {
  flex-shrink: 0;
}

/* Legacy classes for backwards compatibility */
.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
  min-width: 0;
}

/* Terminal Connection Info in Header */
.terminal-connection-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.terminal-connection-label {
  color: var(--text-secondary);
}

.terminal-connection-name {
  color: var(--text-primary);
  font-weight: 500;
}

.terminal-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.terminal-status-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.terminal-status-badge.connected {
  background: rgba(80, 200, 120, 0.15);
  color: var(--success-color);
}

.terminal-status-badge.connected::before {
  background: var(--success-color);
  box-shadow: 0 0 6px var(--success-color);
}

.terminal-status-badge.disconnected {
  background: rgba(160, 160, 160, 0.15);
  color: var(--text-secondary);
}

.terminal-status-badge.disconnected::before {
  background: var(--text-secondary);
}

.terminal-status-badge.connecting {
  background: rgba(243, 156, 18, 0.15);
  color: var(--warning-color);
}

.terminal-status-badge.connecting::before {
  background: var(--warning-color);
  animation: pulse 1.5s infinite;
}

/* User Account */
.user-account {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: background 0.2s;
  min-width: 60px;
}

.user-account:hover {
  background: var(--bg-light);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a90e2, #7b68ee);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.user-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Status Bar Row */
.header-status-row {
  display: flex;
  align-items: center;
}

.status-bar-container {
  position: relative;
  flex: 1;
}

.status-bar {
  background: var(--bg-darker);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: border-color 0.2s, background 0.2s;
  min-height: 32px;
}

.status-bar:hover {
  border-color: var(--primary-color);
  background: rgba(74, 144, 226, 0.05);
}

.status-bar-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.status-bar-text.info {
  color: var(--text-secondary);
}

.status-bar-text.success {
  color: var(--success-color);
}

.status-bar-text.error {
  color: var(--error-color);
}

.status-bar-text.warning {
  color: var(--warning-color);
}

/* Status History Dropdown */
.status-history-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}

.status-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.status-history-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.status-history-actions {
  display: flex;
  gap: 0.5rem;
}

.status-history-actions .btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  width: auto;
}

.status-history-list {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
}

.status-history-item {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  display: flex;
  gap: 0.75rem;
}

.status-history-item:last-child {
  border-bottom: none;
}

.status-history-item .timestamp {
  color: var(--text-secondary);
  font-size: 0.75rem;
  white-space: nowrap;
  min-width: 70px;
}

.status-history-item .message {
  flex: 1;
  word-break: break-word;
}

.status-history-item.info .message {
  color: var(--text-secondary);
}

.status-history-item.success .message {
  color: var(--success-color);
}

.status-history-item.error .message {
  color: var(--error-color);
}

.status-history-item.warning .message {
  color: var(--warning-color);
}

.status-history-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.session-info label {
  color: var(--text-secondary);
  font-weight: 500;
}

.session-name-input {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  min-width: 200px;
}

.session-name-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.session-name-display {
  color: var(--text-primary);
  font-weight: 500;
}

.session-selector {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  min-width: 200px;
  max-width: 300px;
  width: 100%;
  cursor: pointer;
}

.session-selector:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn-small,
.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

/* Modal 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);
  backdrop-filter: blur(2px);
}

.modal-content {
  background-color: var(--bg-dark);
  margin: 5% auto;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-small {
  max-width: 400px;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Session List */
.session-list-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.session-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.session-list-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.session-item {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s;
}

.session-item:hover {
  border-color: var(--primary-color);
}

.session-item.active {
  border-color: var(--primary-color);
  background: rgba(74, 144, 226, 0.1);
}

.session-item-info {
  flex: 1;
  min-width: 0;
}

.session-item-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.session-item-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.session-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.session-item-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.session-item-btn:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
}

.session-item-btn.danger:hover {
  background: var(--error-color);
  border-color: var(--error-color);
  color: white;
}

.muted {
  color: var(--text-secondary);
  font-style: italic;
}

.error {
  color: var(--error-color);
}

/* Modal click outside to close */
.modal-content {
  position: relative;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
}

/* header h1 moved to .header-left section above */

.status {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.status .info {
  color: var(--text-secondary);
}

.status .success {
  color: var(--success-color);
}

.status .error {
  color: var(--error-color);
}

.status .warning {
  color: var(--warning-color);
}

/* Progress Bar */
.progress-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 180px;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-light);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 30px;
  text-align: right;
  white-space: nowrap;
}

/* Main Layout */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0; /* Critical for flex children */
}

/* Full Width Main Content (No Sidebar) */
.main-content-full {
  width: 100%;
}

/* Visualization Controls Grid Layout */
.visualization-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.control-panel {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
}

.control-panel h3 {
  font-size: 1rem;
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

/* Legacy Sidebar (kept for backwards compatibility) */
.sidebar {
  width: 320px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem;
}

.sidebar h2 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.sidebar h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.section:last-child {
  border-bottom: none;
}

/* Form Controls */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-control.input-error {
  border-color: var(--error-color);
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.form-group label input[type="checkbox"] {
  margin-right: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #357abd;
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-darker);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  width: auto;
}

/* Satellite List */
.satellite-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.satellite-item {
  padding: 0.75rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.satellite-item:hover {
  background: var(--bg-darker);
  border-color: var(--primary-color);
}

.satellite-item.selected {
  border-color: var(--primary-color);
  background: rgba(74, 144, 226, 0.1);
}

.satellite-item-name {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.satellite-item-norad {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.satellite-item-elevation {
  font-size: 0.85rem;
  color: var(--primary-color);
  margin-top: 0.25rem;
  font-weight: 500;
}

.muted {
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* Main Content */
.main-content {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Critical for flex children */
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.tab-button {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.tab-button:hover {
  color: var(--text-primary);
  background: var(--bg-light);
}

.tab-button.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--bg-dark);
}

.tab-content {
  display: none;
}

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

/* Viewer Tabs */
.viewer-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1rem;
  width: 100%;
}

.viewer-tabs-left {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.viewer-tabs-left::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.viewer-tabs-right {
  display: flex;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  align-items: center;
  gap: 0.5rem;
}

.viewer-tab-button {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Analysis Sub-Tab Bar */
.analysis-sub-tabs {
  display: flex;
  background: var(--bg-darker, var(--bg-dark));
  border-bottom: 1px solid var(--border-color);
  padding: 0 1rem;
  gap: 0;
}

.analysis-sub-tab {
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.analysis-sub-tab:hover {
  color: var(--text-primary);
  background: var(--bg-light);
}

.analysis-sub-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: transparent;
}

.analysis-sub-content {
  display: none;
  flex: 1;
  overflow-y: auto;
}

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

.viewer-tab-button:hover {
  color: var(--text-primary);
}

.viewer-tab-button.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.viewer-tab-content {
  display: none;
  flex: 1;
  position: relative;
  min-height: 0; /* Critical for flex children */
}

.viewer-tab-content.active {
  display: flex;
  flex-direction: column;
  min-height: 0; /* Critical for flex children */
  overflow-y: auto; /* Allow scrolling for content tabs */
}

/* Satellites tab specific styling */
#satellitesTab {
  padding: 0;
}

#satellitesTab > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
}

@media (max-width: 1200px) {
  #satellitesTab > div {
    grid-template-columns: 1fr;
  }
}

/* Sortable table headers */
th.sortable {
  cursor: pointer;
  padding-right: 25px;
  position: relative;
  user-select: none;
  transition: background 0.2s;
}

th.sortable:hover {
  background: rgba(255, 255, 255, 0.05);
}

th.sortable::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.4;
}

th.sortable.sort-asc::after {
  border-bottom: 6px solid var(--primary-color);
  opacity: 1;
}

th.sortable.sort-desc::after {
  border-top: 6px solid var(--primary-color);
  opacity: 1;
}

/* Available Constellations table borders */
#constellationsTable {
  border-collapse: collapse;
}

#constellationsTable th,
#constellationsTable td {
  border-bottom: 1px solid var(--border-color);
}

/* Platform Catalog table */
#platformCatalogTable {
  border-collapse: collapse;
}

th.platform-sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

th.platform-sortable:hover {
  background: rgba(255, 255, 255, 0.08);
}

th.platform-sortable .sort-indicator {
  margin-left: 4px;
  font-size: 0.7rem;
  opacity: 0.8;
}

#platformCatalogTable tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

#constellationsTable tbody tr:last-child td {
  border-bottom: none;
}

.cesium-container {
  width: 100%;
  flex: 1;
  position: relative;
  min-height: 0; /* Critical for flex sizing */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Cesium viewer container - must have explicit height */
#cesiumContainer {
  width: 100%;
  flex: 1;
  position: relative;
  min-height: 0;
  display: block;
}

/* Ensure Cesium viewer fills container properly */
#cesiumContainer .cesium-viewer {
  width: 100% !important;
  height: 100% !important;
  position: relative !important;
}

/* Make sure bottom controls are visible */
#cesiumContainer .cesium-viewer-bottom {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
}

#cesiumContainer .cesium-viewer {
  width: 100%;
  height: 100%;
}

#cesiumContainer .cesium-viewer-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 112px;
  pointer-events: none;
}

#cesiumContainer .cesium-viewer-bottom > * {
  pointer-events: auto;
}

/* Cesium viewer container - simple and clean */
#cesiumContainer {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Don't interfere with Cesium's default styling */
.cesium-container {
  width: 100%;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Globe Toolbar */
.globe-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  position: relative;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.toolbar-btn-icon {
  font-size: 1rem;
}

.toolbar-btn-primary {
  background: var(--primary-color);
  color: white;
}

.toolbar-btn-primary:hover {
  background: #357abd;
}

.toolbar-btn-secondary {
  background: var(--bg-light);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.toolbar-btn-secondary:hover {
  background: var(--bg-darker);
}


.placeholder-content {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.info-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 1rem;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-color);
}

/* ============================================================================
   Terminal Control Tab Styles
   ============================================================================ */

.terminal-tile {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.terminal-tile .tile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
}

.terminal-tile .tile-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: none;
}

.terminal-tile .tile-content {
  padding: 1rem;
}

.terminal-tile .tile-placeholder {
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem 1rem;
  font-style: italic;
}

.terminal-tile .divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0.75rem 0;
}

/* Detail Row (label/value pairs) */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.25rem 0;
  font-size: 0.9rem;
}

.detail-row .label {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.detail-row .value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  margin-left: 1rem;
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-connected {
  background: rgba(80, 200, 120, 0.15);
  color: var(--success-color);
}

.status-connected::before {
  background: var(--success-color);
  box-shadow: 0 0 4px var(--success-color);
}

.status-disconnected {
  background: rgba(231, 76, 60, 0.15);
  color: var(--error-color);
}

.status-disconnected::before {
  background: var(--error-color);
}

.status-connecting {
  background: rgba(243, 156, 18, 0.15);
  color: var(--warning-color);
}

.status-connecting::before {
  background: var(--warning-color);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Ping Latency Indicator */
.ping-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.ping-indicator .ping-good {
  color: #50c878;
}

.ping-indicator .ping-warn {
  color: #f59e0b;
}

.ping-indicator .ping-bad {
  color: #ef4444;
}

[data-theme="light"] .ping-indicator {
  background: rgba(0, 0, 0, 0.06);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-locked {
  background: rgba(80, 200, 120, 0.2);
  color: var(--success-color);
}

.badge-tracking {
  background: rgba(74, 144, 226, 0.2);
  color: var(--primary-color);
}

.badge-offline {
  background: rgba(160, 160, 160, 0.2);
  color: var(--text-secondary);
}

/* Terminal Tab Layout */
#terminalTab .beam-tiles-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

#terminalTab .control-panels-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 1400px) {
  #terminalTab .control-panels-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1000px) {
  #terminalTab .beam-tiles-container,
  #terminalTab .control-panels-container {
    grid-template-columns: 1fr;
  }
}

/* GPS Grid */
.gps-grid h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Form Controls within Terminal Tiles */
.terminal-tile .form-group {
  margin-bottom: 0.75rem;
}

.terminal-tile .form-group:last-child {
  margin-bottom: 0;
}

.terminal-tile .form-group label {
  display: flex;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.terminal-tile .form-group label input[type="checkbox"] {
  margin-right: 0.5rem;
}

/* Status Icons (checkmark and cross) */
.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  margin-left: 6px;
}

.status-icon.status-ok {
  background: rgba(80, 200, 120, 0.2);
  color: #22c55e;
}

.status-icon.status-error {
  background: rgba(231, 76, 60, 0.2);
  color: #c0392b;
}

/* Status Values with color */
.status-value {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}

.status-value.status-ok {
  color: #22c55e;
}

.status-value.status-error {
  color: #c0392b;
}

.status-value.status-muted {
  color: var(--text-secondary);
}

/* Toggle Display (visual only, not interactive) */
.toggle-row {
  align-items: center;
}

.toggle-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.toggle-label.active {
  color: var(--text-primary);
  font-weight: 500;
}

.toggle-indicator {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
}

.toggle-indicator::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 2px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-indicator.off {
  background: #6b7280;
}

.toggle-indicator.off::after {
  left: 2px;
}

.toggle-indicator.on {
  background: #3b82f6;
}

.toggle-indicator.on::after {
  left: 22px;
}

/* Button Danger Variant */
.btn-danger {
  background: var(--error-color);
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #c0392b;
}

/* ============================================================================
   User Menu Dropdown
   ============================================================================ */

.user-menu-container {
  position: relative;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: var(--dropdown-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px var(--shadow-color);
  z-index: 1001;
  overflow: hidden;
  animation: dropdownFadeIn 0.2s ease-out;
}

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

.user-menu-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-light);
}

.user-menu-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-menu-items {
  padding: 0.5rem 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-menu-item:hover:not(.disabled) {
  background: var(--dropdown-hover);
}

.user-menu-item.disabled {
  cursor: default;
  opacity: 0.7;
}

.menu-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.menu-item-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.menu-item-label {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.menu-item-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-light);
  color: var(--text-secondary);
  border-radius: 4px;
  font-weight: 500;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

/* Theme Toggle Switch */
.theme-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.theme-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #c0c0c0;
  transition: 0.3s;
  border-radius: 26px;
}

.theme-toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Dark theme active (checkbox checked) */
.theme-toggle-switch input:checked + .theme-toggle-slider {
  background: var(--primary-color);
}

.theme-toggle-switch input:checked + .theme-toggle-slider::before {
  transform: translateX(22px);
}

/* Focus styles */
.theme-toggle-switch input:focus + .theme-toggle-slider {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Theme-specific icons in toggle */
.theme-toggle-slider::after {
  content: "☀️";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  transition: opacity 0.3s;
}

.theme-toggle-switch input:checked + .theme-toggle-slider::after {
  content: "🌙";
  left: auto;
  right: 6px;
}

/* ============================================================================
   Light Theme Specific Overrides
   ============================================================================ */

/* Cesium viewer in light mode - keep dark background for space visualization */
[data-theme="light"] #cesiumContainer {
  background: #0f0f0f;
}

/* User avatar gradient adjustment for light theme */
[data-theme="light"] .user-avatar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Button adjustments for light theme */
[data-theme="light"] .btn-secondary {
  background: var(--bg-light);
  border-color: var(--border-color);
}

[data-theme="light"] .btn-secondary:hover {
  background: #d8d8d8;
}

/* Table styles for light theme */
[data-theme="light"] #constellationsTable th,
[data-theme="light"] #dbTable th {
  background: var(--table-header-bg);
}

[data-theme="light"] #constellationsTable tbody tr:hover,
[data-theme="light"] #dbTable tbody tr:hover {
  background: var(--table-row-hover);
}

/* Form controls in light theme */
[data-theme="light"] .form-control {
  background: var(--input-bg);
  border-color: var(--border-color);
}

[data-theme="light"] .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Session selector in light theme */
[data-theme="light"] .session-selector {
  background: var(--input-bg);
  border-color: var(--border-color);
}

/* Status bar in light theme */
[data-theme="light"] .status-bar {
  background: var(--bg-surface);
}

[data-theme="light"] .status-bar:hover {
  background: rgba(74, 144, 226, 0.08);
}

/* Terminal tiles in light theme */
[data-theme="light"] .terminal-tile {
  background: var(--card-bg);
  box-shadow: 0 1px 3px var(--shadow-color);
}

[data-theme="light"] .terminal-tile .tile-header {
  background: var(--bg-light);
}

/* Control panels in light theme */
[data-theme="light"] .control-panel {
  background: var(--card-bg);
  box-shadow: 0 1px 3px var(--shadow-color);
}

/* Modal in light theme */
[data-theme="light"] .modal {
  background-color: var(--modal-overlay);
}

[data-theme="light"] .modal-content {
  background: var(--modal-bg);
  box-shadow: 0 8px 32px var(--shadow-color);
}

/* Session item in light theme */
[data-theme="light"] .session-item {
  background: var(--bg-surface);
}

[data-theme="light"] .session-item:hover {
  background: #f0f0f0;
}

/* Scrollbar in light theme */
[data-theme="light"]::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

[data-theme="light"]::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

[data-theme="light"]::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Help button in light theme */
[data-theme="light"] .help-button {
  background: var(--bg-surface);
}

[data-theme="light"] .help-button:hover {
  background: var(--primary-color);
  color: white;
}

/* Viewer tabs in light theme */
[data-theme="light"] .viewer-tabs {
  background: var(--header-bg);
}

/* Status indicators light theme */
[data-theme="light"] .status-connected {
  background: var(--status-success-bg);
}

[data-theme="light"] .status-disconnected {
  background: var(--status-error-bg);
}

[data-theme="light"] .status-connecting {
  background: var(--status-warning-bg);
}

/* Globe toolbar light theme */
[data-theme="light"] .globe-toolbar {
  background: var(--header-bg);
}

/* Overlap/MEO analysis panels light theme */
[data-theme="light"] #overlapTab [style*="background: var(--panel)"],
[data-theme="light"] #meoTab [style*="background: var(--panel)"] {
  background: var(--card-bg) !important;
}

/* Info boxes in light theme */
[data-theme="light"] [style*="background: rgba(41, 121, 255, 0.1)"] {
  background: rgba(74, 144, 226, 0.08) !important;
}

/* Database table in light theme */
[data-theme="light"] #databaseTab [style*="background: var(--bg-dark)"] {
  background: var(--card-bg) !important;
  box-shadow: 0 1px 3px var(--shadow-color);
}

/* Satellites tab styling in light theme */
[data-theme="light"] #satellitesTab [style*="background: var(--bg-dark)"] {
  background: var(--card-bg) !important;
  box-shadow: 0 1px 3px var(--shadow-color);
}

/* Analysis tabs panels in light theme */
[data-theme="light"] [style*="background: rgba(0,0,0,0.1)"] {
  background: rgba(0, 0, 0, 0.04) !important;
}

/* Inline border styling override */
[data-theme="light"] [style*="border: 1px solid var(--border)"] {
  border-color: var(--border-color) !important;
}

/* Section panels */
[data-theme="light"] .section {
  border-color: var(--border-color);
}

/* Progress bar track in light theme */
[data-theme="light"] .progress-bar {
  background: #e0e0e0;
}

/* Badge colors in light theme */
[data-theme="light"] .badge-locked {
  background: rgba(80, 200, 120, 0.15);
}

[data-theme="light"] .badge-tracking {
  background: rgba(74, 144, 226, 0.15);
}

[data-theme="light"] .badge-offline {
  background: rgba(160, 160, 160, 0.15);
}

/* Satellite item in light theme */
[data-theme="light"] .satellite-item {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="light"] .satellite-item:hover {
  background: #f0f0f0;
}

[data-theme="light"] .satellite-item.selected {
  background: rgba(74, 144, 226, 0.1);
}

/* Tab buttons in light theme */
[data-theme="light"] .tab-button:hover {
  background: #f0f0f0;
}

[data-theme="light"] .tab-button.active {
  background: var(--card-bg);
}

/* Viewer tab button in light theme */
[data-theme="light"] .viewer-tab-button:hover {
  color: var(--text-primary);
}

/* Constellation row hover */
[data-theme="light"] tr.constellation-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] tr.platform-row {
  background: var(--bg-surface);
}

/* Expand icon color */
[data-theme="light"] .expand-icon {
  color: var(--primary-color);
}

/* Sortable header hover in light theme */
[data-theme="light"] th.sortable:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Toolbar buttons in light theme */
[data-theme="light"] .toolbar-btn-secondary {
  background: var(--bg-surface);
}

[data-theme="light"] .toolbar-btn-secondary:hover {
  background: #e0e0e0;
}

/* Header status row styling */
[data-theme="light"] .header-status-row .status-bar {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

/* Status history dropdown in light theme */
[data-theme="light"] .status-history-dropdown {
  background: var(--dropdown-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .status-history-header {
  background: var(--bg-light);
}

/* GPS grid in light theme */
[data-theme="light"] .gps-grid h4 {
  color: var(--text-secondary);
}

/* Text muted and info in light theme */
[data-theme="light"] .muted {
  color: var(--text-secondary);
}

[data-theme="light"] .info-text {
  color: var(--text-secondary);
}

/* Placeholder text in light theme */
[data-theme="light"] .tile-placeholder {
  color: var(--text-secondary);
}

/* Form text muted */
[data-theme="light"] .form-text.text-muted {
  color: var(--text-secondary);
}

/* Session name input/display */
[data-theme="light"] .session-name-input {
  background: var(--input-bg);
  border-color: var(--border-color);
}

/* Checkbox and input styling in light theme */
[data-theme="light"] input[type="checkbox"] {
  accent-color: var(--primary-color);
}

/* Select dropdown in light theme */
[data-theme="light"] select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  padding-right: 2rem;
}

/* Dark theme select arrow */
select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a0a0a0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  padding-right: 2rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Ensure inline styles in analysis tabs work with theme */
[data-theme="light"] #overlapTab,
[data-theme="light"] #meoTab {
  color: var(--text-primary);
}

[data-theme="light"] #overlapTab h2,
[data-theme="light"] #overlapTab h3,
[data-theme="light"] #meoTab h2,
[data-theme="light"] #meoTab h3 {
  color: var(--text-primary);
}

[data-theme="light"] #overlapTab small,
[data-theme="light"] #meoTab small {
  color: var(--text-secondary);
}

/* Ensure the analysis panels have proper backgrounds */
[data-theme="light"] #overlapTab > div > section > div,
[data-theme="light"] #meoTab > div > section > div {
  background: var(--card-bg);
}

/* Make sure tables in overlap analysis have correct colors */
[data-theme="light"] #overlapTable,
[data-theme="light"] #overlapInViewTable {
  color: var(--text-primary);
}

[data-theme="light"] #overlapTab table thead tr,
[data-theme="light"] #meoTab table thead tr {
  border-color: var(--border-color);
}

/* Fix inline panel styles */
[data-theme="light"] [style*="var(--panel)"] {
  background: var(--card-bg) !important;
}

[data-theme="light"] [style*="var(--border)"] {
  border-color: var(--border-color) !important;
}


/* ============================================================================
   Admin / User Management Styles
   ============================================================================ */

/* Admin Badge in Header */
.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  margin-right: 8px;
}

/* User Menu Email */
.user-menu-email {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Logout item styling */
.user-menu-logout {
  color: var(--error-color);
}

.user-menu-logout:hover {
  background: rgba(231, 76, 60, 0.1);
}

.user-menu-version {
  padding: 8px 12px;
  text-align: center;
}

.user-menu-version .version-text {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  opacity: 0.7;
}

/* Badge styles for user table */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-admin {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.badge-user {
  background: rgba(74, 144, 226, 0.15);
  color: var(--primary-color);
  border: 1px solid rgba(74, 144, 226, 0.3);
}

.badge-active {
  background: rgba(80, 200, 120, 0.15);
  color: var(--success-color);
  border: 1px solid rgba(80, 200, 120, 0.3);
}

.badge-inactive {
  background: rgba(231, 76, 60, 0.15);
  color: var(--error-color);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

/* Orbit type badges - consistent colors: LEO: Light Blue, GEO: Blue, MEO: Red, HEO: Orange */
.badge-leo {
  background: rgba(135, 206, 235, 0.25);
  color: #87CEEB;
  border: 1px solid rgba(135, 206, 235, 0.4);
}

.badge-geo {
  background: rgba(74, 144, 226, 0.25);
  color: #4a90e2;
  border: 1px solid rgba(74, 144, 226, 0.4);
}

.badge-meo {
  background: rgba(231, 76, 60, 0.25);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.4);
}

.badge-heo {
  background: rgba(255, 165, 0, 0.25);
  color: #FFA500;
  border: 1px solid rgba(255, 165, 0, 0.4);
}

/* Users table styles */
.users-table {
  border-collapse: collapse;
  width: 100%;
}

.users-table th,
.users-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.users-table th {
  background: var(--table-header-bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.users-table tbody tr:hover {
  background: var(--table-row-hover);
}

.users-table .actions-cell {
  white-space: nowrap;
}

.users-table .empty-message {
  text-align: center;
  color: var(--text-secondary);
  padding: 32px;
}

/* Action buttons */
.btn-icon {
  padding: 6px 8px;
  min-width: auto;
}

.btn-icon svg {
  display: block;
}

/* Icon-only danger button (no background, just text color) */
.btn-icon.btn-danger {
  background: transparent;
  color: var(--error-color);
}

.btn-icon.btn-danger:hover {
  background: rgba(231, 76, 60, 0.1);
}

/* Solid danger button - ensure white text on red background */
.btn.btn-danger:not(.btn-icon) {
  background: var(--error-color);
  color: white;
  border: none;
}

.btn.btn-danger:not(.btn-icon):hover {
  background: #c0392b;
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--modal-bg);
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

/* Form error in modals */
.modal .form-error {
  padding: 12px;
  margin-bottom: 16px;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid var(--error-color);
  border-radius: 8px;
  color: var(--error-color);
  font-size: 13px;
}

/* Form hint text */
.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Light theme admin styles */
[data-theme="light"] .admin-badge {
  background: linear-gradient(135deg, #f39c12, #e67e22);
}

[data-theme="light"] .badge-admin {
  background: rgba(243, 156, 18, 0.1);
}

[data-theme="light"] .badge-user {
  background: rgba(74, 144, 226, 0.1);
}

[data-theme="light"] .badge-active {
  background: rgba(80, 200, 120, 0.1);
}

[data-theme="light"] .badge-inactive {
  background: rgba(231, 76, 60, 0.1);
}

[data-theme="light"] .badge-leo {
  background: rgba(135, 206, 235, 0.2);
  color: #5da5c7;
}

[data-theme="light"] .badge-geo {
  background: rgba(74, 144, 226, 0.15);
  color: #3a7dc4;
}

[data-theme="light"] .badge-meo {
  background: rgba(231, 76, 60, 0.15);
  color: #c94133;
}

[data-theme="light"] .badge-heo {
  background: rgba(255, 165, 0, 0.2);
  color: #cc8400;
}

[data-theme="light"] .modal-content {
  background: #fff;
}

/* ============================================================================
   Environment Indicator Banners
   Shows a persistent banner when connected to production database
   ============================================================================ */

.env-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 99999;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: help;
  user-select: none;
  animation: envBannerPulse 2s ease-in-out infinite;
}

.env-production {
  background: linear-gradient(135deg, #ff4444, #cc0000);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.env-local {
  background: linear-gradient(135deg, #50c878, #3da861);
  color: white;
  font-size: 11px;
  padding: 4px 12px;
  opacity: 0.9;
  animation: none;
}

.env-local:hover {
  opacity: 1;
}

@keyframes envBannerPulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
  }
  50% {
    box-shadow: 0 2px 16px rgba(255, 0, 0, 0.5);
  }
}

/* Light theme adjustments */
[data-theme="light"] .env-banner {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .env-production {
  background: linear-gradient(135deg, #ff5555, #dd0000);
}

/* Ensure banner doesn't overlap with other fixed elements */
body:has(.env-banner) .app-header {
  margin-top: 32px;
}

/* Footprints Admin Tab Styles */
#footprintsAdminTable {
  border-collapse: collapse;
}

#footprintsAdminTable th,
#footprintsAdminTable td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  font-size: 0.9rem;
}

#footprintsAdminTable th {
  background: var(--bg-secondary);
  font-weight: 600;
}

#footprintsAdminTable tbody tr:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}

#footprintsAdminTable .satellite-group-header {
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-light);
}

#footprintsAdminTable .satellite-group-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

#footprintsAdminTable .satellite-group-header .expand-icon {
  display: inline-block;
  width: 20px;
  text-align: center;
  font-weight: bold;
  color: var(--accent-color);
  margin-right: 0.5rem;
}

[data-theme="light"] #footprintsAdminTable .satellite-group-header {
  background: #f5f5f5;
}

[data-theme="light"] #footprintsAdminTable .satellite-group-header:hover {
  background: #e8e8e8;
}

/* Expand/Collapse All buttons */
#footprintsAdminTab .btn-sm.btn-secondary {
  min-width: 28px;
  padding: 0.25rem 0.5rem;
  font-weight: bold;
}

#footprintsAdminTable .footprint-row.selected {
  background: rgba(0, 150, 255, 0.1);
}

#footprintsAdminTable .footprint-row.selected:hover {
  background: rgba(0, 150, 255, 0.15);
}

#footprintsAdminTable .actions-cell {
  white-space: nowrap;
  text-align: right;
  padding: 0.25rem 0.5rem;
}

#footprintsAdminMapContainer {
  background: #f8f9fa;
}

[data-theme="dark"] #footprintsAdminMapContainer {
  background: var(--bg-dark);
}

/* Ensure map fills container properly */
#footprintsAdminMap {
  background: #e5e5e5;
}

.form-success {
  padding: 0.75rem;
  background: rgba(40, 167, 69, 0.15);
  border: 1px solid rgba(40, 167, 69, 0.3);
  border-radius: 4px;
  color: #28a745;
}