/* Écran : adresses et cartes — autocomplétion d'adresse (address.js), cartes Leaflet (maps.js, travel.js),
   volet Paramètres › Déplacement (zones), déplacement dans la réservation.
   Réutilise les tokens et composants de app.css (aucun token redéfini). Clair et sombre, cibles 44 px. */

/* ---------- Suggestions d'adresse (liste dans le groupe, sous le champ) ---------- */

.addr-list { background: var(--surface); max-height: 320px; overflow-y: auto; overscroll-behavior: contain; }
.group > .addr-list { position: relative; }
.addr-opt {
    position: relative; display: flex; flex-direction: column; justify-content: center; gap: 1px;
    min-height: var(--row-min); padding: 7px 16px 7px 42px; cursor: pointer; color: var(--label);
}
/* Épingle devant chaque suggestion */
.addr-opt::after {
    content: ""; position: absolute; left: 16px; top: 50%; width: 14px; height: 14px; margin-top: -8px;
    background: var(--label-3);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.1-7-11.5a7 7 0 0 1 14 0C19 14.9 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.1-7-11.5a7 7 0 0 1 14 0C19 14.9 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.addr-opt + .addr-opt::before { content: ""; position: absolute; top: 0; left: 42px; right: 0; border-top: var(--hairline) solid var(--separator); }
.addr-opt.is-active, .addr-opt:active { background: var(--pressed); }
.addr-opt.is-active::after { background: var(--brand); }
.addr-opt__main { font: var(--t-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-opt__sub { font: var(--t-foot); color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* « Aucune adresse trouvée » : à côté de la liste (fermée), jamais dedans */
.addr-list__empty { background: var(--surface); padding: 11px 16px; font: var(--t-sub); color: var(--label-2); }
@media (hover: hover) and (pointer: fine) { .addr-opt:hover { background: var(--fill); } }

/* ---------- Cartes ---------- */

.travel-map, .map-mini { position: relative; z-index: 0; background: var(--fill); }
/* Hauteur de la carte des zones selon l'écran : 300 px sur iPhone en portrait, jamais plus que ~45 % de la hauteur
   visible (iPhone en paysage : la carte entière tient entre la barre d'outils et la barre d'onglets) */
.travel-map { height: 300px; height: clamp(180px, 45vh, 300px); height: clamp(180px, 45dvh, 300px); }
.map-mini { height: 150px; }
@media (min-width: 700px) {
    .travel-map { height: 360px; height: clamp(220px, 50vh, 360px); height: clamp(220px, 50dvh, 360px); }
    .map-mini { height: 180px; }
}
.travel-map.is-unavailable, .map-mini.is-unavailable {
    height: auto; min-height: 0; padding: 12px 16px; font: var(--t-foot); color: var(--label-2);
}
.map-mini.is-unavailable { display: none; }
.leaflet-container { font: var(--t-cap); background: var(--fill); }
.leaflet-container a { color: var(--brand-text); }
.leaflet-control-attribution { font: 400 11px/14px var(--font); }
/* Boutons +/− : Leaflet ajoute .leaflet-touch à toute carte d'un navigateur à Pointer Events (tous les navigateurs
   récents) et fixe alors « .leaflet-touch .leaflet-bar a » à 30 px (spécificité 0,2,1) : sélecteurs plus précis ici,
   sinon la taille ci-dessous serait ignorée partout. Cibles 44 px sur écran tactile, glyphe centré. */
.leaflet-container .leaflet-bar a,
.leaflet-container.leaflet-touch .leaflet-bar a { width: 34px; height: 34px; line-height: 34px; }
@media (pointer: coarse) {
    .leaflet-container .leaflet-bar a,
    .leaflet-container.leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 24px; }
}
@media (prefers-color-scheme: dark) {
    /* Tuiles OSM assombries (fond de carte lisible en mode sombre, couleurs des zones intactes) */
    .leaflet-tile-pane { filter: brightness(.62) invert(1) contrast(1.05) hue-rotate(200deg) saturate(.35) brightness(.9); }
    .leaflet-container .leaflet-control-attribution { background: rgba(28, 28, 30, .8); color: var(--label-2); }
    .leaflet-bar a { background: var(--elevated-surface); color: var(--label); border-bottom-color: var(--separator); }
    .leaflet-bar a.leaflet-disabled { background: var(--elevated); color: var(--label-3); }
}

/* Épingle dessinée en CSS (couleur de la marque ; point de départ en vert) */
.map-pin { background: none; border: 0; }
.map-pin__head {
    position: absolute; left: 3px; top: 0; width: 24px; height: 24px; border-radius: 50% 50% 50% 0;
    background: var(--brand); transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0, 0, 0, .35); border: 2px solid #fff;
}
.map-pin__head::after { content: ""; position: absolute; left: 7px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.map-pin--origin .map-pin__head { background: var(--green); }
.leaflet-marker-draggable { cursor: grab; }
/* Écran tactile (maps.js) : un doigt fait défiler la page, la carte se déplace à deux doigts ; le repère de départ se
   fait glisser d'un doigt (le geste qui part de l'épingle n'est jamais un défilement) */
.map-guarded .leaflet-marker-draggable { touch-action: none; }
.map-hint {
    position: absolute; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(0, 0, 0, .45); color: #fff; font: 600 15px/20px var(--font); text-align: center;
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.map-hint.is-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .map-hint { transition: none; } }

/* Étiquette d'une zone, posée sur le bord sud de son cercle (travel.js) : le repère de départ ne la couvre jamais */
.map-zone-label { background: none; border: 0; }
.map-zone-label span {
    display: inline-flex; align-items: center; gap: 5px; transform: translate(-50%, -50%);
    padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap;
    font: 600 12px/16px var(--font); color: var(--label); background: var(--elevated); box-shadow: var(--shadow-float);
}
.map-zone-label span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--zone, var(--brand)); flex: none; }

/* ---------- Paramètres › Déplacement ---------- */

.travel-mode .seg { width: 100%; }
/* Rangée de zone : pastille | nom + tranche | rayon | prix | supprimer. Rayon et prix sont regroupés dans
   .travel-zone__vals (display: contents ici : cellules directes de la grille ; vraie grille sur iPhone) */
.travel-zones__head, .travel-zone {
    display: grid; grid-template-columns: 12px minmax(0, 1fr) 7.5em 7.5em 44px; align-items: center; column-gap: 10px;
    padding: 0 12px 0 16px;
}
.travel-zones__head { min-height: 30px; font: var(--t-foot); color: var(--label-2); }
.travel-zones__head > :nth-child(3), .travel-zones__head > :nth-child(4) { text-align: right; padding-right: 10px; }
.travel-zone { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
.travel-zone__vals { display: contents; }
.travel-zone__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--fill-3); }
/* Nom de la zone : toute la cellule (champ + tranche) est la cible, jamais moins de 44 px de haut */
.travel-zone__name { display: flex; flex-direction: column; justify-content: center; min-width: 0; min-height: var(--hit); cursor: text; }
.travel-zone .input { background: transparent; box-shadow: none; padding: 2px 0; min-height: 30px; }
.travel-zone .input:focus { box-shadow: none; }
.travel-zone__name .input { font: var(--t-body); }
/* « Zone 2 » en attente d'un nom : c'est le nom affiché (lisible), pas une consigne */
.travel-zone__name .input::placeholder { color: var(--label-2); }
.travel-zone__range { font: var(--t-foot); color: var(--label-2); }
.travel-zone__range.is-warning { color: var(--orange); }
/* Rayon et prix : une case remplie (comme un champ iOS) qui contient la valeur et son unité, cible de 44 px ;
   anneau de focus sur la case entière (le champ lui-même reste transparent) */
