/* ==========================================================================
   Flight 3D Viewer Styles (CesiumJS)
   ========================================================================== */

/* The map container must establish a positioning context so absolute
   children (toggle button, loading overlay) stay inside the map area. */
.flight-map-container {
  position: relative;
}

/* Isolate the Leaflet map's stacking context so its internal z-index
   values (up to 1000 for controls) don't bleed over the 3D overlay. */
#flight-map {
  isolation: isolate;
}

/* Toggle button — floats in the top-right corner of the map area,
   above Leaflet controls but below modals. */
.flight-3d-toggle-btn {
  position: absolute;
  top: 12px;
  right: 60px;
  z-index: 1000;
  background: white;
  color: #1a1a1a;
  border: 2px solid #e5e7eb;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.flight-3d-toggle-btn:hover {
  background: #f3f4f6;
  border-color: #3b82f6;
  color: #3b82f6;
}

.flight-3d-toggle-btn.btn-active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.flight-3d-toggle-btn.btn-active:hover {
  background: #2563eb;
}

/* 3D container — overlays the 2D map at the same size */
.flight-3d-container {
  position: relative;
  width: 100%;
  height: 450px;
  overflow: hidden;
  background: #0a0a1a;
  z-index: 10;
}

/* Override Cesium viewer defaults for rounded corners */
.flight-3d-container .cesium-viewer {
  border-radius: 12px;
  overflow: hidden;
}

.flight-3d-container .cesium-widget canvas {
  border-radius: 12px;
}

/* Hide Cesium's default credit container clutter */
.flight-3d-container .cesium-viewer-bottom {
  display: none !important;
}

/* Loading overlay — positioned over the 3D container */
.flight-3d-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 26, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
  color: white;
  font-size: 15px;
  font-weight: 500;
}

.flight-3d-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: flight3d-spin 0.8s linear infinite;
}

@keyframes flight3d-spin {
  to { transform: rotate(360deg); }
}

/* Fly-along controls bar */
.flight-3d-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: white;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  flex-wrap: wrap;
}

.flight-3d-fly-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.flight-3d-fly-btn:hover {
  background: #2563eb;
}

.flight-3d-speed-select {
  padding: 5px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  background: #f9fafb;
  cursor: pointer;
}

.flight-3d-scrubber {
  flex: 1;
  min-width: 120px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e5e7eb;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.flight-3d-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.flight-3d-scrubber::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.flight-3d-info-badge {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.flight-3d-vario {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  background: #f3f4f6;
  color: #374151;
  font-variant-numeric: tabular-nums;
}

.flight-3d-vario.climbing {
  background: #dcfce7;
  color: #166534;
}

.flight-3d-vario.sinking {
  background: #fee2e2;
  color: #991b1b;
}

/* Responsive: stack controls on mobile */
@media (max-width: 640px) {
  .flight-3d-controls {
    padding: 8px 12px;
    gap: 8px;
  }

  .flight-3d-scrubber {
    min-width: 80px;
    order: 10; /* Push to next line */
    flex-basis: 100%;
  }

  .flight-3d-container {
    height: 400px;
  }
}
