/* ============================================================
   KIDSTRIBE — CSS OTTIMIZZATO PER WEB APP
   Palette Verde Salvia + Layout a Griglia Orizzontale
   ============================================================ */

:root {
    --sage-pastel:   #E1F2E5;
    --sage-medium:   #A8CBB3;
    --sage-dark:     #77B28C;
    --sage-deep:     #2D3E33;
    --cream:         #F9FCF9;
    --cream-darker:  #F1F8F2;
    --kids-blue:     #007AFF;
    --gray-light:    #f5f5f5;
    --gray-active:   #e0e0e0;

    --navbar-h:      72px;
    --sticky-h:      46px; 
    --card-radius:   20px;
    --card-gap:      7px;
}

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

body {
    background-color: #fff;
    font-family: 'Inter', sans-serif;
    color: var(--sage-deep);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: none;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    background-color: #fff !important;
    padding: 0 1rem;
}

.nav-social        { flex: 1; display: flex; align-items: center; gap: 8px; }
.nav-social a      { color: var(--sage-dark) !important; font-size: 1.1rem; }
.social-label      { font-size: .65rem; font-weight: 800; text-transform: uppercase; color: var(--sage-deep); }

.nav-logo          { flex: 0 0 auto; text-align: center; }
#main-logo         { height: 52px; width: auto; }

.nav-profile       { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }

/* ============================================================
   STICKY HEADER (Location + Filtri)
   ============================================================ */
#sticky-header-container {
    position: fixed;
    top: var(--navbar-h);
    left: 0; right: 0;
    z-index: 99;
    background: #fff;
    border-bottom: 1px solid var(--sage-pastel);
    box-shadow: 0 4px 10px rgba(0,0,0,.03);
}

.header-hidden {  }

/* ============================================================
   BARRA LOCALIZZAZIONE
   ============================================================ */
/* ============================================================
   STICKY — SOLO BADGE (preferiti + servizi)
   ============================================================ */
.filter-wrapper {
    overflow-x: auto;
    white-space: nowrap;
    padding: 5px 0;
    -webkit-overflow-scrolling: touch;
}
.filter-wrapper::-webkit-scrollbar { display: none; }

.filter-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
}

