html, body { margin: 0; }
.map-page__canvas {
    position: absolute;
    inset: 0;
    width: 100%;   /* ← ajout */
    height: 100%;  /* ← ajout */
}

.map-filters__group { border: 0; margin: 0 0 8px; padding: 0; }


.map-filters__dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }


/* mobile first */

.map-fab {
    position: absolute; right: var(--jm-map-gap); bottom: var(--jm-map-gap); z-index: 5;
    width: 58px; height: 58px; border-radius: 50%; border: 0;
    background: var(--jm-red); color: #fff; font-size: 28px; line-height: 1;
    box-shadow: 0 4px 14px rgba(213, 3, 3, .35); cursor: pointer;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
.map-fab:active { transform: scale(.92); }
.map-fab:hover { background: var(--jm-red-deep); }
.map-fab:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--jm-ring); }
.poi-form {
    position: absolute; left: 0; right: 0; bottom: 0;  z-index: 8;
    display: flex; flex-direction: column; gap: 12px;
    background: #fff; border-radius: 16px 16px 0 0; padding: 16px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .2);
    font: 16px/1.4 system-ui, sans-serif;   /* 16px = pas de zoom auto iOS au focus */
    max-height: 80%; overflow: auto;
}
.poi-form h2 { margin: 0; font-size: 18px; }
.poi-form label { display: flex; flex-direction: column; gap: 4px; }
.poi-form input, .poi-form select, .poi-form textarea {
    font: inherit; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px;
}
.poi-form__loc { margin: 0; color: #475569; font-size: 14px; }
.poi-form__actions { display: flex; gap: 10px; }
.poi-form__actions button {
    flex: 1; padding: 12px; border-radius: 8px; border: 1px solid #cbd5e1;
    background: #f1f5f9; font: inherit; cursor: pointer;
}
.poi-form__actions button[type="submit"] {
    background: var(--jm-red); color: #fff; border-color: var(--jm-red);
}
.poi-form input:focus, .poi-form select:focus, .poi-form textarea:focus {
    outline: none; border-color: var(--jm-red); box-shadow: 0 0 0 3px var(--jm-ring);
}

@media (min-width: 640px) {
    .poi-form { left: auto; right: 16px; bottom: 16px; width: 360px; border-radius: 14px; }
}

.poi-form__header { display: flex; align-items: center; justify-content: space-between; }
.poi-form__toggle {
    border: 0; background: none; font-size: 22px; line-height: 1;
    padding: 4px 8px; color: #475569; cursor: pointer;
}
.poi-form__body { display: flex; flex-direction: column; gap: 12px; }

.poi-form[hidden],
.poi-form__body[hidden] { display: none; }

.map-filters-toggle {
    position: absolute; top: var(--jm-map-gap); left: var(--jm-map-gap); z-index: 6;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border: 0; border-radius: var(--jm-radius);
    background: var(--jm-surface); color: var(--jm-indigo);
    box-shadow: var(--jm-shadow-sm);
    font: 600 14px/1 system-ui, sans-serif; cursor: pointer;
}
.map-filters-toggle:active { transform: translateY(1px); }

.map-filters {
    position: absolute; top: calc(var(--jm-map-gap) + 40px); left: var(--jm-map-gap); z-index: 5;
    max-height: calc(100% - var(--jm-map-gap) - 56px); overflow: auto;
    background: var(--jm-surface); border-radius: var(--jm-radius);
    padding: 12px 14px; box-shadow: var(--jm-shadow);
    font: 13px/1.4 system-ui, sans-serif;
    border-top: 3px solid var(--jm-red);
}
.map-filters__group legend { font-weight: 700; color: var(--jm-indigo); margin-bottom: 6px; }
.map-filters__item { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.map-filters select {
    width: 100%; min-height: 40px; padding: 0 10px;
    border: 1px solid var(--jm-border); border-radius: 8px; font: inherit;
}
.map-filters[hidden] { display: none; }

.map-city-select {
    position: absolute; bottom: var(--jm-map-gap); left: var(--jm-map-gap); z-index: 5;
}
.map-city-select select {
    font-size: 16px; min-height: 42px; padding: 6px 12px;
    border: 0; border-radius: var(--jm-radius);
    background: var(--jm-surface); color: var(--jm-text);
    box-shadow: var(--jm-shadow-sm); font-weight: 600;
}

/* recherche*/
.map-search {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%); /* recentré quel que soit l'état */
    z-index: 6;
}

/* état replié : bouton loupe rond */
.map-search__open {
    width: 42px; height: 42px; border: 0; border-radius: 50%;
    background: var(--jm-surface); box-shadow: var(--jm-shadow-sm);
    font-size: 18px; color: var(--jm-indigo); cursor: pointer;
}

/* état déplié : la barre */
.map-search__panel {
    width: min(360px, calc(100vw - 24px));
}
.map-search__panel form {
    display: flex;                 /* ← rétabli : input + croix alignés */
    align-items: center;
    background: var(--jm-surface); border-radius: var(--jm-radius);
    box-shadow: var(--jm-shadow); overflow: hidden;
    border-top: 3px solid var(--jm-red);
}
.map-search__panel input {
    flex: 1 1 auto;                /* prend toute la place dispo */
    min-width: 0;                  /* autorise le rétrécissement (clé en flex) */
    border: 0; padding: 10px 12px;
    font-size: 16px; /* ≥16px : pas de zoom iOS */
}
.map-search__close {
    flex: 0 0 auto;                /* la croix garde sa taille, ne pousse pas l'input */
    border: 0; background: transparent;
    padding: 0 14px; font-size: 18px;
    color: var(--jm-text-muted); cursor: pointer;
}

.map-search__results {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    max-height: 240px;
    overflow-y: auto;
}
.map-search__result,
.map-search__hint {
    padding: 8px 10px;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}
.map-search__result { cursor: pointer; }
.map-search__result:hover { background: color-mix(in srgb, var(--jm-red) 8%, #fff); }
.map-search__hint { color: #6b7280; }

/* indispensable : sinon une règle display: peut écraser l'attribut hidden */
.map-search__open[hidden],
.map-search__panel[hidden] { display: none; }

/* texte de la popup POI agrandi */
.poi-popup .maplibregl-popup-content {
    font-size: 15px;
    line-height: 1.45;
    padding: 12px 14px;
}
.poi-popup .maplibregl-popup-content strong { font-size: 16px; }
.poi-popup .maplibregl-popup-content p { margin: 8px 0 0; }
.poi-popup__delete {
    margin-top: 10px;
    border: 0;
    border-radius: 6px;
    background: var(--jm-red);
    color: #fff;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
}

/* modale de confirmation */
.modal {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .4);
}
.modal[hidden] { display: none; } /* sinon le display:flex écrase l'attribut hidden */
.modal__box {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    width: calc(100% - 40px);
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.modal__text { font-size: 17px; margin: 0 0 16px; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal__actions button {
    font-size: 15px;
    padding: 8px 14px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}
.modal__danger { background: var(--jm-red); color: #fff; }

.poi-popup__actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.poi-popup__visit {
    border: 0; border-radius: 6px;  background: var(--jm-indigo); color: #fff;
    padding: 6px 12px; font-size: 14px; cursor: pointer;
}
.poi-popup__delete {
    margin-top: 0;
    border: 0; border-radius: 6px; background: var(--jm-red); color: #fff;
    padding: 6px 12px; font-size: 14px; cursor: pointer;
}
.city-autocomplete { position: relative; }
.city-autocomplete ul {
    list-style: none; margin: 2px 0 8px; padding: 0;
    border: 1px solid #ddd; border-radius: 6px; background: #fff;
    max-height: 220px; overflow-y: auto;
}
.city-autocomplete li { padding: 6px 10px; font-size: 14px; cursor: pointer; }
.city-autocomplete li:hover { background: #f3f4f6; }

.icon-picker__label { display: block; font-size: .85rem; color: #374151; margin-bottom: 4px; }
.icon-picker__options { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-picker__opt {
    width: 40px; height: 40px; padding: 4px;
    border: 2px solid transparent; border-radius: 10px;
    background: rgba(0, 0, 0, .04); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-picker__opt svg { width: 28px; height: 28px; display: block; }
.icon-picker__opt.is-active {
    border-color: var(--jm-red);
    background: color-mix(in srgb, var(--jm-red) 12%, #fff);
}
.icon-picker__none { font-size: 18px; color: #6b7280; }

.poi-popup__gallery { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.poi-popup__photo { position: relative; width: 72px; height: 72px; }
.poi-popup__thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; cursor: pointer; display: block; }
.poi-popup__photo-del {
    position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
    border: none; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff;
    font-size: 13px; line-height: 1; cursor: pointer;
}
.poi-popup__addphoto {
    display: inline-block; margin: 4px 0 8px; padding: 4px 10px;
    border-radius: 8px; background: var(--jm-indigo); color: #fff; font-size: .85rem; cursor: pointer;
}
.poi-lightbox {
    position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, .85);
    display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.poi-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 6px; }
.poi-lightbox__close {
    position: absolute; top: 16px; right: 20px; background: none; border: none;
    color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
}
.peer-marker { display: flex; flex-direction: column; align-items: center; transform: translateY(-4px); }
.peer-marker__dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }
.peer-marker__name { margin-top: 2px; padding: 0 4px; font-size: 11px; font-weight: 600; color: #111; background: rgba(255, 255, 255, .85); border-radius: 4px; white-space: nowrap; }

.presence { border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.presence legend { padding: 0 4px; font-size: .8rem; font-weight: 700; color: #374151; }
.presence__row { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.presence__hint { margin: 4px 0 0; font-size: .72rem; color: #6b7280; }

.draw-canvas { height: 480px; border-radius: 8px; overflow: hidden; }
.draw-toolbar { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; flex-wrap: wrap; }
.draw-status { color: #6b7280; font-size: .9rem; }

.jm-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9999; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; background: #1f2933; color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 14px; max-width: 92vw; }
.jm-toast .reload {
    border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 600; cursor: pointer;
    background: var(--jm-red); color: #fff;
}
.jm-toast .reload:hover { background: var(--jm-red-deep); }

.trip-order { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.trip-step { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #d6d9dd; border-radius: 8px; margin-bottom: 6px; background: #fff; cursor: grab; }
.trip-step.is-dragging { opacity: .5; }
.trip-step__handle { color: #9aa5b1; cursor: grab; }
.trip-step__num { min-width: 1.6em; height: 1.6em; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #1f2933; color: #fff; font-size: 12px; font-weight: 700; }

:root {
    /* Identité (logo) */
    --jm-indigo:        #0a2540;
    --jm-indigo-soft:   #1a2a5e;
    --jm-red:           #d50303;
    --jm-red-deep:      #ac0000;
    --jm-cream:         #fdfdfb;
    --jm-bronze:        #8c5c2e;
    --jm-sand:          #d4b48c;

    /* Rôles sémantiques (on manipule CEUX-là dans les composants) */
    --jm-bg:            var(--jm-cream);
    --jm-surface:       #ffffff;
    --jm-text:          #18233a;
    --jm-text-muted:    #5b6b86;
    --jm-primary:       var(--jm-red);
    --jm-primary-ink:   #ffffff;
    --jm-accent:        var(--jm-indigo);
    --jm-border:        #e4e7ee;
    --jm-ring:          color-mix(in srgb, var(--jm-red) 35%, transparent);

    /* Échelle */
    --jm-radius:        12px;
    --jm-radius-lg:     18px;
    --jm-gap:           12px;
    --jm-shadow:        0 6px 24px rgba(10, 37, 64, .12);
    --jm-shadow-sm:     0 2px 8px rgba(10, 37, 64, .08);

    /* Barre de nav basse + safe areas iOS */
    --jm-navbar-h:      62px;
    --jm-safe-bottom:   env(safe-area-inset-bottom, 0px);
    --jm-map-gap: 14px; /* marge des contrôles flottants */

    /* couleurs bonbon (vives mais pas fluo) */
    --candy-green:  #7ed957;
    --candy-pink:   #ff6fa5;
    --candy-orange: #ffa64d;
    --candy-blue:   #5bc0eb;
    --candy-purple: #b18cff;
    --poi-pad: 18px; /* padding horizontal de .poi-body */

    --seigaiha-veil: 0.45;   /* 0 = motif pleinement visible, 1 = presque effacé */
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100dvh;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--jm-text);
    background: var(--jm-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
a { color: var(--jm-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Conteneur d'app : occupe l'écran, laisse la place à la navbar basse */
.app-shell {
    min-height: 100dvh;
    padding-bottom: calc(var(--jm-navbar-h) + var(--jm-safe-bottom));
}

.page {
    max-width: 560px;       /* lisible en colonne, centré sur tablette */
    margin: 0 auto;
    padding: 20px 18px;
}

.stack > * + * { margin-top: var(--jm-gap); }
.hint { color: var(--jm-text-muted); font-size: .875rem; }

/* la page carte gère son espace via .map-shell, pas via le padding global */
/* ─── Page carte : conteneur qui s'arrête au-dessus de la navbar ─── */
.app-shell.map-view {
    padding-bottom: 0;          /* la carte gère son espace elle-même */
    overflow: hidden;           /* pas de scroll de page sur la carte */
}
.map-view .map-shell {
    position: relative;
    height: calc(100dvh - var(--jm-navbar-h) - var(--jm-safe-bottom));
    width: 100%;
    overflow: hidden;
}
.map-view .map-page__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}



/*DARUMA Animé */

.map-fab {
    display: grid; place-items: center; padding: 0;
    /* on retire l'ancienne respiration CSS : Lottie gère l'anim */
    animation: none;
}
.map-fab svg { width: 52px !important; height: 52px !important; display: block; }
.map-fab::before { content: '+'; color: #fff; font-size: 28px; line-height: 1; }
.map-fab:has(svg)::before { content: none; } /* dès que Lottie a injecté le SVG */

/* icones SVG JSON LOTTIE : */
[data-controller~="lottie"] { display: inline-grid; place-items: center; line-height: 0; }
[data-controller~="lottie"] svg { width: 100% !important; height: 100% !important; display: block; }

/* tailles utilitaires */
.anim-icon      { width: 28px; height: 28px; }
.empty-state__icon { width: 96px; height: 96px; }
/* le .map-fab garde sa taille : le svg suivra à 100% */

.maplibregl-ctrl-bottom-right {
    display: none;
}

/* POI avec SVG fichier */
.poi-popup__head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.poi-popup__icon { width: 28px; height: 28px; flex: 0 0 auto; }
.poi-popup__icon svg { width: 100%; height: 100%; display: block; }
.poi-popup__title { flex: 1 1 auto; min-width: 0; font-size: 16px; }
.poi-popup__anim  { width: 69px; height: 69px; flex: 0 0 auto; }
.poi-popup__anim svg { width: 100% !important; height: 100% !important; display: block; }

.icon-picker__opt img {
    width: 28px; height: 28px; object-fit: contain; display: block;
}

.icon-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.icon-badge img { width: 62%; height: 62%; object-fit: contain; display: block; }

.icon-bare { width: 32px; height: 32px; object-fit: contain; display: block; }


/* modale d'alerte */
/* conteneur unique : pile en bas, centré */
.jm-toasts {
    position: fixed;
    left: 50%;
    bottom: calc(var(--jm-navbar-h) + var(--jm-safe-bottom) + 12px); /* au-dessus de la navbar */
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse; /* le plus récent en bas, près de l'utilisateur */
    gap: 8px;
    width: max-content;
    max-width: 92vw;
    pointer-events: none; /* le conteneur ne bloque pas la carte */
}

/* chaque toast : plus de position fixed, il vit dans la pile */
.jm-toast {
    position: static;
    transform: none;
    left: auto; bottom: auto;
    pointer-events: auto; /* mais le toast lui-même reste cliquable */
    display: flex; gap: 12px; align-items: center;
    padding: 10px 14px; border-radius: 10px;
    background: #1f2933; color: #fff;
    box-shadow: 0 6px 24px rgba(0,0,0,.25);
    font-size: 14px;
    opacity: 1;
    transition: opacity .2s ease, transform .2s ease;
}
.jm-toast.is-leaving { opacity: 0; transform: translateY(6px); }

.jm-toast--error { background: var(--jm-red-deep); }
.jm-toast--warn  { background: var(--jm-bronze); }
.jm-toast__close {
    border: 0; background: transparent; color: rgba(255,255,255,.85);
    font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px;
}

/* Import depuis GMaps*/
.poi-import { margin-bottom: 10px; }
.poi-import__toggle {
    width: 100%; padding: 10px; border: 1px dashed var(--jm-border);
    border-radius: var(--jm-radius); background: color-mix(in srgb, var(--jm-indigo) 5%, #fff);
    color: var(--jm-indigo); font-weight: 600; cursor: pointer;
}
.poi-import__toggle:active { transform: translateY(1px); }
.poi-import__panel {
    margin-top: 8px; padding: 10px; border: 1px solid var(--jm-border);
    border-radius: var(--jm-radius); background: var(--jm-surface);
}
.poi-import__panel textarea {
    width: 100%; font: inherit; padding: 8px; border: 1px solid var(--jm-border);
    border-radius: 8px; resize: vertical;
}
.poi-import__panel textarea:focus {
    outline: none; border-color: var(--jm-red); box-shadow: 0 0 0 3px var(--jm-ring);
}
.poi-import__actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.poi-import__actions button {
    padding: 8px 14px; border: 0; border-radius: 8px;
    background: var(--jm-indigo); color: #fff; font-weight: 600; cursor: pointer;
}
.poi-import__actions button:disabled { opacity: .6; cursor: default; }
.poi-import__status { font-size: .85rem; }
.poi-import__status[data-kind="error"]   { color: var(--jm-red-deep); }
.poi-import__status[data-kind="warn"]    { color: var(--jm-bronze); }
.poi-import__status[data-kind="success"] { color: #1a7f4b; }
.poi-import__status[data-kind="info"]    { color: var(--jm-text-muted); }