/* ═══════════════════════════════════════════════════════════
   IONIC THEME – OrarioMesse · Diocesi di Pisa
   Palette: bordeaux var(--ion-color-primary) · oro #C8A96E · avorio #F5F3F0
═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────
   VARIABILI IONIC
───────────────────────────────────── */
:root {
  /* Primary: bordeaux */
  --ion-color-primary:          #8B2635;
  --ion-color-primary-rgb:      139, 38, 53;
  --ion-color-primary-contrast: #ffffff;
  --ion-color-primary-shade:    #6d1e29;
  --ion-color-primary-tint:     #a33040;
  --color-primary-soft:         #f2e8ea;

  /* Oro (custom) */
  --color-gold:       #C8A96E;
  --color-gold-light: #e8c98e;

  /* Sfondi */
  --ion-background-color:     #F5F3F0;
  --ion-background-color-rgb: 245, 243, 240;

  /* Testo */
  --ion-text-color:     #1A1A1A;
  --ion-text-color-rgb: 26, 26, 26;

  /* Card e item */
  --ion-item-background: #FFFFFF;
  --ion-card-background: #FFFFFF;

  /* Toolbar */
  --ion-toolbar-background: rgba(245, 243, 240, 0.92);
  --ion-toolbar-color:      #1A1A1A;

  /* Tab bar */
  --ion-tab-bar-background:       rgba(255, 255, 255, 0.92);
  --ion-tab-bar-color:            #999;
  --ion-tab-bar-color-selected:   var(--ion-color-primary);
  --ion-tab-bar-border-color:     rgba(0, 0, 0, 0.06);

  /* Safe area top (notch / Dynamic Island) */
  --sat: env(safe-area-inset-top, 0px);

  /* Gradiente primario bordeaux */
  --color-primary-deep:  #5a1520;
  --gradient-primary:    linear-gradient(160deg, var(--ion-color-primary) 0%, var(--color-primary-deep) 100%);
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100vh;
  background: var(--ion-color-primary);
}

/* SPLASH SCREEN – stili nel <style> inline di index.html (critical path) */

/* ─────────────────────────────────────
   BOOTSTRAP FALLBACK
───────────────────────────────────── */
#bootstrap-fallback {
  position: fixed;
  inset: 0;
  z-index: 9998;
  overflow: auto;
  background:
    radial-gradient(circle at top left, rgba(200,169,110,0.22), transparent 34%),
    linear-gradient(180deg, #f7f1e7 0%, #f2ece4 100%);
  color: #2a2020;
}

.bootstrap-fallback-shell {
  min-height: 100%;
  padding: calc(32px + var(--sat)) 18px 28px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.bootstrap-fallback-hero,
.bootstrap-fallback-panel {
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(139,38,53,0.12);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(66, 32, 36, 0.10);
  backdrop-filter: blur(10px);
}

.bootstrap-fallback-hero {
  padding: 22px 20px 18px;
}

.bootstrap-fallback-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(139,38,53,0.10);
  color: #7c2331;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bootstrap-fallback-hero h1 {
  margin: 14px 0 10px;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.bootstrap-fallback-hero p {
  margin: 0;
  color: rgba(42, 32, 32, 0.78);
  line-height: 1.5;
}

.bootstrap-fallback-note {
  margin-top: 12px !important;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(var(--ion-color-primary-rgb), 0.06);
  color: rgba(66, 32, 36, 0.82) !important;
}

.bootstrap-fallback-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.bootstrap-fallback-actions button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--ion-color-primary);
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(var(--ion-color-primary-rgb), 0.22);
}

.bootstrap-fallback-meta {
  color: rgba(42, 32, 32, 0.62);
  font-size: 14px;
}

.bootstrap-fallback-panel {
  padding: 16px;
}

.bootstrap-fallback-panel-head {
  display: grid;
  gap: 12px;
}

.bootstrap-fallback-search {
  width: 100%;
  border: 1px solid rgba(139,38,53,0.16);
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
  background: #fffdf9;
  color: #2a2020;
}

.bootstrap-fallback-results {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.bootstrap-fallback-card {
  padding: 14px 14px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,242,235,0.95));
  border: 1px solid rgba(139,38,53,0.10);
}

.bootstrap-fallback-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.bootstrap-fallback-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.bootstrap-fallback-card-head span,
.bootstrap-fallback-card p {
  color: rgba(42, 32, 32, 0.68);
  font-size: 13px;
}

.bootstrap-fallback-card p {
  margin: 8px 0 0;
}

.bootstrap-fallback-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--ion-color-primary);
  font-weight: 700;
  text-decoration: none;
}

.bootstrap-fallback-empty {
  padding: 18px 14px;
  border-radius: 18px;
  background: rgba(139,38,53,0.06);
  color: rgba(42, 32, 32, 0.72);
}

@media (min-width: 760px) {
  .bootstrap-fallback-shell {
    max-width: 900px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
  }

  .bootstrap-fallback-panel-head {
    grid-template-columns: 1fr minmax(280px, 360px);
    align-items: center;
  }
}

/* ─────────────────────────────────────
   TAB BAR
───────────────────────────────────── */
ion-tab-bar {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Ionic 8: il tag <ion-page> dentro i custom element (.ion-page) non riceve
   position:absolute automaticamente (Ionic usa la classe .ion-page, non il tag).
   Questo fix lo fa riempire il parent con flex per avere header+content corretti. */
.ion-page > ion-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Map content */
.map-content {
  --overflow: hidden;
  --map-controls-right: 14px;
}

/* Forza lo scroll container (shadow DOM) ad avere dimensioni definite
   in modo che #map con position:absolute si ancora correttamente */
.map-content::part(scroll) {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Contenitore mappa e card – posizionamento assoluto */
#map-viewport {
  position: absolute;
  inset: 0;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #e6e5e3;
}

/* MapLibre: attribution compatto */
.maplibregl-ctrl-attrib {
  background: rgba(255,255,255,0.75) !important;
  font-size: 9px !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  backdrop-filter: blur(4px);
}
.maplibregl-ctrl-attrib a { color: #555 !important; }
.maplibregl-marker { cursor: pointer !important; }

/* Marker utente (HTML overlay) */
.user-marker-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.user-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #007AFF;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.5);
  z-index: 1;
  position: relative;
}
.user-dot-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 122, 255, 0.18);
  animation: pulse-ring 2.5s ease-out infinite;
}
.user-marker-icon--fallback .user-dot {
  background: #D64545;
  box-shadow: 0 2px 6px rgba(214, 69, 69, 0.48);
}
.user-marker-icon--fallback .user-dot-ring {
  background: rgba(214, 69, 69, 0.2);
}
@keyframes pulse-ring {
  0%   { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Marker manuale (pin oro HTML) */
.manual-marker-icon {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ─────────────────────────────────────
   CARD FLOATING (marker mappa)
───────────────────────────────────── */
.map-church-card,
.mcc-container {
  position: absolute;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  z-index: 620;
  background: transparent;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.map-church-card.visible,
.mcc-container.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.map-church-card.mcc--dragging,
.mcc-container.mcc--dragging,
.map-church-card.mcc--closing,
.mcc-container.mcc--closing {
  z-index: 720;
}
.map-church-card.mcc--closing,
.mcc-container.mcc--closing {
  pointer-events: none;
}
.mcc-context-label {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
  max-width: 100%;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  background: #ffffff;
  /* default (church) */
  color: var(--ion-color-primary);
}
.mcc-context-label:empty,
.mcc-context-label[hidden] {
  display: none;
}
.mcc-context-label ion-icon {
  font-size: 13px;
  flex-shrink: 0;
}
.mcc-label-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.mcc-label-dist {
  flex-shrink: 0;
  white-space: nowrap;
}
.mcc-context-label--gps {
  color: #1565c0;
}
.mcc-context-label--pin {
  color: #b45000;
}

/* Prima che Swiper inizializzi (.swiper-initialized) mostra solo il primo slide:
   la card appare subito senza aspettare il download di Swiper su connessione lenta. */
.mcc-swiper:not(.swiper-initialized) .swiper-slide:not(:first-child) {
  display: none;
}

/* Swiper container per il carosello card.
   width: 100% è necessario esplicitamente: senza di esso, come flex-item in colonna,
   la larghezza si risolve ricorsivamente dalle slide producendo valori enormi.
   overflow: hidden nasconde solo la parte eccedente delle slide laterali. */
.mcc-swiper {
  width: 100%;
  border-radius: 20px;
  overflow: visible !important;
}

/* Slide: layout colonnare (top info + hint discreto).
   height: auto !important sovrascrive il height:100% che Swiper inietta inline.
   width: 100% + box-sizing: border-box previene espansione da white-space:nowrap in .mcc-sub */
.mcc-slide {
  position: relative;
  width: 100%;
  height: auto !important;
  overflow: visible;
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

.mcc-surface {
  position: relative;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(26, 26, 26, 0.06);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Sezione superiore: foto + info */
.mcc-slide-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  min-width: 0;
  overflow: hidden;
}

/* Foto quadrata a sinistra */
.mcc-img,
.mcc-thumb {
  width: 80px;
  min-width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f0ebe6, #e8e0d8);
  object-fit: cover;
  display: block;
}
.church-thumb-wrapper {
  position: relative;
  overflow: hidden;
  display: block;
}
.church-thumb-wrapper .church-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.14s ease;
}
.church-thumb-wrapper .church-thumb-fallback-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #bbb;
}
.church-thumb-wrapper.is-ready .church-thumb-img {
  opacity: 1;
}
.church-thumb-wrapper.is-ready .church-thumb-fallback-icon {
  display: none;
}
.church-thumb-wrapper.is-missing .church-thumb-img {
  display: none;
}
.mcc-thumb .church-thumb-fallback-icon {
  font-size: 28px;
}
.mcc-thumb--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #bbb;
}
.mcc-img ion-img,
.mcc-img img {
  width: 100%;
  height: 100%;
  display: block;
}
/* Colonna testo a destra */
.mcc-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mcc-name {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
  color: #201a15;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mcc-sub {
  font-size: 12px;
  color: #7b746c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

/* Chip orario messa */
.mcc-time { margin-top: 5px; }
.mcc-mass,
.mcc-chip {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 4px 6px;
  background: #ece8e4;
  color: #57514a;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(95, 81, 70, 0.08);
  line-height: 1.1;
  margin-top: 6px;
}
.mcc-chip ion-icon {
  font-size: 13px;
  color: #4c4640;
  flex-shrink: 0;
}
.mcc-chip span:last-child {
  display: inline-block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}
.mcc-mass svg { width: 13px; height: 13px; flex-shrink: 0; }
.mcc-mass-none {
  font-size: 11px;
  color: #aaa;
  font-style: italic;
  margin-top: 5px;
}

/* Hint compatto per indicare che la card e' cliccabile */
.mcc-tap-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.045);
  color: rgba(26, 26, 26, 0.38);
  pointer-events: none;
}
.mcc-tap-hint ion-icon {
  font-size: 13px;
}

/* Paginazione Swiper – centrata sotto la card come elemento statico.
   position: static !important sovrascrive l'inline style che Swiper inietta (position: absolute).
   Con i bullet normali (non dynamicBullets) le <span> non ricevono left/top assoluti,
   quindi flow normalmente come flex items dentro questo container. */
.mcc-swiper-pagination {
  position: static !important;
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100% !important;
  padding: 8px 0 4px;
  bottom: auto !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  pointer-events: none;
}

/* Bullet singolo */
.mcc-swiper-pagination .swiper-pagination-bullet {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(var(--ion-color-primary-rgb), 0.28);
  opacity: 1;
  margin: 0 !important;   /* azzera il margin che Swiper imposta */
  flex-shrink: 0;
  transition: width 0.2s ease, background 0.2s ease;
}

/* Bullet attivo → pill bordeaux */
.mcc-swiper-pagination .swiper-pagination-bullet-active {
  width: 18px;
  background: var(--ion-color-primary);
}

/* Search bar floating in basso (stile pill) */
.map-search-dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 650;
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
}

