/* ==========================================================================
   Carte Feux Actifs - Design Responsive & Classification par Couleurs
   ========================================================================== */

:root {
  --bg-dark: #0b0f17;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.95);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(249, 115, 22, 0.3);
  
  --accent-orange: #f97316;
  --accent-red: #ef4444;
  --accent-yellow: #eab308;
  --accent-blue: #3b82f6;
  --accent-sky: #0284c7;
  --accent-purple: #8b5cf6;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', sans-serif;

  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* TOP HEADER */
.top-header {
  background: rgba(11, 15, 23, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.top-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
  flex-shrink: 0;
}

.title-container h1 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.title-container h1 span {
  background: linear-gradient(90deg, #ef4444, #eab308);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 10px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sector-bar {
  display: flex;
  align-items: center;
  padding: 0 14px 6px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sector-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  width: 100%;
  padding-top: 4px;
}

.sector-scroll::-webkit-scrollbar { display: none; }

.btn-sector, .btn-basemap, .btn-layer-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-sector:hover, .btn-sector.active {
  background: var(--accent-orange);
  color: white;
  border-color: transparent;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
}

.btn-basemap:hover, .btn-basemap.active {
  background: var(--accent-sky);
  color: white;
  border-color: transparent;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.4);
}

.btn-layer-toggle:hover, .btn-layer-toggle.active {
  background: #dc2626;
  color: white;
  border-color: transparent;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.btn-toggle-markers {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-toggle-markers:hover {
  background: rgba(51, 65, 85, 0.9);
  color: white;
}

.btn-toggle-markers.active {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.basemap-buttons {
  display: flex;
  gap: 4px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  white-space: nowrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-red);
}

/* MAIN LAYOUT */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}



/* MAP WRAPPER */
.map-wrapper {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background: #000;
}

.glass-panel {
  background: rgba(11, 15, 23, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
}

/* Crisp pixel rendering for zoomed-in satellite tiles */
.leaflet-tile-container img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.map-legend {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 800;
}

.satellite-date-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 800;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #38bdf8;
  border-left: 3px solid #38bdf8;
  padding: 8px 14px;
  border-radius: 12px;
  flex-wrap: wrap;
  transition: all 0.3s ease;
}

.satellite-date-badge.hidden {
  display: none !important;
}

.sentinel-badge-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #f8fafc;
}

.sentinel-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 2px 6px;
}

.btn-sentinel-nav {
  background: transparent;
  border: none;
  color: #38bdf8;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}

.btn-sentinel-nav:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
}

.sentinel-date-display {
  position: relative;
  font-weight: 700;
  color: #38bdf8;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.sentinel-date-display:hover {
  background: rgba(56, 189, 248, 0.15);
}

.sentinel-hidden-date-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.sentinel-quick-presets {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-preset {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-preset:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.btn-preset.active {
  background: #0284c7;
  color: white;
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.5);
}

.legend-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--accent-orange);
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.legend-item {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-foyer-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
}

.legend-zone-estim {
  background-color: rgba(185, 28, 28, 0.7);
  border-radius: 3px;
  border: 2px dashed #fca5a5;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.legend-red {
  background-color: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.legend-sdis {
  background-color: #dc2626;
  box-shadow: 0 0 12px #dc2626;
}

.legend-gray {
  background-color: #64748b;
  opacity: 0.6;
}

/* Pulsing outline for Google Maps style estimated fire zone polygon */
.google-fire-zone-path {
  stroke-dasharray: 8 5;
  animation: fireZonePulse 3s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 8px rgba(185, 28, 28, 0.9));
}

@keyframes fireZonePulse {
  from {
    fill-opacity: 0.35;
    stroke-opacity: 0.8;
  }
  to {
    fill-opacity: 0.55;
    stroke-opacity: 1.0;
  }
}

/* Pulsing outline for Leaflet GeoJSON polygons */
.commune-contour-path {
  stroke-dasharray: 6 4;
  animation: dashPulse 4s linear infinite;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.8));
}

@keyframes dashPulse {
  to {
    stroke-dashoffset: -20;
  }
}

/* FOYER MARKERS & BADGES */
.unique-zone-marker-with-date {
  display: flex;
  align-items: center;
}

