/* ==========================================================================
   SankiSecure — console d'exploitation Protection Civile
   Pensée pour un écran de salle d'opération : fond sombre, contrastes forts,
   information hiérarchisée à trois mètres de distance.
   ========================================================================== */

body {
  background: var(--ink-900);
  min-height: 100dvh;
}

/* ------------------------------------------------------------- Écran d'accès */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(760px 520px at 50% -10%, rgba(201, 162, 76, .13), transparent 60%),
    var(--ink-900);
}

.gate-card {
  width: min(420px, 100%);
  padding: 38px 34px 32px;
  border-radius: var(--r-xl);
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
  box-shadow: var(--shadow-3);
  text-align: center;
}

.gate-card h1 { font-size: 21px; margin-top: 18px; }
.gate-card p { margin-top: 9px; font-size: 13.5px; color: var(--mute-400); }

.gate-card input {
  width: 100%;
  margin-top: 22px;
  padding: 15px;
  text-align: center;
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: .3em;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, .05);
  color: var(--gold-300);
}

.gate-card input:focus { outline: none; border-color: var(--gold-500); }

.gate-err {
  margin-top: 14px;
  font-size: 13px;
  color: var(--alert-300);
  min-height: 18px;
}

/* ------------------------------------------------------------------ Ossature */

.console { display: none; min-height: 100dvh; flex-direction: column; }
.console.on { display: flex; }

.chead {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(7, 12, 24, .9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.chead .brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.chead .brand-name { font-size: 15px; font-weight: 300; letter-spacing: .1em; color: #E9EDF5; }
.chead .brand-name b { font-weight: 700; color: var(--gold-400); }

.service {
  padding-left: 16px;
  margin-left: 4px;
  border-left: 1px solid var(--hairline-soft);
  font-size: 12.5px;
  color: var(--mute-400);
  letter-spacing: .04em;
}

.chead-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.link-state { color: var(--mute-400); }
.link-state[data-on="1"] { color: #34D399; }
.link-state[data-on="1"] .dot { animation: blink 2.4s infinite; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, .04);
  color: #C6CDDB;
  transition: background .16s var(--ease), color .16s var(--ease);
}

.icon-btn:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.icon-btn[aria-pressed="false"] { color: var(--alert-400); border-color: rgba(229, 52, 42, .35); }

/* ------------------------------------------------------------------- Stats */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--hairline-soft);
  border-bottom: 1px solid var(--hairline-soft);
}

.stat {
  background: var(--ink-900);
  padding: 14px 22px;
}

.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.stat span {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mute-500);
}

.stat.hot b { color: var(--alert-400); }
.stat.gold b { color: var(--gold-400); }

/* ------------------------------------------------------------------- Corps */

.cbody {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  min-height: 0;
}

.list-col {
  border-right: 1px solid var(--hairline-soft);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.filters {
  display: flex;
  gap: 7px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--hairline-soft);
  overflow-x: auto;
}

.filter {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline-soft);
  background: transparent;
  color: var(--mute-400);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.filter[aria-pressed="true"] {
  background: rgba(231, 196, 118, .14);
  border-color: var(--gold-500);
  color: var(--gold-300);
}

.list { flex: 1; overflow-y: auto; padding: 12px; display: grid; gap: 9px; align-content: start; }

.empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--mute-500);
  font-size: 13.5px;
  line-height: 1.7;
}

/* Carte d'alerte */
.alert-card {
  --tint: var(--nat-autre);
  position: relative;
  width: 100%;
  text-align: left;
  padding: 15px 16px 15px 19px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .018));
  overflow: hidden;
  transition: border-color .18s var(--ease), transform .12s var(--ease);
}

.alert-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--tint);
}

.alert-card:hover { border-color: color-mix(in srgb, var(--tint) 50%, transparent); }
.alert-card[aria-selected="true"] {
  border-color: var(--gold-500);
  background: linear-gradient(180deg, rgba(231, 196, 118, .12), rgba(255, 255, 255, .02));
}

.alert-card.fresh { animation: flash 1.6s var(--ease) 3; }

@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 52, 42, 0); }
  40% { box-shadow: 0 0 0 3px rgba(229, 52, 42, .38), 0 0 34px -6px rgba(229, 52, 42, .6); }
}

.ac-top { display: flex; align-items: center; gap: 9px; }

.ac-ico {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--tint) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 36%, transparent);
  color: var(--tint);
}

.ac-type { font-size: 14.5px; font-weight: 600; }

