/* Reset and base styles */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: #1a1a1a;
}

/* Link styles */
a {
  color: #5a9ff5;
  text-decoration: none;
}

a:hover {
  color: #7bb3ff;
  text-decoration: underline;
}

a:visited {
  color: #87CEEB; /* Light blue */
}

/* Sidebar styles */
#sidebar {
  width: 500px;
  background: #2c2c2c;
  border-right: 1px solid #444;
  overflow-y: auto;
  padding: 1rem;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #444;
}

#sidebar h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #fff;
  font-weight: 600;
}

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

.icon-btn {
  background: #3a3a3a;
  border: 1px solid #555;
  color: #e0e0e0;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #4a4a4a;
  border-color: #666;
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(0);
}

.icon-btn.active {
  background: #4a90e2;
  border-color: #5a9ff5;
}

/* Geometry Selector */
.geometry-selector, .atlas-selector {
  margin: 1rem 0;
  padding: 1rem;
  background: #333;
  border-radius: 8px;
  border: 1px solid #444;
}

.geometry-selector label, .atlas-selector label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #aaa;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.geometry-selector select, .atlas-selector select {
  width: 100%;
  background: #2c2c2c;
  border: 1px solid #555;
  color: #e0e0e0;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.geometry-selector select:hover, .atlas-selector select:hover {
  border-color: #666;
  background: #333;
}

.geometry-selector select:focus, .atlas-selector select:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.geometry-selector select option, .atlas-selector select option {
  background: #2c2c2c;
  color: #e0e0e0;
  padding: 0.5rem;
}

/* Label columns container */
#labels-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  flex: 1;
}

.hemisphere-column {
  display: flex;
  flex-direction: column;
}

.hemisphere-column h3 {
  font-size: 0.9rem;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #444;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Label list styles */
.label-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.label-list li {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
  font-size: 0.85rem;
  background: #333;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  min-height: 2rem;
  line-height: 1.4;
}

.label-list li:hover {
  background: #3a3a3a;
  border-color: #555;
}

.label-list li.active {
  background: #4a90e2;
  border-color: #5a9ff5;
  color: #fff;
  font-weight: 500;
}

/* VTK container */
#vtk-container {
  flex: 1;
  background: #0a0a0a;
  position: relative;
}

/* Floating button in VTK container */
.floating-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(44, 44, 44, 0.95);
  color: #e0e0e0;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.floating-btn:hover {
  background: rgba(74, 144, 226, 0.95);
  border-color: #4a90e2;
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(74, 144, 226, 0.3);
}

.floating-btn:active {
  transform: scale(0.98);
}

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

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

#sidebar::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* Loading indicator */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1.2rem;
  text-align: center;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}

/* 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);
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #2c2c2c;
  color: #e0e0e0;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: slideIn 0.3s ease;
}

.close {
  color: #aaa;
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close:hover,
.close:focus {
  color: #fff;
}

.instructions h2 {
  color: #fff;
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.instructions h3 {
  color: #4a90e2;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.instructions ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.instructions li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.instructions strong {
  color: #5a9ff5;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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