:root {
  color-scheme: dark;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --bg: #1a1a1a;
  --panel: #242424;
  --muted: #908e8a;
  --accent: #d4af37;           /* User POI Gold */
  --accent-example: #38bdf8;   /* Example POI Cyan */
  --border: #333333;
  --text: #e4e2de;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-weight: 300;
}

#canvas-container {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Side Panel Headers & Titles */
.main-title {
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 0.8rem 0;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.5px;
}

.version-tag {
  font-size: 0.75rem;
  color: var(--accent);
  vertical-align: super;
}

/* Floating Content Sidebar Layers */
.side-panel {
  position: absolute;
  width: 360px;
  max-height: calc(100vh - 3rem);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  pointer-events: auto;
}

.side-panel-left {
  left: 1.5rem;
  top: 1.5rem;
  bottom: 1.5rem;
  overflow-y: auto;
  position: absolute;
}

.side-panel-left::after {
  content: '';
  position: sticky;
  display: block;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  margin-top: -24px;
  background: linear-gradient(to bottom, transparent, rgba(26, 26, 26, 0.85));
  pointer-events: none;
}

.side-panel-right {
  right: 1.5rem;
  top: 1.5rem;
  bottom: 1.5rem;
  overflow-y: auto;
}

.panel-section {
  background: rgba(36, 36, 36, 0.9);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  backdrop-filter: blur(10px);
}

#panel-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* Allows nested flex child scrolling */
  overflow: hidden;
}

#poi-list-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 6px;
  margin-top: 4px;
}

/* Custom Scrollbar for POI List */
#poi-list-content::-webkit-scrollbar {
  width: 6px;
}

#poi-list-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

#poi-list-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#poi-list-content::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.panel-section h2 {
  margin: 0 0 0.8rem 0;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  flex-shrink: 0;
}

.panel-header {
  flex-shrink: 0;
}

.poi-section-header {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px dashed var(--border);
  padding-bottom: 4px;
}

/* Right Panel Switcher Tabs */
.panel-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
}

.tab-btn {
  flex: 1;
  background: #121212;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

.tab-btn:hover:not(.active) {
  border-color: var(--muted);
  color: var(--text);
}

/* Control Box Styles */
.control-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-shrink: 0; /* Prevent control box from shrinking */
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-group label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0;
}

.button-row {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}

.btn-control {
  background: #121212;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.82rem;
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-control:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-highlight {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-full-width {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.control-indicator {
  font-size: 0.82rem;
  color: var(--text);
  background: #121212;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 4px;
  min-width: 68px;
  text-align: center;
}

.rotation-slider {
  width: 100%;
  margin-top: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-sublabel {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 8px 0 0 0;
}

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

.form-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.form-row .form-group {
  flex: 1;
  min-width: 0;
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  box-sizing: border-box;
  background: #121212;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-tip {
  font-size: 0.75rem;
  color: var(--muted);
  margin: -0.5rem 0 1rem 0;
  font-style: italic;
}

.file-preview-zone {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.file-badge {
  background: #2d2d2d;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-submit {
  width: 100%;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.btn-submit:hover {
  background: var(--accent);
  color: #1a1a1a;
}

.btn-subtle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.15s, color 0.15s;
}

.btn-subtle:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* POI Detail Output Cards */
.placeholder-text {
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.5;
  margin: 0;
}

.details-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  word-break: break-all;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.details-links a:hover {
  text-decoration: underline;
}

/* Image Thumbnails Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.thumbnail-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  background: #121212;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.thumbnail-card:hover {
  border-color: var(--accent);
  transform: scale(1.03);
}

.thumbnail-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* File-type Thumbnails (non-image attachments) */
.thumbnail-card-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 8px 4px 6px;
  gap: 4px;
}

.thumbnail-card-file img {
  width: 60%;
  height: 60%;
  object-fit: contain;
  flex-shrink: 1;
}

.thumbnail-file-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Lightbox Modal Overlay */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.lightbox-content {
  max-width: 85vw;
  max-height: 80vh;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: var(--text);
  font-size: 2.2rem;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  user-select: none;
  transition: color 0.15s;
}

.lightbox-close:hover {
  color: var(--accent);
}

.lightbox-caption {
  margin-top: 14px;
  color: var(--text);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  text-align: center;
}

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

/* Visual Badge Indicator for POI Types in Sidebar */
.poi-badge-example {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-example);
  border: 1px solid rgba(56, 189, 248, 0.4);
  margin-left: 6px;
  vertical-align: middle;
}

.poi-badge-user {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent);
  border: 1px solid rgba(212, 175, 55, 0.4);
  margin-left: 6px;
  vertical-align: middle;
}

/* Bottom-right HUD: live cursor lat/lon over the lunar surface.
   Sits below and clear of the right side panel's width (360px + its 1.5rem inset). */
.coord-hud {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 10;
  background: rgba(36, 36, 36, 0.9);
  border: 1px solid var(--border);
  border-radius: 4px;
  backdrop-filter: blur(10px);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.coord-hud-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.coord-hud-value {
  font-size: 0.85rem;
  color: var(--text);
}

@media (max-width: 900px) {
  .coord-hud {
    right: 1rem;
    bottom: 1rem;
  }
}