/* ════════ Webmapping participatif ════════ */
:root { --topbar-h: 60px; --sidebar-w: 340px; }
html, body { height: 100%; overflow: hidden; }

/* ─── Topbar ─── */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1200; height: var(--topbar-h);
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%); box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.topbar-inner { display: flex; align-items: center; gap: 14px; height: 100%; padding: 0 18px; }
.topbar-logo { display: flex; align-items: center; flex-shrink: 0; }
.topbar-logo img { height: 32px; width: auto; display: block; }
.topbar-divider { width: 1px; height: 28px; background: rgba(255,255,255,.28); flex-shrink: 0; }
.topbar-titles { flex: 1; min-width: 0; }
.topbar-titles h1 { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-titles p { font-size: 11.5px; color: rgba(255,255,255,.82); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-badge { flex-shrink: 0; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 5px 13px; font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap; }
.topbar-help { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.14); color: #fff; font-size: 15px; cursor: pointer; transition: background .15s; }
.topbar-help:hover { background: rgba(255,255,255,.28); }

/* ─── Layout ─── */
.layout { position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0; display: flex; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
  overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: thin; }
.sidebar::-webkit-scrollbar { width: 5px; } .sidebar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
#map { flex: 1; height: 100%; background: #e8eef0; }

.side-block { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.side-intro { background: var(--teal-tint); }
.side-intro h2 { font-size: 16px; font-weight: 700; color: var(--teal-darker); margin-bottom: 6px; }
.side-intro p { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.btn-add { width: 100%; justify-content: center; }
.btn-add.is-active { background: var(--accent); box-shadow: 0 8px 22px rgba(253,193,13,.34); }
.add-hint { font-size: 12.5px; color: var(--accent-2); font-weight: 600; margin-top: 10px; min-height: 1em; line-height: 1.4; }

.side-label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.side-count { background: var(--teal-light); color: var(--teal-dark); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0; }

/* ─── Légende thèmes (cliquables = filtres) ─── */
.legend { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); padding: 6px 8px; border-radius: 7px; cursor: pointer; transition: background .12s, opacity .12s; user-select: none; }
.legend li:hover { background: var(--bg); }
.legend li.off { opacity: .4; }
.legend li.off .lg-dot { background: #cbd2d8 !important; }
.lg-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.lg-name { flex: 1; line-height: 1.25; }
.lg-n { font-size: 11px; font-family: var(--font-mono); color: var(--muted); }
.legend-type li { cursor: default; }
.legend-type li:hover { background: none; }
.type-pin { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; flex-shrink: 0; }
.type-atout { background: var(--t-marche); }
.type-vigilance { background: var(--t-voiture); }
.type-idee { background: var(--accent); }

.legend-actions { display: flex; gap: 14px; margin-top: 10px; }
.link-btn { background: none; border: none; color: var(--teal-dark); font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--font); padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ─── Feed ─── */
.side-feed { flex: 1; }
.feed { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.feed-item { border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; cursor: pointer; transition: border-color .12s, box-shadow .12s; background: #fff; }
.feed-item:hover { border-color: var(--teal); box-shadow: var(--shadow-sm); }
.feed-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.feed-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.feed-theme { font-size: 11px; font-weight: 700; color: var(--text); flex: 1; line-height: 1.2; }
.feed-badge { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 6px; border-radius: 5px; }
.fb-atout { background: #e7f6ed; color: #1d7a43; }
.fb-vigilance { background: #fdeaea; color: #b23b37; }
.fb-idee { background: #fff3d6; color: #9a6a00; }
.feed-text { font-size: 12px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed-by { font-size: 10.5px; color: #9aa6b1; margin-top: 5px; }
.feed-empty { font-size: 12.5px; color: var(--muted); font-style: italic; }

/* ─── Encart de pied de colonne (démarche de la collectivité) ─── */
.side-note { background: var(--navy-soft); border-top: 1px solid var(--navy-line); }
.side-note p { font-size: 12px; line-height: 1.55; color: #36406e; margin-bottom: 9px; }
.side-note p strong { color: var(--navy); }
.side-contact { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--teal-dark); }
.side-contact:hover { color: var(--teal-darker); }

/* ─── Marqueurs Leaflet ─── */
.contrib-marker { display: grid; place-items: center; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.contrib-marker span { transform: rotate(45deg); font-size: 12px; font-weight: 800; color: #fff; line-height: 1; }

/* popups */
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 14px 16px; font-family: var(--font); font-size: 13px; line-height: 1.5; }
.pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pop-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.pop-theme { font-size: 12.5px; font-weight: 700; color: var(--navy); }
.pop-badge { font-size: 9.5px; font-weight: 700; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; margin-left: auto; }
.pop-text { color: var(--text); margin-bottom: 6px; }
.pop-by { font-size: 11px; color: var(--muted); }

/* ─── Modales (mode d'emploi + formulaire) ─── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.66); z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 22px; animation: fadeIn .2s ease-out; }
.modal-overlay.is-hidden { display: none; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal-card { background: #fff; border-radius: 16px; padding: 28px 32px 26px; box-shadow: 0 16px 50px rgba(0,0,0,.34); max-width: 680px; width: 100%; max-height: 92vh; overflow-y: auto; animation: zoomIn .22s ease-out; position: relative; }
@keyframes zoomIn { from { transform: scale(.96); opacity: .7 } to { transform: scale(1); opacity: 1 } }
.modal-header { display: flex; align-items: center; gap: 13px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 2px solid var(--teal-light); }
.modal-icon { font-size: 28px; }
.modal-header h2 { font-size: 21px; font-weight: 800; color: var(--teal-darker); flex: 1; }
.modal-close { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 14px; color: var(--muted); }
.modal-close:hover { background: #fee; color: #b23b37; border-color: #f3c4c4; }
.modal-intro { font-size: 14.5px; line-height: 1.6; margin-bottom: 16px; }
.modal-block { margin-bottom: 18px; }
.modal-block h3 { font-size: 15px; font-weight: 700; color: var(--teal-darker); margin-bottom: 9px; }
.modal-block p { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.modal-list { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; counter-reset: step; }
ol.modal-list li { counter-increment: step; }
.modal-list li { font-size: 13.5px; line-height: 1.5; padding: 9px 12px 9px 40px; background: var(--teal-tint); border-radius: 7px; position: relative; }
ol.modal-list li::before { content: counter(step); position: absolute; left: 10px; top: 9px; width: 20px; height: 20px; background: var(--teal); color: #fff; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.modal-warning { display: flex; gap: 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 13px 15px; margin: 18px 0 18px; }
.modal-warning-icon { font-size: 20px; }
.modal-warning strong { color: #92400e; display: block; margin-bottom: 3px; font-size: 13.5px; }
.modal-warning p { font-size: 12.5px; line-height: 1.45; color: #78350f; }
.modal-cta { width: 100%; padding: 14px; background: var(--teal); color: #fff; border: none; border-radius: 9px; font-family: var(--font); font-size: 15px; font-weight: 700; cursor: pointer; transition: background .15s; }
.modal-cta:hover { background: var(--teal-dark); }

/* ─── Formulaire ─── */
.form-card { max-width: 540px; }
.form-target { background: var(--teal-light); color: var(--teal-darker); font-size: 12.5px; font-weight: 600; border-radius: 8px; padding: 9px 13px; margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); margin: 14px 0 8px; }
.field-label small { font-weight: 400; color: var(--muted); }
.theme-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.theme-opt { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text); text-align: left; transition: border-color .12s, background .12s; }
.theme-opt .to-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
.theme-opt:hover { background: var(--bg); }
.theme-opt.is-sel { border-color: var(--teal); background: var(--teal-tint); box-shadow: inset 0 0 0 1px var(--teal); }
.type-picker { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.type-btn { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 6px; border: 2px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; font-family: var(--font); font-size: 12px; font-weight: 700; color: var(--text); transition: transform .1s, border-color .12s, background .12s; }
.type-btn .tb-ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; }
.type-btn-atout .tb-ico { background: var(--t-marche); }
.type-btn-vigilance .tb-ico { background: var(--t-voiture); }
.type-btn-idee .tb-ico { background: var(--accent); }
.type-btn:hover { transform: translateY(-1px); }
.type-btn.is-sel { background: var(--teal-tint); }
.type-btn-atout.is-sel { border-color: var(--t-marche); }
.type-btn-vigilance.is-sel { border-color: var(--t-voiture); }
.type-btn-idee.is-sel { border-color: var(--accent); }
#fComment, #fName { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: var(--font); font-size: 13.5px; background: #fff; color: var(--text); }
#fComment { resize: vertical; min-height: 88px; }
#fComment:focus, #fName:focus { outline: none; border-color: var(--teal); box-shadow: var(--ring); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-msg { font-size: 12.5px; margin-top: 12px; min-height: 1em; }
.form-msg.is-err { color: #b23b37; font-weight: 600; }
.form-msg.is-ok { color: #1d7a43; font-weight: 600; }

/* mask hors territoire */
.leaflet-control-attribution { font-size: 10px; }

/* ─── Responsive ─── */
@media (max-width: 860px) {
  :root { --sidebar-w: 100%; }
  .layout { flex-direction: column; top: var(--topbar-h); }
  .sidebar { width: 100%; max-height: 42vh; }
  #map { min-height: 50vh; }
  .topbar-badge { display: none; }
  .topbar-titles h1 { font-size: 13.5px; }
}

/* ════════════════════════════════════════════════════════════════
   Ajouts CCVCD — limites communales, commune de résidence,
   consentement RGPD, file d'attente de modération, mode dégradé
   ════════════════════════════════════════════════════════════════ */

/* ─── Limites communales ─── */
.commune-tip { font-family: var(--font); font-size: 12px; line-height: 1.4; border-radius: 8px; border: 1px solid var(--line); }
.centre-label {
  font-family: var(--font); font-size: 12px; font-weight: 800; color: var(--navy);
  text-align: center; letter-spacing: .01em; white-space: nowrap;
  text-shadow: 0 0 4px #fff, 0 0 4px #fff, 0 0 8px #fff;
  pointer-events: none;
}
.side-toggle { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.switch { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--teal); width: 15px; height: 15px; cursor: pointer; }

/* ─── Champs ajoutés au formulaire ─── */
#fCommune {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-family: var(--font); font-size: 13.5px; background: #fff; color: var(--text);
}
#fCommune:focus { outline: none; border-color: var(--teal); box-shadow: var(--ring); }
.consent {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 18px;
  background: var(--teal-tint); border: 1px solid var(--teal-light); border-radius: 9px;
  padding: 12px 14px; font-size: 12px; line-height: 1.5; color: var(--text); cursor: pointer;
}
.consent input { accent-color: var(--teal); width: 16px; height: 16px; margin-top: 1px; flex-shrink: 0; cursor: pointer; }

/* ─── Contributions en attente de validation ─── */
.contrib-marker.is-pending { border-style: dashed; opacity: .82; }
.pop-pending, .feed-pending { font-size: 11px; font-weight: 600; color: #9a6a00; margin-top: 6px; }
.feed-item.is-pending { border-style: dashed; background: #fffdf5; }

/* ─── Bandeau mode dégradé ─── */
.offline-flag {
  position: fixed; right: 14px; top: calc(var(--topbar-h) + 12px); z-index: 4000;
  display: inline-flex; align-items: center; gap: 8px; max-width: 300px;
  background: rgba(24,60,109,.94); color: #fff; font-size: 11.5px; font-weight: 600;
  padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow); line-height: 1.4;
}
.offline-flag.is-hidden { display: none; }
.offline-flag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ─── Toast de confirmation ─── */
.toast {
  position: fixed; left: 50%; bottom: 74px; transform: translate(-50%, 14px);
  z-index: 4500; max-width: min(520px, 92vw);
  background: var(--navy); color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.45;
  padding: 13px 20px; border-radius: 12px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ─── Outils pas encore ouverts (sélecteur d'outils) ─── */
.toolswitch .ts-soon {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: #b3bcc5;
  padding: 8px 13px; border-radius: 999px; white-space: nowrap; cursor: default;
}
.toolswitch .ts-soon .ts-ico { font-size: 14px; line-height: 1; filter: grayscale(1); opacity: .6; }
@media (max-width: 720px) { .toolswitch .ts-soon { padding: 8px 10px; } .toolswitch .ts-soon .ts-label { display: none; } }

/* ════════════════════════════════════════════════════════════════
   Identité CCVCD (26 juillet 2026)
   Logo de la collectivité dans la barre de titre + crédit Mobilité positive
   ════════════════════════════════════════════════════════════════ */

/* Le logo CCVCD est presque carré (581 × 481) là où celui de Mobilité positive
   était très large : on le monte à 44 px pour qu'il pèse autant dans la barre. */
.topbar { height: 68px; }
:root { --topbar-h: 68px; }
.topbar-logo img { height: 52px; }
@media (max-width: 860px) { .topbar { height: 60px; } :root { --topbar-h: 60px; } .topbar-logo img { height: 44px; } }

/* Crédit du bureau d'études, déplacé du bandeau vers le bas de la colonne */
.side-credit {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--navy-line);
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: #6b76a3;
}
.side-credit img { height: 22px; width: auto; display: block; }
