/* ============================================================
   TOKENS
============================================================ */
:root {
  --ink-900: #121814;
  --ink-800: #1b251e;
  --ink-700: #233027;
  --ink-600: #2c3c31;
  --line: #343a46;
  --ash: #8b92a0;
  --ash-soft: #5f6674;
  --paper: #f2f0ea;
  --ember: #046b58;
  --ember-dim: #e4592d;
  --amber: #ffb627;
  --danger: #e63946;
  --info: #4fa8d8;
  --success: #2c9357;

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-lift: 0 12px 32px -12px rgba(0, 0, 0, .55);
}

html {
  background: var(--ink-900) !important;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100dvh;
  background: var(--ink-800) !important;
}

body {
  margin: 0;
  background: var(--ink-900);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--ember);
  color: #1b1e25;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ink-800);
}

::-webkit-scrollbar-thumb {
  background: var(--ink-600);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ash-soft);
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.font-display {
  font-family: var(--font-display);
}

.font-mono {
  font-family: var(--font-mono);
}

/* ============================================================
   LAYOUT SHELL
============================================================ */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--ink-900);
}

.map-locked {
  height: 100vh;
  /* On utilise "vh" normal : Safari ne buggera plus sur la barre du bas ! */
  width: 100vw;
  overflow: hidden;
  touch-action: none;
}

.main-content {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background: var(--ink-900);
}

@media (max-width: 991.98px) {
  .app {
    min-height: 100dvh;
  }

  .main-content {
    margin-bottom: 5vh
  }
}

.bg-danger {
  background: var(--ember-dim) !important;
}

/* ---------- Topbar ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  background: linear-gradient(180deg, var(--ink-800), var(--ink-900));
  border-bottom: 1px solid var(--line);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.brand-mark {
  position: flex;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.32rem;
  letter-spacing: .3px;
  line-height: 1;
}

.brand-text small {
  display: block;
  font-family: var(--font-body);
  font-size: .66rem;
  font-weight: 500;
  color: var(--ash);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin-top: 3px;
}

.brand-subtext {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ash);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: .5rem;
  padding: .28rem .7rem .28rem .55rem;
  border-radius: 999px;
  background: rgba(230, 57, 70, .12);
  border: 1px solid rgba(230, 57, 70, .35);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #ff9aa2;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(230, 57, 70, .7);
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  0% {
    box-shadow: 0 0 0 0 rgba(230, 57, 70, .55);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(230, 57, 70, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(230, 57, 70, 0);
  }
}

.topbar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: var(--ash);
  font-size: .78rem;
}

.topbar-meta .meta-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}

.topbar-meta .meta-item span:first-child {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ash-soft);
}

.topbar-meta .meta-item span:last-child {
  font-family: var(--font-mono);
  color: var(--paper);
  font-size: .85rem;
}

/* ---------- Stats strip ---------- */
.stats-strip {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.kpi {
  background: var(--ink-800);
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.kpi-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--kpi-accent, var(--ember)) 16%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kpi-accent, var(--ember));
}

.kpi-icon svg {
  width: 18px;
  height: 18px;
}

.kpi-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: -.5px;
}

.kpi-label {
  font-size: .68rem;
  color: var(--ash);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 3px;
}

/* ---------- Main layout ---------- */
.main-layout {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

/* ---------- Sidebar (flottante au-dessus de la carte) ---------- */
.sidebar {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: 340px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  background: rgba(8, 15, 10, 0.8);
  backdrop-filter: blur(13px) saturate(0);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  transition: transform .35s cubic-bezier(.16, 1, .3, 1), opacity .3s ease;
}

.sidebar.is-hidden {
  transform: translateX(calc(-100% - 32px));
  opacity: 0;
  pointer-events: none;
}

/* Bouton pour afficher/masquer la sidebar : posé sur la carte,
   se déplace avec le bord de la sidebar grâce au sélecteur ~ */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  left: 370px;
  /* 16 (marge) + 360 (largeur sidebar) + 16 (espace) */
  transform: translateY(-50%);
  z-index: 16;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 30, 37, .92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--paper);
  cursor: pointer;
  box-shadow: var(--shadow-lift);
  transition: left .35s cubic-bezier(.16, 1, .3, 1), background .15s ease;
}

.sidebar-toggle:hover {
  background: var(--ink-700);
}

.sidebar-toggle i {
  display: block;
  transition: transform .3s ease;
}

.sidebar.is-hidden~.sidebar-toggle {
  left: 16px;
}

.sidebar.is-hidden~.sidebar-toggle i {
  transform: rotate(180deg);
}