.map-search-dock-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 52px;
  border-radius: 999px;
  background: #f3f3f3;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
}
.map-top-actions {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 661;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.map-top-info-action {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px;
  z-index: 661;
  display: flex;
  align-items: center;
}
.map-top-actions-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.map-search-home-filter-status {
  max-width: calc(100vw - 80px);
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.94);
  color: #4c5762;
  border: 1px solid rgba(76, 87, 98, 0.12);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.map-search-home-filter-status[hidden] {
  display: none !important;
}
.map-search-home-filter-status--advanced {
  background: rgba(255, 255, 255, 0.94);
  color: #4c5762;
}
.map-search-home-filter-status--text {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ion-color-primary);
}
.map-search-main {
  border: none;
  background: transparent;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #666;
  font-size: 17px;
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
  border-radius: 999px;
}
.map-search-main ion-icon {
  font-size: 22px;
  color: #1f1f1f;
  flex-shrink: 0;
}
.map-search-main span {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.22;
  padding-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Input e icona ricerca desktop – nascosti su mobile */
.map-search-dock-input,
.map-search-dock-icon {
  display: none;
}

/* ── Custom search drawer (sostituisce ion-modal sheet) ── */
.msd {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
}
.msd.msd--open { pointer-events: auto; }
.msd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  opacity: 0;
  transition: opacity 0.4s;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.msd--open .msd-backdrop {
  opacity: 1;
  pointer-events: auto;
}
.msd-sheet {
  position: absolute;
  top: calc(var(--sat) + 12px);
  bottom: 0;
  left: 0;
  right: 0;
  width: min(100%, 540px);
  margin: 0 auto;
  height: auto;
  background: #f7f6f4;
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  /* transform è gestita via JS (openMapSearchSheet/closeMapSearchSheet).
     Tenerla qui causerebbe un flash al primo caricamento: il browser
     anima da transform:none → translateY(100%) rendendo il pannello visibile. */
  transition: border-radius 0.3s;
  will-change: transform;
  pointer-events: auto;
}
.msd--open .msd-sheet {
  transform: translateY(0);
}
.msd-handle,
.cs-drag-area {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}
.msd-handle {
  width: 100%;
  padding: 5px 0;
  margin-bottom: -10px;
  cursor: ns-resize;
  touch-action: none;
}
.msd-handle::before {
  content: '';
}
.msd-handle::before,
.cs-drag-handle {
  display: block;
  width: 36px;
  height: 6px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 2px;
}
.msd--dragging .msd-sheet {
  transition: none !important;
  user-select: none;
}
.msd-header {
  flex-shrink: 0;
  padding: 0 15px 2px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 46px;
}
.msd-header ion-searchbar {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding-inline-start: 0;
  padding-inline-end: 6px;
  --background: #ffffff;
  --border-radius: 14px;
  align-self: center;
}
.msd-header ion-searchbar .searchbar-input,
.cerca-searchbar .searchbar-input {
  line-height: 1.22;
}
.msd-header-btn {
  --color: #666;
  min-height: 0;
}
.msd-header-btn::part(native) {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  background: #ecebe9;
  padding: 0;
}
.msd-header-btn ion-icon {
  font-size: 18px;
}
.msd-body {
  flex: 1;
  min-height: 0; /* fondamentale per flex + scroll */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
.map-search-filter-strip {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 6px 10px;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(92, 74, 58, 0.08);
  scrollbar-width: none;
}
.map-search-filter-strip::-webkit-scrollbar {
  display: none;
}
.map-search-filter-strip ion-chip {
  flex: 0 0 auto;
  width: max-content;
  max-width: none;
  min-height: 28px;
  padding: 0 11px;
  white-space: nowrap;
  color: #43372d;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(87, 67, 51, 0.14);
  margin-left: 0;
}
.map-search-filter-strip ion-chip[color="primary"] {
  color: var(--ion-color-primary-contrast, #fff);
  background: var(--ion-color-primary, #8b2635);
  border-color: var(--ion-color-primary, #8b2635);
}
.map-search-filter-strip ion-chip::part(native),
.map-search-filter-strip ion-chip span {
  white-space: nowrap;
}
.map-search-filter-strip ion-chip::part(native),
.map-search-toolbar-chip::part(native) {
  display: inline-flex;
  align-items: center;
}
.map-search-toolbar-chip {
  flex: 0 0 auto;
  align-self: center;
  font-size: 12px;
  color: #6a635c;
}
.map-search-toolbar-chip::part(native) {
  min-height: 28px;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid #ddd6ce;
  background: #f5f2ed;
  cursor: pointer;
}
.map-search-toolbar-chip--trigger {
  cursor: pointer;
}
.map-search-count.is-open {
  border-color: rgba(var(--ion-color-primary-rgb), 0.24);
  box-shadow: 0 6px 18px rgba(60, 37, 20, 0.1);
}
.map-search-filter-strip ion-chip span,
.map-search-toolbar-chip span {
  line-height: 1;
}
.map-search-count-icon,
.map-search-count-caret,
.map-search-chip-action {
  flex-shrink: 0;
}
.map-search-count-caret,
.map-search-chip-action {
  font-size: 13px;
}
.map-search-count-caret {
  transition: transform 0.18s ease;
}
.map-search-count.is-open .map-search-count-caret {
  transform: rotate(180deg);
}
.map-search-filter-strip ion-chip ion-icon {
  color: currentColor;
  font-size: 14px;
}
ion-chip[color="primary"] ion-icon {
  color: currentColor;
}
ion-chip > ion-icon[hidden] {
  display: none !important;
}
.map-search-sort-popover {
  --offset-x: 6px;
}
.map-search-sort-popover::part(content) {
  border-radius: 18px;
  border: 1px solid rgba(87, 67, 51, 0.12);
  background: rgba(255, 252, 248, 0.97);
  box-shadow: 0 16px 36px rgba(41, 29, 22, 0.18);
  backdrop-filter: blur(18px);
}
.map-search-sort-menu {
  padding: 8px;
}
.map-search-sort-popover-title {
  padding: 8px 12px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #7a6757;
}
.map-search-sort-list {
  padding: 0;
  background: transparent;
}
.map-search-sort-option {
  border-radius: 14px;
  --background: transparent;
  --color: #3f3126;
  --padding-start: 12px;
  --inner-padding-end: 12px;
  --inner-padding-top: 0;
  --inner-padding-bottom: 0;
  --min-height: 0;
}
.map-search-sort-option ion-icon {
  font-size: 18px;
  opacity: 0;
  color: var(--ion-color-primary, #8b2635);
}
.map-search-sort-option.is-active {
  --background: rgba(var(--ion-color-primary-rgb), 0.08);
  --color: #6b1f2a;
}
.map-search-sort-option.is-active ion-icon {
  opacity: 1;
}
.map-search-sort-option.is-disabled {
  opacity: 0.45;
}
.map-search-sort-option::part(native) {
  border-radius: 14px;
}
.map-search-sort-option.ion-focused::part(native) {
  outline: 2px solid rgba(var(--ion-color-primary-rgb), 0.28);
  outline-offset: 2px;
}
.map-filter-modal {
  --width: min(100%, 540px);
  --border-radius: 26px 26px 0 0;
  --box-shadow: 0 -10px 32px rgba(35, 28, 23, 0.18);
  --background: #fff;
}
.map-filter-modal::part(content) {
  width: min(100%, 540px);
  margin: auto auto 0;
  border-radius: 26px 26px 0 0;
  overflow: hidden;
  background: #fff;
}
/* Aggiungere dynamic-height alla ion-modal per farle avere l'altezza del contenuto */
ion-modal.dynamic-height {
  --height: unset;
  --max-height: 100%;
}
ion-modal.dynamic-height ion-content,
ion-modal.dynamic-height ion-content::part(scroll) {
  position: relative;
  contain: content;
}
ion-modal.dynamic-height::part(content) {
  overflow: auto;
}
ion-modal.dynamic-height .ion-page {
  overflow: unset;
}
ion-modal.dynamic-height .ion-page ion-header {
  position: sticky;
  top: 0;
}
.ios-install-modal {
  --width: min(100%, 540px);
  --max-width: min(100vw - 24px, 540px);
  --max-height: min(100vh - 24px, 620px);
  --height: auto;
  --border-radius: 28px;
  --box-shadow: 0 14px 34px rgba(35, 28, 23, 0.22);
  --background: #f3eee8;
}
.ios-install-modal::part(content) {
  width: min(100%, 540px);
  max-height: min(100vh - 24px, 620px);
  margin: auto;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(200,169,110,0.22), transparent 36%),
    linear-gradient(180deg, #f7f1e7 0%, #f1ebe4 100%);
}
.ios-install-modal-content {
  --background: transparent;
  --color: #231a14;
  --overflow: auto;
}
.ios-install-sheet {
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 18px;
}
.ios-install-sheet__hero {
  display: grid;
  gap: 10px;
}
.ios-install-sheet__icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--gradient-primary);
  box-shadow: 0 14px 28px rgba(var(--ion-color-primary-rgb), 0.22);
}
.ios-install-sheet__icon ion-icon {
  font-size: 28px;
}
.ios-install-sheet__eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(var(--ion-color-primary-rgb), 0.10);
  color: #7c2331;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ios-install-sheet__hero h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: #241a15;
}
.ios-install-sheet__hero p {
  margin: 0;
  color: rgba(42, 32, 32, 0.78);
  line-height: 1.5;
}
.ios-install-steps {
  display: grid;
  gap: 12px;
}
.ios-install-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(var(--ion-color-primary-rgb), 0.10);
  box-shadow: 0 14px 30px rgba(61, 39, 31, 0.08);
}
.ios-install-step__index {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--ion-color-primary-rgb), 0.10);
  color: #7c2331;
  font-size: 15px;
  font-weight: 800;
}
.ios-install-step__body {
  min-width: 0;
}
.ios-install-step__body strong {
  display: block;
  color: #241a15;
  font-size: 15px;
  line-height: 1.3;
}
.ios-install-step__body p {
  margin: 4px 0 0;
  color: #66574b;
  font-size: 14px;
  line-height: 1.45;
}
.ios-install-step__body ion-icon {
  vertical-align: -2px;
  font-size: 15px;
  color: var(--ion-color-primary);
}
.ios-install-sheet__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.ios-install-sheet__actions ion-button {
  margin: 0;
  min-height: 46px;
  --border-radius: 16px;
}
.ios-install-sheet__actions ion-button[fill="clear"] {
  --color: var(--ion-color-primary-shade);
  --background-hover: rgba(var(--ion-color-primary-rgb), 0.06);
}
@media (max-width: 420px) {
  .ios-install-sheet__hero h2 {
    font-size: 24px;
  }
}
.install-pwa-toast::part(message) {
  white-space: pre-line;
}
.install-pwa-toast::part(icon) {
  background-image: url(/icons/apple-touch-icon.png);
  background-size: cover;
  background-repeat: no-repeat;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 9px;
  color: transparent; /* nasconde il fill SVG dell'ion-icon (usa currentColor) */
  font-size: 0;       /* riduce la dimensione dell'ion-icon a 0 */
}
.map-filter-modal-content {
  --background: #f0ede9;
  --color: #231a14;
  border-top: 1px solid rgba(87, 67, 51, 0.06);
}
.map-filter-modal-list {
  background: transparent;
}
.map-filter-modal-item {
  --background: #fff;
  --padding-start: 14px;
  --inner-padding-end: 14px;
  --border-radius: 18px;
  --min-height: 0;
  margin-bottom: 12px;
  border: 1px solid rgba(87, 67, 51, 0.08);
  border-radius: 18px;
  overflow: hidden;
}
.map-filter-modal-item ion-label[position="stacked"] {
  margin-bottom: 10px;
  color: #5b4a3c;
  font-size: 13px;
  font-weight: 800;
}
.map-filter-modal-item--datetime {
  display: block;
}
.map-filter-modal-note {
  display: block;
  width: 100%;
  padding: 2px 0;
  font-size: 13px;
  line-height: 1.45;
  color: #64564b;
  white-space: normal;
}
.map-filter-sheet__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
}
.map-filter-sheet__actions ion-button {
  margin: 0;
  --border-radius: 14px;
  min-height: 44px;
}
.map-filter-time-grid {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  flex-wrap: nowrap;
}
.map-filter-time-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
}
.map-filter-time-field__label {
  font-size: 12px;
  font-weight: 700;
  color: #6a584a;
}
.map-filter-modal-content ion-datetime {
  --background: transparent;
  --wheel-highlight-background: rgba(var(--ion-color-primary-rgb), 0.08);
  border-radius: 16px;
}
.map-filter-time-field ion-datetime {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(87, 67, 51, 0.08);
}

