/* Ubino — assets/css/app.css
   Mobile-first. La carte est le fond ; les écrans sont des surcouches.
   Palette sobre : bleu nuit / blanc cassé / accent corail. */

:root {
    --bleu: #14324f;
    --bleu-clair: #1d4a75;
    --accent: #ff6b57;
    --fond: #f7f6f2;
    --carte: #ffffff;
    --texte: #22303c;
    --texte-2: #5c6b78;
    --ombre: 0 2px 14px rgba(20, 50, 79, .18);
    --radius: 14px;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
/* L'attribut hidden gagne toujours, même sur les éléments display:flex. */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--texte);
    background: var(--fond);
}

#map { position: fixed; inset: 0; z-index: 0; }

/* ---- Barre haute ---- */
.topbar {
    position: fixed; top: 10px; left: 10px; right: 10px; z-index: 500;
    display: flex; gap: 8px;
}
.topbar input {
    flex: 1; border: 0; border-radius: var(--radius); padding: 12px 16px;
    font-size: 16px; box-shadow: var(--ombre); background: var(--carte);
}
.btn-round {
    width: 46px; height: 46px; border: 0; border-radius: 50%;
    background: var(--bleu); color: #fff; font-size: 20px;
    box-shadow: var(--ombre); cursor: pointer; flex: none;
}
.btn-round-light { background: var(--carte); color: var(--bleu); }
.dropdown {
    position: fixed; top: 62px; left: 10px; right: 68px; z-index: 500;
    background: var(--carte); border-radius: var(--radius); box-shadow: var(--ombre);
    max-height: 40vh; overflow: auto;
}
.dropdown button {
    display: block; width: 100%; text-align: left; border: 0; background: none;
    padding: 12px 16px; font-size: 15px; cursor: pointer;
    border-bottom: 1px solid #eee;
}
.dropdown button:active { background: #f0efe9; }

/* ---- Zone d'affichage paramétrable (back-office) ---- */
/* ---- Filtres par catégorie (sous la barre haute) ---- */
.filtres {
    position: fixed; top: 60px; left: 0; right: 0; z-index: 470;
    display: flex; gap: 6px; overflow-x: auto; padding: 4px 10px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.filtres::-webkit-scrollbar { display: none; }
.filtres .chip {
    flex: 0 0 auto; border: 0; cursor: pointer; white-space: nowrap;
    background: #fff; color: var(--bleu); border-radius: 16px;
    padding: 6px 12px; font-size: 13px; box-shadow: var(--ombre);
}
.filtres .chip.selected { background: var(--bleu); color: #fff; }
.filtres .chip .nb { font-size: 11px; margin-left: 5px; opacity: .65; }

/* ---- Hiérarchie visuelle : l'importé est atténué (saillance, pas couleur) ---- */
.marker-importe { opacity: .62; filter: saturate(.55); }

/* ---- Sections du champ unifié (Lieux / Mots-clés) ---- */
.dropdown .section-titre {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--texte-2); padding: 8px 12px 3px; letter-spacing: .4px;
}
.dropdown button .nb { color: var(--texte-2); font-size: 12px; margin-left: 6px; }

.info-banner {
    position: fixed; top: 104px; left: 10px; right: 10px; z-index: 480;
    display: flex; align-items: flex-start; gap: 8px;
    border-radius: var(--radius); box-shadow: var(--ombre);
    padding: 10px 12px; font-size: 13px; line-height: 1.4;
    background: #e8eef5; color: var(--bleu);
}
.info-banner.promo { background: #ffe9e4; color: #8a2f1f; }
.info-banner.alerte { background: #fff3bf; color: #7a5c00; }
.info-banner-texte { flex: 1; }
.info-banner-texte strong { display: block; }
.info-banner-texte a { color: inherit; font-weight: 700; }
.info-banner button {
    border: 0; background: none; color: inherit; font-size: 15px;
    cursor: pointer; padding: 0 2px; flex: none;
}

/* ---- Bandeaux ---- */
.offline {
    position: fixed; top: 66px; left: 50%; transform: translateX(-50%);
    z-index: 600; background: #444; color: #fff; font-size: 13px;
    padding: 6px 14px; border-radius: 20px; opacity: .92;
}
.zoom-hint {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 400; background: rgba(20,50,79,.85); color: #fff;
    padding: 10px 18px; border-radius: 20px; font-size: 14px; pointer-events: none;
}

/* ---- Bande de suggestions (éditorial → tags vivants → rien) ---- */
.bande {
    /* Au-dessus du bouton Liste (76px) pour ne pas le recouvrir */
    position: fixed; bottom: calc(124px + var(--safe-b)); left: 0; right: 0; z-index: 460;
    display: flex; gap: 6px; overflow-x: auto; padding: 4px 10px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    pointer-events: none; /* la carte reste manipulable entre les puces */
}
.bande::-webkit-scrollbar { display: none; }
.bande button {
    pointer-events: auto; flex: 0 0 auto; border: 0; cursor: pointer;
    background: #fff; color: var(--bleu); border-radius: 16px;
    padding: 7px 13px; font-size: 13px; box-shadow: var(--ombre);
    white-space: nowrap;
}
.bande button.bande-evenement {
    background: var(--bleu); color: #fff; font-weight: 600;
}
.bande button .nb { color: var(--texte-2); font-size: 11px; margin-left: 4px; }
.bande button.bande-evenement .nb { color: #cfe0f0; }

/* ---- Mode choix de position ---- */
.crosshair {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 450; pointer-events: none;
    width: 44px; height: 44px; font-size: 0;
    border: 3px solid var(--accent); border-radius: 50%;
    box-shadow: 0 1px 6px rgba(0,0,0,.35), inset 0 1px 6px rgba(0,0,0,.2);
}
.crosshair::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.pick-bar {
    position: fixed; bottom: calc(70px + var(--safe-b)); left: 10px; right: 10px; z-index: 500;
    background: var(--carte); border-radius: var(--radius); box-shadow: var(--ombre);
    padding: 12px 16px; text-align: center;
}
.pick-bar p { margin: 0 0 10px; font-size: 14px; color: var(--texte-2); }
/* Mode « une adresse » : les suggestions s'ouvrent AU-DESSUS du champ (la
   barre est en bas d'écran — vers le bas elles sortiraient de l'écran). */
.pick-adresse-bloc { position: relative; margin-bottom: 10px; }
.pick-adresse-bloc input {
    width: 100%; box-sizing: border-box; border: 1px solid #d9d5c9;
    border-radius: var(--radius); padding: 10px 12px; font-size: 15px;
    background: var(--fond);
}
.dropdown-pick {
    position: absolute; top: auto; bottom: calc(100% + 6px); left: 0; right: 0;
    max-height: 34vh;
}
.pick-resolue {
    font-size: 13px; color: var(--bleu);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- Boutons ---- */
.btn {
    border: 0; border-radius: var(--radius); padding: 12px 18px;
    font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary { background: var(--bleu); color: #fff; }
.btn-primary:active { background: var(--bleu-clair); }
.btn-ghost { background: transparent; color: var(--bleu); }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.btn-small { padding: 8px 12px; font-size: 13px; }

/* ---- Liste / feuilles ---- */
.btn-list-toggle {
    position: fixed; bottom: calc(76px + var(--safe-b)); left: 50%; transform: translateX(-50%);
    z-index: 500; border: 0; border-radius: 20px; padding: 10px 18px;
    background: var(--bleu); color: #fff; font-size: 14px; font-weight: 600;
    box-shadow: var(--ombre); cursor: pointer;
}
.btn-install-flottant {
    position: fixed; bottom: calc(76px + var(--safe-b)); right: 10px;
    z-index: 500; border: 0; border-radius: 20px; padding: 10px 16px;
    background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
    box-shadow: var(--ombre); cursor: pointer;
}
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 700;
    background: var(--fond); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.2);
    max-height: 62vh; overflow-y: auto; padding-bottom: calc(64px + var(--safe-b));
}
.sheet-tall { max-height: 86vh; }
/* Le détail s'ouvre au-dessus des écrans de recherche/liste ;
   signalement et consentement passent au-dessus de tout. */
#screen-detail { z-index: 850; }
#screen-report, #screen-consent { z-index: 950; }
.sheet-grip {
    width: 42px; height: 4px; border-radius: 2px; background: #c9c6bd;
    margin: 10px auto 4px; cursor: pointer;
    /* Zone de tap élargie sans épaissir le trait */
    box-shadow: 0 -8px 0 12px transparent, 0 8px 0 12px transparent;
}
.sheet h2 { margin: 6px 16px 10px; font-size: 17px; }

/* ---- Cartes de flags ---- */
.cards { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.pad { padding: 14px 16px calc(72px + var(--safe-b)); }
.card {
    background: var(--carte); border-radius: var(--radius); box-shadow: 0 1px 6px rgba(0,0,0,.08);
    padding: 12px 14px; cursor: pointer;
}
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card p { margin: 0; font-size: 13px; color: var(--texte-2); }
.card .meta { display: flex; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--texte-2); }
/* Un flag sponsorisé EST un flag ordinaire : même gabarit, seul un badge le
   distingue (spec §5.1). Aucun composant publicitaire à part. */
.card.sponsored { outline: 2px solid #e8d9a0; }
.badge-sponso {
    display: inline-block; background: #f4e9c8; color: #7a5c12;
    font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 6px;
    margin-bottom: 4px;
}
.badge-prive {
    display: inline-block; background: #e3ecf5; color: var(--bleu);
    font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 6px;
}
.badge-statut { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 6px; }
.badge-statut.publie { background: #dcefdc; color: #1d6b2a; }
.badge-statut.masque, .badge-statut.bloque { background: #f7dcd7; color: #9c2b1c; }
.empty-state { text-align: center; color: var(--texte-2); padding: 26px 20px; }
.empty-state strong { color: var(--texte); }

/* ---- Overlays plein écran ---- */
.overlay {
    position: fixed; inset: 0; z-index: 800; background: var(--fond);
    overflow-y: auto;
}
.overlay-head {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
    background: var(--fond); padding: 10px 12px; border-bottom: 1px solid #e6e3da;
}
.overlay-head h2 { margin: 0; font-size: 17px; flex: 1; }
.overlay-head input {
    flex: 1; border: 1px solid #ddd; border-radius: var(--radius);
    padding: 10px 14px; font-size: 16px;
}
.btn-back {
    border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer;
    color: var(--bleu); padding: 4px 10px;
}

/* ---- Suggestions / rattrapage ---- */
.suggest { padding: 0 12px; }
.suggest button, .tag-chip {
    display: inline-block; margin: 4px 4px 0 0; border: 0; cursor: pointer;
    background: #e8eef5; color: var(--bleu); border-radius: 16px;
    padding: 7px 13px; font-size: 14px;
}
.suggest button b { font-weight: 700; }
.suggest .nb { color: var(--texte-2); font-size: 12px; margin-left: 4px; }
.rescue-title { margin: 16px 0 6px; font-size: 14px; color: var(--texte-2); }
.rescue-constat { font-size: 15px; margin: 14px 0 0; }
.rescue-suggestion button { background: none; border: 0; color: var(--accent); font-size: 15px; font-weight: 700; cursor: pointer; padding: 0; }

/* ---- Formulaires ---- */
.form label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
.form input[type=text], .form input[type=search], .form input:not([type]),
.form input[type=datetime-local], .form textarea, .form select {
    width: 100%; border: 1px solid #ddd; border-radius: 10px;
    padding: 11px 13px; font-size: 16px; background: var(--carte);
}
.form fieldset { border: 0; padding: 0; margin: 14px 0 0; }
.form legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.radio {
    display: flex; gap: 10px; align-items: flex-start; background: var(--carte);
    border: 1px solid #ddd; border-radius: 10px; padding: 11px 13px; margin-top: 8px;
    cursor: pointer; font-weight: 400;
}
.radio input { margin-top: 3px; }
.radio small { color: var(--texte-2); }
.hint { font-size: 13px; color: var(--texte-2); }
.hint-inline { font-weight: 400; font-size: 12px; color: var(--texte-2); }
.error { color: #b3261e; font-size: 14px; }
.warn { font-size: 13px; color: #8a5a00; background: #fff6df; border-radius: 10px; padding: 10px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip {
    border: 1px solid #ccc; background: var(--carte); border-radius: 16px;
    padding: 7px 13px; font-size: 14px; cursor: pointer;
}
.chip.selected { background: var(--bleu); color: #fff; border-color: var(--bleu); }
.chip .x { margin-left: 6px; font-weight: 700; }
details summary { cursor: pointer; font-weight: 600; margin: 16px 0 4px; }

/* ---- Confirmation / code de récupération ---- */
.center { text-align: center; }
.big-icon {
    width: 64px; height: 64px; margin: 24px auto 8px; border-radius: 50%;
    background: #dcefdc; color: #1d6b2a; font-size: 34px; line-height: 64px;
}
.created-tags { font-size: 16px; }
.share-box { display: flex; gap: 8px; margin: 12px 0; }
.share-box input {
    flex: 1; border: 1px solid #ddd; border-radius: 10px; padding: 10px 12px;
    font-size: 14px; background: var(--carte); min-width: 0;
}
.recovery-code {
    font-family: ui-monospace, Consolas, monospace; font-size: 19px; letter-spacing: 1px;
    background: var(--carte); border: 1px dashed #bbb; border-radius: 10px;
    padding: 14px; margin: 14px 0; user-select: all; word-break: break-all;
}
.recovery-code.small { font-size: 15px; padding: 10px; }

/* ---- Détail ---- */
.detail-title { margin: 4px 0 2px; font-size: 19px; }
.detail-meta { display: flex; gap: 12px; font-size: 13px; color: var(--texte-2); margin: 4px 0 10px; }
.detail-desc { font-size: 15px; white-space: pre-wrap; }
.detail-photos { display: flex; gap: 8px; overflow-x: auto; margin: 10px 0; }
.detail-photos img { height: 130px; border-radius: 10px; }
.detail-actions { display: flex; gap: 8px; margin: 14px 0; }
.detail-actions .btn { flex: 1; text-align: center; text-decoration: none; }
.notif-moderation { border-left: 4px solid #b3261e; }
.owner-box {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: #e8eef5; border-radius: 10px; padding: 8px 12px; margin: 4px 0 10px;
    font-size: 13px; color: var(--bleu);
}
.owner-box .btn { color: #b3261e; }
.comments { margin-top: 16px; }
.comment { background: var(--carte); border-radius: 10px; padding: 9px 12px; margin-top: 8px; font-size: 14px; }
.comment time { display: block; font-size: 11px; color: var(--texte-2); margin-top: 3px; }

/* ---- Antirobot maison (grille 4×4) ---- */
.ar-widget { margin: 14px 0; }
.ub-ar-instruction { font-size: 14px; }
.ub-ar-cible { font-weight: 700; color: var(--accent); }
.ub-ar-table { border-collapse: separate; border-spacing: 6px; margin: 0 auto; }
.ub-ar-cell {
    display: flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 10px; cursor: pointer;
    background: var(--carte); border: 2px solid #ccc;
    font-size: 20px; font-weight: 700; user-select: none;
}
.ub-ar-cell.selected { background: var(--bleu); color: #fff; border-color: var(--bleu); }

/* ---- Consentement ---- */
.consent-actions { margin: 18px 0 8px; }
.consent-actions .btn + .btn { margin-top: 8px; }

/* ---- Réglages ---- */
.legal-links a { display: block; padding: 11px 0; border-bottom: 1px solid #e6e3da; color: var(--bleu); text-decoration: none; }

/* ---- Navigation basse ---- */
.bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    display: flex; background: var(--carte); box-shadow: 0 -1px 8px rgba(0,0,0,.12);
    padding-bottom: var(--safe-b);
}
.bottombar button {
    flex: 1; border: 0; background: none; padding: 8px 0 7px; cursor: pointer;
    font-size: 11px; color: var(--texte-2); display: flex; flex-direction: column; gap: 1px;
    align-items: center;
}
.bottombar button span:first-child { font-size: 20px; }
.bottombar button.active { color: var(--bleu); font-weight: 700; }
/* Premier span = pastille icône ; le second (libellé traduit) reste en texte. */
.nav-create span:first-child {
    background: var(--accent); color: #fff; width: 34px; height: 34px;
    border-radius: 50%; line-height: 34px; margin-bottom: 1px;
}

/* ---- Attribution de la source (obligation de licence) ---- */
.detail-source { font-size: 12px; color: var(--texte-2); margin: 2px 0 8px; }
.detail-source a { color: var(--bleu); }

/* ---- Guide intégré (accordéon tactile, même vocabulaire que les cartes) ---- */
.guide details {
    background: var(--carte); border-radius: var(--radius); box-shadow: var(--ombre);
    margin: 0 0 10px; overflow: hidden;
}
.guide summary {
    list-style: none; cursor: pointer; padding: 13px 15px;
    font-weight: 600; font-size: 15px; position: relative;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after {
    content: '▾'; position: absolute; right: 14px; color: var(--texte-2);
    transition: transform .15s;
}
.guide details[open] summary::after { transform: rotate(180deg); }
.guide .guide-corps { padding: 0 15px 13px; font-size: 14px; line-height: 1.5; }
.guide .guide-corps p { margin: 0 0 8px; }
.guide .guide-corps ul { margin: 0 0 8px; padding-left: 20px; }
.guide .guide-corps li { margin-bottom: 4px; }

/* ---- Badge « éditeur identifié » (abonnés vérifiés) ---- */
.badge-verifie {
    display: inline-block; font-size: 11px; font-weight: 700;
    background: #dcefdc; color: #1d6b2a; border-radius: 4px;
    padding: 2px 7px; vertical-align: middle; white-space: nowrap;
}

/* ---- Mise en avant exposant (détail propriétaire) ---- */
.owner-avant { margin: 8px 0 4px; }
.owner-avant label { font-size: 14px; }
.owner-avant input {
    width: 58px; padding: 5px 6px; border: 1px solid #ccc; border-radius: 8px;
    font-size: 14px; text-align: center; margin: 0 2px;
}
.owner-avant .btn { margin-left: 6px; }
.owner-avant .hint { margin: 5px 0 0; font-size: 12px; }

/* ---- Espace premium ---- */
.carte-premium {
    background: #eef4ec; border: 1px solid #cfe3cb; border-radius: 10px;
    padding: 11px 13px; margin: 8px 0 12px; font-size: 14px;
}
.carte-premium .btn { margin-top: 8px; }

/* ---- Instructions iOS ---- */
.ios-etape { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; font-size: 15px; }
.ios-num {
    flex: none; width: 28px; height: 28px; border-radius: 50%;
    background: var(--bleu); color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.ios-icone {
    display: inline-block; border: 1.5px solid var(--bleu); border-radius: 6px;
    padding: 1px 7px; color: var(--bleu); font-weight: 700; margin: 0 3px;
}

/* ---- Toast ---- */
.toast {
    position: fixed; bottom: calc(76px + var(--safe-b)); left: 50%; transform: translateX(-50%);
    z-index: 1000; background: #333; color: #fff; font-size: 14px;
    padding: 10px 18px; border-radius: 20px; max-width: 86vw; text-align: center;
}

/* ---- Amas (clusters) ---- */
.cluster-icon {
    background: var(--bleu); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; box-shadow: 0 1px 6px rgba(0,0,0,.3);
    border: 2px solid #fff;
}
.marker-sponso { filter: hue-rotate(140deg) saturate(1.4); }
/* Mes propres flags : teinte corail, repérables d'un coup d'œil */
.marker-mine { filter: hue-rotate(150deg) saturate(2) brightness(1.1); }

@media (min-width: 760px) {
    .sheet, .overlay { max-width: 480px; left: 50%; transform: translateX(-50%); }
    .overlay { border-left: 1px solid #e2ded4; border-right: 1px solid #e2ded4; }
    .bottombar { max-width: 480px; left: 50%; transform: translateX(-50%); }
}
