/* ============================================================
   Extended Layers CSS — Intel Globe v2
   Timeline Scrubber · Fire Markers · Ship Markers

   Design system:
   - Background: #06070a
   - Accent: #C4D600 (lime)
   - Glass: rgba(6,7,10,0.88) + blur(24px)
   - Font: JetBrains Mono (data), Inter (UI)
   - Border radius: 14px
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   FEATURE 1: Timeline Scrubber — "Rewind Time"
   ════════════════════════════════════════════════════════════ */

#timeline-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  background: rgba(6, 7, 10, 0.88);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid rgba(196, 214, 0, 0.12);
  border-radius: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: border-color 0.3s ease;
}

#timeline-bar.rewind-mode {
  border-top-color: rgba(196, 214, 0, 0.35);
  box-shadow: 0 -4px 30px rgba(196, 214, 0, 0.06);
}

/* ── Left section: Play/Pause + LIVE ── */
.tl-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(196, 214, 0, 0.15);
  background: rgba(196, 214, 0, 0.05);
  color: #C4D600;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  transition: all 0.2s ease;
  user-select: none;
}

.tl-btn:hover {
  background: rgba(196, 214, 0, 0.12);
  border-color: rgba(196, 214, 0, 0.3);
}

.tl-btn:active {
  transform: scale(0.96);
}

.tl-play-btn {
  width: 36px;
  padding: 0;
}

.tl-play-btn.playing {
  background: rgba(196, 214, 0, 0.18);
  border-color: rgba(196, 214, 0, 0.4);
  box-shadow: 0 0 12px rgba(196, 214, 0, 0.15);
}

.tl-live-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tl-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #C4D600;
  box-shadow: 0 0 8px rgba(196, 214, 0, 0.6);
  animation: tl-live-pulse 2s ease-in-out infinite;
}

@keyframes tl-live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(196, 214, 0, 0.6); }
  50% { opacity: 0.5; box-shadow: 0 0 4px rgba(196, 214, 0, 0.3); }
}

.tl-live-btn.active {
  background: rgba(196, 214, 0, 0.12);
  border-color: rgba(196, 214, 0, 0.3);
}

.tl-live-btn:not(.active) .tl-live-dot {
  background: #667;
  box-shadow: none;
  animation: none;
}

/* ── Center section: Scrubber + Timestamp ── */
.tl-center {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.tl-scrubber-wrapper {
  position: relative;
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tl-density {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.5;
}

.tl-scrubber-track {
  position: relative;
  flex: 1;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(196, 214, 0, 0.08);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
}

.tl-scrubber-track:hover {
  border-color: rgba(196, 214, 0, 0.2);
}

.tl-scrubber-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg,
    rgba(196, 214, 0, 0.04) 0%,
    rgba(196, 214, 0, 0.08) 50%,
    rgba(196, 214, 0, 0.12) 100%
  );
  pointer-events: none;
}

.rewind-mode .tl-scrubber-fill {
  background: linear-gradient(90deg,
    rgba(196, 214, 0, 0.08) 0%,
    rgba(196, 214, 0, 0.15) 80%,
    rgba(196, 214, 0, 0.25) 100%
  );
}

.tl-playhead {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  background: #C4D600;
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 10px rgba(196, 214, 0, 0.6);
  transition: opacity 0.2s;
}

.tl-playhead-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #C4D600;
  box-shadow: 0 0 12px rgba(196, 214, 0, 0.5);
  border: 2px solid #06070a;
}

.tl-event-markers {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  pointer-events: none;
}

.tl-timestamp-display {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.tl-ts-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #C4D600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(196, 214, 0, 0.1);
  border: 1px solid rgba(196, 214, 0, 0.2);
}

.tl-ts-label.live {
  animation: tl-live-pulse 2s ease-in-out infinite;
}

.tl-ts-label:not(.live) {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
}

.tl-ts-time {
  font-size: 12px;
  color: #e8eaed;
  letter-spacing: 0.5px;
  min-width: 140px;
}

/* ── Right section: Speed selector ── */
.tl-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.tl-speed-group {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(196, 214, 0, 0.08);
}

.tl-speed-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #889;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.15s;
}

.tl-speed-btn:hover {
  color: #e8eaed;
  background: rgba(255, 255, 255, 0.04);
}

.tl-speed-btn.active {
  background: rgba(196, 214, 0, 0.15);
  color: #C4D600;
  box-shadow: 0 0 8px rgba(196, 214, 0, 0.1);
}


/* ════════════════════════════════════════════════════════════
   FEATURE 2: Fire Tooltips
   ════════════════════════════════════════════════════════════ */

.fire-tooltip {
  position: fixed;
  z-index: 100;
  min-width: 200px;
  max-width: 280px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(6, 7, 10, 0.92);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255, 107, 53, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 107, 53, 0.08);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #e8eaed;
  pointer-events: none;
  animation: ft-fade-in 0.15s ease-out;
}

@keyframes ft-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ft-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 107, 53, 0.15);
}

.ft-icon {
  font-size: 14px;
}

.ft-title {
  font-size: 12px;
  font-weight: 600;
  color: #ff6b35;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ft-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 11px;
}