.btn-filter {
    background-color: var(--gray-light);
    border: none;
    color: var(--sage-deep);
    border-radius: 20px;
    padding: 6px 13px;
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.btn-filter.active { background-color: var(--sage-dark); color: #fff; }

.icon-fav-filter {
    fill: none;
    stroke: currentColor;
    stroke-width: 2px;
    transition: all .3s ease;
}
.btn-filter.active .icon-fav-filter { fill: #ff4757; stroke: #ff4757; }

/* ============================================================
   COLONNA ICONE DESTRA (fixed)
   ============================================================ */
#sidebar-actions {
    position: fixed;
    right: 14px;      
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    
    top: var(--sidebar-top, -200px);
}

.sab-btn {
    width: 54px;                 /* x1.5 (era 36) */
    height: 54px;
    border-radius: 50%;
    border: 2px solid #111;      /* cerchio nero, non verde */
    background: #fff;
    color: var(--sage-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    padding: 0;
    outline: none;
    transition: background .18s, color .18s, transform .12s;
    flex-shrink: 0;
    overflow: hidden;            /* clip: l'icona non sborda mai dal cerchio, nemmeno al primo load */
}
.sab-btn svg { width: 24px; height: 24px; }   /* icone x1.5 */
.sab-btn img { width: 34px; height: 34px; object-fit: contain; display: block; transform: translateZ(0); backface-visibility: hidden; -webkit-backface-visibility: hidden; }  /* translateZ: object-fit applicato dal 1° disegno (fix bande bianche al load) */
.sab-btn:active  { transform: scale(.90); }
.sab-btn.active,
.sab-btn.map-active {
    background: var(--sage-medium);
    color: var(--sage-deep);
    border-color: #111;
}

/* ============================================================
   FILTRI MACRO-CATEGORIA (riga orizzontale, sotto "Aggiungi luogo")
   ============================================================ */
#category-filters {
    /* Colonna a sinistra, speculare a #sidebar-actions (right:14px) */
    position: fixed;
    left: 14px;
    top: var(--sidebar-top, -200px);
    z-index: 200;                /* sopra map/marker e altri controlli (aggiungi = 150) */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cat-filter-btn {
    /* Bottone tondo, stessa dimensione dei .sab-btn a destra */
    position: relative;
    width: 54px;                 /* x1.5 (era 36) */
    height: 54px;
    border-radius: 50%;
    border: 2px solid #111;      /* cerchio nero, non verde */
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    outline: none;
    transition: background .18s, border-color .18s, transform .12s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.cat-filter-btn .cat-ico {
    width: 34px;                 /* leggermente più piccola: gli angoli del quadrato
                                    restano dentro il cerchio bianco → niente bianco che sborda */
    height: 34px;
    object-fit: contain;
    display: block;
    pointer-events: none;
    transform: translateZ(0);        /* forza il layer: object-fit applicato dal 1° disegno
                                        (fix bande bianche WebKit al load, senza click) */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.cat-filter-btn:active { transform: scale(.90); }
.cat-filter-btn.active {
    background: var(--sage-medium);
    border-color: #111;
}
/* Quando l'etichetta è visibile, alzo il bottone sopra i vicini */
.cat-filter-btn.show-lbl { z-index: 30; }

/* Descrizione a destra del bottone: compare per un breve lasso al click.
   Sfondo nero (non verde) per non confondersi coi punti sulla mappa. */
.cat-filter-btn .cat-lbl {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: #111;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: .8rem;
    line-height: 1;
    padding: 8px 12px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease;
    z-index: 40;                 /* sopra i bottoni adiacenti */
}
.cat-filter-btn.show-lbl .cat-lbl {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   DROPDOWN AZIONE (cerca / provincia) — appaiono a sx della colonna
   ============================================================ */
.action-dropdown {
    position: fixed;
    right: 64px;   
    z-index: 101;
    background: #fff;
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,.14);
    border: 1px solid var(--sage-pastel);
    min-width: 220px;
    
    animation: fadeDropdown .15s ease;
}

@keyframes fadeDropdown {
    from { opacity: 0; transform: scale(.95) translateX(6px); }
    to   { opacity: 1; transform: scale(1)   translateX(0); }
}

.action-dropdown select {
    width: 100%;
    padding: 7px 10px;
    border-radius: 10px;
    border: 2px solid var(--sage-dark);
    background: var(--sage-pastel);
    color: var(--sage-deep);
    font-size: .85rem;
    font-weight: 700;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

/* ============================================================
   MAIN CONTENT — GRIGLIA LOCALI OTTIMIZZATA WEB APP
   ============================================================ */
.main-content {
    
    margin-top: 112px !important;
    padding: 8px !important;
    width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

#lista-locali.row {
    margin-left: 0;
    margin-right: 0;
    display: grid !important;
    grid-template-columns: 1fr;
    gap: var(--card-gap);
}

@media (min-width: 576px)  { #lista-locali.row { grid-template-columns: repeat(2, 1fr); } }

#lista-locali.row > [class*="col"] {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    
    display: flex;
}

/* ============================================================
   CARD LOCALE
   ============================================================ */
.card-locale {
    border: none;
    border-radius: var(--card-radius);
    position: relative;
    overflow: hidden;
    background-color: transparent;
    box-shadow: 0 4px 15px rgba(0,0,0,.06);
    width: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s ease, transform .15s ease;
}
.card-locale:active { transform: scale(.98); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.card-locale.lista-card:active { transform: none; box-shadow: none; }
#map-popup-body .card-locale:active { transform: none; box-shadow: none; -webkit-tap-highlight-color: transparent; }

.card-locale .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 10px !important;
    background-color: rgba(255,255,255,0.0);
    position: relative;
    z-index: 1;
}

.card-locale::after {
    content: "";
    position: absolute;
    inset: 0;
    background-size: contain;
    background-position: right center;
    background-repeat: no-repeat;
    -webkit-mask-image: linear-gradient(to right, transparent 40%, black 85%);
    mask-image:         linear-gradient(to right, transparent 40%, black 85%);
    pointer-events: none; 
}

.card-locale::after      { background-image: url('img/card-bg.png'); }

.card-locale h5 {
    font-size: .95rem;
    font-weight: 800;
    color: var(--sage-deep);
    line-height: 1.2;
    margin-bottom: 4px;
    
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-width: 0;
}

.text-primary {
    color: var(--kids-blue) !important;
    font-weight: 800 !important;
    background: rgba(0, 122, 255, .1);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: .68rem;
    display: inline-block;
    width: auto;
}

#gps-help {
    margin: 8px;
    border-radius: 16px;
}

/* ============================================================
   BADGE KIDS (caratteristiche del locale)
   ============================================================ */

.badges-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    width: 100%;
    
    flex: 1;
    align-content: flex-start;
}

.badge-kids {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: .65rem;
    font-weight: 700;
    transition: all .2s ease;
    background-color: transparent;
}

.badge-kids.grey {
    
    color: var(--sage-medium);
    border: 1px solid var(--sage-pastel);
}

.badge-kids.confirmed {
    
    color: var(--sage-deep);
    border: 2px solid var(--sage-medium);
}

.badge-kids.active {
    
    color: var(--sage-deep);
    border: 2px solid var(--sage-medium);
    background-color: rgba(119, 178, 140, 0.15); 
}

.badge-kids strong {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 16px; height: 16px;
    background-color: var(--sage-pastel);
    color: var(--sage-dark);
    border-radius: 4px;
    font-size: .6rem;
    padding: 0 3px;
}

.badge-kids.confirmed strong,
.badge-kids.active strong {
    background-color: var(--sage-medium);
    color: #fff;
}

.icona-badge {
    width: 13px; height: 13px;
    stroke-width: 4;
    flex-shrink: 0;
}

.badge-kids.confirmed .icona-badge { color: var(--sage-dark); }
.badge-kids.active    .icona-badge { color: var(--sage-dark); }
.badge-kids.grey      .icona-badge { color: var(--sage-dark); }

/* ============================================================
   BADGE SEGNALA ASSENZA SERVIZI KIDSTRIBE (separato, non concorre al livello)
   ============================================================ */

.badge-kids-segnala {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: .57rem;
    font-weight: 600;
    transition: all .2s ease;
    border: 1px solid #c0c0c0; 
    color: #b0b0b0;
    background-color: transparent;
    cursor: pointer;
}

.badge-kids-segnala:hover {
    background-color: rgba(224, 123, 57, 0.08);
}

.badge-kids-segnala.active {
    color: #7a3a0a;
    border: 1.5px dashed #b85c1a;
    background-color: rgba(224, 123, 57, 0.12);
}

/* ============================================================
   PULSANTI AZIONE CARD
   ============================================================ */

.card-locale .card-body > .row:last-child {
    margin-top: auto;
    padding-top: 8px;
}

.btn-dettagli,
.btn-maps,
.btn-prenota {
    background-color: transparent;
    color: var(--sage-deep);
    border: 2px solid var(--sage-pastel);
    border-radius: 12px;
    font-weight: 800;
    font-size: .72rem;
    padding: 6px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 36px;
    transition: all .2s ease;
    white-space: nowrap;
}

.btn-dettagli:active,
.btn-maps:active { background-color: var(--sage-pastel); }

.btn-heart svg {
    pointer-events: none;
    fill: none;
    stroke: #000;
    stroke-width: 2px;
    transition: all .3s ease;
}
.btn-heart.active svg     { fill: #ff4757; stroke: #ff4757; }
.btn-heart:active          { transform: scale(1.2); }
.btn-heart:focus           { outline: none; box-shadow: none; }

/* ============================================================
   MODAL QUANTITÀ
   ============================================================ */
.btn-qty {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid var(--sage-dark);
    background: #fff;
    color: var(--sage-dark);
    font-weight: bold;
    display: flex; align-items: center; justify-content: center;
}

.qty-input {
    width: 36px;
    border: none;
    background: transparent;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
}

/* ============================================================
   OVERRIDE BOOTSTRAP (colore warning → verde salvia)
   ============================================================ */
.btn-warning,
.text-warning {
    background-color: var(--sage-dark) !important;
    border-color:     var(--sage-dark) !important;
    color: #fff !important;
}
.spinner-border.text-warning { color: var(--sage-dark) !important; }

/* ============================================================
   APP STORE / PLAY STORE BADGES
   ============================================================ */
.store-badge-btn {
    display: block;
    border-radius: 6px;
    overflow: hidden;
    line-height: 0;
    transition: opacity .15s;
    flex-shrink: 0;
}
.store-badge-btn:hover { opacity: .82; }

.pwa-banner {
    position: fixed;
    bottom: 15px; left: 15px; right: 15px;
    background: #fff;
    z-index: 9999;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(0,0,0,.15);
    border: 2px solid var(--sage-dark);
}

/* ============================================================
   SWEETALERT2
   ============================================================ */
.swal2-popup    { border-radius: 25px !important; }
.swal2-confirm,
.swal2-cancel   { border-radius: 12px !important; }

/* ============================================================
   UTILITY
   ============================================================ */
.x-small {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.user-level-badge {
    font-size: .75rem;
    font-weight: 800;
    color: var(--sage-dark);
    display: inline-block;
    line-height: 1;
    letter-spacing: .3px;
}

.user-badge-name {
    font-size: .6rem;
    font-weight: 700;
    color: var(--sage-deep);
    margin: 0;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-avatar-circle {
    width: 60px; height: 60px;
    background: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--sage-dark);
    color: var(--sage-dark);
    transition: transform .2s ease;
    overflow: hidden;
    padding: 0;
}

.avatar-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 20px;
    border: 3px solid transparent;
    transition: all .2s ease;
}

.avatar-picker-item img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--sage-pastel);
    border: 3px solid var(--sage-pastel);
    transition: transform .2s ease;
}

.avatar-picker-item:hover img,
.avatar-picker-item.selected img {
    transform: scale(1.06);
    border-color: var(--sage-dark);
}

.avatar-picker-item.selected {
    border-color: var(--sage-dark);
    background-color: var(--sage-pastel);
}

@media (max-width: 360px) {

    #lista-locali.row { grid-template-columns: 1fr; }
}

input[type=number]                            { -moz-appearance: textfield; }
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button              { -webkit-appearance: none; margin: 0; }

/* ============================================================
   SEARCH BAR
   ============================================================ */

.search-bar-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--cream-darker);
    border: 1.5px solid var(--sage-medium);
    border-radius: 14px;
    padding: 5px 8px;
    transition: border-color .2s ease;
}

.search-bar-inner:focus-within {
    border-color: var(--sage-dark);
    box-shadow: 0 0 0 3px rgba(119,178,140,.12);
}

.search-icon {
    color: var(--sage-dark);
    flex-shrink: 0;
}

#search-nome {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: .82rem;
    font-weight: 600;
    color: var(--sage-deep);
    min-width: 0;
}