.foyer-with-date-container {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zone-marker-box {
  border-radius: 50%;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  width: 26px;
  height: 26px;
}

.foyer-date-badge {
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.sdis-glow {
  background: #ef4444;
  color: white;
  border: 1.5px solid white;
  box-shadow: 0 0 12px rgba(239, 68, 68, 1);
}

.glow-red {
  background: #dc2626;
  color: white;
  border: 1px solid #fca5a5;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.glow-orange {
  background: #ea580c;
  color: white;
  border: 1px solid #fed7aa;
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.8);
}

.glow-yellow {
  background: #ca8a04;
  color: white;
  border: 1px solid #fef08a;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.8);
}

.glow-blue {
  background: #2563eb;
  color: white;
  border: 1px solid #bfdbfe;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
}

.yesterday-dim {
  background: rgba(71, 85, 105, 0.8);
  color: #cbd5e1;
}

/* LANDMARK BADGES */
.landmark-badge div {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 14px;
  color: white;
  font-weight: 700;
  font-size: 11px;
  border: 1.5px solid white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.rouen-style div { background: linear-gradient(135deg, #0284c7, #0369a1); }
.ruch-style div { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.arcs-style div { background: linear-gradient(135deg, #eab308, #ca8a04); }

/* RESPONSIVE MEDIA QUERIES */
@media (min-width: 769px) {
  .top-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 16px;
  }

  .top-header-row {
    padding: 0;
  }

  .sector-bar {
    padding: 0;
    border-top: none;
    margin-left: 12px;
  }

  .sector-scroll {
    padding-top: 0;
  }
}

@media (max-width: 768px) {
  .top-header-row {
    padding: 6px 10px;
  }

  .brand {
    gap: 8px;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .title-container h1 {
    font-size: 13px;
  }

  .subtitle { display: none; }
  .hide-mobile { display: none !important; }

  .main-layout {
    flex-direction: column;
  }

  .sector-bar {
    padding: 2px 10px 6px 10px;
  }

  .map-legend {
    top: 8px;
    right: 8px;
    padding: 6px 10px;
    font-size: 9px;
  }
}

/* ==========================================================================
   DATA AGE & MANUAL REFRESH BUTTON
   ========================================================================== */
.data-age-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-age-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(3, 105, 161, 0.25));
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  color: #38bdf8;
  white-space: nowrap;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.data-age-badge i {
  color: #38bdf8;
  font-size: 12px;
}

.btn-refresh {
  background: linear-gradient(135deg, #ea580c, #dc2626);
  border: 1px solid rgba(249, 115, 22, 0.4);
  color: white;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 12px rgba(234, 88, 12, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-refresh:hover {
  background: linear-gradient(135deg, #f97316, #ef4444);
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.5);
}

.btn-refresh.spinning i {
  animation: spin 1s linear infinite;
}

.btn-refresh.hidden {
  display: none !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   LOADING POPUP MODAL (BLOQUANT & ANIMÉ)
   ========================================================================== */
.loading-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loading-modal-card {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(249, 115, 22, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(249, 115, 22, 0.2);
  border-radius: 20px;
  padding: 32px 36px;
  width: 90%;
  max-width: 440px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loading-modal-overlay.active .loading-modal-card {
  transform: scale(1);
}

/* FLAME & RADAR ANIMATION */
.loading-animation-container {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.fire-icon-box {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: white;
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.7);
  z-index: 2;
  animation: fireGlow 1.8s ease-in-out infinite alternate;
}

.fire-pulse-ring {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(249, 115, 22, 0.6);
  animation: pulseRing 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  z-index: 1;
}

.fire-pulse-ring-outer {
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px dashed rgba(234, 179, 8, 0.4);
  animation: pulseRingOuter 3s linear infinite;
  z-index: 1;
}

@keyframes fireGlow {
  0% { transform: scale(0.96); box-shadow: 0 0 15px rgba(239, 68, 68, 0.6); }
  100% { transform: scale(1.04); box-shadow: 0 0 30px rgba(249, 115, 22, 0.9), 0 0 50px rgba(234, 179, 8, 0.5); }
}

@keyframes pulseRing {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes pulseRingOuter {
  0% { transform: rotate(0deg) scale(0.95); opacity: 0.5; }
  50% { opacity: 0.9; }
  100% { transform: rotate(360deg) scale(1.1); opacity: 0.5; }
}

/* TEXT & PROGRESS BAR */
.loading-title {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 6px;
}

.loading-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 22px;
  min-height: 18px;
}

.progress-bar-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f97316, #ef4444, #eab308);
  background-size: 200% 100%;
  border-radius: 10px;
  transition: width 0.3s ease-out;
  animation: gradientShift 2s linear infinite;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
}

.loading-eta {
  color: #64748b;
  font-weight: 500;
}