.sidebar-head {
  flex: 0 0 auto;
  padding: .9rem 1rem .7rem;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: .3px;
  line-height: 1;
  margin-bottom: .25rem;
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--ash-soft);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--ink-700);
  border: 1px solid var(--line);
  color: var(--paper);
  border-radius: var(--radius-md);
  padding: .5rem .75rem .5rem 2rem;
  font-size: .85rem;
  font-family: var(--font-body);
  transition: border-color .15s ease, background .15s ease;
}

.search-input::placeholder {
  color: var(--ash-soft);
}

.search-input:focus {
  outline: none;
  border-color: var(--ember);
  background: var(--ink-600);
}

.filter-row {
  display: flex;
  gap: .4rem;
  margin-top: .65rem;
  flex-wrap: wrap;
}

.filter-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ash);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: .32rem .65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.filter-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--chip-color, var(--ash));
}

.filter-chip:hover {
  border-color: var(--ash-soft);
  color: var(--paper);
}

.filter-chip.active {
  background: var(--chip-color, var(--ember));
  border-color: var(--chip-color, var(--ember));
  color: var(--ink-900);
}

.filter-chip.active .dot {
  background: var(--ink-900);
}

.sidebar-sub {
  flex: 0 0 auto;
  padding: .55rem 1rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ash-soft);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}

.fire-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .5rem;
}

.fire-card {
  position: relative;
  display: flex;
  gap: .75rem;
  padding: .7rem .75rem .7rem .9rem;
  border-radius: var(--radius-md);
  margin-bottom: .4rem;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .05);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.fire-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55rem;
  bottom: .55rem;
  width: 3px;
  border-radius: 3px;
  background: var(--sev-color, var(--ash));
}

.fire-card:hover {
  background: var(--ink-700);
}

.fire-card.selected {
  background: var(--ink-700);
  border-color: var(--sev-color, var(--ember));
}

.fire-card-body {
  flex: 1 1 auto;
  min-width: 0;
}

.fire-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
}

.fire-name {
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fire-dept {
  font-size: .72rem;
  color: var(--ash);
  margin-top: 1px;
}

.fire-badge {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: .14rem .45rem;
  border-radius: 4px;
  color: var(--sev-color, var(--ash));
  background: color-mix(in srgb, var(--sev-color, var(--ash)) 14%, transparent);
  white-space: nowrap;
}

.fire-meta-row {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-top: .4rem;
  font-size: .72rem;
  color: var(--ash);
}

.fire-meta-row .val {
  font-family: var(--font-mono);
  color: var(--paper);
  font-weight: 500;
}

.fire-meta-row svg {
  width: 12px;
  height: 12px;
  margin-right: 2px;
  vertical-align: -1px;
}

.intensity-bar {
  height: 3px;
  border-radius: 2px;
  background: var(--ink-600);
  margin-top: .5rem;
  overflow: hidden;
}

.intensity-bar span {
  display: block;
  height: 100%;
  background: var(--sev-color, var(--ember));
  width: var(--intensity, 40%);
}

.empty-state {
  text-align: center;
  color: var(--ash-soft);
  padding: 2.5rem 1rem;
  font-size: .85rem;
}

/* ---------- Map area ---------- */
.map-wrap {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
}

#map {
  position: absolute;
  inset: 0;
}

#signal-map {
  width: 100%;
  height: 240px;
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: var(--ink-700) !important;
  border-top-color: transparent !important;
  border-bottom-color: transparent !important;
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: var(--ink-700) !important;
  border-top-color: transparent !important;
  border-bottom-color: transparent !important;
}

.maplibregl-popup-content {
  background: var(--ink-700) !important;
  color: var(--paper) !important;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
  padding: 0 !important;
  font-family: var(--font-body);

}

.maplibregl-popup {
  will-change: auto !important;
  /* Le VRAI responsable était ici */
  width: 260px !important;
  /* Force un chiffre pair pour que le translate(-50%) tombe juste */
}

/* 2. Le contenu s'adapte et lance l'animation "Pop" */
.maplibregl-popup-content {
  width: 100% !important;
  animation: popupPop 0.15s ease-out;
}

@keyframes popupPop {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }

  60% {
    opacity: 1;
    transform: scale(1.03);
    /* Le léger dépassement pour l'effet rebond */
  }

  100% {
    opacity: 1;
    transform: none;
    /* Le secret absolu pour éviter le texte flou ! */
  }
}

/* 3. L'animation avec effet rebond (qui se désactive à la fin) */

.maplibregl-popup-tip {
  border-top-color: var(--ink-700) !important;
  border-bottom-color: var(--ink-700) !important;
}