/* ── Apple Maps-style filter layout ─────────────────────────── */
.amf-content {
  --background: #f0ede9;
}
.amf-section-label {
  margin: 0;
  padding: 4px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #7a6858;
  letter-spacing: 0.01em;
}
.amf-section-label:first-child {
  padding-top: 4px;
}
.amf-list ion-item.amf-item {
  --background: #ffffff;
  --background-activated: rgba(87, 67, 51, 0.06);
  --padding-start: 16px;
  --inner-padding-end: 16px;
  --min-height: 50px;
  --border-color: rgba(87, 67, 51, 0.1);
}
.amf-item ion-label {
  font-size: 17px !important;
  font-weight: 400 !important;
  color: #1a1007 !important;
}
.amf-item--note {
  --min-height: auto !important;
}
.amf-note {
  display: block;
  width: 100%;
  padding: 10px 0;
  font-size: 13px;
  line-height: 1.45;
  color: #64564b;
  white-space: normal;
}
.amf-item--range ion-range {
  width: 100%;
  padding-top: 0;
  --bar-height: 2px;
}
.amf-item--range ion-range::part(label) {
  margin-inline-end: 12px;
  white-space: nowrap;
}
.amf-item--range ion-range .range-tick {
  top: 18px;
  width: 2px;
  height: 6px;
}
/* Dalle / Alle on same row */
.amf-item--timerow {
  --min-height: 52px;
}
.amf-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 0;
  justify-content: space-between;
}
.amf-time-label {
  font-size: 17px;
  color: #1a1007;
}
.map-search-dock-clear {
  position: absolute;
  top: 50%;
  right: 7px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #aaa;
  flex-shrink: 0;
  transform: translateY(-50%);
  z-index: 1;
}
.map-search-dock-clear ion-icon {
  font-size: 20px;
  pointer-events: none;
}
.map-search-dock--has-text .map-search-dock-clear {
  display: flex;
  margin-right: 30px;
}

