/* HornetMap — interface de terrain : la carte occupe tout l'écran, les commandes flottent dessus.
   Surfaces claires, coins arrondis, ombres douces ; contrastes forts et grandes cibles (lisible au soleil, utilisable avec des gants). */
:root {
  /* Palette du logo HornetMap : vert profond, orange, crème */
  --encre: #0b2e21; --encre-2: #2f4a3f; --gris: #55635c; --miel: #b85c05; --miel-vif: #c96f0e; --miel-pale: #fbf1e2; --creme: #f6e5d0;
  --surface: #fff; --fond: #f6f3ee; --trait: #e5dfd5; --trait-fort: #bbb4a7; --champ: #efebe4;
  --obs: #0a4fb3; --zone: #c24a00; --nid: #b0103a; --detruit: #4a4a4a; --secteur: #6234b0; --ok: #14663a; --alerte: #b3001b; --lien: #9a4c00;
  --ombre-1: 0 1px 2px #0b2e2114, 0 2px 8px #0b2e2114;
  --ombre-2: 0 2px 6px #0b2e211f, 0 10px 28px #0b2e2129;
  --barre: 72px;   /* bas de la barre flottante + marge */
  --bas: 82px;     /* hauteur réservée aux deux boutons du bas (téléphone) */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 16.500px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; color: var(--encre); background: var(--fond); overflow: hidden;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h2 { font-size: 1.3rem; font-weight: 750; letter-spacing: -.015em; margin: 0 0 .5rem; }
h3 { font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gris); margin: 1.4rem 0 .5rem; }
p { margin: .55rem 0; }
small, .note { font-size: .9rem; color: var(--gris); }
a { color: var(--lien); }

/* ---- Barre flottante */
#barre { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; height: 54px; z-index: 1100; display: flex; align-items: center; gap: .5rem;
  padding: 0 7px 0 9px; border-radius: 18px; background: #ffffffeb; -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: var(--ombre-2); border: 1px solid #ffffffb3; }
.marque { display: flex; align-items: center; flex: none; }
.marque img { display: block; }
.marque .long { display: none; }
@media (min-width: 521px) { .marque .picto { display: none; } .marque .long { display: block; margin: 0 .2rem 0 .1rem; } }
#lieu { flex: 1; position: relative; min-width: 0; }
#lieu-q { width: 100%; height: 40px; min-height: 0; border: 1.500px solid transparent; border-radius: 12px; padding: 0 .8rem 0 2.3rem; background: var(--champ) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355635c' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.500'/%3E%3Cpath d='m16 16 4.500 4.500'/%3E%3C/svg%3E") .65rem center / 18px no-repeat; color: var(--encre); }
#lieu-q::placeholder { color: var(--gris); }
#lieu-q:focus { background-color: #fff; border-color: var(--encre); outline: none; }
#lieu-res { position: absolute; top: 50px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--surface);
  border-radius: 16px; max-height: 50vh; overflow: auto; box-shadow: var(--ombre-2); }
#lieu-res button { display: block; width: 100%; text-align: left; padding: .7rem .75rem; border: 0; border-radius: 10px; background: none; }
#lieu-res button:hover, #lieu-res button:focus { background: var(--miel-pale); }
.bouton-barre { height: 40px; padding: 0 .95rem; border-radius: 12px; border: 0; background: var(--encre); color: #fff; font-weight: 650;
  max-width: 9.500rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Carte */
#carte { position: fixed; inset: 0; z-index: 1; background: #dfe6ea; }
.leaflet-container { font: inherit; }
.leaflet-top { top: var(--barre); }
.leaflet-bottom { bottom: var(--bas); }
.leaflet-control-attribution { font-size: 11px; background: #ffffffd9 !important; border-radius: 8px 0 0 0; padding: 1px 7px !important; }
.leaflet-bar, .leaflet-control-layers { border: 0 !important; border-radius: 14px !important; box-shadow: var(--ombre-1) !important; overflow: hidden; }
.leaflet-touch .leaflet-bar a, .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; color: var(--encre); border-bottom-color: var(--trait); }
.leaflet-touch .leaflet-control-layers-toggle, .leaflet-control-layers-toggle { width: 44px; height: 44px; }
.leaflet-control-layers-expanded { padding: 10px 14px 10px 12px; font-size: 15px; }
.leaflet-control-layers label { font-weight: 500; margin: .45rem 0; }
.leaflet-control-scale-line { border-color: var(--encre) !important; background: #ffffffcc !important; border-radius: 0 0 4px 4px; }
.leaflet-popup-content-wrapper { border-radius: 16px; box-shadow: var(--ombre-2); }
.leaflet-popup-content { font-size: 15px; margin: 14px 16px; }
.leaflet-popup-content button { margin-top: .5rem; }

#bandeau { position: fixed; top: var(--barre); left: 10px; right: 10px; z-index: 1050; background: #fff3c4; color: #3d2a00; border: 1.500px solid #d9a400; border-radius: 14px;
  padding: .5rem .75rem; font-weight: 600; font-size: .95rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; box-shadow: var(--ombre-1); }
#bandeau.erreur { background: #ffe1dd; border-color: var(--alerte); color: #4a0009; }
#bandeau button { min-height: 36px; padding: 0 .8rem; border-radius: 10px; border: 0; background: var(--encre); color: #fff; font-weight: 650; }

#consigne { position: fixed; top: var(--barre); left: 10px; right: 68px; z-index: 1040; background: #0b2e21f0; color: #fff;
  padding: .5rem .8rem .5rem .75rem; border-radius: 14px; font-weight: 600; font-size: .93rem; line-height: 1.25; box-shadow: var(--ombre-2); border-left: 5px solid var(--miel-vif);
  pointer-events: none; /* ne bloque jamais un toucher sur la carte */ }