.maplibregl-popup-close-button {
  color: var(--ash);
  font-size: 1.1rem;
  padding: 2px 8px;
}

.maplibregl-popup-close-button:hover {
  background: transparent;
  color: var(--paper);
}

.maplibregl-ctrl-top-right {
  top: auto;
}

.maplibregl-ctrl-group {
  background: var(--ink-700) !important;
  border: 1px solid var(--line) !important;
}

.maplibregl-ctrl-group button {
  background: transparent !important;
}

.maplibregl-ctrl-group button+button {
  border-top: 1px solid var(--line) !important;
}

.maplibregl-ctrl-icon {
  filter: invert(1) brightness(1.6);
}

.maplibregl-ctrl {
  border-radius: var(--radius-md) !important;
}

.popup-card {
  min-width: 230px;
}

.popup-head {
  padding: .7rem .85rem .55rem;
  border-bottom: 1px solid var(--line);
}

.popup-head h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 2px;
}

.popup-head .popup-dept {
  font-size: .72rem;
  color: var(--ash);
}

.popup-body {
  padding: .65rem .85rem .8rem;
}

.popup-button {
  margin-top: .65rem;
  text-align: center;
  width: 100%;
}

.popup-button .btn {
  width: 100%;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  font-size: .76rem;
  color: var(--ash);
  padding: .2rem 0;
}

.popup-row .v {
  font-family: var(--font-mono);
  color: var(--paper);
  font-weight: 500;
}

.popup-sev {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--sev-color);
}

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

/* marker */
.fire-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sev-color, var(--ember));
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--sev-color, var(--ember)) 55%, transparent);
  cursor: grab;
}

.fire-marker i {
  color: var(--paper);
  font-size: 1rem;
}

.fire-marker.is-active {
  animation: emberPulse 1.8s ease-out infinite;
}

@keyframes emberPulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--sev-color, var(--ember)) 55%, transparent);
  }

  70% {
    box-shadow: 0 0 0 14px color-mix(in srgb, var(--sev-color, var(--ember)) 0%, transparent);
  }

  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--sev-color, var(--ember)) 0%, transparent);
  }
}

/* legend */
/* ============================================================
   LÉGENDE REPLIABLE
============================================================ */

/* Le conteneur qui fixe la position en bas à gauche de la carte */
.legend-wrapper {
  position: absolute;
  left: 370px;
  bottom: 16px;
  z-index: 10;
  transition: left .35s cubic-bezier(.16, 1, .3, 1);
}

.sidebar.is-hidden~.legend-wrapper {
  left: 16px;
}