#search-nome::placeholder {
    color: var(--sage-medium);
    font-weight: 500;
}

#search-nome::-webkit-search-cancel-button { display: none; }

#search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--sage-medium);
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    color: #fff;
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
    transition: background .15s ease;
}

#search-clear:hover { background: var(--sage-dark); }

/* ============================================================
   GDPR COOKIE BANNER
   Posizionato in basso, sopra tutto (z-index > PWA banner).
   Animazione slide-up al primo render.
   ============================================================ */
.gdpr-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000; 
    background: #fff;
    border-top: 2px solid var(--sage-pastel);
    box-shadow: 0 -4px 20px rgba(0,0,0,.12);
    padding: 14px 16px 18px;
    animation: slideUpBanner .35s ease;
}

.gdpr-banner-inner {
    max-width: 640px;
    margin: 0 auto;
}

.gdpr-text {
    font-size: 0.78rem;
    color: #555;
    line-height: 1.55;
    margin-bottom: 10px;
}

.gdpr-link {
    color: var(--sage-dark);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gdpr-link:hover { color: var(--sage-deep); }

@keyframes slideUpBanner {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Avatar picker: stati locked / selected ───────────────── */
.avatar-picker-item.locked {
    opacity: 0.45;
    cursor: not-allowed;
}
.avatar-picker-item.locked img {
    filter: grayscale(80%);
}

/* ============================================================
   TOGGLE VISTA LISTA / MAPPA — fixed, segue bordo inferiore sticky
   ============================================================ */

/* Il toggle mappa/lista ora vive dentro #sidebar-actions come primo bottone:
   dimensione, forma e bordo li fornisce .sab-btn. Qui resta solo lo stato attivo. */
#btn-toggle-view.map-active {
    background: var(--sage-dark);
    color: #fff;
    border-color: #111;
}

#sticky-header-container.sticky-pinned {
    transform: none !important;
    transition: none;
}

