/* ==========================================================================
   SankiSecure — application citoyenne
   Conçue pour être utilisée d'une main, debout, dans l'urgence, la nuit.
   ========================================================================== */

html, body { height: 100%; }

body {
  background:
    radial-gradient(900px 620px at 50% -12%, rgba(229, 52, 42, .17), transparent 62%),
    radial-gradient(700px 520px at 12% 108%, rgba(201, 162, 76, .10), transparent 60%),
    var(--ink-900);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 560px;
  margin-inline: auto;
  padding: calc(var(--safe-top) + 14px) 18px calc(var(--safe-bottom) + 18px);
}

/* --------------------------------------------------------- Barre supérieure */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand svg { flex: none; }

.brand-name {
  font-size: 15px;
  font-weight: 300;
  letter-spacing: .1em;
  color: #E9EDF5;
}

.brand-name b {
  font-weight: 700;
  color: var(--gold-400);
}

/* Indicateur GPS */
.gps {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, .04);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--mute-400);
  white-space: nowrap;
}

.gps .dot { background: var(--mute-500); }
.gps[data-state="searching"] { color: var(--gold-400); border-color: rgba(231, 196, 118, .3); }
.gps[data-state="searching"] .dot { background: var(--gold-400); animation: blink 1.1s infinite; }
.gps[data-state="ok"] { color: #6EE7A8; border-color: rgba(22, 163, 74, .35); }
.gps[data-state="ok"] .dot { background: #34D399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.gps[data-state="error"] { color: var(--alert-300); border-color: rgba(229, 52, 42, .4); }
.gps[data-state="error"] .dot { background: var(--alert-400); }

@keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

/* ------------------------------------------------------------------- Étapes */

.step {
  display: none;
  flex: 1;
  flex-direction: column;
  animation: rise .32s var(--ease);
}

.step.is-active { display: flex; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.step-head { margin: 18px 0 20px; }

.step-title {
  font-size: clamp(23px, 6.2vw, 29px);
  line-height: 1.14;
  margin-top: 10px;
}

.step-sub {
  margin-top: 9px;
  font-size: 14.5px;
  color: #AFB8C9;
  line-height: 1.6;
}

/* ------------------------------------------------------------ Bouton d'alerte */

.sos-zone {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 12px 0 22px;
}

.sos-wrap {
  position: relative;
  width: min(300px, 74vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.sos-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(240, 68, 56, .45);
  animation: sonar 3s var(--ease) infinite;
}

.sos-ring:nth-child(2) { animation-delay: 1s; }
.sos-ring:nth-child(3) { animation-delay: 2s; }

@keyframes sonar {
  0%   { transform: scale(.58); opacity: 0; }
  18%  { opacity: .85; }
  100% { transform: scale(1.06); opacity: 0; }
}

.sos {
  position: relative;
  width: 66%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  color: #fff;
  background:
    radial-gradient(circle at 34% 26%, #FF7A5F 0%, #F04438 34%, #C92B20 68%, #8C1A12 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .16) inset,
    0 0 0 7px rgba(229, 52, 42, .12),
    0 0 0 14px rgba(229, 52, 42, .06),
    0 26px 60px -18px rgba(229, 52, 42, .8);
  display: grid;
  place-items: center;
  gap: 2px;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sos:active {
  transform: scale(.955);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .16) inset,
    0 0 0 5px rgba(229, 52, 42, .2),
    0 14px 34px -16px rgba(229, 52, 42, .9);
}

.sos-label {
  font-size: clamp(19px, 5.6vw, 24px);
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

.sos-sub {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .2em;
  opacity: .8;
  text-transform: uppercase;
}

.sos-hint {
  text-align: center;
  font-size: 13.5px;
  color: var(--mute-400);
  max-width: 30ch;
  margin: 20px auto 0;
  line-height: 1.6;
}

/* ------------------------------------------------------------ Choix du sinistre */

.natures {
  display: grid;
  gap: 11px;
}

.nature {
  --tint: var(--gold-500);
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 17px 18px;
  text-align: left;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .12s var(--ease);
}

.nature:active { transform: scale(.988); }

.nature:hover,
.nature[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--tint) 55%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 16%, transparent), rgba(255, 255, 255, .02));
}

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

.nature-txt strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.nature-txt span {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--mute-400);
}

.nature-go {
  margin-left: auto;
  color: var(--mute-500);
  flex: none;
}

/* ------------------------------------------------------------------- Position */

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

.map-card iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  filter: saturate(.85) contrast(1.03);
}

.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
  color: var(--mute-400);
  font-size: 13px;
}

.coords {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--mute-400);
}

.coords b {
  color: #E9EDF5;
  font-weight: 600;
}

.address {
  margin-top: 10px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: rgba(231, 196, 118, .08);
  border: 1px solid rgba(231, 196, 118, .2);
  font-size: 13px;
  color: var(--gold-300);
  line-height: 1.5;
}

/* ------------------------------------------------------------ Champs de saisie */

.field { margin-top: 14px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute-400);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, .045);
  color: var(--paper);
  font-size: 15.5px;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}

.field textarea { resize: vertical; min-height: 78px; line-height: 1.5; }

.field input::placeholder,
.field textarea::placeholder { color: #66708A; }

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold-500);
  background: rgba(255, 255, 255, .07);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

/* Repli “détails” */
.details {
  margin-top: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, .028);
  overflow: hidden;
}

.details > summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: #C6CDDB;
  display: flex;
  align-items: center;
  gap: 10px;
}

.details > summary::-webkit-details-marker { display: none; }

.details > summary::after {
  content: '';
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2px solid var(--mute-500);
  border-bottom: 2px solid var(--mute-500);
  transform: rotate(45deg);
  transition: transform .2s var(--ease);
}