/* Le bouton */
.btn-legend-toggle {
  background: rgba(27, 30, 37, 0.92);
  backdrop-filter: blur(2px);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: var(--shadow-lift);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-legend-toggle:hover {
  background: var(--ink-700);
}

/* La boîte de la légende */
/* La boîte de la légende (État FERMÉ par défaut) */
.map-legend {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 190px;

  backdrop-filter: blur(2px);
  background: rgba(27, 30, 37, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  box-shadow: var(--shadow-lift);
  font-size: 0.72rem;

  /* Paramètres d'invisibilité */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  /* Position de départ (plus bas et légèrement réduit, comme le début de ton keyframe) */
  transform: translateY(15px) scale(0.95);
  transform-origin: bottom left;

  /* LA MAGIE EST ICI : La transition gère l'aller et le retour sur toutes les propriétés */
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* État OUVERT (activé par le JavaScript) */
.map-legend.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  /* Position finale (à sa place normale) */
  transform: translateY(0) scale(1);
}

/* Le reste du style intérieur de la légende */
.map-legend .legend-title {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.62rem;
  color: var(--ash);
  margin-bottom: 0.45rem;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
  color: var(--ash);
}

.legend-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.btn-report {
  font-size: .80rem;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: .32rem .65rem;
  border-radius: 999px;
  color: var(--paper);
  background: var(--danger);
  border: 1px solid var(--danger);
  transition: all .15s ease;
}

.btn-report:hover {
  background: var(--danger-dim);
  border-color: var(--danger-dim);
}

.map-toast {
  position: absolute;
  top: 16px;
  left: 370px;
  z-index: 10;
  border-radius: var(--radius-md);
  font-size: .72rem;
  color: var(--ash);
  max-width: 280px;
  transition: left .35s cubic-bezier(.16, 1, .3, 1);
}

.map-toast .btn {
  text-transform: uppercase;
}

.sidebar.is-hidden~.map-toast {
  left: 16px;
}

.map-toast strong {
  color: var(--danger);
}

/* footer */
.footer-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: .45rem 1.25rem;
  background: var(--ink-900);
  border-top: 1px solid var(--line);
  font-size: .68rem;
  color: var(--ash-soft);
}

.footer-bar a {
  color: var(--ember);
  font-weight: 600;
}

.footer-bar a:hover {
  text-decoration: underline;
}

.footer-sep {
  opacity: .5;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 991.98px) {
  .stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .sidebar {
    width: 300px;
  }

  .topbar-meta {
    display: none;
  }
}

@media (max-width: 991.98px) {
  .maplibregl-ctrl {
    display: none;
  }

  .sidebar {
    left: 12px;
    right: 12px;
    top: 12px;
    bottom: auto;
    width: auto;
    max-height: 45vh;
    /* Un peu plus d'espace pour la liste */
  }

  /* --- NOUVEAU COMPORTEMENT MOBILE : ACCORDÉON --- */
  .sidebar.is-hidden {
    transform: none !important;
    /* La sidebar ne sort plus de l'écran */
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* On cache le contenu de la liste quand c'est fermé */
  .sidebar.is-hidden .fire-list {
    display: none !important;
  }

  /* On retire la bordure du bas du header pour que ce soit plus propre */
  .sidebar.is-hidden .sidebar-head {
    border-bottom: none;
  }

  /* Intégration du bouton toggle à droite du titre */
  .sidebar-toggle {
    top: 21px !important;
    bottom: auto !important;
    left: auto !important;
    right: 18px !important;
    transform: none !important;
    width: 34px;
    height: 34px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Flèche vers le haut quand la liste est ouverte */
  .sidebar-toggle i {
    transform: rotate(90deg) !important;
    font-size: 1.1rem;
    color: var(--ash);
  }

  /* Flèche vers le bas quand la liste est fermée */
  .sidebar.is-hidden~.sidebar-toggle i {
    transform: rotate(-90deg) !important;
  }

  /* On s'assure que la légende ne touche pas la nav du bas */
  .legend-wrapper {
    bottom: calc(90px + env(safe-area-inset-bottom)) !important;
    left: 12px !important;
  }
}

@media (max-width: 575.98px) {
  .stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .kpi {
    padding: .65rem .85rem;
  }

  .kpi-num {
    font-size: 1.2rem;
  }

  .brand-text {
    font-size: 1.05rem;
  }
}


.alert-danger {
  color: var(--danger);
  background-color: rgba(230, 57, 70, 0.12);
  border: 1px solid rgba(230, 57, 70, 0.35);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.80rem;
}

.alert-success {
  color: var(--success);
  background-color: rgba(40, 180, 99, 0.12);
  border: 1px solid rgba(40, 180, 99, 0.35);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.80rem;
}

.alert-loading {
  color: var(--ash);
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.80rem;
}

.text-ember {
  color: var(--ember);
}

.alert-info {
  color: var(--info);
  background-color: rgba(79, 168, 216, 0.12);
  border: 1px solid rgba(79, 168, 216, 0.35);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.80rem;
}


/* BUTTONS */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .85rem;
  border-radius: var(--radius-md);
  padding: .55rem 1.1rem;
  border: 1px solid transparent;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  letter-spacing: .2px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus {
  box-shadow: none;
}

.btn-sm {
  padding: .35rem .75rem;
  font-size: .76rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: .75rem 1.5rem;
  font-size: .95rem;
}

.btn-primary {
  background: var(--ember-dim);
  border-color: var(--ember-dim);
  color: #fff;
}

.btn-primary:hover {
  color: #fff;
  background: var(--ember);
  border-color: var(--ember);
}

.btn-primary:active {
  background: var(--ember) !important;
  border-color: var(--ember-dim);
}

.btn-secondary {
  background: var(--ink-700);
  border-color: var(--line);
  color: var(--paper);
}

.btn-secondary:hover {
  background: var(--ink-600);
  color: var(--paper);
  border-color: var(--ash-soft);
}

.btn-outline-light {
  background: transparent;
  border-color: var(--line);
  color: var(--paper);
}

.btn-outline-light:hover {
  background: var(--ink-700);
  color: var(--paper);
  border-color: var(--ash-soft);
}

.btn-danger {
  background: linear-gradient(180deg, var(--danger), #b6222f);
  border-color: #d03c48;
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(230, 57, 70, .6);
}

.btn-danger:hover {
  filter: brightness(1.1);
  color: #fff;
}

.btn-success {
  background: var(--ember);
  border-color: var(--controlled);
  color: #0d1a14;
}

.btn-success:hover {
  filter: brightness(1.1);
  color: #0d1a14;
  background: var(--success);
  border-color: var(--success);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ash);
}

.btn-ghost:hover {
  color: var(--paper);
  background: var(--ink-700);
}

.btn:disabled,
.btn.disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}


/* INPUTS */
label,
.form-label {
  font-size: .76rem;
  font-weight: 600;
  color: var(--ash);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: .4rem;
  display: block;
}

.form-control,
.form-select {
  background: var(--ink-700);
  border: 1px solid var(--line);
  color: var(--paper);
  border-radius: var(--radius-md);
  padding: .55rem .8rem;
  font-size: .86rem;
  font-family: var(--font-body);
  transition: border-color .15s ease, background .15s ease;
}

.form-control::placeholder {
  color: var(--ash-soft);
}

.form-control:focus,
.form-select:focus {
  outline: none;
  box-shadow: none;
  border-color: var(--ember);
  background: var(--ink-600);
  color: var(--paper);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%238b92a0' d='M8 11 3 6h10z'/%3E%3C/svg%3E");
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-valid {
  border-color: var(--controlled);
}

.form-feedback {
  font-size: .72rem;
  margin-top: .35rem;
}

.form-feedback.invalid {
  color: var(--danger);
}

.form-feedback.valid {
  color: var(--controlled);
}

.input-group-text {
  background: var(--ink-600);
  border: 1px solid var(--line);
  color: var(--ash);
  border-radius: var(--radius-md);
}





/* NAVBAR */
/* Structure globale de la Navbar */

.navbar-pro {
  position: relative;
  width: 100%;
  z-index: 1000;

  /* LA MAGIE EST ICI : Utilisation de Grid pour un centrage absolu */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: var(--ink-800);
  padding: 1rem 1.5rem;
  padding-top: calc(1rem + env(safe-area-inset-top)) !important;
  pointer-events: none;
  border-bottom: 1px solid var(--line);
}

.navbar-pro>* {
  pointer-events: auto;
}

/* --- Placement précis des 3 blocs --- */
.navbar-left {
  justify-self: start;
  /* Pousse le logo tout à gauche */
  display: flex;
  align-items: center;
}

.navbar-center {
  justify-self: center;
  /* Force le menu au milieu exact de l'écran */
}

.navbar-right {
  justify-self: end;
  /* Pousse les outils tout à droite */
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- Gestion du Responsive (Mobile & Tablette) --- */
@media (max-width: 991.98px) {
  .navbar-pro {
    /* Quand le menu central disparaît sur petit écran, on repasse en flex classique */
    display: flex;
    justify-content: space-between;
  }
}

/* --- Style des onglets centraux --- */
.nav-links {
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--paper);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.nav-links a:hover {
  color: var(--paper);
  text-decoration: none;
  opacity: 0.8;
}

.nav-links a.active {
  color: var(--ember);
  border-bottom-color: var(--ember);
}


.badge-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--status-color);
  background: color-mix(in srgb, var(--status-color) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--status-color) 40%, transparent);
  padding: .3rem .7rem;
  border-radius: 999px;
}

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

.page-hero {
  background:
    radial-gradient(ellipse 900px 260px at 50% -60px, var(--color-accent), transparent 65%),
    linear-gradient(180deg, var(--ink-800), var(--ink-900));
  border-bottom: 1px solid var(--line);
  padding: 2.25rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.page-hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem 1.25rem;
  color: var(--ash);
  font-size: .85rem;
  margin-top: .35rem;
}


.page-hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 1080px;
  margin: 0 auto;
}