/* ============================================================
   CONTAINER MAPPA
   ============================================================ */
.mappa-container {
    position: fixed;
    top: 110px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    background: var(--cream);
}

.mappa-container .leaflet-container {
    width: 100%;
    height: 100%;
    background: var(--cream);
    font-family: 'Inter', sans-serif;
}

.mappa-container .leaflet-tile-pane {
    transition: filter .4s ease;
}

/* ---- Map Style Switcher (collapsible) ---- */
.map-style-switcher-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.map-style-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 5px 11px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--sage-deep, #2d5a3d);
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.08);
    white-space: nowrap;
    transition: background .15s ease;
}

.map-style-toggle-btn svg path {
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.map-style-toggle-btn.open svg {
    transform: rotate(180deg);
}

.map-style-switcher {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 3px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    border: 1px solid rgba(0,0,0,0.08);
    gap: 0;
    animation: fadeInDown .15s ease;
    transform-origin: top left;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: scaleY(.85); }
    to   { opacity: 1; transform: scaleY(1); }
}

.map-style-btn {
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: #666;
    padding: 5px 10px;
    border-radius: 13px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    white-space: nowrap;
    line-height: 1.2;
    text-align: left;
}

.map-style-btn.active {
    background: var(--sage-dark, #5a8a6a);
    color: #fff;
}

.marker-locale-outer {
    /* width/height impostati inline dallo JS in base allo zoom */
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--sage-dark);
    box-shadow: 0 3px 10px rgba(0,0,0,.18);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, width .2s ease, height .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.marker-locale-outer:hover,
.marker-locale-outer.active {
    transform: scale(1.25);
    box-shadow: 0 4px 14px rgba(119,178,140,.45);
    border-color: var(--sage-deep);
}

/* ============================================================
   POPUP LOCALE SU MAPPA
   ============================================================ */
.map-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0,0,0,.35);
    padding: 0;
    animation: fadeInOverlay .2s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.map-popup-card {
    width: 100%;
    max-width: 560px;
    max-height: 80dvh;
    overflow-y: auto;
    overflow-x: hidden;          /* ritaglia lo slide orizzontale dello swipe ai bordi */
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 20px 16px 28px;
    position: relative;
    box-shadow: 0 -6px 30px rgba(0,0,0,.18);
    animation: slideUpCard .25s ease;
}

