:root {
  --vert: #1f9d55;
  --bleu: #2a7de1;
  --texte: #1d1d1f;
  --gris: #6e6e73;
  --fond: #ffffff;
  --bordure: #e2e2e6;
  --pub-h: 0px;
  --volet-replie: 38vh;
  --cible: 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
}

/* La bande pub ne prend de place que lorsqu'elle est affichée. */
body:has(#pub:not([hidden])) { --pub-h: 50px; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--fond);
}

#carte {
  position: fixed;
  inset: 0 0 var(--pub-h) 0;
  z-index: 0;
}

/* Filtres en haut, par-dessus la carte */
#filtres {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  overflow-x: auto;
  pointer-events: none;
}
#filtres > * { pointer-events: auto; }

#carburants { display: flex; gap: 6px; }

.puce, #rayon {
  min-height: var(--cible);
  min-width: var(--cible);
  padding: 0 14px;
  border: none;
  border-radius: 22px;
  background: var(--fond);
  color: var(--texte);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  cursor: pointer;
}
.puce[aria-pressed="true"] { background: var(--texte); color: var(--fond); }

.rayon {
  display: flex;
  align-items: center;
  font-size: 0;  /* libellé visible seulement pour les lecteurs d'écran */
}

#message {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 66px);
  left: 12px;
  right: 12px;
  z-index: 1000;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--fond);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  font-size: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
#message[hidden] { display: none; }
#message button {
  min-height: var(--cible);
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: var(--bleu);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

/* Marqueurs de prix */
.marqueur-prix {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--texte);
  border-radius: 8px;
  background: var(--fond);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.marqueur-prix.moins-cher {
  background: var(--vert);
  border-color: var(--vert);
  color: #fff;
  z-index: 1000 !important;
}

.bulle-prix { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.bulle-adresse { margin: 0 0 8px; color: var(--gris); }
.bouton-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--cible);
  padding: 0 16px;
  border-radius: 10px;
  background: var(--bleu);
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
}

/* Bande pub réservée (étape 3) */
#pub {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50px;
  z-index: 1100;
  display: flex;
  justify-content: center;
  background: #f4f4f6;
}
#pub[hidden] { display: none; }

/* Volet liste */
#volet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--pub-h);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  background: var(--fond);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  transition: top 0.2s ease, height 0.2s ease;
}
#volet.replie { height: var(--volet-replie); }
#volet.deplie {
  height: calc(100% - var(--pub-h) - env(safe-area-inset-top, 0px) - 64px);
  border-radius: 0;
}

#entete-volet {
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 0 12px 6px;
  border-bottom: 1px solid var(--bordure);
}
#poignee {
  width: 100%;
  min-height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  touch-action: none;
}
#poignee::before {
  content: "";
  display: block;
  width: 44px;
  height: 5px;
  margin: 0 auto;
  border-radius: 3px;
  background: #c7c7cc;
}
.actions-volet { display: flex; justify-content: space-between; gap: 8px; }
.bouton-volet {
  min-height: var(--cible);
  padding: 0 14px;
  border: 1px solid var(--bordure);
  border-radius: 10px;
  background: var(--fond);
  color: var(--texte);
  font-size: 15px;
  font-weight: 600;
}
.bouton-volet[hidden] { display: none; }

#liste {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}
.liste-vide { color: var(--gris); text-align: center; margin: 16px 0; }

.station {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--bordure);
  border-radius: 12px;
}
.station.moins-cher { border: 2px solid var(--vert); }
.station .infos { min-width: 0; }
.station p { margin: 0; }
.station .prix { font-size: 24px; font-weight: 700; }
.station.moins-cher .prix { color: var(--vert); }
.station .prix.ancien { color: var(--gris); }
.station .date-prix { font-size: 12px; color: var(--gris); }
.station .adresse {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.station .distance { font-size: 13px; color: var(--gris); }
.station .bouton-go { flex: none; }

#message { z-index: 1200; }
/* Volet déplié : le message passe en bas pour ne pas masquer les boutons du volet. */
body:has(#volet.deplie) #message {
  top: auto;
  bottom: calc(var(--pub-h) + 12px + env(safe-area-inset-bottom, 0px));
}
#note-volet { margin: 4px 0 0; font-size: 12px; color: var(--gris); }
#note-volet:empty { display: none; }

#lien-legal {
  flex: none;
  display: block;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  font-size: 12px;
  color: var(--gris);
  text-align: center;
}