.map-search-filter-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  z-index: 1;
}
.map-search-filter-btn--active {
  background: var(--ion-color-primary);
  box-shadow: none;
}
.map-search-filter-btn ion-icon {
  font-size: 21px;
  color: #1f1f1f;
}
.map-search-filter-btn--active ion-icon {
  color: #fff;
}

/* Base condivisa per tutti i FAB della mappa */
.map-fab-btn {
  position: relative !important;
  margin: 0;
  --background: var(--ion-color-light);
  --background-hover: rgba(var(--ion-color-light-rgb), 0.92);
  --background-focused: rgba(var(--ion-color-light-rgb), 0.94);
  --background-activated: rgba(var(--ion-color-light-rgb), 0.88);
  --color: #1f1f1f;
  --border-width: 0;
  --border-style: solid;
  --border-color: transparent;
  flex-shrink: 0;
}

.map-fab-settings-btn {
  --background: var(--ion-color-light);
  --background-hover: rgba(var(--ion-color-light-rgb), 0.96);
  --background-focused: rgba(var(--ion-color-light-rgb), 0.98);
  --background-activated: rgba(var(--ion-color-light-rgb), 0.92);
  --color: #1f1f1f;
  --box-shadow: 0 4px 16px rgba(0,0,0,0.14), 0 1px 4px rgba(0,0,0,0.08);
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  margin: 0;
}
.map-fab-settings-btn ion-icon {
  font-size: 22px;
}
/* Mobile: icona info visibile, hamburger nascosto */
.fab-icon-desktop { display: none; }
.fab-icon-mobile  { display: block; }

.map-fab-boundary-toggle {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  --box-shadow: 0 4px 16px rgba(0,0,0,0.14), 0 1px 4px rgba(0,0,0,0.08);
}
.map-fab-boundary-toggle ion-icon {
  font-size: 22px;
}
.map-fab-boundary-toggle.map-fab-boundary-toggle--active {
  --color: var(--ion-color-primary);
}
.map-fab-boundary-toggle.map-fab-boundary-toggle--inactive {
  --color: #1f1f1f;
}

/* FAB localizzazione – posizionato in assoluto nel contenuto (sopra la tab bar) */
.map-fab-locate {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  --box-shadow: 0 8px 20px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.map-fab-locate.map-fab-locate--gps-active { --color: #1565c0; }
.map-fab-locate.map-fab-locate--gps-idle   { --color: #1f1f1f; }
.map-fab-locate.map-fab-locate--pin-active { --color: #C8A96E; }
.map-fab-locate.map-fab-locate--pin-idle   { --color: #1f1f1f; }
.map-fab-locate-icon {
  font-size: 30px;
  color: inherit;
}

.map-fab-mass-filter {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.map-fab-locate::part(native),
.map-fab-boundary-toggle::part(native),
.map-fab-mass-filter::part(native) {
  flex-shrink: 0;
}
.map-fab-mass-filter--active {
  --color: var(--ion-color-primary);
}
.map-fab-zoom { display: none; }

/* Desktop filter bar: nascosto su mobile */
#map-desktop-filter-bar { display: none; }

.map-desktop-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px 0 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(0,0,0,0.14);
  background: #fff;
  color: #1f1f1f;
  font-size: 13px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: background 0.12s, border-color 0.12s;
}
.map-desktop-chip:hover { background: #f5f5f5; }
.map-desktop-chip--active {
  background: var(--ion-color-primary);
  color: #fff;
  border-color: var(--ion-color-primary);
}
.map-desktop-chip--active:hover { background: var(--ion-color-primary-shade, #7a2030); }
.map-desktop-chip ion-icon { font-size: 16px; flex-shrink: 0; }
.map-desktop-chip ion-icon[hidden] { display: none !important; }
/* Icona azione (chevron/close): stessa dimensione delle icone principali, nessuna opacità */
.map-desktop-chip-action { font-size: 18px; }

.map-mass-filter-indicator {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 661;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  cursor: pointer;
}
.map-mass-filter-indicator[hidden] {
  display: none !important;
}
.map-mass-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ion-color-primary);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(var(--ion-color-primary-rgb), 0.3);
}
.map-mass-filter-chip ion-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.map-mass-filter-count {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #666;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.map-search-count-icon {
  flex-shrink: 0;
  font-size: 14px;
  color: currentColor;
}
.map-search-count-value {
  letter-spacing: 0.01em;
}
.map-search-list {
  --ion-padding: 10px;
  overflow: visible;
}
.map-search-ion-list {
  margin: 0;
  padding: 0;
  background: transparent;
}
.map-search-item {
  --map-search-card-radius: 20px;
  --map-search-card-padding: 10px;
  --map-search-thumb-size: 80px;
  --background: #fff;
  --ripple-color: transparent;
  --padding-start: 0;
  --padding-end: 0;
  --padding-top: 0;
  --padding-bottom: 0;
  --inner-padding-start: 0;
  --inner-padding-end: 0;
  --min-height: 0;
  --inner-border-width: 0;
  border: 1px solid rgba(128, 95, 68, 0.08);
  border-radius: var(--map-search-card-radius);
  box-shadow: 0 8px 18px rgba(77, 58, 41, 0.08);
  overflow: hidden;
  margin: 10px 10px;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.msi-body {
  width: 100%;
  padding: var(--map-search-card-padding);
  background: var(--background);
}
.map-search-item::part(native),
.map-search-item::part(native):hover {
  box-shadow: none;
  border-radius: var(--map-search-card-radius);
}
@media (hover: hover) and (pointer: fine) {
  .map-search-item:hover {
    box-shadow: 0 16px 32px rgba(77, 58, 41, 0.18);
    transform: translateY(-1px);
  }
}
.map-search-item--pressed {
  transform: scale(0.97);
}
@keyframes msi-appear {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.map-search-item.msi-will-appear {
  opacity: 0;
}
.map-search-item.msi-appearing {
  animation: msi-appear 0.22s ease-out backwards;
}
.msi-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.msi-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  max-height: var(--map-search-thumb-size);
}
.msi-head {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
}
.map-search-item-img {
  width: var(--map-search-thumb-size);
  height: var(--map-search-thumb-size);
  border-radius: calc(var(--map-search-card-radius) - var(--map-search-card-padding));
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f0ebe6, #e8e0d8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}
.map-search-item-img ion-img,
.map-search-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.map-search-item-img ion-icon {
  font-size: 22px;
}
.map-search-item-img .church-thumb-fallback-icon {
  font-size: 24px;
}
.map-search-item-name {
  font-size: 14px;
  font-weight: 800;
  color: #201a15;
  line-height: 1.15;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.map-search-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.map-search-item-location {
  display: flex;
  align-items: center;
  margin-top: 4px;
  min-width: 0;
}
.map-search-item-sub {
  font-size: 12px;
  color: #7b746c;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}
.msi-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-width: 0;
  margin-top: auto;
}
.msi-meta-empty {
  font-size: 11px;
  color: #9e978f;
}
.map-search-next-mass-row {
  display: flex;
  align-items: center;
  min-width: 0;
  line-height: 1.15;
}
.map-search-next-mass-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 4px 6px;
  border-radius: 999px;
  background: #ece8e4;
  color: #57514a;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(95, 81, 70, 0.08);
  line-height: 1.1;
}
.map-search-next-mass-badge ion-icon {
  font-size: 13px;
  color: #4c4640;
  flex-shrink: 0;
}
.next-mass-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  background: rgba(var(--ion-color-primary-rgb), 0.09);
  color: var(--ion-color-primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}
.next-mass-pill ion-icon {
  font-size: 13px;
  flex-shrink: 0;
}
.next-mass-pill span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-search-next-mass-pill {
  margin-top: 0;
  min-height: 22px;
  padding: 3px 8px 3px 6px;
  font-size: 10px;
  background: rgba(var(--ion-color-primary-rgb), 0.08);
  box-shadow: inset 0 0 0 1px rgba(var(--ion-color-primary-rgb), 0.08);
}
.distance-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(var(--ion-color-primary-rgb), 0.08);
  color: #95555f;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(var(--ion-color-primary-rgb), 0.08);
}
.distance-pill--gps {
  background: rgba(10, 99, 201, 0.10);
  color: #4a77a5;
  box-shadow: inset 0 0 0 1px rgba(10, 99, 201, 0.12);
}
.distance-pill--pin {
  background: rgba(122, 90, 29, 0.11);
  color: #8b7650;
  box-shadow: inset 0 0 0 1px rgba(122, 90, 29, 0.12);
}
.map-search-distance-pill {
  flex-shrink: 0;
  align-self: center;
}
@media (max-width: 360px) {
  .map-search-filter-strip {
    padding-inline: 8px;
  }
  .map-search-item {
    --map-search-thumb-size: 72px;
  }
  .msi-content {
    gap: 5px;
  }
  .map-search-item-name {
    font-size: 13px;
  }
  .distance-pill {
    padding: 0 7px;
  }
}
.map-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 20px;
}
.map-search-empty ion-icon { font-size: 38px; }
.map-search-empty p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

/* ─────────────────────────────────────
   CHURCH SHEET MODAL
───────────────────────────────────── */
#church-sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  visibility: hidden;
}
#church-sheet.cs-visible {
  pointer-events: auto;
  visibility: visible;
}

ion-action-sheet.church-nav-action-sheet {
  z-index: 3200 !important;
}

.cs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.48);
  opacity: 0;
  z-index: 0;
}

.cs-stack-underlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.cs-stack-underlay[hidden] {
  display: none;
}
.cs-panel-underlay {
  position: absolute;
  top: calc(var(--sat) + 12px);
  bottom: 0;
  left: 0;
  right: 0;
  width: min(100%, 540px);
  margin: 0 auto;
  height: auto;
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
}
.cs-panel-underlay .cs-inner {
  overflow: hidden;
  pointer-events: none;
}
.cs-panel-underlay .cs-back-btn,
.cs-panel-underlay .cs-close-btn {
  opacity: 0 !important;
  pointer-events: none !important;
}

.cs-panel {
  position: absolute;
  top: calc(var(--sat) + 12px);
  bottom: 0;
  left: 0;
  right: 0;
  width: min(100%, 540px);
  margin: 0 auto;
  height: auto;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(to bottom, transparent 0 42%, #fff 42% 100%);
  overflow: visible;
  transform: translateY(100%);
  transform-origin: 50% 100%;
  will-change: transform;
  z-index: 2;
  /* -webkit-overflow-scrolling: touch; */
}
.cs-panel::after {
  content: '';
  position: fixed;
  bottom: -60px;
  left: 0;
  right: 0;
  height: 60px;
  width: 100%;
  background: #fff;
  pointer-events: none;
  z-index: -1;
}

.cs-inner {
  position: relative;
  height: 100%;
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
  z-index: 1;
  border-radius: 24px 24px 0 0;
}
.cs-inner::-webkit-scrollbar {
  display: none;
}

/* ── Hero ── */
.cs-hero {
  position: sticky;
  top: 0;
  z-index: 0;
  height: 40%;
  margin-bottom: -1rem;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(160deg, #c9b4a4 0%, #a08070 100%);
  overflow: hidden;
}
.cs-hero-img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(var(--cs-hero-scale, 1));
  transform-origin: center top;
  opacity: 0;
  transition: transform 0.16s ease-out, opacity 0.35s ease-out;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  pointer-events: none;
}
.cs-hero.has-image .cs-hero-img {
  opacity: 1;
}
.cs-hero.is-stretching .cs-hero-img {
  transition: none;
}
.cs-hero.has-image {
  cursor: zoom-in;
}
.cs-hero-placeholder {
  position: relative;
  z-index: 1;
  width: 100%; height: 100%;
  background: linear-gradient(160deg, #d8cdc5 0%, #c0b0a4 100%);
}
.cs-hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.22));
  pointer-events: none;
}

/* Nessuna immagine: nascondi area hero e porta la card in alto */
.cs-panel.cs-panel--no-hero {
  background: #fff;
}
.cs-panel.cs-panel--no-hero .cs-hero {
  height: 0;
  margin-bottom: 0;
  background: none;
  overflow: visible;
}
.cs-panel.cs-panel--no-hero .cs-hero::after,
.cs-panel.cs-panel--no-hero .cs-hero-img,
.cs-panel.cs-panel--no-hero .cs-hero-placeholder {
  display: none;
}
/* ── Tasto chiudi hero ── */
.cs-back-btn,
.cs-close-btn {
  position: absolute;
  top: 12px;
  width: 32px; 
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.32);
  border: none; color: white; 
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
}
.cs-back-btn {
  left: 16px;
}
.cs-close-btn {
  right: 16px;
}
.cs-back-btn.is-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}
#church-sheet.cs-visible .cs-back-btn,
#church-sheet.cs-visible .cs-close-btn {
  opacity: 1;
  pointer-events: auto;
}
.cs-hero.is-sticky-controls-hidden .cs-close-btn {
  opacity: 0;
  pointer-events: none;
}
#church-sheet.cs-visible .cs-panel.cs-panel--no-hero .cs-back-btn,
#church-sheet.cs-visible .cs-panel.cs-panel--no-hero .cs-close-btn {
  opacity: 0;
  pointer-events: none;
}