body.avec-bandeau #consigne { top: calc(var(--barre) + 62px); }

#outils { position: fixed; right: 10px; bottom: calc(var(--bas) + 30px); z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
#outils button { width: 56px; min-height: 56px; border-radius: 16px; border: 0; background: var(--surface); color: var(--encre);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: .66rem; font-weight: 650; padding: 4px 0; box-shadow: var(--ombre-1); }
#outils svg { width: 22px; height: 22px; fill: currentColor; }
#outils button.actif { background: var(--encre); color: #fff; }

/* ---- Boutons du bas : flottants */
#bas { position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 1000; display: flex; gap: .5rem; pointer-events: none; }
#bas button { flex: 1; pointer-events: auto; min-height: 58px; border-radius: 18px; box-shadow: var(--ombre-2); }
#bas button { font-size: .98rem; padding-inline: .5rem; white-space: nowrap; }
#bas .secondaire { flex: 0 0 31%; border-color: transparent; }

button.principal, button.secondaire, button.danger, a.secondaire, a.google { min-height: 52px; border-radius: 14px; font-weight: 700; font-size: 1.02rem; padding: .4rem 1rem; border: 1.500px solid transparent;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .6rem; text-align: center; transition: transform .08s, background-color .15s, box-shadow .15s; }
button.principal { background: var(--miel); color: #fff; box-shadow: inset 0 -2px 0 #0000001f; }
button.principal:hover { background: #a24f02; }
button.secondaire, a.secondaire { background: var(--surface); color: var(--encre); border-color: var(--trait-fort); }
button.secondaire:hover, a.secondaire:hover { background: var(--fond); }
button.danger { background: #fff0ee; color: var(--alerte); border-color: #e8a59c; }
button.petit { min-height: 44px; font-size: .95rem; border-radius: 12px; }
button.principal:active, button.secondaire:active, button.danger:active, a.google:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--lien); outline-offset: 2px; }
.rangee { display: flex; gap: .5rem; flex-wrap: wrap; margin: .7rem 0; }
.rangee > * { flex: 1 1 8rem; }

/* Connexion avec Google */
a.google { display: flex; width: 100%; margin: .4rem 0 0; background: var(--surface); color: var(--encre); border-color: var(--trait-fort); box-shadow: var(--ombre-1); }
a.google:hover { background: var(--fond); }
a.google .sym svg { filter: none; }
.ou { display: flex; align-items: center; gap: .8rem; margin: 1rem 0 .9rem; color: var(--gris); font-size: .88rem; }
.ou::before, .ou::after { content: ""; flex: 1; height: 1px; background: var(--trait); }

/* ---- Panneau : feuille du bas (téléphone), colonne (ordinateur) */
#panneau { position: fixed; z-index: 1200; left: 0; right: 0; bottom: 0; max-height: 72vh; overflow: auto; overscroll-behavior: contain; background: var(--surface);
  border-radius: 24px 24px 0 0; padding: 0 1rem 1.2rem; padding-bottom: max(1.2rem, env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px #0b2e2138; }
#panneau.compact { max-height: 46vh; }
.entete { display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; background: var(--surface); padding: 1.15rem 0 .55rem; z-index: 2; }
.entete::before { content: ""; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--trait-fort); }
.entete h2 { flex: 1; margin: 0; }
.entete button { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; background: var(--fond); color: var(--encre); font-weight: 700; font-size: 1.05rem; }
.entete button:hover { background: var(--trait); }

label { display: block; font-weight: 650; font-size: .95rem; margin: .8rem 0 .25rem; }
label > input, label > select, label > textarea { margin-top: .3rem; font-weight: 400; font-size: 1rem; }
label.case { display: flex; gap: .65rem; align-items: flex-start; font-weight: 450; font-size: 1rem; padding: .45rem 0; }
label.case input { width: 24px; height: 24px; flex: none; margin: 1px 0 0; accent-color: var(--encre); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 48px; border: 1.500px solid var(--trait-fort); border-radius: 12px; padding: .45rem .7rem; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--encre); box-shadow: 0 0 0 3px #c96f0e59; outline: none; }
textarea { min-height: 76px; resize: vertical; }
.segments { display: flex; gap: 4px; padding: 4px; background: var(--champ); border-radius: 15px; }
.segments button { flex: 1; min-height: 48px; border: 0; border-radius: 11px; background: none; color: var(--encre-2); font-weight: 650; padding: .2rem .3rem; line-height: 1.15; transition: background-color .15s; }
.segments button[aria-pressed=true] { background: var(--encre); color: #fff; box-shadow: var(--ombre-1); }
.segments small { display: block; font-weight: 500; color: inherit; opacity: .85; font-size: .76rem; }
.azimut { display: flex; gap: 6px; align-items: stretch; }
.azimut input { text-align: center; font-size: 1.4rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.azimut button { min-width: 56px; border: 1.500px solid var(--trait-fort); border-radius: 12px; background: var(--surface); font-weight: 750; font-size: 1.1rem; }
.azimut output { min-width: 4rem; display: flex; align-items: center; justify-content: center; font-weight: 750; font-size: 1.15rem; }

.carte-r { border: 1px solid var(--trait); border-radius: 16px; padding: .8rem .9rem; margin: .6rem 0; background: var(--surface); box-shadow: var(--ombre-1); }
.carte-r h3 { margin: 0 0 .3rem; font-size: 1.05rem; text-transform: none; letter-spacing: -.01em; color: var(--encre); }
.carte-r .rangee { margin-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; font-size: .84rem; padding: .18rem .65rem; border-radius: 99px; white-space: nowrap; }
.badge.en_cours { color: #083c8a; background: #e3edfc; } .badge.localise { color: #8c0b2d; background: #fde4ea; } .badge.detruite { color: #333; background: #e8e9eb; } .badge.attente { color: #6b4200; background: #ffeab3; }
.avis { background: var(--miel-pale); border: 1px solid #e8cfa6; color: #3a2606; padding: .65rem .8rem; border-radius: 14px; margin: .7rem 0; font-size: .97rem; }
.avis.rouge { background: #ffeceb; border-color: #f0b3ac; color: #4a0009; }
.avis.gris { background: #eef0f3; border-color: var(--trait); color: var(--encre); }
.avis.vert { background: #e6f5ec; border-color: #a9d6b9; color: #0c3d22; }
.erreur-f { color: var(--alerte); font-weight: 650; margin: .5rem 0; }
ul.liste { list-style: none; margin: .3rem 0; padding: 0; }
ul.liste > li { border-bottom: 1px solid var(--trait); padding: .55rem 0; }
ul.liste > li:last-child { border-bottom: 0; }
ul.liste button.ligne { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: .35rem .3rem; min-height: 48px; }
ul.liste button.ligne:hover { background: var(--miel-pale); }
dl.fiche { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: .6rem 0; padding: .8rem .9rem; background: var(--fond); border-radius: 14px; }
dl.fiche dt { font-weight: 500; color: var(--gris); } dl.fiche dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
table.legende { border-collapse: collapse; width: 100%; } table.legende td { padding: .5rem .3rem; vertical-align: middle; border-bottom: 1px solid var(--trait); }
table.legende td:first-child { width: 64px; text-align: center; }
details { margin: .7rem 0; border: 1px solid var(--trait); border-radius: 14px; padding: 0 .9rem; }
details[open] { padding-bottom: .6rem; }
summary { font-weight: 650; padding: .75rem 0; cursor: pointer; min-height: 44px; }
.lien { background: none; border: 0; padding: 0; color: var(--lien); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; min-height: 44px; }

#toast { position: fixed; z-index: 1500; left: 50%; transform: translateX(-50%); top: calc(var(--barre) + 4px); width: max-content; background: #0b2e21f2; color: #fff; padding: .7rem 1.1rem;
  border-radius: 14px; font-weight: 600; max-width: 92vw; box-shadow: var(--ombre-2); }
#toast.erreur { background: var(--alerte); }

/* Symboles de la carte */
.sym { display: flex; align-items: center; justify-content: center; }
.sym svg { display: block; filter: drop-shadow(0 1px 2px #0008); }
.etiquette { background: var(--surface); border: 0; border-radius: 99px; padding: 2px 9px; font-weight: 700; font-size: 12px; color: var(--encre); white-space: nowrap; box-shadow: 0 0 0 1.500px #0b2e21, var(--ombre-1); }
.etiquette::before { display: none; }

@media (min-width: 900px) {
  :root { --bas: 0px; }
  #barre { left: 14px; right: 14px; top: 14px; }
  :root { --barre: 80px; }
  #lieu { max-width: 460px; margin-right: auto; }
  #bas { left: auto; right: 86px; bottom: 26px; width: 470px; }
  #panneau { top: 0; bottom: 0; right: auto; width: 420px; max-height: none; border-radius: 0; padding-top: .4rem; box-shadow: 4px 0 24px #0b2e2124; }
  #panneau.compact { max-height: none; }
  .entete::before { display: none; }
  body.panneau-ouvert #carte { left: 420px; }
  body.panneau-ouvert #barre { left: 434px; }
  body.panneau-ouvert #bandeau, body.panneau-ouvert #consigne { left: 434px; }
  #bandeau { left: 14px; right: 14px; }
  #consigne { left: 14px; right: 80px; }
  #outils { right: 14px; bottom: 30px; }
}
@media (max-width: 899px) {
  body.panneau-ouvert #bas, body.panneau-ouvert #outils { display: none; }
  body.panneau-ouvert .leaflet-bottom { bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
