/* ============================================================
   CrossBooks — Stili
   ============================================================ */

/* ─── Font self-hosted (Google Fonts: Fraunces + Inter) ────── */
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --c-primary:    #00329f;          /* blu CrossBooks (Cross) */
  --c-primary-d:  #001f5c;          /* blu scuro */
  --c-accent:     #FFCC00;          /* giallo CrossBooks */
  --c-accent-d:   #a07f00;          /* giallo scuro */
  --c-ink:        #1a0f0b;          /* nero caldo (Books) */
  --c-cream:      #fbf8f1;          /* panna libro / sfondo pagina */
  --c-cream-edge: #d4cfbf;          /* dorso libro */
  /* UI */
  --c-bg:        #ffffff;
  --c-fg:        #1a1a1a;
  --c-muted:     #6b6b6b;
  --c-border:    #e5e5e5;
  --c-ok:        #2c8a3b;
  --c-err:       #b3261e;
  /* Tipografia */
  --f-display:   'Fraunces', Georgia, 'Times New Roman', serif;
  --f-body:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Geometria */
  --r:           8px;
  --maxw:        60em;
  --topbar-h:    52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--f-body);
  color: var(--c-fg);
  background: var(--c-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--f-display); font-weight: 600; letter-spacing: -0.01em; }

a { color: var(--c-primary); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

/* ─── Top bar ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--c-primary);
  color: #fff;
  position: sticky;
  top: 0;
  /* sopra ai controlli Leaflet (.leaflet-top/bottom hanno z-index 1000) */
  z-index: 2000;
  min-height: var(--topbar-h);
}
.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  text-decoration: none;
  line-height: 1;
}
.topbar .brand:hover, .topbar .brand:focus { text-decoration: none; }
.topbar .brand-mark { width: 32px; height: 32px; display: inline-block; flex: 0 0 auto; }
.topbar .brand-mark svg { width: 100%; height: 100%; display: block; }
.topbar .brand-wordmark {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.topbar .brand-cross { color: #fff; }
.topbar .brand-books { color: var(--c-accent); }

.topbar nav a { color: #fff; }

/* ─── Hamburger toggle (visibile solo su mobile) ───────────── */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.6rem;
}
.menu-toggle:hover { background: rgba(255,255,255,0.1); }

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

.bottombar {
  text-align: center;
  padding: 1rem;
  color: var(--c-muted);
  border-top: 1px solid var(--c-border);
  margin-top: 2rem;
}
/* Su mobile, il credit "crafted with" va a capo, senza pallino. */
@media (max-width: 720px) {
  .bottombar .footer-credit { display: block; margin-top: 0.4rem; }
  .bottombar .footer-credit .footer-sep { display: none; }
}

button {
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: var(--r);
  border: 1px solid var(--c-primary);
  background: var(--c-primary);
  color: #fff;
  cursor: pointer;
}
button:hover { background: var(--c-primary-d); }

/* ─── Hero / sezioni testo ─────────────────────────────────── */
.hero h1 { color: var(--c-primary); margin-top: 0; }
.hero .status { color: var(--c-muted); font-style: italic; }

/* ─── Diagnostica ─────────────────────────────────────────── */
.diagnostica {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--c-border);
  border-radius: var(--r);
  background: #fafafa;
}
.diagnostica h2 { margin: 1rem 0 0.5rem; font-size: 1rem; color: var(--c-muted); }
.diagnostica h2:first-child { margin-top: 0; }
.diagnostica dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
}
.diagnostica dt { font-weight: 600; color: var(--c-muted); }
.diagnostica dd { margin: 0; word-break: break-word; }
.diagnostica code {
  background: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  font-size: 0.9em;
}

/* ─── Pagina mappa fullscreen ──────────────────────────────── */
body.page-mappa {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
body.page-mappa main {
  max-width: none;
  padding: 0;
  margin: 0;
  flex: 1;
  display: flex;
}
body.page-mappa .bottombar { display: none; }

.mappa-fullscreen {
  flex: 1;
  width: 100%;
  height: 100%;
  background: #f0eee9;
}

/* ─── Marker "beacon" per tipologia ────────────────────────── */
.beacon span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin: 2px;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  color: #fff;
  font-size: 13px;
  line-height: 1;
}
.beacon span > i.bi { display: inline-flex; }

/* ─── Contatore luoghi ─────────────────────────────────────── */
.mappa-contatore {
  background: #fff;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  font-size: 0.85rem;
  color: var(--c-fg);
}

/* ─── Pulsante GPS ─────────────────────────────────────────── */
/* FAB "Trova la mia posizione" in basso a destra della mappa.
   Pattern Google/Apple/Waze. Tondo 48px, blu brand, icona crosshair
   bianca. Touch target rispetta WCAG 2.5.5 AA (>= 44x44). */