/* ── Card bianca che sovrasta l'hero ── */
.cs-card {
  background: transparent;
  border-radius: 24px 24px 0 0;
  position: relative;
  z-index: 2;
  min-height: calc(min(95dvh,95vh) - 180px);
}
.cs-card-surface {
  position: relative;
  min-height: calc(min(95dvh,95vh) - 216px);
  overflow: visible;
}
.cs-card-surface::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  z-index: 0;
  pointer-events: none;
}
.cs-card-surface > * {
  position: relative;
  z-index: 1;
}
.cs-drag-area {
  padding: 5px 0;
}

/* ── Header ── */
.cs-header { margin-top: -8px; padding-top: 4px;
  margin-bottom: -8px;
  z-index: 10;
  position: relative;
 }
.cs-meta-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.cs-meta-badges { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.cs-meta-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.24s ease;
}
.cs-meta-actions--sticky {
  position: absolute;
  top: 0;
  right: 0;
  opacity: 0;
  transform: translateX(14px);
  pointer-events: none;
}
.cs-panel.cs-panel--meta-actions-stuck .cs-meta-actions--primary {
  opacity: 0;
  pointer-events: none;
}
.cs-panel.cs-panel--meta-actions-stuck .cs-meta-actions--sticky {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
.cs-meta-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f2efec;
  color: #4b4b4b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}
.cs-meta-icon-btn ion-icon {
  font-size: 18px;
}
.cs-meta-icon-btn:active {
  opacity: 0.72;
}
.cs-meta-close-slot {
  display: flex;
  width: 0;
  margin-left: -8px;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-12px);
  pointer-events: none;
  transition: width 0.28s cubic-bezier(0.32,0.72,0,1), margin-left 0.28s cubic-bezier(0.32,0.72,0,1), opacity 0.18s ease, transform 0.28s cubic-bezier(0.32,0.72,0,1);
}
.cs-panel.cs-panel--meta-actions-stuck .cs-meta-actions--sticky .cs-meta-close-slot,
.cs-panel.cs-panel--no-hero .cs-meta-close-slot {
  width: 32px;
  margin-left: 0;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.cs-meta-close-btn {
  display: inline-flex;
  flex-shrink: 0;
}
.cs-type-badge {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--ion-color-primary);
  background: var(--color-primary-soft);
  padding: 3px 10px; border-radius: 20px;
}
.cs-dist-badge {
  font-size: 12px; font-weight: 600; color: #666;
  display: flex; align-items: center; gap: 3px;
}
.cs-dist-badge ion-icon { font-size: 13px; color: var(--ion-color-primary); }
.cs-title-sticky {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0;
  padding-top: 16px;
  padding-bottom: 10px;
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: box-shadow 0.16s ease;
}
.cs-title-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
}
.cs-title-copy {
  min-width: 0;
  flex: 1;
}
.cs-panel.cs-panel--meta-actions-stuck .cs-title-copy {
  padding-right: 116px;
}
.cs-name {
  display: block;
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: #111;
  line-height: 1.25;
  letter-spacing: -0.4px;
  transition: none;
}
.cs-title-sticky.is-stuck .cs-name {
  display: -webkit-box;
  overflow: hidden;
  max-height: calc(var(--cs-name-max-lines, 2) * var(--cs-name-line-height, 28px));
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--cs-name-max-lines, 2);
  text-overflow: ellipsis;
}
.cs-comune {
  font-size: 14px;
  color: #888;
  margin: 0;
  transition: none;
}
.cs-comune-btn {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}
.cs-comune-text {
  min-width: 0;
  flex: 1;
  color: inherit;
}
.cs-comune-icon {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--ion-color-primary);
}
.cs-title-sticky.is-stuck {
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.06);
}
.cs-title-sticky .cs-meta-actions--sticky {
  z-index: 2;
}
.cs-next-mass-inline {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px;
  background: var(--color-primary-soft); border-radius: 10px;
}
.cs-next-mass-icon { font-size: 16px; color: var(--ion-color-primary); flex-shrink: 0; }
.cs-next-mass-label {
  font-size: 11px; font-weight: 700; color: var(--ion-color-primary);
  text-transform: uppercase; letter-spacing: 0.5px; flex: 1;
}
.cs-next-val { font-size: 15px; font-weight: 700; color: #111; }

/* ── Divisore ── */
.cs-divider { height: 1px; background: #F0EDEA; }

/* ── Segment dettaglio ── */
.cs-detail-tabs-wrap ion-item::part(native) {
  padding-top: 0;
  padding-bottom: 0;
}
ion-segment.cs-detail-segment {
  position: sticky;
  top: var(--cs-segment-sticky-top, 60px);
  z-index: 3;
  margin: 8px 0 0;
  padding-bottom: 5px;
  padding-top: 5px;
  --background: #fff;
  --border-radius: 12px;
  border-radius: 0;
}
ion-segment.cs-detail-segment ion-segment-button {
  --border-radius: 10px;
  --color-checked: var(--ion-color-primary);
  --indicator-color: var(--color-primary-soft);
  --indicator-box-shadow: 0;
}
.cs-detail-segment-shell {
  overflow: visible;
}
.cs-detail-swiper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.cs-detail-swiper .swiper-wrapper {
  align-items: flex-start;
}
.cs-detail-slide {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex-shrink: 0;
}
.cs-news-wrap {
  padding: 8px 0 20px;
  overflow: hidden;
}
.cs-news-feed-section + .cs-news-section,
.cs-news-section + .cs-news-section {
  margin-top: 18px;
}
.cs-news-swiper {
  width: 100%;
  overflow: hidden;
}
.cs-news-slide {
  width: 100%;
  height: auto !important;
  box-sizing: border-box;
}
.cs-news-card {
  display: block;
  height: 100%;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(139,38,53,0.12);
  background: #fff;
  color: inherit;
  text-decoration: none;
}
.cs-news-card--status {
  text-align: center;
}
.cs-news-pagination {
  position: static !important;
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100% !important;
  padding: 10px 0 2px;
  bottom: auto !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
}
.cs-news-pagination .swiper-pagination-bullet {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(var(--ion-color-primary-rgb), 0.28);
  opacity: 1;
  margin: 0 !important;
  flex-shrink: 0;
  transition: width 0.2s ease, background 0.2s ease;
}
.cs-news-pagination .swiper-pagination-bullet-active {
  width: 18px;
  background: var(--ion-color-primary);
}
.cs-news-section-title {
  margin: 0 0 10px;
  color: var(--ion-color-primary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}
.cs-social-embed {
  display: flex;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(139,38,53,0.12);
  background: #fff;
}
.cs-social-embed-frame {
  display: block;
  width: 500px;
  max-width: 100%;
  margin: 0 auto;
  flex: 0 1 auto;
  min-height: 680px;
  border: 0;
  background: #fff;
}
.cs-news-media {
  margin: -16px -16px 12px;
  aspect-ratio: 16 / 9;
  /* max-height: 260px; */
  overflow: hidden;
  border-radius: 14px 14px 0 0;
  background: #f3f4f6;
}
.cs-news-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cs-news-date {
  margin: 0 0 8px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cs-news-title {
  margin: 0 0 8px;
  color: #1f2328;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}
.cs-news-summary {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.65;
}
.cs-news-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--ion-color-primary);
  font-size: 13px;
  font-weight: 700;
}
.cs-description-wrap {
  padding: 8px 0 20px;
}
.cs-description-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(139,38,53,0.12);
  background: #fff;
}
#cs-segment-descrizione-inner h3 {
  margin: 0 0 4px;
  color: var(--ion-color-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}
#cs-segment-descrizione-inner {
  color: #222;
}
#cs-segment-descrizione-inner > .cs-description-content {
  display: block;
  position: relative;
  height: auto;
  min-height: 1px;
}
#cs-segment-descrizione-inner > .cs-description-content:not(.cs-loading) {
  display: flow-root;
}
#cs-segment-descrizione-inner p,
#cs-segment-descrizione-inner li,
#cs-segment-descrizione-inner blockquote {
  margin: 0 0 6px;
  color: #222;
  font-size: 15px;
  line-height: 1.65;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
