/* Timeline slider high-tech style */
.timeline-slider-container {
  --min: 0;
  --max: 100;
  --value: 60;
  --percent: 0.6;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 14px 6px;
  border-radius: var(--radius-md, 12px);
  border: 1px solid var(--timeline-border, rgba(122, 139, 255, 0.16));
  background: var(--timeline-bg, linear-gradient(180deg, rgba(22, 23, 38, 0.72) 0%, rgba(12, 12, 18, 0.4) 100%));
  box-shadow: var(--timeline-shadow, inset 0 0 0 1px rgba(17, 18, 34, 0.5), 0 10px 18px rgba(10, 12, 26, 0.35));
}
.timeline-slider-shell {
  position: relative;
  height: 28px; /* Reduced height for sleeker look */
  border-radius: 999px;
  margin-bottom: 42px; /* Reserve space for value chip + year labels below the rail */
}
.timeline-slider-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--timeline-track-bg, linear-gradient(180deg, rgba(33, 37, 62, 0.8) 0%, rgba(21, 22, 38, 0.62) 55%, rgba(12, 12, 20, 0.4) 100%));
}
.timeline-slider-track,
.timeline-slider-progress,
.timeline-slider-glow {
  position: absolute;
  border-radius: inherit;
  pointer-events: none;
}

.timeline-slider-track {
  top: 50%;
  left: 16px;
  right: 16px;
  height: 6px;
  transform: translateY(-50%);
  background: var(--timeline-scrub-bg, linear-gradient(90deg, rgba(28, 30, 52, 0.9) 0%, rgba(20, 22, 38, 0.7) 100%));
  border: 1px solid var(--timeline-scrub-border, rgba(122, 139, 255, 0.18));
}

.timeline-slider-progress {
  left: 16px;
  top: 50%;
  height: 6px;
  width: max(18px, calc((100% - 32px) * var(--percent)));
  transform: translateY(-50%);
  border-radius: 14px;
  background: linear-gradient(90deg, var(--timeline-track-start) 0%, var(--timeline-track-mid) 55%, var(--timeline-track-end) 100%);
  box-shadow: 0 0 16px var(--timeline-glow, rgba(90, 139, 255, 0.45));
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

/* Enhanced glow when actively scrubbing */
.timeline-slider-input:active ~ .timeline-slider-progress {
  box-shadow: 0 0 24px var(--timeline-glow-active, rgba(90, 139, 255, 0.65)), 0 0 36px var(--timeline-glow-secondary, rgba(90, 139, 255, 0.35));
}

/* Pulsing animation when timeline is active */
body.timeline-active .timeline-slider-progress {
  animation: timeline-pulse 2s ease-in-out infinite;
}

@keyframes timeline-pulse {
  0%, 100% {
    box-shadow: 0 0 16px rgba(90, 139, 255, 0.45);
  }
  50% {
    box-shadow: 0 0 24px rgba(90, 139, 255, 0.65), 0 0 36px rgba(90, 139, 255, 0.25);
  }
}

.timeline-slider-glow {
  inset: 1px;
  background: var(--timeline-progress-bg, radial-gradient(circle at clamp(16px, calc(16px + (100% - 32px) * var(--percent)), calc(100% - 16px)) 50%, rgba(122, 139, 255, 0.35) 0%, rgba(122, 139, 255, 0.08) 35%, rgba(122, 139, 255, 0) 70%));
  filter: blur(12px);
}

.timeline-slider-value-chip {
  position: absolute;
  top: calc(100% + 4px);
  bottom: auto;
  left: clamp(16px, calc(16px + (100% - 32px) * var(--percent)), calc(100% - 16px));
  transform: translate(-50%, 0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--timeline-handle-border, rgba(122, 139, 255, 0.55));
  background: linear-gradient(135deg, rgba(122, 139, 255, 0.32) 0%, rgba(28, 30, 53, 0.88) 100%);
  color: var(--color-text-strong);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  box-shadow: 0 6px 16px rgba(90, 139, 255, 0.3);
  min-width: 140px;
  text-align: center;
  pointer-events: none;
  z-index: 4;
}

.timeline-slider-label {
  position: absolute;
  bottom: -32px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(122, 139, 255, 0.85);
  z-index: 1;
  transition: all 0.3s ease;
  text-shadow: 0 2px 8px rgba(90, 139, 255, 0.4);
}

/* Highlight effect when labels change */
@keyframes label-update {
  0%, 100% {
    color: rgba(122, 139, 255, 0.85);
    transform: scale(1);
  }
  50% {
    color: rgba(137, 179, 255, 1);
    transform: scale(1.12);
    text-shadow: 0 2px 12px rgba(90, 139, 255, 0.7);
  }
}

.timeline-slider-label--min {
  left: 16px;
}

.timeline-slider-label--max {
  right: 16px;
}

.timeline-slider-input {
  position: absolute;
  z-index: 3;
  width: calc(100% - 32px);
  height: 28px;
  left: 16px;
  top: 0;
  background: transparent;
  appearance: none;
  outline: none;
  margin: 0;
  border-radius: inherit;
}

.timeline-slider-input:focus-visible {
  outline: 2px solid rgba(122, 139, 255, 0.7);
  outline-offset: 6px;
}

.timeline-slider-input::-webkit-slider-runnable-track {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
}

.timeline-slider-input::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(122, 139, 255, 0.95);
  background: radial-gradient(circle at 30% 30%, var(--timeline-handle-bg) 0%, var(--timeline-handle-mid) 45%, var(--timeline-handle-end) 100%);
  box-shadow: 0 0 10px rgba(122, 139, 255, 0.45), 0 4px 18px rgba(20, 24, 52, 0.6);
  cursor: grab;
  position: relative;
  z-index: 3;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.timeline-slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(122, 139, 255, 0.65), 0 6px 24px rgba(20, 24, 52, 0.7);
}