.mappa-locate {
  /* Wrapper Leaflet: niente background/bordo, solo positioning */
  background: transparent;
  border: none;
  box-shadow: none;
  /* Su mobile aggiungo respiro per evitare overlap con la nav bar Android
     (3 pulsanti) e il home indicator iOS. env(safe-area-inset-bottom) si
     attiva automaticamente su dispositivi con gesture/notch (richiede
     viewport-fit=cover, già impostato in header.php). */
  margin: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px !important;
}
@media (max-width: 720px) {
  .mappa-locate {
    margin-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
.mappa-locate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.30);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.mappa-locate-btn:hover,
.mappa-locate-btn:focus-visible {
  background: var(--c-primary-d);
  transform: scale(1.06);
  box-shadow: 0 3px 12px rgba(0,0,0,0.35);
}
.mappa-locate-btn:active { transform: scale(0.97); }
.mappa-locate-btn:disabled,
.mappa-locate-btn.caricamento {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}
.mappa-locate-btn svg { display: block; }

/* ─── No-script warn ───────────────────────────────────────── */
.noscript-warn {
  padding: 1rem;
  margin: 1rem;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  border-radius: var(--r);
  color: #664d03;
}

/* ─── Form pagine (login, registrazione) ───────────────────── */
.form-pagina {
  max-width: 28em;
  margin: 0 auto;
  padding: 1rem 0;
}
.form-pagina h1 { color: var(--c-primary); margin-top: 0; }
.form-auth { display: flex; flex-direction: column; }
.form-auth .campo {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.form-auth .campo label { font-weight: 600; }
.form-auth .campo small { color: var(--c-muted); font-size: 0.85em; }
.form-auth input[type="text"],
.form-auth input[type="email"],
.form-auth input[type="password"] {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  width: 100%;
}
.form-auth input:focus {
  outline: 2px solid var(--c-primary);
  outline-offset: 0;
  border-color: var(--c-primary);
}
.form-auth button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  margin-top: 0.5rem;
}
.form-foot {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--c-muted);
}

/* ─── Topbar: nav auth ─────────────────────────────────────── */
.topbar nav { display: flex; align-items: center; gap: 0.25rem; }
.topbar nav a { padding: 0.25rem 0.5rem; }
.topbar nav .utente { font-weight: 600; }
.topbar nav .diag { opacity: 0.75; font-size: 0.9em; }

.logout-form { display: inline; margin: 0; padding: 0; }
.link-button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font: inherit;
  text-decoration: none;
}
.link-button:hover { text-decoration: underline; }

/* ─── Flash messages ───────────────────────────────────────── */
.flash-area {
  max-width: var(--maxw);
  margin: 0.75rem auto 0;
  padding: 0 1rem;
}
body.page-mappa .flash-area {
  position: absolute;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  z-index: 500;
  pointer-events: none;
}
body.page-mappa .flash {
  pointer-events: auto;
}
.flash {
  padding: 0.7rem 1rem;
  border-radius: var(--r);
  margin-bottom: 0.5rem;
  border: 1px solid var(--c-border);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.flash-ok    { background: #e6f4e8; border-color: #b8d8be; color: #1f3e22; }
.flash-warn  { background: #fff3cd; border-color: #ffe69c; color: #664d03; }
.flash-error { background: #f8d7da; border-color: #f5c2c7; color: #721c24; }

/* ─── Profilo ──────────────────────────────────────────────── */
.profilo h1, .profilo-luoghi h2 { color: var(--c-primary); }
.profilo-dati {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  margin: 1rem 0 2rem;
}
.profilo-dati dt { font-weight: 600; color: var(--c-muted); }
.profilo-dati dd { margin: 0; word-break: break-word; }

.lista-luoghi { list-style: none; padding: 0; margin: 0; }
.lista-luoghi li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--c-border);
}
.lista-luoghi li small { color: var(--c-muted); }

/* ─── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75em;
  font-weight: 600;
  border: 1px solid currentColor;
  vertical-align: middle;
}
.badge-ok    { color: #1f3e22; background: #d4eddb; border-color: #b8d8be; }
.badge-warn  { color: #664d03; background: #fff3cd; border-color: #ffe69c; }
.badge-error { color: #721c24; background: #f8d7da; border-color: #f5c2c7; }
.badge-stato.badge-in_attesa { color: #664d03; background: #fff3cd; border-color: #ffe69c; }
.badge-stato.badge-approvato { color: #1f3e22; background: #d4eddb; border-color: #b8d8be; }
.badge-stato.badge-rifiutato { color: #721c24; background: #f8d7da; border-color: #f5c2c7; }
.badge-stato.badge-rimosso   { color: #6b6b6b; background: #eeeeee; border-color: #cccccc; }

/* ─── Form aggiungi luogo ──────────────────────────────────── */
.form-aggiungi { max-width: 36em; }
.form-aggiungi .hint { color: var(--c-muted); font-style: italic; }
.form-aggiungi fieldset {
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  margin: 0 0 1.25rem;
}
.form-aggiungi legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--c-primary);
}
.form-aggiungi textarea {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  width: 100%;
  resize: vertical;
  min-height: 6em;
}
.form-aggiungi textarea:focus {
  outline: 2px solid var(--c-primary);
  outline-offset: 0;
  border-color: var(--c-primary);
}
.form-aggiungi select {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  width: 100%;
  background: #fff;
}
.form-aggiungi input[type="file"] {
  font: inherit;
  width: 100%;
}
.form-aggiungi .riga {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 32em) {
  .form-aggiungi .riga { grid-template-columns: 1fr; }
}

.separatore-oppure {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0 1rem;
  color: var(--c-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.separatore-oppure::before,
.separatore-oppure::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--c-border);
}
.separatore-oppure > span {
  padding: 0 0.8rem;
}