#cs-segment-descrizione-inner ul,
#cs-segment-descrizione-inner ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
#cs-segment-descrizione-inner li {
  margin: 0 0 6px;
}
#cs-segment-descrizione-inner blockquote {
  margin: 0;
  padding: 0;
  border-left: 0;
}
#cs-segment-descrizione-inner a {
  color: var(--ion-color-primary);
  font-weight: 600;
  text-decoration: underline;
}
#cs-segment-descrizione-inner > *:last-child,
#cs-segment-descrizione-inner li:last-child,
#cs-segment-descrizione-inner ul:last-child,
#cs-segment-descrizione-inner ol:last-child,
#cs-segment-descrizione-inner blockquote:last-child,
#cs-segment-descrizione-inner p:last-child {
  margin-bottom: 0;
}
.cs-debug-wrap {
  padding-top: 4px;
}
.cs-debug-card {
  padding: 0;
}
.cs-debug-section + .cs-debug-section {
  margin-top: 10px;
}
.cs-debug-section-title {
  margin: 0 0 6px;
  color: var(--ion-color-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.cs-debug-kv {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cs-debug-kv-row {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(139,38,53,0.08);
  background: #faf9fa;
}
.cs-debug-kv-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.cs-debug-kv-label {
  color: #4d525b;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}
.cs-debug-kv-key {
  color: var(--ion-color-primary);
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: nowrap;
}
.cs-debug-kv-value {
  color: #1f2328;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
  word-break: break-word;
}
.cs-debug-kv-source {
  margin-top: 3px;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.35;
}
.cs-debug-empty {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
}
.cs-description-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px auto 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--ion-color-primary);
  font-size: 13px;
  font-weight: 700;
  width: fit-content;
}
#cs-segment-descrizione-inner a.cs-description-link {
  text-decoration: none;
}
.cs-description-link ion-icon {
  font-size: 16px;
}

.cs-tab-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 180px;
  padding: 68px 16px 28px;
}

.cs-tab-status.cs-loading {
  justify-content: center;
  min-height: 120px;
  padding-top: 36px;
}

.cs-tab-status.cs-compact {
  min-height: auto;
  padding: 12px 16px 10px;
  gap: 8px;
  justify-content: center;
}

#church-sheet .cs-tab-status .cs-no-data {
  margin: 0;
  padding: 0;
  color: #b7b7b7;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  text-align: center;
}

#church-sheet .cs-tab-status a.cs-description-link {
  margin-top: 0;
}

/* ── Contacts ── */
.cs-contact-list {
  margin: 0;
  padding: 0;
  background: transparent;
}
.cs-contact-list ion-item {
  --padding-start: 16px;
  --inner-padding-end: 16px;
  --background: #fff;
  --border-color: rgba(139,38,53,0.12);
  --border-width: 0;
  --inner-border-width: 0 0 1px 0;
  margin: 0;
}
.cs-contact-list ion-item:last-child {
  --inner-border-width: 0;
}
.cs-contact-list ion-item ion-icon[slot="start"] {
  color: var(--ion-color-primary);
}
.cs-contact-list ion-label h3 {
  color: var(--ion-color-primary);
  font-weight: 700;
}
.cs-contact-list ion-label p {
  color: #222;
}
.cs-contact-list--church {
  margin-bottom: 10px;
}
.cs-contact-source-note {
  margin: 0 0 12px;
  padding-top: 10px;
  padding-bottom: 10px;
  border: 1px solid rgba(139,38,53,0.2);
  border-radius: 12px;
  background: rgba(139,38,53,0.06);
  color: #6b2230;
  font-size: 13px;
  line-height: 1.45;
}
/* ── Contacts socials ── */
.cs-contact-socials-wrap {
  padding-top: 8px;
  padding-bottom: 20px;
}
.cs-contact-socials-title {
  text-align: center;
  color: var(--ion-color-primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.cs-contact-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0;
  justify-content: center;
}
.cs-social-icon-btn {
  text-decoration: none;
  background: rgba(139,38,53,0.08);
  color: var(--ion-color-primary);
  box-shadow: inset 0 0 0 1px rgba(139,38,53,0.14);
}
.cs-social-icon-btn ion-icon {
  font-size: 18px;
}

/* ── Actions ── */
.cs-actions {
  display: flex; gap: 10px;
  padding: 4px 20px 16px;
}
.cs-action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  cursor: pointer; border: none; transition: opacity 0.15s;
  flex: 1;
}
.cs-action-btn:active { opacity: 0.7; }
.cs-action-navigate {
  background: var(--ion-color-primary); color: #fff;
}
.cs-action-navigate ion-icon { font-size: 16px; }