.details[open] > summary::after { transform: rotate(-135deg); }

.details-body { padding: 2px 18px 18px; }

/* Photo */
.photo-slot {
  position: relative;
  margin-top: 14px;
  border-radius: var(--r-md);
  border: 1px dashed rgba(255, 255, 255, .17);
  background: rgba(255, 255, 255, .028);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color .18s var(--ease);
}

.photo-slot:hover { border-color: var(--gold-500); }
.photo-slot input[type="file"] { display: none; }

.photo-slot .nature-ico { width: 42px; height: 42px; --tint: var(--gold-500); }

.photo-preview {
  position: relative;
  margin-top: 14px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--hairline);
}

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

.photo-drop {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(7, 12, 24, .78);
  backdrop-filter: blur(6px);
  color: #fff;
  display: grid;
  place-items: center;
}

/* ------------------------------------------------------------ Barre d'actions */

/* Barre d'action collante : le bouton d'envoi doit rester atteignable sans
   défilement. Fond opaque + dégradé au-dessus pour que le contenu qui passe
   dessous disparaisse proprement au lieu d'être coupé en deux. */
.actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 22px;
  padding-top: 4px;
  padding-bottom: 4px;
  display: grid;
  gap: 10px;
  background: var(--ink-900);
}

.actions::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: 100%;
  height: 28px;
  background: linear-gradient(180deg, transparent, var(--ink-900));
  pointer-events: none;
}

.btn-xl {
  min-height: 62px;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 18px;
}

.btn-back {
  justify-self: center;
  padding: 10px 18px;
  min-height: 0;
  border: none;
  background: none;
  color: var(--mute-400);
  font-size: 13.5px;
  font-weight: 500;
}

.call18 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  border-radius: 16px;
  border: 1px solid rgba(231, 196, 118, .28);
  background: rgba(231, 196, 118, .07);
  color: var(--gold-300);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
}

/* --------------------------------------------------------------- Transmission */

.sending {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 4px;
}

.pulse-core {
  position: relative;
  width: 120px; height: 120px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.pulse-core span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(231, 196, 118, .5);
  animation: sonar 1.8s var(--ease) infinite;
}

.pulse-core span:nth-child(2) { animation-delay: .6s; }
.pulse-core span:nth-child(3) { animation-delay: 1.2s; }

/* ---------------------------------------------------------------- Confirmation */

.receipt {
  text-align: center;
  padding: 30px 22px 26px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(22, 163, 74, .3);
  background: linear-gradient(180deg, rgba(22, 163, 74, .12), rgba(255, 255, 255, .02));
}

.receipt-ico {
  width: 62px; height: 62px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(22, 163, 74, .18);
  border: 1px solid rgba(52, 211, 153, .45);
  color: #34D399;
}

.ref {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--hairline-soft);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--gold-300);
}

/* Suivi du statut */
.timeline {
  margin-top: 18px;
  display: grid;
  gap: 0;
}

.tl {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 18px;
  position: relative;
}

.tl:last-child { padding-bottom: 0; }

.tl::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 22px;
  bottom: -4px;
  width: 2px;
  background: rgba(255, 255, 255, .09);
}

.tl:last-child::before { display: none; }

.tl-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--hairline-soft);
  color: var(--mute-500);
  font-size: 12px;
  z-index: 1;
}

.tl.done .tl-dot {
  background: rgba(22, 163, 74, .2);
  border-color: rgba(52, 211, 153, .5);
  color: #34D399;
}

.tl.current .tl-dot {
  background: rgba(231, 196, 118, .18);
  border-color: var(--gold-500);
  color: var(--gold-300);
  box-shadow: 0 0 0 4px rgba(231, 196, 118, .12);
}

.tl-txt strong { display: block; font-size: 14.5px; font-weight: 600; }
.tl.pending .tl-txt strong { color: var(--mute-500); font-weight: 500; }
.tl-txt span { display: block; margin-top: 2px; font-size: 12px; color: var(--mute-400); }

/* ------------------------------------------------------------------ Bandeaux */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 14px;
}

.banner svg { flex: none; margin-top: 1px; }

.banner-warn {
  background: rgba(245, 165, 36, .1);
  border: 1px solid rgba(245, 165, 36, .3);
  color: #F8CE86;
}

.banner-err {
  background: rgba(229, 52, 42, .12);
  border: 1px solid rgba(229, 52, 42, .35);
  color: #FFA894;
}

.banner-info {
  background: rgba(59, 130, 246, .1);
  border: 1px solid rgba(59, 130, 246, .28);
  color: #A6C8FF;
}

/* Bandeau hors-ligne fixe */
.offline-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 40;
  padding: 11px 16px calc(11px + var(--safe-bottom));
  background: linear-gradient(90deg, var(--alert-600), var(--alert-500));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transform: translateY(110%);
  transition: transform .3s var(--ease);
}

.offline-bar.show { transform: none; }

.foot {
  margin-top: 26px;
  text-align: center;
  font-size: 11.5px;
  color: var(--mute-500);
}

.foot a { color: var(--mute-400); }

@media (max-width: 400px) {
  .shell { padding-inline: 14px; }
  .field-row { grid-template-columns: 1fr; }
}

/* Poste de secours prévenu — affiché sur le reçu */
.dispatch-line {
  margin-top: 14px;
  padding: 11px 15px;
  border-radius: var(--r-sm);
  background: rgba(231, 196, 118, .1);
  border: 1px solid rgba(231, 196, 118, .26);
  font-size: 13px;
  line-height: 1.55;
  color: var(--gold-300);
}

.dispatch-line b { color: var(--paper); font-weight: 600; }