.page-hero-inner .page-hero-date {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  margin: 0;
  padding: 0;
  color: var(--ash);
}

.page-hero-inner h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0;
  color: var(--ash);
}

.page-hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.9rem;
  margin: 0;
  color: var(--paper);
}

.page-hero-emergency {
  max-width: 600px;
  margin: 1.25rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  background: rgba(230, 57, 70, .1);
  border: 1px solid rgba(230, 57, 70, .32);
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: .65rem .95rem;
  font-size: .82rem;
}

.page-hero-emergency i {
  font-size: 1.15rem;
  flex: 0 0 auto;
}



/* ============================================================
   BARRE DE NAVIGATION MOBILE (BOTTOM NAV) - STYLE APP
============================================================ */

.bottom-nav-mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;

  /* Fond avec ton nouveau vert profond (--ink-900 = rgb(18, 24, 20)) et effet de flou */
  background: var(--ink-800);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  border-top: 1px solid var(--line);

  /* Masqué par défaut sur ordinateur */
  display: none;
  justify-content: space-around;
  gap: 0.5rem;
  align-items: center;
  z-index: 1050;

  padding-top: 0.3rem;
  padding-bottom: calc(0.3rem + env(safe-area-inset-bottom));
}


.bottom-nav-mobile .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--ash);
  font-size: 0.65rem;
  font-weight: 600;
  gap: 0.2rem;
  position: relative;
  flex: 1;
  transition: color 0.2s ease;
  text-align: center;
}