/* ── Section header ── */
.cs-section-header {
  font-size: 16px; font-weight: 700; color: #111;
  letter-spacing: -0.2px;
}

/* ── Schedule ── */
.cs-loading { display: flex; justify-content: center; padding: 28px; }
.cs-no-data { text-align: center; padding: 20px 16px; color: #aaa; font-size: 14px; }
.cs-schedule-container { padding: 6px 20px 8px; }
.cs-day-group { padding: 14px 0 4px; border-top: 1px solid #EDE9E5; }
.cs-day-group:first-child { border-top: none; padding-top: 2px; }
.cs-day-header {
  font-size: 11px; font-weight: 700; color: #aaa;
  text-transform: uppercase; letter-spacing: 0.7px; padding-bottom: 6px;
}
.cs-times { display: flex; flex-direction: column; }
.cs-time-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid #F5F2EF;
}
.cs-time-row:last-child { border-bottom: none; }
.cs-time-chip {
  font-size: 20px; font-weight: 600; color: #111;
  min-width: 62px; letter-spacing: -0.5px;
}
.cs-time-note {
  font-size: 13px; color: #999; flex: 1; line-height: 1.35;
}
.cs-time-note-inline {
  font-style: italic;
  color: #777;
}

/* ── Chiese correlate ── */
.cs-related-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  display: flex; gap: 12px;
  padding: 6px 0 20px; scrollbar-width: none;
}
.cs-related-scroll::-webkit-scrollbar { display: none; }
.cs-related-card {
  flex-shrink: 0; width: 130px;
  background: #FAF8F6; border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.cs-related-card--pressed {
  transform: scale(0.96);
}
.cs-related-card-img {
  width: 100%; height: 82px;
  background: linear-gradient(135deg, #ede4dc, #d8ccc4);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.cs-related-card-img ion-img,
.cs-related-card-img img { width: 100%; height: 100%; display: block; object-fit: cover; }
.cs-related-card-icon {
  width: 30px;
  height: 30px;
}
.cs-related-card-img .church-thumb-fallback-icon {
  width: 30px;
  height: 30px;
}
.cs-related-card-info { padding: 9px 11px 11px; }
.cs-related-type {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ion-color-primary); margin-bottom: 4px;
}
.cs-related-name {
  font-size: 12px; font-weight: 600; color: #1A1A1A; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ── Bottom spacer ── */
.cs-bottom-spacer { height: max(40px, env(safe-area-inset-bottom, 40px)); }

/* ─── PhotoSwipe bullets (stile pill coerente con la PWA) ─── */
.pswp-bullets {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
}
.pswp-bullet {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  flex-shrink: 0;
  transition: width 0.2s ease, background 0.2s ease;
}
.pswp-bullet--active {
  width: 18px;
  background: #fff;
}
/* ─────────────────────────────────────
   PAGINA CERCA
───────────────────────────────────── */
.cerca-content { --background: #F5F3F0; }

.cerca-searchbar {
  padding-top: 12px !important;
  padding-bottom: 4px !important;
  --padding-top: 12px;
  --padding-bottom: 12px;
}
.cerca-btn-row { margin: 12px 0 4px; }
.section-header { margin-top: 4px; }

/* Header risultati */
.results-header-note {
  font-size: 13px; color: #666;
  padding: 8px 20px 4px;
}

/* Ricerca in corso */
.search-loading {
  display: flex; flex-direction: column;
  align-items: center; padding: 40px; gap: 14px;
}
.search-loading p { color: #666; font-size: 14px; margin: 0; }

/* Stato vuoto */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; padding: 48px 32px; gap: 12px;
}
.empty-state ion-icon { font-size: 48px; }
.empty-state p { color: #666; font-size: 15px; font-weight: 500; margin: 0; }

/* Cards risultati ricerca */
.result-card {
  margin: 0 12px 10px !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07) !important;
}
.result-card-inner { display: flex; align-items: stretch; }
.result-img-wrap {
  width: 80px; flex-shrink: 0;
  background: linear-gradient(135deg, #f0ebe6, #e8e0d8);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.result-img-wrap ion-img,
.result-img-wrap img { width: 100%; height: 100%; display: block; }
.result-img-wrap .church-thumb-fallback-icon {
  font-size: 28px;
}
.result-info { flex: 1; padding: 12px 14px; min-width: 0; }
.result-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.result-name {
  font-size: 14px; font-weight: 600; color: #1A1A1A;
  margin: 0; line-height: 1.28;
  flex: 1;
  min-width: 0;
  min-height: calc(1.28em * 2);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.result-meta-row {
  margin: 6px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.result-location-icon {
  font-size: 14px;
  color: #b48a62;
  flex-shrink: 0;
  opacity: 0.92;
}
.result-comune {
  font-size: 13px;
  color: #72675d;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-distance-pill {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
}
.result-bottom-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  min-width: 0;
}
.result-next-mass-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: #9a3d4a;
}
.result-next-mass-row ion-icon {
  font-size: 14px;
  color: #b35a68;
  flex-shrink: 0;
}
.result-next-mass-row span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────
   PAGINA IMPOSTAZIONI
───────────────────────────────────── */
.settings-menu {
  --width: min(420px, 100vw);
  --max-width: 100vw;
  --background: #F5F3F0;
  z-index: 3000;
}
.settings-menu::part(container) {
  box-shadow: 20px 0 48px rgba(38, 20, 23, 0.18);
  border-right: 1px solid rgba(var(--ion-color-primary-rgb), 0.10);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.settings-menu ion-content {
  flex: 1;
  min-height: 0;
}
.settings-content {
  --background: #F5F3F0;
}
.settings-content ion-refresher {
  z-index: 2;
}

.settings-hero {
  background: var(--gradient-primary);
  padding: 40px 20px 32px;
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
}
.settings-hero-icon {
  width: 72px; height: 72px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
}
.settings-hero-title { font-size: 20px; font-weight: 700; color: white; }
.settings-hero-sub {
  font-size: 13px; color: rgba(255,255,255,0.7); margin-top: -8px;
}
.settings-content ion-item p + p {
  margin-top: 4px;
  color: #7b746c;
  font-size: 13px;
}
.settings-footer-attributions a {
  color: var(--ion-color-primary);
  text-decoration: none;
}
.settings-footer-attributions a:hover,
.settings-footer-attributions a:focus-visible {
  text-decoration: underline;
}
.settings-data-stale-note {
  display: block;
  margin-top: 6px;
  text-align: center;
  color: #9a3d4a;
  font-weight: 600;
}
.settings-footer {
  text-align: center;
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.5;
}
.settings-footer-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ion-color-primary);
}
.settings-footer-attributions {
  font-size: 13px;
  color: #6f6760;
}
.settings-footer-version {
  font-size: 12px;
  color: #8b837c;
}
.settings-footer-privacy {
  font-size: 13px;
  color: var(--ion-color-primary);
  text-decoration: none;
}
.settings-footer-privacy:hover,
.settings-footer-privacy:focus-visible {
  text-decoration: underline;
}

/* ── Privacy Policy modal ── */
@media (min-width: 600px) {
  .privacy-policy-modal {
    --width: 600px;
    --height: min(88vh, 740px);
    --border-radius: 16px;
  }
}
.privacy-policy-content ion-text p,
.privacy-policy-content ion-text li {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ion-color-medium-shade, #555);
  margin: 0 0 10px;
}
.privacy-policy-content ion-text p:last-child { margin-bottom: 0; }
.privacy-policy-content ion-text a {
  color: var(--ion-color-primary, #c0392b);
}
.privacy-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ion-color-medium, #92949c);
  margin: 24px 0 6px;
}
.privacy-section-title:first-child { margin-top: 0; }

/* Il selettore + di Ionic azzera margin-top del fratello successivo anche quando
   la lista install è nascosta (display:none non rimuove il nodo dal DOM) */
#settings-install-list[hidden] + ion-list { margin-top: 16px; }

@media (display-mode: standalone) {
  #settings-install-list { display: none !important; }
  #settings-install-list + ion-list { margin-top: 16px; }
}

/* ═══════════════════════════════════════════════════════════
   MAPPA · layout desktop (≥ 760px) – stile Google Maps
   Ricerca → top-left   |   boundary toggle → top-right
   GPS + filtro messe   → bottom-right
═══════════════════════════════════════════════════════════ */
@media (min-width: 760px) {

  /* Il dock diventa un overlay trasparente a tutta mappa così i FAB figli
     possono essere posizionati in absolute senza uscire dal contenitore.
     pointer-events: none per non bloccare le gesture sulla mappa. */
  .map-search-dock {
    inset: 0;
    width: auto;
    pointer-events: none;
    display: block;
  }

  /* Pill di ricerca: top-left, padding-sx per ospitare il bottone info.
     48px = larghezza area bottone (36px icona + margini). */
  .map-search-dock-field {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    width: 400px;
    padding-left: 48px;
    box-sizing: border-box;
    pointer-events: all;
  }

  /* Contenitore info/menu: allineato verticalmente alla pill (52px) */
  .map-top-info-action {
    top: calc(12px + env(safe-area-inset-top, 0px));
    z-index: 662;
    width: 52px;
    height: 52px;
    align-items: center;
    justify-content: center;
  }

  /* Bottone hamburger desktop: icona piatta, nessuno stile FAB */
  .map-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    color: #1f1f1f;
    transition: background 0.15s;
  }
  .map-menu-btn:hover { background: rgba(0, 0, 0, 0.06); }
  .map-menu-btn ion-icon { font-size: 24px; pointer-events: none; }

  /* Swap icona: hamburger su desktop, info su mobile */
  .fab-icon-mobile  { display: none; }
  .fab-icon-desktop { display: block; }

  /* Bottone-placeholder nascosto: sostituito dall'input reale */
  .map-search-main { display: none; }

  /* Input reale: occupa lo spazio del bottone, stile coerente con la pill */
  .map-search-dock-input {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    height: 52px;
    border: none;
    background: transparent;
    font-size: 17px;
    color: #1f1f1f;
    outline: none;
    padding: 0 8px;
    caret-color: #1f1f1f;
    padding-bottom: 3px;
  }
  .map-search-dock-input::placeholder { color: #666; }

  .map-search-dock-icon {
    display: block;
    font-size: 22px;
    color: #1f1f1f;
    flex-shrink: 0;
    margin-right: 14px;
    pointer-events: none;
  }

  /* Header del drawer nascosto: la ricerca avviene dalla pill */
  .msd-header { display: none; }

  /* Nasconde i chip filtro nel drawer su desktop (controlli nella filter bar),
     ma mantiene la pill conteggio/ordinamento */
  #btn-map-filter-onlymass,
  #btn-map-filter-datetime,
  #btn-map-filter-distance { display: none !important; }

  /* FAB filtro messe: nascosto su desktop (rimpiazzato dalla filter bar) */
  .map-fab-mass-filter { display: none !important; }

  /* FAB GPS: sopra la pill zoom, stessa colonna right */
  .map-fab-locate {
    position: absolute !important;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + 56px + 56px + 8px);
    pointer-events: all;
  }

  /* FAB zoom: pill verticale unita, altezza = 2 FAB + gap (52+8+52 = 112) */
  .map-fab-zoom {
    display: inline-flex;
    position: absolute !important;
    right: 12px;
    pointer-events: all;
    width: 52px;
    height: 56px;
    min-width: 52px;
    min-height: 56px;
    --border-radius: 0;
    --box-shadow: none;
    border-radius: 0;
    overflow: hidden;
  }
  .map-fab-zoom ion-icon { font-size: 24px; }
  #btn-zoom-in {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + 56px);
    --border-radius: 26px 26px 0 0;
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.10);
  }
  #btn-zoom-in::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 1px;
    background: rgba(0,0,0,0.1);
    z-index: 1;
  }
  #btn-zoom-out {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    --border-radius: 0 0 26px 26px;
    border-radius: 0 0 26px 26px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  }

  /* map-top-actions (boundary toggle): rimane top-right, nessuna variazione */

  /* ── Search drawer: pannello laterale sinistro stile Google Maps ── */

  /* Overlay non blocca gli eventi: la mappa resta navigabile con il drawer aperto */
  .msd.msd--open { pointer-events: none; }

  /* Nessun backdrop scuro */
  .msd-backdrop { display: none; }

  /* Niente handle di trascinamento */
  .msd-handle { display: none; }

  .msd-sheet {
    top: calc(12px + env(safe-area-inset-top, 0px) + 52px + 8px);
    bottom: auto;                /* altezza determinata dal contenuto */
    left: 12px;
    right: auto;
    margin: 0;
    width: 400px;
    max-height: calc(100dvh - (12px + env(safe-area-inset-top, 0px) + 52px + 8px) - 12px);
    border-radius: 30px; /* card-radius (20px) + card-padding (10px) → curve parallele */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    pointer-events: auto;       /* solo il pannello riceve eventi */
    transform: translateX(calc(-400px - 24px));
    /* Nessuna transizione nel CSS statico: la transizione da mobile (translateY(100%))
       a desktop (translateX(-424px)) al caricamento farebbe passare il pannello
       per il centro dello schermo. La transizione viene impostata via JS
       solo durante apertura e chiusura esplicite. */
    transition: none;
  }
  .msd--open .msd-sheet {
    transform: translateX(0);
  }

  /* Il body scorre se il contenuto supera il max-height */
  .msd-body {
    max-height: none;
    overflow-y: auto;
    padding: 0;
  }

  /* Indicatore solo messe: nascosto su desktop, rimpiazzato dal filter bar */
  .map-mass-filter-indicator { display: none !important; }

  /* Card marker mappa: nascosta su desktop (non ha senso con il pannello laterale) */
  #map-church-card { display: none !important; }

  /* Desktop filter bar: sempre visibile, inline con la searchbar */
  #map-desktop-filter-bar {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: calc(12px + 400px + 8px);
    height: 52px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    pointer-events: all;
    z-index: 661;
  }

  /* Modal filtri: card centrata invece di bottom sheet.
     Il JS non setta breakpoints su desktop → Ionic usa card modal.
     Qui correggiamo posizionamento, shadow e border-radius. */
  .map-filter-modal {
    --width: 420px;
    --border-radius: 20px;
    --box-shadow: 0 8px 32px rgba(35, 28, 23, 0.22);
  }
  .map-filter-modal::part(content) {
    margin: auto;
    border-radius: 20px;
  }
  /* Altezze calibrate sul contenuto (toolbar 56px + lista): zero padding safe-area */
  #map-search-datetime-modal { --height: 192px; }
  #map-search-distance-modal { --height: 140px; }
  #map-search-datetime-modal .map-filter-modal-content,
  #map-search-distance-modal .map-filter-modal-content {
    --padding-bottom: 0;
  }

  /* ── Church sheet: pannello dettaglio laterale ── */

  /* Sotto il drawer (z-index: 1100) così l'elenco rimane visibile sopra */
  #church-sheet { z-index: 1050; }

  /* Overlay non blocca la mappa */
  #church-sheet,
  #church-sheet.cs-visible { pointer-events: none; }

  /* Backdrop e underlay nascosti */
  .cs-backdrop       { display: none; }
  .cs-stack-underlay { display: none; }

  /* Pannello flottante: non tocca il fondo → fascia anti-bounce non serve */
  .cs-panel::after { content: none; }

  /* Pannello: left gestito da JS (12px senza drawer, 420px con drawer aperto) */
  .cs-panel {
    top: calc(12px + env(safe-area-inset-top, 0px) + 52px + 8px);
    bottom: 12px;
    left: 12px;
    right: auto;
    margin: 0;
    width: 400px;
    height: auto;
    border-radius: 30px;
    background: #fff;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    transform: translateX(-16px);
    opacity: 0;
  }

  .cs-inner { border-radius: 30px; }

  /* Icona toggle drawer: cliccabile, transizione colore */
  .map-search-dock-icon {
    pointer-events: auto;
    cursor: pointer;
    transition: color 0.18s;
    border-radius: 50%;
    padding: 2px;
  }
  .map-search-dock-icon:hover { color: #000; }

}