.ac-age {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--mute-400);
  flex: none;
}

.ac-age.urgent { color: var(--alert-400); font-weight: 600; }

.ac-meta {
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--mute-400);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ac-foot { margin-top: 11px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.ac-ref {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--mute-500);
  margin-left: auto;
}

/* Pastilles de statut */
.st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.st-nouvelle { color: #FF8A6B; background: rgba(229, 52, 42, .14); }
.st-prise_en_charge { color: var(--gold-400); background: rgba(231, 196, 118, .12); }
.st-en_route { color: #7FB4FF; background: rgba(59, 130, 246, .14); }
.st-sur_place { color: #5FE3B6; background: rgba(34, 195, 154, .14); }
.st-cloturee { color: #93A0B8; background: rgba(255, 255, 255, .05); }
.st-fausse_alerte { color: #93A0B8; background: rgba(255, 255, 255, .04); }

/* ----------------------------------------------------------------- Détail */

.detail { overflow-y: auto; padding: 22px; min-height: 0; }

.detail-empty {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--mute-500);
  gap: 12px;
  padding: 40px;
}

.d-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }

.d-title { font-size: 24px; }

.d-sub { margin-top: 6px; font-size: 13px; color: var(--mute-400); }

.d-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
  align-items: start;
}

.d-map {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--ink-800);
  aspect-ratio: 4 / 3;
}

/* Texte de repli visible tant que la tuile OpenStreetMap n'est pas arrivée :
   un rectangle vide laisserait croire à une panne. */
.d-map::after {
  content: 'Chargement de la carte — les coordonnées ci-contre restent exploitables';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 12.5px;
  color: var(--mute-500);
  z-index: 0;
}

.d-map iframe { position: relative; z-index: 1; width: 100%; height: 100%; border: 0; display: block; }

.map-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 11px; }

.info-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 13.5px;
}

.info-row:last-child { border-bottom: none; }

.info-row dt {
  flex: none;
  width: 108px;
  color: var(--mute-500);
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding-top: 2px;
}

.info-row dd { margin: 0; flex: 1; line-height: 1.55; }

.info-row dd a { color: var(--gold-300); }

.d-photo {
  margin-top: 16px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.d-photo img { width: 100%; display: block; }

.status-bar {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: rgba(231, 196, 118, .05);
}

.status-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.sbtn {
  padding: 13px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, .045);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}

.sbtn:hover { background: rgba(255, 255, 255, .1); }
.sbtn[data-current="1"] { border-color: var(--gold-500); background: rgba(231, 196, 118, .16); color: var(--gold-300); }
.sbtn.danger { color: #FFA894; border-color: rgba(229, 52, 42, .3); }

.hist { margin-top: 18px; display: grid; gap: 8px; }

.hist-row {
  display: flex;
  gap: 12px;
  font-size: 12.5px;
  color: var(--mute-400);
  font-family: var(--mono);
}

.hist-row b { color: #C6CDDB; font-weight: 600; font-family: var(--font); }

/* ------------------------------------------------------------- Alerte plein écran */

.klaxon {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(7, 12, 24, .82);
  backdrop-filter: blur(10px);
  animation: klax 1.2s infinite;
}

.klaxon.on { display: grid; }

@keyframes klax {
  0%, 100% { background: rgba(7, 12, 24, .82); }
  50% { background: rgba(60, 10, 6, .86); }
}

.klaxon-card {
  width: min(520px, 100%);
  text-align: center;
  padding: 40px 32px 32px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(229, 52, 42, .45);
  background: linear-gradient(180deg, rgba(229, 52, 42, .18), rgba(11, 18, 32, .96));
  box-shadow: 0 0 80px -20px rgba(229, 52, 42, .8);
}

.klaxon-card h2 { font-size: 30px; margin-top: 16px; }
.klaxon-card p { margin-top: 10px; color: #E4CFCC; }

.klaxon-ico {
  width: 76px; height: 76px;
  margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(229, 52, 42, .22);
  border: 1px solid rgba(255, 138, 107, .5);
  color: #FF8A6B;
  animation: pop 1s var(--ease) infinite alternate;
}

@keyframes pop { from { transform: scale(1); } to { transform: scale(1.09); } }

/* ---------------------------------------------------------------- Adaptatif */

@media (max-width: 1100px) {
  .d-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .cbody { grid-template-columns: 1fr; }
  .list-col { border-right: none; border-bottom: 1px solid var(--hairline-soft); }
  .list { max-height: 46vh; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .service { display: none; }
}