.bottom-nav-mobile .nav-item.signaler {
  background: rgba(230, 57, 70, 0.2);
  color: var(--danger);
  border-radius: 10px;
  font-weight: bold;
  padding: 0.15rem 0.35rem;
  border: 1px solid rgba(230, 57, 70, 0.35);
}

.bottom-nav-mobile .nav-item i {
  font-size: 1.3rem;
}

.bottom-nav-mobile .nav-item:hover,
.bottom-nav-mobile .nav-item:active {
  color: var(--paper);
}

.bottom-nav-mobile .nav-item.active {
  color: var(--ember);
}

.bottom-nav-mobile .nav-item .nav-badge {
  position: absolute;
  top: -2px;
  right: 25%;
  font-size: 0.55rem;
  font-weight: bold;
  padding: 0.15rem 0.35rem;
  background: var(--ember-dim);
  color: #fff;
  border-radius: 50rem;
}

/* ============================================================
   CORRECTIF DE CHEVAUCHEMENT (Seulement sur mobile)
============================================================ */
@media (max-width: 991.98px) {

  /* 1. On affiche la barre sur mobile */
  .bottom-nav-mobile {
    display: flex;
  }


  /* 3. On remonte les éléments flottants de la carte (bouton sidebar, légende) 
          pour qu'ils ne soient pas bloqués derrière la barre de navigation */

}

.offcanvas {
  background-color: var(--ink-800);
  color: var(--paper);
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
}


.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--ink-900);
}

.login-card {
  margin-top: 5rem;
  background: var(--ink-800);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--paper);
}

.dropdown-custom {
  background: var(--ink-800);
  border-color: var(--line);
  border-radius: var(--radius-md);
  min-width: 220px;
}

.dropdown-custom .dropdown-item {
  color: var(--paper);
  transition: background .15s ease, color .15s ease;
}

.dropdown-custom .dropdown-item:active,
.dropdown-custom .dropdown-item:hover {
  background: var(--ink-700) !important;
  color: var(--paper);
}




/* PAGE FICHE */
.detail-card {
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ---------- Composeur de mise à jour ---------- */
.composer-body {
  padding: 1rem 1.1rem .25rem;
}

.composer-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--paper);
  resize: none;
  font-size: .92rem;
  font-family: var(--font-body);
  padding: 0;
}

.composer-textarea::placeholder {
  color: var(--ash-soft);
}

.composer-textarea:focus {
  outline: none;
}

.composer-footer {
  background: var(--ink-900);
  border-top: 1px solid var(--line);
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex: 1 1 auto;
  min-width: 0;
}

.btn-action-icon {
  flex: 0 0 auto;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink-800);
  border: 1px solid var(--line);
  color: var(--ash);
  cursor: pointer;
  transition: all .15s ease;
}

.btn-action-icon:hover {
  background: var(--ink-700);
  color: var(--paper);
}

.composer-link {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .4rem .8rem;
  color: var(--ash-soft);
  font-size: .8rem;
}

.composer-link input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--paper);
  font-size: .8rem;
}

.composer-link input::placeholder {
  color: var(--ash-soft);
}

.composer-link input:focus {
  outline: none;
}

.preview-container {
  position: relative;
  display: inline-block;
  margin: 0 0 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 4px;
  background: var(--ink-900);
}

.preview-container img {
  max-height: 120px;
  border-radius: 4px;
  display: block;
}

.btn-remove-preview {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .85rem;
}

/* ---------- Fil d'actualité ---------- */
.timeline-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--paper);
  margin-bottom: 1rem;
}

.updates-feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}


/* UPDATE CARD COMMUNITY */
.update-card.is-community {
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
}

.update-card.is-community .update-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  color: var(--ash);
}

.update-card.is-community .update-card-body p {
  margin: 0;
  font-size: .9rem;
  color: var(--paper);
  line-height: 1.6;
  white-space: pre-line;
}

/* FIN UPDATE CARD COMMUNITY */

/* UPDATE CARD ADMIN */
.update-card.is-admin {
  background: var(--ink-800);
  border: 1px solid var(--ember);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
}

.update-card.is-admin .update-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  color: var(--ember);
  font-size: 1rem;
  font-weight: 600;
}

.update-card.is-admin .update-card-body p {
  margin: 0;
  font-size: .9rem;
  color: var(--paper);
  line-height: 1.6;
  white-space: pre-line;
}

/* FIN UPDATE CARD ADMIN */