/* Filter bar: gap compresso tra 760 e 1024px dove lo spazio è stretto */
@media (min-width: 760px) and (max-width: 1024px) {
  #map-desktop-filter-bar { gap: 4px; }
}


/* ══════════════════════════════════════════════════════════════════
   MICROINTERAZIONI
   ══════════════════════════════════════════════════════════════════ */

/* GPS button: bounce di conferma quando la posizione viene acquisita */
@keyframes fab-bounce {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.22); }
  75%  { transform: scale(0.90); }
  100% { transform: scale(1); }
}
.map-fab-locate--success {
  animation: fab-bounce 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* Shimmer skeleton per il caricamento del dettaglio chiesa */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.cs-skeleton-line {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0ece8 25%, #e4ddd6 50%, #f0ece8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* Ingresso staggered dei risultati nella lista ricerca */

/* Skeleton pane: padding e spaziatura righe ion-skeleton-text */
.cs-skeleton-pane {
  padding: 4px 0 8px;
}
.cs-skeleton-pane ion-skeleton-text {
  display: block;
  border-radius: 4px;
  margin-bottom: 0;
}
.cs-skeleton-pane--orari {
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
  align-items: flex-start;
  min-height: unset;
  gap: 10px;
}
.cs-skeleton-pane.cs-description-content {
  padding: 8px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
