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

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;
}

.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;
}