.btn-secondary {
  font: inherit;
  padding: 0.55rem 0.9rem;
  border-radius: var(--r);
  border: 1px solid var(--c-primary);
  background: #fff;
  color: var(--c-primary);
  cursor: pointer;
}
.btn-secondary:hover:not(:disabled) { background: #f1f5f1; }
.btn-secondary:disabled { opacity: 0.6; cursor: progress; }

.mini-mappa {
  height: 320px;
  border-radius: var(--r);
  border: 1px solid var(--c-border);
  margin-bottom: 0.5rem;
  background: #f0eee9;
}
.coord-display {
  font-size: 0.85em;
  color: var(--c-muted);
  margin: 0.25rem 0 0;
}

/* Flash temporaneo sui campi auto-compilati dal geocode */
@keyframes campoFlash {
  0%   { background-color: #fff7c2; box-shadow: 0 0 0 2px #f0d000 inset; }
  100% { background-color: transparent; box-shadow: none; }
}
.campo-flash { animation: campoFlash 1.6s ease-out; }

/* ─── Form preferenze profilo ───────────────────────────────── */
.preferenze {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--c-border);
}
.preferenze h2 { color: var(--c-primary); margin-top: 0; }
.preferenze .hint {
  color: var(--c-muted);
  font-size: 0.92em;
  line-height: 1.5;
  margin: 0 0 0.5rem;
}
.form-preferenze {
  background: #fafafa;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ─── Toast notifica di prossimità ─────────────────────────── */
.toast-vicinanza {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 30px);
  background: var(--c-primary);
  color: #fff !important;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 5000;
  max-width: calc(100vw - 2rem);
  text-align: center;
  text-decoration: none !important;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: auto;
}
.toast-vicinanza.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast-vicinanza:hover { background: var(--c-primary-d); }

/* ─── Pagina moderazione ───────────────────────────────────── */
.moderazione h1 { color: var(--c-primary); }
.moderazione .hint { color: var(--c-muted); font-style: italic; }

/* Dialog di conferma post-approvazione */
.dlg-approvato {
  border: none;
  border-radius: var(--r);
  padding: 1.5rem 1.75rem;
  max-width: 28em;
  width: calc(100% - 2rem);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  color: inherit;
  background: #fff;
}
.dlg-approvato::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}
.dlg-approvato h2 {
  margin: 0 0 0.5rem;
  color: var(--c-primary);
  font-size: 1.3rem;
}
.dlg-approvato p {
  margin: 0 0 1.25rem;
  color: var(--c-muted);
}
.dlg-approvato .dlg-azioni {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}
.dlg-approvato .dlg-azioni .btn-ok,
.dlg-approvato .dlg-azioni .btn-secondary {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: var(--r);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--c-primary);
}
.dlg-approvato .dlg-azioni .btn-ok {
  background: var(--c-primary);
  color: #fff;
}
.dlg-approvato .dlg-azioni .btn-ok:hover { background: var(--c-primary-d); }
.dlg-approvato .dlg-azioni .btn-secondary {
  background: #fff;
  color: var(--c-primary);
}
.dlg-approvato .dlg-azioni .btn-secondary:hover {
  background: var(--c-primary);
  color: #fff;
}
@media (max-width: 32em) {
  .dlg-approvato .dlg-azioni { flex-direction: column-reverse; }
  .dlg-approvato .dlg-azioni .btn-ok,
  .dlg-approvato .dlg-azioni .btn-secondary { text-align: center; }
}