@keyframes slideUpCard {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.map-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--gray-light);
    color: var(--sage-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    padding: 0;
    transition: background .15s;
}

.map-popup-close:hover {
    background: var(--gray-active);
}

#map-popup-body .card-locale {
    box-shadow: none !important;
    border-radius: 0 !important;
    -webkit-tap-highlight-color: transparent;
    cursor: default;
}

.mappa-container + #map-popup-overlay {
    z-index: 201;
}

/* ============================================================
   MAPPA — Avatar centro e bottone Cerca in quest'area
   ============================================================ */

.map-center-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    pointer-events: none;
    width: 65px;
    height: 65px;
}

.map-center-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ============================================================
   SCINTILLE CUORE — burst a raggera sui preferiti
   ============================================================ */
.heart-spark-container {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    width: 0;
    height: 0;
}

.heart-spark {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ff4757;
    transform-origin: center;
    animation: spark-burst 0.75s ease-out forwards;
}

.heart-spark-mini {
    border-radius: 0;
    background: transparent !important;
    animation: spark-burst 0.85s ease-out forwards;
}

@keyframes spark-burst {
    0%   { transform: translate(0, 0) scale(1.2); opacity: 1; }
    40%  { opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

.btn-cerca-area {
    position: fixed;
    
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));   /* sopra "Aggiungi luogo" */
    left: 50%;
    transform: translateX(-50%);   /* base: mantiene il centraggio quando l'anim è ferma */
    z-index: 150; 
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 26px;
    border: 3px solid var(--sage-deep);
    background: #fff;
    color: var(--sage-deep);
    font-size: 0.96rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 9px 24px rgba(0,0,0,.28);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, box-shadow .2s, opacity .25s;
    /* Effetto "galleggiante": sale e scende per attirare l'attenzione */
    animation: cercaFloat 1.6s ease-in-out infinite;
    will-change: transform, box-shadow;
}