/* UPDATE CARD SYSTEM */
.update-card.is-system {
  background: var(--ink-800);
  border: 1px solid rgba(255, 183, 39, 0.5);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
}

.update-card.is-system .update-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  color: var(--amber);
  font-size: 1rem;
  font-weight: 600;
}

.update-card.is-system .update-card-body p {
  margin: 0;
  font-size: .9rem;
  color: var(--paper);
  line-height: 1.6;
  white-space: pre-line;
}


.avatar-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink-600);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  font-size: .75rem;
}

.update-date {
  font-size: .72rem;
  color: var(--ash-soft);
  font-family: var(--font-mono);
}




.update-card-attachments {
  margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.attached-photo {
  position: relative;
  display: inline-block;
  width: 130px;
  height: 100px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
}

.attached-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attached-photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  opacity: 0;
  transition: opacity .2s ease;
}

.attached-photo:hover .attached-photo-overlay {
  opacity: 1;
}

.attached-link {
  display: flex;
  align-items: center;
  background: var(--ink-700);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--paper);
  overflow: hidden;
  max-width: 320px;
}

.attached-link:hover {
  background: var(--ink-600);
  color: var(--paper);
}

.link-icon {
  background: var(--ink-900);
  padding: .5rem .7rem;
  color: var(--ash);
}

.link-text {
  padding: .5rem .7rem;
  font-size: .8rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .fiche-layout {
    grid-template-columns: 1fr;
  }

  .fiche-sidebar {
    position: static;
  }

  .fiche-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575.98px) {
  .page-hero-title {
    font-size: 1.5rem;
  }

  #detail-map {
    height: 260px;
  }
}


.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--ink-800);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table th,
.table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  font-size: 0.82rem;
  color: var(--paper);
  border: none;
}

.table th {
  background: var(--ink-700);
  font-weight: 600;
}

.title-mention {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--ember);
}

.timeline-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--paper);
  margin-bottom: 1rem;
}

#detail-map {
  border-radius: var(--radius-md) !important;
  overflow: hidden !important;
  /* Force la coupure (clipping) de la carte qui dépasse */
}

/* S'assure que le canvas généré par le script respecte l'arrondi */
#detail-map .maplibregl-canvas {
  border-radius: var(--radius-md) !important;
}

/* ============================================================
   BANNIÈRE COOKIES (INFORMATIVE)
============================================================ */
@media (max-width: 991.98px) {
  .cookie-banner {
    left: 50%;
    transform: translateX(-50%);
    right: auto;
  }
}

.cookie-banner {
  position: fixed;
  bottom: 24px;
  right: 10px;
  width: calc(100% - 32px);
  max-width: 400px;

  background: var(--ink-700);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--ember);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);

  padding: 1rem;
  z-index: 2000;

  display: flex;
  flex-direction: column;
  gap: 0.85rem;

  /* Animation d'apparition */
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}


.cookie-content {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.cookie-icon {
  flex: 0 0 auto;
  font-size: 1.25rem;
  color: white;
  /* Couleur bleue pour l'information */
  margin-top: -2px;
}

.cookie-text p {
  font-size: 0.8rem;
  color: var(--paper);
  margin: 0;
  line-height: 1.45;
}

.cookie-actions {
  display: flex;
  justify-content: flex-end;
}

.cookie-actions .btn {
  width: 100%;
  /* Bouton pleine largeur sur le petit encart */
}

/* Ajustement pour mobile : on remonte l'encart au-dessus de la barre de navigation du bas */
@media (max-width: 991.98px) {
  .cookie-banner {
    bottom: calc(90px + env(safe-area-inset-bottom));
  }
}


/* CUSTOM SWITCH (DROPDOWN NOTIFICATIONS)*/

/* Empêche le fond de devenir gris moche quand on passe la souris sur la ligne du switch */
.dropdown-custom .switch-item {
  padding: 0.6rem 0.85rem !important;
  cursor: default;
}

.dropdown-custom .switch-item:hover {
  background: transparent !important;
}

/* Le texte : on annule l'effet majuscule des autres labels */
.switch-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: none;
  color: var(--paper);
  cursor: pointer;
  margin: 0;
}

/* On retire les marges parasites de Bootstrap */
.dropdown-custom .form-switch {
  padding-left: 0;
  margin: 0;
}

/* Le design de l'interrupteur */
.dropdown-custom .form-check-input {
  margin: 0;
  width: 2.6em;
  height: 1.3em;
  background-color: var(--ink-600);
  border-color: var(--line);
  cursor: pointer;
}

/* Quand il est allumé : Couleur Verte VigiFeux */
.dropdown-custom .form-check-input:checked {
  background-color: var(--ember);
  border-color: var(--ember);
}