.ft-lbl {
  color: #889;
  font-weight: 400;
}

.ft-val {
  color: #e8eaed;
  font-weight: 500;
  text-align: right;
}

.ft-conf-high { color: #ff453a; font-weight: 600; }
.ft-conf-nominal { color: #ff6b35; }
.ft-conf-low { color: #cc5500; }


/* ════════════════════════════════════════════════════════════
   FEATURE 3: Ship Tooltips
   ════════════════════════════════════════════════════════════ */

.ship-tooltip {
  position: fixed;
  z-index: 100;
  min-width: 200px;
  max-width: 280px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(6, 7, 10, 0.92);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(0, 212, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 212, 255, 0.08);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #e8eaed;
  pointer-events: none;
  animation: st-fade-in 0.15s ease-out;
}

@keyframes st-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.st-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.15);
}

.st-icon {
  font-size: 14px;
}

.st-title {
  font-size: 12px;
  font-weight: 600;
  color: #00d4ff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.st-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 11px;
}

.st-lbl {
  color: #889;
  font-weight: 400;
}

.st-val {
  color: #e8eaed;
  font-weight: 500;
  text-align: right;
}

.st-following {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 212, 255, 0.15);
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #C4D600;
  text-transform: uppercase;
}

.st-hint {
  margin-top: 6px;
  text-align: center;
  font-size: 9px;
  color: #667;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}


/* ════════════════════════════════════════════════════════════
   Layer Toggle Additions (fires + ships)
   ════════════════════════════════════════════════════════════ */

/* The layer toggles for fires and ships are dynamically inserted
   by their respective JS files into the #layers-panel under the
   "LIVE FEEDS" section. They use the existing .layer-toggle styles
   from the main globe CSS. These additions ensure proper icon colors. */

.layer-toggle .lt-icon {
  font-size: 15px;
  transition: filter 0.2s;
}

.layer-toggle:hover .lt-icon {
  filter: brightness(1.3);
}

/* Active fires icon glow */
#lt-fires:checked ~ .lt-icon {
  text-shadow: 0 0 8px rgba(255, 107, 53, 0.5);
}

/* Active ships icon glow */
#lt-ships:checked ~ .lt-icon {
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}


/* ════════════════════════════════════════════════════════════
   Responsive — Mobile Adaptations
   ════════════════════════════════════════════════════════════ */

/* Tablet: compact timeline */
@media (max-width: 900px) {
  #timeline-bar {
    height: 52px;
    padding: 0 12px;
    gap: 10px;
  }

  .tl-btn {
    height: 32px;
    padding: 0 8px;
    font-size: 10px;
  }

  .tl-play-btn {
    width: 32px;
  }

  .tl-ts-time {
    font-size: 10px;
    min-width: 100px;
  }

  .tl-speed-btn {
    padding: 4px 6px;
    font-size: 10px;
  }

  .fire-tooltip,
  .ship-tooltip {
    max-width: 220px;
    font-size: 10px;
  }
}

/* Mobile: hide timeline, show compact version */
@media (max-width: 640px) {
  #timeline-bar {
    display: none;
  }

  /* Compact timeline for mobile — minimal controls */
  #timeline-bar.mobile-compact {
    display: flex;
    height: 44px;
    padding: 0 8px;
    gap: 6px;
  }

  #timeline-bar.mobile-compact .tl-timestamp-display {
    display: none;
  }

  #timeline-bar.mobile-compact .tl-speed-group {
    display: none;
  }

  #timeline-bar.mobile-compact .tl-scrubber-track {
    height: 20px;
  }

  /* Tooltips become bottom sheets on mobile */
  .fire-tooltip,
  .ship-tooltip {
    position: fixed;
    bottom: 50px;
    left: 8px !important;
    right: 8px;
    top: auto !important;
    max-width: none;
    width: auto;
    border-radius: 12px;
    font-size: 10px;
  }
}

/* Extra small: further compact */
@media (max-width: 380px) {
  #timeline-bar.mobile-compact .tl-live-btn span:not(.tl-live-dot) {
    display: none;
  }

  .tl-btn {
    padding: 0 6px;
  }
}


/* ════════════════════════════════════════════════════════════
   Accessibility
   ════════════════════════════════════════════════════════════ */

.tl-btn:focus-visible {
  outline: 2px solid rgba(196, 214, 0, 0.5);
  outline-offset: 2px;
}

.tl-speed-btn:focus-visible {
  outline: 2px solid rgba(196, 214, 0, 0.5);
  outline-offset: 1px;
}

.tl-scrubber-track:focus-visible {
  outline: 2px solid rgba(196, 214, 0, 0.4);
  outline-offset: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tl-live-dot {
    animation: none;
  }

  .tl-ts-label.live {
    animation: none;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}


/* ════════════════════════════════════════════════════════════
   High-DPI Canvas Rendering
   ════════════════════════════════════════════════════════════ */

.tl-density {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Ensure timeline density canvas doesn't capture pointer events */
.tl-density,
.tl-scrubber-fill,
.tl-playhead,
.tl-event-markers {
  pointer-events: none;
}