/* Il -50% orizzontale è ripetuto in ogni keyframe per non far saltare il bottone */
@keyframes cercaFloat {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        box-shadow: 0 9px 24px rgba(0,0,0,.28);
    }
    50% {
        transform: translateX(-50%) translateY(-8px);
        box-shadow: 0 18px 30px rgba(0,0,0,.32);
    }
}

.btn-cerca-area:hover {
    box-shadow: 0 20px 34px rgba(0,0,0,.34);
}

.btn-cerca-area:active {
    animation: none;
    transform: translateX(-50%) scale(.96);
}

.btn-cerca-area.loading {
    opacity: .6;
    pointer-events: none;
    animation: none;            /* niente rimbalzo durante il caricamento */
    transform: translateX(-50%);
}

/* Rispetta chi preferisce meno animazioni */
@media (prefers-reduced-motion: reduce) {
    .btn-cerca-area { animation: none; }
}

.btn-cerca-area.loading svg {
    animation: spin .7s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================================
   BARRA DI RICERCA INTELLIGENTE (nome + comune) — sopra "Cerca qui"
   ============================================================ */
.smart-search-wrap {
    position: fixed;
    top: 64px;                      /* sovrascritto da JS */
    left: 50%;
    transform: translateX(-50%);
    z-index: 151;
    width: min(68vw, 300px);        /* leggermente più stretta */
    max-width: calc(100vw - 150px); /* ~75px liberi per lato: sta sopra i bottoni da 54px */
}

.smart-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 22px;
    padding: 9px 14px;
    box-shadow: 0 3px 14px rgba(0,0,0,.18);
}
.smart-search-bar .ss-icon { color: var(--sage-dark); flex: 0 0 auto; }

#smart-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: .9rem;
    color: var(--sage-deep);
}
#smart-search-input::placeholder { color: var(--sage-medium); }
#smart-search-input::-webkit-search-cancel-button { display: none; }

.ss-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    flex: 0 0 auto;
    border: none;
    background: var(--sage-pastel);
    color: var(--sage-deep);
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.smart-search-results {
    margin-top: 6px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,.16);
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.ssr-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--cream-darker);
}
.ssr-item:last-child { border-bottom: none; }
.ssr-item:hover, .ssr-item:active { background: var(--cream-darker); }
.ssr-nome   { font-family: 'Inter', sans-serif; font-size: .86rem; font-weight: 700; color: var(--sage-deep); }
.ssr-comune { font-size: .72rem; font-weight: 600; color: var(--sage-medium); }
.ssr-empty  { padding: 14px 16px; font-size: .82rem; color: var(--sage-medium); font-family: 'Inter', sans-serif; }

/* ============================================================
   MAPPA — Tooltip nome locale (Leaflet permanent tooltip)
   ============================================================ */