.timeline-slider-input:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.25);
  box-shadow: 0 0 20px rgba(122, 139, 255, 0.85), 0 8px 32px rgba(20, 24, 52, 0.8);
}

.timeline-slider-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(122, 139, 255, 0.95);
  background: radial-gradient(circle at 30% 30%, var(--timeline-handle-bg) 0%, var(--timeline-handle-mid) 45%, var(--timeline-handle-end) 100%);
  box-shadow: 0 0 10px rgba(122, 139, 255, 0.45), 0 4px 18px rgba(20, 24, 52, 0.6);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.timeline-slider-input::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(122, 139, 255, 0.65), 0 6px 24px rgba(20, 24, 52, 0.7);
}

.timeline-slider-input:active::-moz-range-thumb {
  cursor: grabbing;
  transform: scale(1.25);
  box-shadow: 0 0 20px rgba(122, 139, 255, 0.85), 0 8px 32px rgba(20, 24, 52, 0.8);
}

.timeline-slider-input::-ms-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(122, 139, 255, 0.95);
  background: radial-gradient(circle at 30% 30%, var(--timeline-handle-bg) 0%, var(--timeline-handle-mid) 45%, var(--timeline-handle-end) 100%);
  box-shadow: 0 0 10px rgba(122, 139, 255, 0.45), 0 4px 18px rgba(20, 24, 52, 0.6);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.timeline-slider-input::-ms-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(122, 139, 255, 0.65), 0 6px 24px rgba(20, 24, 52, 0.7);
}

.timeline-slider-input:active::-ms-thumb {
  cursor: grabbing;
  transform: scale(1.25);
  box-shadow: 0 0 20px rgba(122, 139, 255, 0.85), 0 8px 32px rgba(20, 24, 52, 0.8);
}

.timeline-slider-input::-moz-range-track,
.timeline-slider-input::-ms-track {
  height: 100%;
  background: transparent;
  border: none;
  color: transparent;
}

.timeline-slider-input::-moz-range-progress {
  background: transparent;
}

.timeline-slider-ticks {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(231, 231, 234, 0.68);
  pointer-events: none;
  padding: 0 16px; /* Align with year labels above */
  margin-top: 2px; /* Space between year labels and Past/Future labels */
}

.timeline-slider-ticks span {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.timeline-slider-ticks span::before {
  content: '';
  width: 2px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(122, 139, 255, 0.65) 0%, rgba(122, 139, 255, 0) 100%);
  box-shadow: 0 0 6px rgba(122, 139, 255, 0.4);
}

.timeline-slider-ticks span::after {
  content: attr(data-label);
  opacity: 0.72;
}

.timeline-caption {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(231, 231, 234, 0.72);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Value chip smooth transitions */
.timeline-slider-value-chip {
  transition: left 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .timeline-slider-container {
  background: var(--timeline-bg);
  border-color: var(--timeline-border);
  box-shadow: var(--timeline-shadow);
}

[data-theme="light"] .timeline-slider-shell::before {
  background: var(--timeline-track-bg);
}

[data-theme="light"] .timeline-slider-track {
  background: var(--timeline-scrub-bg);
  border-color: var(--timeline-scrub-border);
}

[data-theme="light"] .timeline-slider-progress {
  box-shadow: 0 0 16px var(--timeline-glow);
}

[data-theme="light"] .timeline-slider-input:active ~ .timeline-slider-progress {
  box-shadow: 0 0 24px var(--timeline-glow-active), 0 0 36px var(--timeline-glow-secondary);
}

[data-theme="light"] .timeline-slider-glow {
  background: var(--timeline-progress-bg);
}

[data-theme="light"] .timeline-slider-value-chip {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(236, 243, 255, 0.96));
  color: var(--text-primary);
  border-color: var(--timeline-handle-border);
  box-shadow: 0 8px 18px rgba(15, 24, 64, 0.16);
}

[data-theme="light"] .timeline-slider-label,
[data-theme="light"] .timeline-slider-ticks {
  color: var(--text-secondary);
}

[data-theme="light"] .timeline-slider-ticks span::before {
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.7) 0%, rgba(79, 70, 229, 0) 100%);
  box-shadow: 0 0 6px rgba(79, 70, 229, 0.3);
}

[data-theme="light"] .timeline-slider-ticks span::after {
  color: var(--text-secondary);
  opacity: 0.8;
}

/* POI marker active/inactive visual states */
.poi-active {
  opacity: 1 !important;
  filter: saturate(1.2) brightness(1.1);
}

.poi-inactive {
  opacity: 0.3 !important;
  filter: saturate(0.5) brightness(0.7);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.poi-undated {
  opacity: 0.6 !important;
  filter: saturate(0.8) brightness(0.9);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Smooth transitions for POI state changes */
.text-chip--poi,
.leaflet-marker-icon,
.cesium-billboard {
  transition: opacity 0.3s ease, filter 0.3s ease, transform 0.2s ease;
}

/* Highlight animation for active POIs */
.poi-active.text-chip--poi {
  animation: poi-highlight-pulse 1.5s ease-in-out;
}

@keyframes poi-highlight-pulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(90, 139, 255, 0);
  }
  50% {
    box-shadow: 0 0 16px rgba(90, 139, 255, 0.6);
  }
}