/* ─── Condividi luogo sui social (pagina /luogo) ──────────── */
.condividi {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem 1.2rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: #fafbfc;
}
.condividi h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--c-primary);
}
.share-buttons {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--r);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: #555;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  white-space: nowrap;
}
.share-btn:hover { transform: translateY(-1px); text-decoration: none; }
.share-btn:active { transform: translateY(0); }
.share-btn i.bi { font-size: 1.05em; line-height: 1; }
.share-wa    { background: #25D366; }
.share-wa:hover    { background: #1EBC58; color: #fff; }
.share-fb    { background: #1877F2; }
.share-fb:hover    { background: #1462C7; color: #fff; }
.share-tg    { background: #229ED9; }
.share-tg:hover    { background: #1B84B5; color: #fff; }
.share-x     { background: #000; }
.share-x:hover     { background: #333; color: #fff; }
.share-mail  { background: #6B6B6B; }
.share-mail:hover  { background: #4F4F4F; color: #fff; }
.share-copia { background: var(--c-primary); }
.share-copia:hover { background: var(--c-primary-d); color: #fff; }
.share-feedback {
  min-height: 1.3em;
  margin: 0.7rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-muted);
  transition: opacity 0.2s;
}
.share-feedback-ok  { color: #2c8a3a; }
.share-feedback-err { color: #c02020; }
@media (max-width: 32em) {
  .share-buttons { gap: 0.4rem; }
  .share-btn { padding: 0.45rem 0.7rem; font-size: 0.88rem; }
}

/* ─── /admin-tipologie ────────────────────────────────────── */
.admin-tipologie { max-width: 40em; }
.admin-tipologie .form-tipologie fieldset {
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 0.8rem 1rem 1rem;
  margin: 0 0 1rem;
}
.admin-tipologie .form-tipologie legend {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.4rem;
  font-weight: 600;
  color: var(--c-primary);
}
.admin-tipologie .form-tipologie legend code {
  background: #f3f4f6;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}
.tipo-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--c-border), 0 1px 3px rgba(0,0,0,0.15);
  font-size: 14px;
}
.campo-colore { display: flex; flex-direction: column; }
.campo-colore input[type="color"] {
  width: 60px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  cursor: pointer;
}
.campo-colore-hex {
  margin-top: 0.4rem;
  font-family: monospace;
  max-width: 8em;
}
.campo-icona { position: relative; }
.icona-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-top: 0.4rem;
  border-radius: var(--r);
  background: #f3f4f6;
  color: var(--c-primary);
  font-size: 18px;
}
.campo-ordine input { max-width: 6em; }

.card-moderazione {
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: #fafafa;
}
.card-moderazione .card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.card-moderazione h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--c-primary);
}
.card-moderazione .tipo {
  font-size: 0.85em;
  color: var(--c-muted);
  font-weight: 600;
}
.card-moderazione .descrizione {
  background: #fff;
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--c-border);
}
.card-moderazione .dati {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.92em;
}
.card-moderazione .dati dt { font-weight: 600; color: var(--c-muted); }
.card-moderazione .dati dd { margin: 0; word-break: break-word; }
.card-moderazione .dati code {
  font-size: 0.9em;
  background: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--c-border);
}

.foto-griglia {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.foto-griglia img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--c-border);
}

/* Miniature delle foto già presenti nel form di /luogo-modifica */
.foto-modifica-attuali {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.5rem 0 0.25rem;
}
.foto-thumb-elimina {
  position: relative;
  display: inline-block;
}
.foto-thumb-elimina img {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--c-border);
}
.foto-thumb-elimina form { margin: 0; }
.btn-elimina-thumb {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--c-danger, #c0392b);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.btn-elimina-thumb:hover,
.btn-elimina-thumb:focus { background: #a32a1f; }
.foto-gestione { margin-bottom: 1rem; }

/* ─── Azioni motivate (details + form con textarea) ───────── */
.azione-motivata { display: inline-block; margin: 0.25rem 0.4rem 0.25rem 0; }
.azione-motivata > summary {
  cursor: pointer;
  list-style: none;
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--r);
  border: 1px solid currentColor;
  font-weight: 600;
}
.azione-motivata > summary::-webkit-details-marker { display: none; }
.azione-motivata[open] > summary { margin-bottom: 0.5rem; }
.azione-motivata > form {
  display: block;
  padding: 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: #fafafa;
  max-width: 480px;
}
.azione-motivata > form > label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  font-size: 0.9em;
}
.azione-motivata > form > textarea {
  width: 100%;
  margin-bottom: 0.5rem;
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  box-sizing: border-box;
}
.azione-cessazione > form { border-color: var(--c-danger, #c0392b); background: #fff5f5; }
.info-cancellato {
  padding: 0.7rem 1rem;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  border-radius: var(--r);
  color: #664d03;
  font-weight: 600;
}

/* "Danger zone" in fondo a /profilo: separazione visiva netta */
.danger-zone {
  margin-top: 3rem;
  padding: 1.2rem;
  border: 1px solid #f5c6cb;
  border-radius: var(--r);
  background: #fff8f8;
}
.danger-zone h2 {
  margin-top: 0;
  color: var(--c-danger, #c0392b);
}
.danger-zone > .hint { margin: 0.4rem 0 1rem; }

/* Popup elimina foto in /luogo-modifica */
.foto-elimina-pop { position: absolute; top: -8px; right: -8px; }
.foto-elimina-pop > summary {
  list-style: none;
  cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--c-danger, #c0392b);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.foto-elimina-pop > summary::-webkit-details-marker { display: none; }
.foto-elimina-pop[open] > form {
  position: absolute;
  top: 30px;
  right: 0;
  z-index: 10;
  width: 260px;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.foto-elimina-pop[open] > form label {
  display: block;
  font-weight: 600;
  font-size: 0.85em;
  margin-bottom: 0.25rem;
}
.foto-elimina-pop[open] > form textarea {
  width: 100%;
  font: inherit;
  padding: 0.4rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  box-sizing: border-box;
}

/* Su mobile il popup absolute a destra esce dal viewport quando la
   thumb è vicino al bordo sinistro. Lo fissiamo centrato nel viewport. */
@media (max-width: 32em) {
  .foto-elimina-pop[open] > form {
    position: fixed;
    top: 50%;
    left: 1rem;
    right: 1rem;
    transform: translateY(-50%);
    width: auto;
    max-width: 320px;
    margin: 0 auto;
    z-index: 100;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  }
}

/* ─── Tabella audit log ───────────────────────────────────── */
.audit-tabella {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
  margin: 1rem 0;
}
.audit-tabella th,
.audit-tabella td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.audit-tabella th {
  background: #f5f5f5;
  font-weight: 600;
}
.audit-tabella code {
  font-family: monospace;
  font-size: 0.92em;
  background: #f0eee9;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}
.audit-tabella .motivo {
  color: var(--c-muted);
  font-style: italic;
  max-width: 30em;
}
.paginazione {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

/* ─── Bottone "Traduci" (UGC: bio, commenti) ───────────────── */
.btn-traduci {
  display: inline-block;
  margin: 0.35rem 0 0;
  padding: 0.15rem 0.6rem;
  font: inherit;
  font-size: 0.82em;
  background: transparent;
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}
.btn-traduci:hover,
.btn-traduci:focus {
  background: var(--c-primary);
  color: #fff;
}
.btn-traduci[disabled],
.btn-traduci[data-state="loading"] { opacity: 0.7; cursor: wait; }
.btn-traduci[data-state="error"]   { color: var(--c-danger, #c0392b); border-color: currentColor; }

/* ─── Checkbox accettazione informativa (registrazione) ─── */
.campo-checkbox label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: normal;
}
.campo-checkbox input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}
.campo-checkbox a { font-weight: 600; }

/* ─── Pagina informativa ──────────────────────────────────── */
.informativa {
  max-width: 52em;
  margin: 0 auto;
  padding: 0 1rem;
  line-height: 1.6;
}
.informativa h1 { color: var(--c-primary); }
.informativa h2 {
  color: var(--c-primary);
  margin-top: 1.8rem;
  font-size: 1.15em;
}
.informativa ul { margin: 0.4rem 0 0.4rem 1.2rem; }
.informativa li { margin-bottom: 0.3rem; }
.informativa .cta-row { margin-top: 2rem; }

.azioni {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.inline-form { display: inline; margin: 0; }
.btn-ok, .btn-danger {
  font: inherit;
  padding: 0.55rem 1rem;
  border-radius: var(--r);
  border: 1px solid;
  cursor: pointer;
  font-weight: 600;
}
.btn-ok     { background: #2c5530; color: #fff; border-color: #2c5530; }
.btn-ok:hover     { background: #1f3e22; }
.btn-danger { background: #b3261e; color: #fff; border-color: #b3261e; }
.btn-danger:hover { background: #8d1d18; }

/* ─── Topbar: link nuovi ───────────────────────────────────── */
.topbar nav .aggiungi { font-weight: 600; }
.topbar nav .moderazione { font-style: italic; }

/* ─── Mobile: nav hamburger ────────────────────────────────── */
@media (max-width: 720px) {
  .menu-toggle { display: inline-flex; align-items: center; }

  .topbar nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--c-primary);
    padding: 0.25rem 0;
    border-top: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    gap: 0;
    z-index: 2001;
  }
  .topbar nav.open { display: flex; }

  /* Quando il menu è aperto: nascondi i controlli Leaflet (zoom,
     contatore, GPS) per evitare la sovrapposizione visiva. */
  body.menu-aperto .leaflet-top,
  body.menu-aperto .leaflet-bottom { visibility: hidden; }
  .topbar nav a,
  .topbar nav .link-button {
    padding: 0.75rem 1rem;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .topbar nav a:last-of-type { border-bottom: none; }
  .topbar nav .logout-form {
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.18);
    margin: 0;
    margin-top: 0.25rem;
  }

  /* Lingua: una sola riga centrata anche in dropdown mobile. */
  .topbar nav .lang-switcher {
    width: 100%;
    justify-content: center;
    padding: 0.6rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.18);
  }
  .topbar nav .lang-switcher .lang {
    width: auto;
    padding: 0.35rem 0.6rem;
    border-bottom: none;
    text-align: center;
  }
}

/* ─── Topbar: selettore lingua ──────────────────────────────── */
.topbar nav .lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 0.5rem;
  font-size: 0.9em;
  opacity: 0.85;
}
.topbar nav .lang-switcher .lang { padding: 0.2rem 0.35rem; text-decoration: none; }
.topbar nav .lang-switcher .lang.is-active {
  font-weight: 700;
  text-decoration: underline;
  opacity: 1;
}
.topbar nav .lang-switcher .lang-sep { opacity: 0.6; }

/* ─── Popup mappa (Leaflet) ───────────────────────────────── */
.leaflet-popup-content { margin: 12px 16px; font-family: inherit; font-size: 0.92em; }
.popup-content { min-width: 220px; }
.popup-content strong { color: var(--c-primary); }
.popup-foto img {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: 4px;
  margin: 0.6rem 0 0.25rem;
}
.popup-piu-foto { color: var(--c-muted); font-size: 0.85em; }
.popup-desc { margin: 0.5rem 0; line-height: 1.4; }
.popup-info { margin: 0.25rem 0; color: var(--c-fg); }
.popup-info small { color: var(--c-muted); }
.popup-cta { margin: 0.75rem 0 0; }
.popup-cta a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  background: var(--c-primary);
  color: #fff !important;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
}
.popup-cta a:hover { background: var(--c-primary-d); }
.popup-loading { font-size: 0.85em; color: var(--c-muted); margin-top: 0.5rem; font-style: italic; }
.popup-orig { color: var(--c-muted); font-size: 0.85em; }

/* ─── Pagina dettaglio luogo ───────────────────────────────── */
.luogo-detail h1 {
  color: var(--c-primary);
  margin: 0.25rem 0 0.25rem;
}
.luogo-detail .nome-originale {
  color: var(--c-muted);
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.luogo-detail .citta-originale {
  color: var(--c-muted);
  font-style: italic;
}
.luogo-detail .meta {
  color: var(--c-muted);
  margin-top: 0;
  margin-bottom: 1rem;
}
.luogo-detail .meta .tipo {
  font-weight: 600;
  color: var(--c-fg);
}
.luogo-detail .foto-griglia {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}
.luogo-detail .foto-griglia img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--c-border);
  display: block;
}
.luogo-detail .descrizione {
  font-size: 1.05em;
  line-height: 1.6;
  margin: 1rem 0;
  white-space: pre-wrap;
}
.luogo-detail .dati {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 1rem 0;
}
.luogo-detail .dati dt { font-weight: 600; color: var(--c-muted); }
.luogo-detail .dati dd { margin: 0; word-break: break-word; }
.luogo-detail .dati code {
  font-size: 0.9em;
  background: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--c-border);
}
.luogo-mappa {
  height: 280px;
  border-radius: var(--r);
  border: 1px solid var(--c-border);
  margin: 1rem 0;
  background: #f0eee9;
}
.luogo-detail .back { margin: 1.5rem 0 0; }

/* ─── Bottone foto custom (input file mascherato) ──────────── */
.btn-foto {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  background: var(--c-primary);
  color: #fff;
  border-radius: var(--r);
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
}
.btn-foto:hover { background: var(--c-primary-d); }
.btn-foto-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.btn-foto-row .btn-foto {
  flex: 1 1 12em;
  text-align: center;
}
.btn-foto-secondario {
  background: #fff;
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
}
.btn-foto-secondario:hover {
  background: var(--c-primary);
  color: #fff;
}

/* Preview thumbnail delle foto in selezione (pre-submit) */
.foto-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0 0.3rem;
}
.foto-preview:empty { display: none; }
.foto-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
}
.foto-preview-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--c-border);
}
.foto-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  background: #cc2222;
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.foto-preview-remove:hover { background: #aa1111; }

/* ─── Bottone "Torna alla mappa" in cima a /luogo ─────────── */
.back-link-top {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem 0.4rem 0.5rem;
  margin: 0 0 1rem;
  border-radius: var(--r);
  background: #f3f4f6;
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.back-link-top:hover { background: #e7eaef; text-decoration: none; }

/* ─── Lightbox foto ───────────────────────────────────────── */
html.lightbox-open { overflow: hidden; }
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease-out, visibility 0s linear 0.22s;
}
.lightbox-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.22s ease-out, visibility 0s linear 0s;
}
.lightbox-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1rem;
  box-sizing: border-box;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.25s ease-out, opacity 0.2s ease-out;
}
.lightbox-overlay.is-open .lightbox-img {
  transform: scale(1);
  opacity: 1;
}
/* Mini-fade durante il cambio src con ← → */
.lightbox-img.is-swap {
  opacity: 0;
  transition: opacity 0.12s ease-out;
}
.lightbox-nav, .lightbox-close {
  position: absolute;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: background 0.15s, opacity 0.25s ease-out 0.08s;
}
.lightbox-overlay.is-open .lightbox-nav,
.lightbox-overlay.is-open .lightbox-close,
.lightbox-overlay.is-open .lightbox-counter { opacity: 1; }
.lightbox-nav:hover, .lightbox-close:hover { background: rgba(0, 0, 0, 0.8); }
.lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 36px;
  line-height: 1;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-counter {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.25s ease-out 0.08s;
}
@media (max-width: 32em) {
  .lightbox-nav { width: 44px; height: 44px; font-size: 28px; }
  .lightbox-inner { padding: 3rem 0.5rem; }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Accessibilità: skip link + focus globale ────────────── */
/* Pattern canonico "visually-hidden until focused": stesso meccanismo
   di .sr-only (clip rect) per la stato hidden — è robusto su tutti i
   browser ed evita interazioni strane con elementi `position: sticky`
   adiacenti (come la nostra topbar). */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  z-index: 10000;
  background: var(--c-accent);
  color: var(--c-primary-d);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus,
.skip-link:focus-visible {
  width: auto;
  height: auto;
  padding: 0.6rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border-bottom-right-radius: 4px;
  outline: 2px solid var(--c-primary-d);
  outline-offset: 0;
}

/* Focus visibile globale (override su sfondo blu della topbar). Risolve
   2.4.7 in un colpo per bottoni, link e form non già coperti. */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.topbar nav a:focus-visible,
.topbar nav .link-button:focus-visible,
.topbar .menu-toggle:focus-visible {
  outline-color: var(--c-accent);
  outline-offset: 1px;
}
.foto-info {
  color: var(--c-muted);
  font-size: 0.9em;
  margin: 0.4rem 0 0;
  min-height: 1em;
}
.campo-foto small { display: block; margin-top: 0.25rem; color: var(--c-muted); }

/* ─── Reinvia verifica (profilo) ───────────────────────────── */
.reinvia-verifica { display: block; margin-top: 0.5rem; }

/* ─── Azioni admin (sulla pagina luogo) ────────────────────── */
.admin-azioni {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  background: #fdecea;
  border: 1px solid #f5c2c7;
  border-radius: var(--r);
}
.admin-azioni h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--c-err);
}

/* ─── Commenti ─────────────────────────────────────────────── */
.commenti {
  margin: 2rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--c-border);
}
.commenti h2 { color: var(--c-primary); margin-top: 0; }

.form-commento {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: #fafafa;
}
.form-commento .campo { margin-bottom: 0.75rem; }
.form-commento label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.form-commento select,
.form-commento textarea {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  width: 100%;
  background: #fff;
  resize: vertical;
}
.form-commento textarea { min-height: 5em; }
.form-commento button[type="submit"] {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
}

.login-richiesto {
  padding: 1rem;
  background: #fafafa;
  border: 1px dashed var(--c-border);
  border-radius: var(--r);
  color: var(--c-muted);
  text-align: center;
}

.lista-commenti { list-style: none; padding: 0; margin: 0; }
.lista-commenti .commento {
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
}
.lista-commenti .commento header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.4rem;
  font-size: 0.92em;
}
.lista-commenti .tipo-comm { font-weight: 600; color: var(--c-primary); }
.lista-commenti .autore    { color: var(--c-fg); }
.lista-commenti .data      { color: var(--c-muted); margin-left: auto; font-size: 0.85em; }
.lista-commenti .valutazione { color: #b07d00; letter-spacing: 1px; }  /* AA su bianco (4.74:1) */
.lista-commenti .commento p { margin: 0; line-height: 1.5; }
.lista-commenti .commento-lascito  { border-left: 3px solid #1f6feb; }
.lista-commenti .commento-prelevato { border-left: 3px solid #bf6900; }

.commenti .vuoto { color: var(--c-muted); font-style: italic; }

/* ─── Avatar ───────────────────────────────────────────────── */
.avatar {
  display: inline-block;
  border-radius: 50%;
  background: #f1f5f1;
  border: 1px solid var(--c-border);
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-piccolo { width: 28px; height: 28px; }
.avatar-medio   { width: 80px; height: 80px; }
.avatar-grande  { width: 140px; height: 140px; }
.avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4em;
  color: var(--c-muted);
}
.avatar-grande.avatar-placeholder { font-size: 3em; }
.avatar-medio.avatar-placeholder  { font-size: 2em; }

/* ─── Profilo: head con avatar + saluto ────────────────────── */
.profilo-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.profilo-head h1 { margin: 0; }

/* ─── Modifica profilo (form) ──────────────────────────────── */
.modifica-profilo {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--c-border);
}
.modifica-profilo h2 { color: var(--c-primary); margin-top: 0; }
.form-modifica-profilo {
  background: #fafafa;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 1rem 1.25rem;
}
.form-modifica-profilo .campo { margin-bottom: 1rem; }
.form-modifica-profilo label { font-weight: 600; display: block; margin-bottom: 0.25rem; }
.form-modifica-profilo input[type="text"],
.form-modifica-profilo input[type="url"],
.form-modifica-profilo textarea {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  width: 100%;
  background: #fff;
  resize: vertical;
}
.form-modifica-profilo small { display: block; margin-top: 0.25rem; color: var(--c-muted); font-size: 0.9em; }
.form-modifica-profilo button[type="submit"] {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
}
.campo-avatar { display: flex; flex-direction: column; gap: 0.5rem; }
.avatar-attuale { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.avatar-attuale-label { color: var(--c-muted); font-size: 0.9em; }

.preview-cropped {
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: #f1f8f2;
  border: 1px solid #c4ddc8;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
/* Necessario: display:flex sopra batte la regola UA [hidden]{display:none}
   a parità di specificità (l'autore vince), quindi senza questa l'area
   resterebbe visibile anche all'apertura della pagina. */
.preview-cropped[hidden] { display: none; }
.preview-cropped .preview-label {
  margin: 0;
  color: var(--c-primary);
  font-weight: 600;
  font-size: 0.92em;
}

.form-elimina-avatar {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--c-border);
}

/* ─── Cropper modal ────────────────────────────────────────── */
body.modal-aperto { overflow: hidden; }

.cropper-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  /* "safe center" cade su flex-start quando il contenuto è più alto del
     viewport: senza, su flex normale la metà superiore eccedente finiva
     sopra il bordo dello schermo e non era raggiungibile. */
  align-items: safe center;
  justify-content: center;
  z-index: 5000;
  padding: 1rem;
  overflow-y: auto;
}
.cropper-modal[hidden] { display: none; }
.cropper-modal-inner {
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  margin: auto 0;
}
.cropper-modal-inner h3 {
  margin: 0;
  color: var(--c-primary);
}
.cropper-help {
  color: var(--c-muted);
  font-size: 0.92em;
  margin: 0;
}
/* Stage con altezza ESPLICITA: senza, Cropper.js userebbe la dimensione
   naturale dell'immagine come riferimento e foto ad alta risoluzione
   farebbero esplodere la modale fuori viewport. Tetto a 55vh (non 60)
   per lasciare spazio a header + help + actions dentro la modale 90vh. */
.cropper-stage {
  height: clamp(240px, 55vh, 480px);
  width: 100%;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}
.cropper-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
.cropper-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ─── Profilo pubblico /utente ─────────────────────────────── */
.utente-detail h1 { color: var(--c-primary); margin: 0; }
.utente-head {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.utente-head-testo .meta { color: var(--c-muted); margin: 0.25rem 0 0; }
.utente-bio {
  font-size: 1.05em;
  line-height: 1.6;
  background: #fafafa;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 0.8rem 1rem;
  white-space: pre-wrap;
}
.utente-sito a { word-break: break-all; }
.utente-luoghi h2 { color: var(--c-primary); }
.utente-luoghi .vuoto { color: var(--c-muted); font-style: italic; }

.form-admin-utente { margin: 1rem 0; }
.form-admin-utente label { font-weight: 600; display: block; margin-bottom: 0.4rem; }
.riga-inline { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.riga-inline select {
  font: inherit;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: #fff;
}

/* ─── Tabella admin /utenti ────────────────────────────────── */
.tabella-utenti-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: #fff;
}
.tabella-utenti {
  width: 100%;
  border-collapse: collapse;
}
.tabella-utenti th,
.tabella-utenti td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  font-size: 0.92em;
}
.tabella-utenti th {
  background: #fafafa;
  color: var(--c-muted);
  font-weight: 600;
  white-space: nowrap;
}
.tabella-utenti tr:last-child td { border-bottom: none; }
.tabella-utenti tr.disattivato { opacity: 0.55; background: #faf5f5; }
.tabella-utenti td small { color: var(--c-muted); }

/* ─── Commenti: avatar inline ──────────────────────────────── */
.lista-commenti .commento header { gap: 0.5rem; }
.lista-commenti .commento header .avatar { margin-right: 0.25rem; }

/* ─── Engagement bar (cuoricino + preferito) ─────────────── */
.engagement-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: #fafafa;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
}

.btn-utile {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-utile:hover {
  border-color: #e5395f;
  background: #fff5f7;
}
.btn-utile.attivo {
  border-color: #e5395f;
  background: #ffe6ec;
  color: #b51c43;
}
.btn-utile .icon { font-size: 1.1em; }
.btn-utile .label { font-weight: 600; font-size: 0.92em; }
.btn-utile .count {
  background: rgba(0,0,0,0.08);
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 700;
}
.btn-utile.attivo .count { background: #e5395f; color: #fff; }

.utili-only {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--c-muted);
}
.utili-only .icon { font-size: 1.1em; }

.form-preferito {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 0.6rem 0.85rem;
  min-width: 240px;
}
.form-preferito .toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.92em;
}
.form-preferito .toggle-row.sub { padding-left: 1.4rem; color: var(--c-muted); font-size: 0.85em; }
.form-preferito button {
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.85em;
}

/* ─── Allerta admin nei commenti ───────────────────────────── */
.form-commento .toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92em;
}
.form-commento .toggle-row + .hint {
  display: block;
  margin-left: 1.7rem;
  font-style: italic;
}

/* ─── Profilo utente: link social aggiuntivi ───────────────── */
.utente-link {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}
.utente-link li {
  margin-bottom: 0.35rem;
  word-break: break-word;
}
.utente-link strong { color: var(--c-muted); margin-right: 0.35rem; }

/* ─── Sezione preferiti nel profilo ────────────────────────── */
.profilo-preferiti {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--c-border);
}
.profilo-preferiti h2 { color: var(--c-primary); margin-top: 0; }
.profilo-preferiti .hint { color: var(--c-muted); font-style: italic; }

/* ─── Pagina elenco luoghi (filtrabile) ────────────────────── */
.lista-pagina h1 { color: var(--c-primary); }
.lista-pagina .hint { color: var(--c-muted); font-style: italic; margin-top: -0.5rem; }
.lista-pagina .vuoto {
  padding: 1.5rem;
  background: #fafafa;
  border: 1px dashed var(--c-border);
  border-radius: var(--r);
  color: var(--c-muted);
  text-align: center;
}

.filtri {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
  padding: 1rem;
  background: #fafafa;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  margin-bottom: 1.5rem;
}
.filtri .campo { margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.filtri label { font-weight: 600; font-size: 0.9em; color: var(--c-muted); }
.filtri input,
.filtri select {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: #fff;
  width: 100%;
}
.filtri input:focus,
.filtri select:focus {
  outline: 2px solid var(--c-primary);
  outline-offset: 0;
  border-color: var(--c-primary);
}
.filtri .campo-azioni {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.filtri .reset {
  color: var(--c-muted);
  font-size: 0.9em;
}

.gruppo-citta { margin-bottom: 2rem; }
.gruppo-citta h2 {
  color: var(--c-primary);
  font-size: 1.1rem;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--c-border);
}
.gruppo-citta h2 small { color: var(--c-muted); font-weight: normal; font-size: 0.85em; }

.lista-luoghi-pubblica {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}
.card-luogo {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  background: #fff;
  text-decoration: none !important;
  color: var(--c-fg);
  transition: box-shadow 0.15s, transform 0.15s;
}
.card-luogo:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
  border-color: var(--c-primary);
}
.card-luogo img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.card-no-thumb {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: #fafafa;
  border: 1px dashed var(--c-border);
  border-radius: 4px;
  flex-shrink: 0;
}
.card-body { flex: 1; min-width: 0; }
.card-body strong {
  display: block;
  color: var(--c-primary);
  margin-bottom: 0.15rem;
  word-break: break-word;
}
.card-body .card-orig {
  display: block;
  color: var(--c-muted);
  font-size: 0.85em;
  margin: -0.1rem 0 0.15rem;
}
.card-body .card-tipo {
  display: block;
  color: var(--c-muted);
  font-size: 0.85em;
  margin-bottom: 0.25rem;
}
.card-body p {
  margin: 0;
  font-size: 0.9em;
  color: var(--c-fg);
  line-height: 1.4;
}

/* ─── Pagina Benvenuto (home) ──────────────────────────────── */
body.page-home {
  background: var(--c-cream);
}
body.page-home main {
  max-width: none;
  padding: 0;
}
body.page-home .bottombar {
  background: var(--c-cream);
  border-top-color: rgba(0,0,0,0.08);
}

.home-hero {
  padding: clamp(2rem, 5vw, 4rem) 1.25rem clamp(2.5rem, 6vw, 5rem);
  text-align: center;
}
.home-hero-inner {
  max-width: 56em;
  margin: 0 auto;
}
.home-hero .logo-grande {
  width: clamp(110px, 16vw, 180px);
  height: auto;
  margin: 0 auto -0.15em;          /* ravvicinato alla scritta come da logoconscrittarett.png */
  display: block;
}
.home-hero h1 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.home-hero h1 .word-cross { color: #00329f; }
.home-hero h1 .word-books { color: #1a0f0b; }
.home-hero .claim {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  color: var(--c-primary-d);
  margin: 0 auto 1.25rem;
  max-width: 36em;
}
.home-hero .intro {
  font-size: 1.05rem;
  color: var(--c-fg);
  max-width: 38em;
  margin: 0 auto 2rem;
}
.home-hero .cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  display: inline-block;
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--r);
  border: 1px solid var(--c-primary);
  background: var(--c-primary);
  color: #fff !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--c-primary-d); border-color: var(--c-primary-d); }
.btn:active { transform: translateY(1px); }
.btn-accent {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-primary-d) !important;
}
.btn-accent:hover { background: var(--c-accent-d); border-color: var(--c-accent-d); color: #fff !important; }
.btn-ghost {
  background: transparent;
  color: var(--c-primary) !important;
}
.btn-ghost:hover { background: var(--c-primary); color: #fff !important; }

.home-sezioni {
  max-width: 64em;
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 4rem) 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem 2rem;
}
.home-sezioni article h2 {
  font-family: var(--f-display);
  color: var(--c-primary);
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
}
.home-sezioni article p {
  margin: 0;
  color: var(--c-fg);
}

/* ─── Pagina Presentazione ─────────────────────────────────── */
.presentazione {
  max-width: 44em;
  margin: 0 auto;
}
.presentazione .logo-grande {
  width: 88px;
  height: 88px;
  display: block;
  margin: 0 auto 1.25rem;
}
.presentazione h1 {
  font-family: var(--f-display);
  color: var(--c-primary);
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0 0 0.5rem;
  text-align: center;
}
.presentazione .sottotitolo {
  font-family: var(--f-display);
  font-style: italic;
  color: var(--c-muted);
  text-align: center;
  font-size: 1.15rem;
  margin: 0 0 2rem;
}
.presentazione .corpo {
  font-size: 1.05rem;
  line-height: 1.7;
}
.presentazione .corpo p { margin: 0 0 1rem; }
.presentazione .cta-row {
  text-align: center;
  margin-top: 2rem;
}
