/* ==========================================================================
   RADAR MÉTÉO - GLASSMORPHIC STYLESHEET
   ========================================================================== */

:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Glassmorphism Variables */
  --glass-bg: rgba(15, 23, 42, 0.65);
  --glass-bg-hover: rgba(30, 41, 59, 0.75);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-light: rgba(255, 255, 255, 0.22);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(16px) saturate(180%);

  /* Accent Colors */
  --primary-accent: #38bdf8;
  --primary-accent-glow: rgba(56, 189, 248, 0.35);
  --success-color: #22c55e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  /* Spacing & Sizes */
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Light Mode Overrides */
body.light-theme {
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-hover: rgba(241, 245, 249, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-light: rgba(0, 0, 0, 0.15);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.12);
  --text-main: #0f172a;
  --text-muted: #64748b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: #0b0f19;
  color: var(--text-main);
}

/* Map Container */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Common Glass Panel Base */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  z-index: 10;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  border-color: var(--glass-border-light);
}

/* Buttons */
.glass-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--glass-border-light);
  transform: translateY(-1px);
}

.glass-btn:active {
  transform: translateY(1px);
  background: rgba(255, 255, 255, 0.08);
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
}

.mini-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.play-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary-accent);
  color: #0f172a;
  border: none;
  box-shadow: 0 0 20px var(--primary-accent-glow);
}

.play-btn:hover {
  background: #7dd3fc;
  box-shadow: 0 0 28px var(--primary-accent-glow);
  transform: scale(1.05);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   HEADER PANEL
   ========================================================================== */
.header-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-title-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.radar-ping-icon {
  position: relative;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary-accent);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.center-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-accent);
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.6); opacity: 0; }
}

.app-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

/* ==========================================================================
   LEGEND PANEL
   ========================================================================== */
.legend-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 220px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.legend-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.legend-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.legend-panel.collapsed .legend-body {
  display: none;
}

.legend-compact-swatches {
  display: none;
}

.legend-panel.collapsed .legend-compact-swatches {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 2px;
}

.color-badge-mini {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-panel.collapsed #legendArrow {
  transform: rotate(180deg);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
}

.color-badge {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-label {
  flex-grow: 1;
  color: var(--text-main);

}

.legend-val {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   PLAYER CONTROL PANEL
   ========================================================================== */
.player-panel {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(650px, calc(100vw - 32px));
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.player-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.time-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.time-clock {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

.time-relative {
  font-size: 0.85rem;
  color: var(--primary-accent);
  font-weight: 500;
}

.speed-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  padding: 2px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.speed-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.speed-btn.active, .speed-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

/* Timeline Slider Custom Styling */
.slider-container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
}

#timelineSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

#timelineSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-accent);
  box-shadow: 0 0 10px var(--primary-accent-glow);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

#timelineSlider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #7dd3fc;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.spacer {
  flex-grow: 1;
}

/* ==========================================================================
   LOADING OVERLAY
   ========================================================================== */
.glass-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.glass-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  padding: 36px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 768px) {
  .header-panel {
    top: 12px;
    left: 12px;
    right: 12px;
    justify-content: space-between;
    padding: 10px 14px;
  }

  .app-subtitle {
    display: none;
  }

  .legend-panel {
    top: 75px;
    right: 12px;
    width: 170px;
    padding: 10px;
  }

  .player-panel {
    bottom: 12px;
    width: calc(100vw - 24px);
    padding: 14px 16px;
    gap: 10px;
  }

  .time-clock {
    font-size: 1.3rem;
  }

  .time-relative {
    font-size: 0.75rem;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .play-btn {
    width: 46px;
    height: 46px;
  }
}