.tooltip-locale-nome {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    
    white-space: normal !important;
    width: 90px !important;
    max-width: 90px !important;
    word-break: break-word !important;
    line-height: 1.25 !important;
    text-shadow:
        0 0 3px #fff,
        0 0 3px #fff,
        0 0 3px #fff;
    pointer-events: none !important;
}

.tooltip-locale-nome::before {
    display: none !important;
}

/* ============================================================
   MAPPA — Varianti marker: partner (stella) e preferiti (cuore)
   ============================================================ */

/* marker-partner e marker-fav ora sono badge overlay — vedi .marker-badge */
.marker-locale-outer.marker-partner,
.marker-locale-outer.marker-fav {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Badge numero conferme totali sul marker mappa */
.leaflet-div-icon {
    position: relative !important;
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
}

.marker-conferme-badge {
    position: absolute;
    top: -18px;
    left: -24px;
    min-width: 46px;
    height: 46px;
    padding: 0 10px;
    background: transparent;
    color: #111;
    border-radius: 0;
    font-size: 1.04rem;
    font-weight: 900;
    line-height: 46px;
    text-align: center;
    box-shadow: none;
    pointer-events: none;
    z-index: 10;
    border: none;
    text-shadow:
        -2px -2px 0 #fff,
         2px -2px 0 #fff,
        -2px  2px 0 #fff,
         2px  2px 0 #fff,
         0   -2px 0 #fff,
         0    2px 0 #fff,
        -2px  0   0 #fff,
         2px  0   0 #fff;
}

/* Badge partner (stellina) — alto a destra */
/* Badge preferito (cuore) — basso a destra */
.marker-badge {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 11;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.20);
}

.marker-badge--partner {
    box-sizing: border-box;
    width: 32px;
    height: 32px;
    background: #fff9e6;
    border-color: #b37700;
}

.marker-badge--fav {
    bottom: -8px;
    right: -11px;
    background: #fff0f4;
    border-color: #b03058;
}

/* Badge fasciatoio — basso a sinistra del marker */
.marker-badge--fasciatoio {
    position: absolute;
    bottom: -12px;
    left: -16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 11;
    box-shadow: 0 1px 4px rgba(0,0,0,0.20);
    overflow: hidden;
    background: #fff;
    border: 1px solid #111;
}

#btnInviaPrenotazione.btn-invia-prenotazione {
    background: var(--sage-medium);
    color: var(--sage-deep);
    border: 2px solid var(--sage-dark);
    white-space: normal;
    word-break: break-word;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    transition: background .18s, color .18s;
}
#btnInviaPrenotazione.btn-invia-prenotazione:hover {
    background: var(--sage-dark);
    color: #fff;
}

/* ── Fix iOS: SweetAlert2 sopra banner GDPR (z-index 10000) ── */
.swal2-container {
    z-index: 20000 !important;
}

/* ── FUNNEL: badge-missione-hint — suggerimento su badge grigi per ospiti ── */
.badge-missione-hint {
    display: block;
    font-size: 0.62rem;
    color: var(--sage-dark, #5a8a6a);
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-top: 2px;
    line-height: 1.2;
    pointer-events: none;
}

/* ── FUNNEL: banner valore nel modal auth ── */
.kt-auth-value-banner {
    background: #f0f7f0;
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 14px;
    font-size: 0.8rem;
    color: #2a7a4b;
    border: 1px solid #c3dfc9;
    text-align: center;
    line-height: 1.45;
}

#btn-provincia-toggle,
#provincia-dropdown { display: none !important; }

/* ── Bottone Condividi sulla card (accanto al cuore) ── */
.btn-share { transition: transform .12s ease, opacity .12s ease; }
.btn-share:active { transform: scale(.88); opacity: .7; }

/* ============================================================
   SPLASH DI AVVIO (schermata bianca con logo)
   ============================================================ */
#kt-splash {
    transition: opacity .45s ease;
}
#kt-splash.kt-hide {
    opacity: 0;
    pointer-events: none;
}
#kt-splash-logo {
    width: min(56vw, 240px);
    height: auto;
    animation: kt-splash-pulse 1.4s ease-in-out infinite;
}
@keyframes kt-splash-pulse {
    0%, 100% { transform: scale(1);    opacity: 1;   }
    50%      { transform: scale(1.06); opacity: .82; }
}