/* Quand on clique dessus (retire l'ombre bleue par défaut) */
.dropdown-custom .form-check-input:focus {
  box-shadow: none;
  border-color: var(--ash-soft);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255, 255, 255, 0.75%29'/%3e%3c/svg%3e");
}

.dropdown-custom .form-check-input:checked:focus {
  border-color: var(--ember);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.form-check {
  min-height: 0 !important;
}

.modal-header {
  padding-top: calc(1rem + env(safe-area-inset-top)) !important;
}

/* On fait la même chose pour l'en-tête du menu latéral (offcanvas) */
.offcanvas-header {
  padding-top: calc(1rem + env(safe-area-inset-top)) !important;
}


/* Bonus : Si tu as des modales plein écran sur mobile, on s'assure que 
   la boîte elle-même ne passe pas sous la barre noire d'iOS */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin-top: calc(0.5rem + env(safe-area-inset-top));
  }

  .offcanvas-footer {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom)) !important;
  }

  #map {
    bottom: calc(4rem + env(safe-area-inset-bottom));
  }
  .container {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom)) !important;
  }
}

.green-link {
  color:var(--ember);
}



.signal-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.75rem 1rem 3rem;
  }

  .signal-layout {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
    align-items: center;
  }

  .signal-steps {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  /* ---------- Cartes d'étape ---------- */
  .step-card {
    background: var(--ink-800);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .step-head {
    display: flex;
    gap: .9rem;
    align-items: flex-start;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    position: relative;
  }

  .step-num {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--step-accent) 18%, transparent);
    color: var(--step-accent);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: .95rem;
  }

  .step-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    color: var(--paper);
  }

  .step-title i {
    color: var(--step-accent);
  }

  .step-optional {
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--ash-soft);
    font-family: var(--font-body);
    font-weight: 600;
    margin-left: .55rem;
    border: 1px solid var(--line);
    padding: .12rem .45rem;
    border-radius: 999px;
  }

  .step-desc {
    font-size: .78rem;
    color: var(--ash);
    margin: .25rem 0 0;
  }

  .step-body {
    padding: 1.15rem 1.25rem 1.3rem;
  }

  /* ---------- Carte de positionnement ---------- */
  #signal-map {
    width: 100%;
    height: 280px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    overflow: hidden;
  }

  .map-hint {
    font-size: .74rem;
    color: var(--ash);
  }

  /* ---------- Zone de dépôt des photos ---------- */
  .upload-zone {
    position: relative;
    border: 1.5px dashed var(--line);
    border-radius: var(--radius-md);
    background: var(--ink-700);
    padding: 1.75rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
  }

  .upload-zone:hover,
  .upload-zone.dragover {
    border-color: var(--ember);
    background: var(--ink-600);
  }

  .upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
  }

  .upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    color: var(--ash);
    font-size: .85rem;
    pointer-events: none;
  }

  .upload-placeholder i {
    font-size: 1.8rem;
    color: var(--ember);
  }

  .upload-placeholder small {
    color: var(--ash-soft);
    font-size: .72rem;
  }

  .photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: .6rem;
    margin-top: .9rem;
  }

  .photo-preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    background: var(--ink-700);
  }

  .photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .photo-preview-item .remove-photo {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(20, 22, 27, .85);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    cursor: pointer;
    padding: 0;
  }

  .photo-preview-item .watermark-tag {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(20, 22, 27, .75);
    color: var(--amber);
    font-size: .55rem;
    text-align: center;
    padding: 2px 0;
    font-family: var(--font-mono);
    letter-spacing: .3px;
  }

  /* ---------- Récapitulatif (sticky) ---------- */
  .signal-recap {
    width: 100%;
    padding: 1.15rem 0rem 1.3rem;
  }

  .recap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    font-size: .76rem;
    padding: .3rem 0;
  }


  .recap-value {
    font-family: var(--font-mono);
    color: var(--paper);
    font-weight: 500;
    text-align: right;
  }

  .recap-privacy {
    font-size: .68rem;
    color: var(--ash-soft);
    line-height: 1.5;
  }

  /* ---------- Responsive ---------- */
  @media (max-width: 991.98px) {
    .signal-layout {
      grid-template-columns: 1fr;
    }

    .signal-recap {
      position: static;
    }
  }

  @media (max-width: 575.98px) {
    .signal-hero-inner {
      flex-direction: column;
      text-align: center;
    }

    .signal-hero-title {
      font-size: 1.5rem;
    }

    .signal-hero-emergency {
      flex-direction: column;
      text-align: center;
    }
  }