.travel-zone__field {
    display: flex; align-items: center; gap: 4px; min-width: 0; min-height: var(--hit); padding: 0 10px;
    background: var(--fill); border-radius: var(--radius-sm); cursor: text;
    transition: box-shadow var(--t-fast) var(--ease-std);
}
.travel-zone__field:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 40%, transparent); }
.travel-zone .travel-zone__field .input {
    flex: 1 1 auto; width: 100%; min-width: 0; min-height: 0; padding: 0; text-align: right;
    font: var(--t-body); color: var(--label); font-variant-numeric: tabular-nums;
}
.travel-zone__field .input::placeholder { color: var(--label-3); }
.travel-zone__unit { flex: none; color: var(--label-2); white-space: nowrap; }
/* Légende de la case : seulement sur iPhone (l'en-tête « Jusqu'à / Prix » y est masqué) */
.travel-zone__cap { display: none; flex: none; font: var(--t-foot); color: var(--label-2); white-space: nowrap; }
.travel-zone .cfg-del { margin: 0; justify-self: end; }
.travel-zones > .item--action { gap: 6px; }
/* iPhone (et fenêtre étroite sur iPad) : 1re ligne pastille, nom et tranche, supprimer ; 2e ligne les deux cases
   côte à côte, alignées sur le nom, chacune avec sa légende */
@media (max-width: 559px) {
    .travel-zones__head { display: none; }
    .travel-zone {
        grid-template-columns: 12px minmax(0, 1fr) 44px; grid-template-areas: "dot name del" ". vals vals";
        row-gap: 4px; padding-top: 6px; padding-bottom: 10px;
    }
    .travel-zone__dot { grid-area: dot; }
    .travel-zone__name { grid-area: name; }
    .travel-zone .cfg-del { grid-area: del; }
    .travel-zone__vals { grid-area: vals; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .travel-zone__cap { display: block; }
}
/* Très petit écran (iPhone SE, 320 px) : les deux cases l'une sous l'autre, pour garder légende, valeur et unité */
@media (max-width: 374px) {
    .travel-zone__vals { grid-template-columns: minmax(0, 1fr); }
}
/* Ordinateur (rampe resserrée de l'admin, pointeur précis) : cases à la hauteur des autres champs */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
    .admin .travel-zone__field { min-height: 30px; border-radius: var(--radius-xs); }
    .admin .travel-zone { min-height: 48px; }
}

/* ---------- Réservation et fiche RDV ---------- */

.bk-travel-row .item__sub { display: block; -webkit-line-clamp: unset; line-clamp: unset; }
.bk-travel-row.is-warning .item__icon { background: var(--red); }
.bk-travel-row.is-warning .item__title { color: var(--red); }
.bk-travel { margin: var(--header-gap) 16px 0; font: var(--t-foot); color: var(--label-2); }
.bk-travel.is-warning { color: var(--red); }
.bk-map { margin-top: 12px; border-radius: var(--radius); overflow: hidden; }
.summary__lines li.is-muted { color: var(--label-2); }