/* ── Icona "Condividi KidsTribe" accanto alle icone social ── */
.share-site-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    margin-left: 4px;
    cursor: pointer;
    vertical-align: middle;
    line-height: 0;
}
.share-site-btn:active { opacity: .7; }

/* ── Riga "comune" evidenziata in cima ai risultati della ricerca smart ── */
.ssr-comune-row {
    flex-direction: row !important;   /* override del .ssr-item (column) */
    align-items: center;
    gap: 10px;
    background: var(--sage-pastel);
    border-bottom: 2px solid var(--sage-medium);
}
.ssr-comune-row:hover,
.ssr-comune-row:active { background: var(--sage-medium); }
.ssr-comune-pin {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--sage-deep);
}
.ssr-comune-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}
.ssr-comune-nome {
    font-family: 'Inter', sans-serif;
    font-size: .9rem;
    font-weight: 800;
    color: var(--sage-deep);
}
.ssr-comune-sub {
    font-size: .7rem;
    font-weight: 600;
    color: var(--sage-dark);
}


/* ── Bottone "Aggiungi luogo" — fixed in basso al centro (vista mappa) ── */
.btn-aggiungi-locale {
    position: fixed;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 22px;
    border-radius: 26px;
    border: none;
    background: var(--sage-medium, #77B28C);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 5px 18px rgba(0,0,0,.24);
    cursor: pointer;
    white-space: nowrap;
    transition: transform .12s ease, box-shadow .2s ease, opacity .25s ease;
}
.btn-aggiungi-locale:hover { box-shadow: 0 7px 22px rgba(0,0,0,.28); }
.btn-aggiungi-locale:active { transform: translateX(-50%) scale(.96); }
.btn-aggiungi-locale svg { flex-shrink: 0; }/* ============================================================
   Stato "loading" del bottone Vicini a me (#btn-vicini-sidebar)
   Da appendere in fondo a style.css.
   Prima il bottone visibile non aveva alcun feedback: l'utente
   toccava e non vedeva nulla per ~10 secondi.
   ============================================================ */

.sab-btn.loading {
    position: relative;
    pointer-events: none;
}

/* L'icona del mirino sfuma, lo spinner prende il suo posto */
.sab-btn.loading > svg,
.sab-btn.loading > img {
    opacity: .18;
    transition: opacity .15s ease;
}

.sab-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border-radius: 50%;
    border: 2.5px solid rgba(119, 178, 140, .28);
    border-top-color: var(--sage-dark, #77B28C);
    animation: kt-gps-spin .7s linear infinite;
}

@keyframes kt-gps-spin {
    to { transform: rotate(360deg); }
}

/* Rispetta chi ha ridotto le animazioni di sistema */
@media (prefers-reduced-motion: reduce) {
    .sab-btn.loading::after {
        animation-duration: 2s;
    }
}


/* ============================================================
   Box grado nel menu utente (#kt-grade-box)
   Tutto il riquadro apre "I tuoi Gradi": serve un feedback
   proporzionato all'area, altrimenti un tap su una superficie
   cosi' grande sembra non aver fatto niente.
   ============================================================ */

#kt-grade-box:hover {
    background: var(--sage-pastel);
    border-color: var(--sage-medium);
}

#kt-grade-box:active {
    transform: scale(.985);
}

#kt-grade-box:focus-visible {
    outline: 2px solid var(--sage-dark);
    outline-offset: 2px;
}

/* Su touch l'hover resta "appiccicato" dopo il tap: lo disattiviamo */
@media (hover: none) {
    #kt-grade-box:hover {
        background: var(--cream-darker);
        border-color: var(--sage-pastel);
    }
}

@media (prefers-reduced-motion: reduce) {
    #kt-grade-box { transition: none; }
    #kt-grade-box:active { transform: none; }
}