/* ========================================================================== 
   ANXA - WIDGET "VICINO A TE"
   File nuovo: css/vicino-a-te.css
   ========================================================================== */

.anxa-nearby-section {
    width: calc(100% - (var(--anxa-mobile-gutter, 12px) * 2));
    max-width: calc(100% - (var(--anxa-mobile-gutter, 12px) * 2));
    margin: 0 auto 30px;
    box-sizing: border-box;
}

.anxa-nearby-card {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--glass-border, rgba(0,0,0,.08));
    border-radius: 20px;
    background: var(--glass-bg, rgba(255,255,255,.94));
    color: var(--text-main, #1e293b);
    box-shadow: var(--shadow-md, 0 6px 20px rgba(0,0,0,.12));
    padding: 14px;
}

.anxa-nearby-head {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-bottom: 10px;
}

.anxa-nearby-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.anxa-nearby-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 21px;
    background: linear-gradient(135deg, rgba(0,51,160,.13), rgba(255,213,79,.32));
    border: 1px solid rgba(0,51,160,.12);
}

.anxa-nearby-head h2 {
    margin: 0;
    font-family: 'Outfit','Roboto',sans-serif;
    font-size: 16px;
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: .65px;
}

.anxa-nearby-head p {
    margin: 3px 0 0;
    font-size: 11px;
    line-height: 1.25;
    color: var(--text-muted, #64748b);
}

.anxa-nearby-locate {
    width: 100%;
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 11px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #0033a0, #001f68);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    box-shadow: 0 5px 14px rgba(0,51,160,.2);
}

.anxa-nearby-locate.is-active {
    background: linear-gradient(135deg, #16803d, #0e5e2c);
}

.anxa-nearby-status {
    margin: 0 0 12px;
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(0,51,160,.07);
    color: var(--text-muted, #64748b);
    font-size: 10.5px;
    line-height: 1.35;
}

.anxa-nearby-status.is-error {
    background: rgba(220,38,38,.09);
    color: #b91c1c;
}

.anxa-nearby-filter-block {
    margin-top: 10px;
}

.anxa-nearby-filter-block-vetrine {
    padding-top: 9px;
    border-top: 1px solid var(--glass-border, rgba(0,0,0,.07));
}

.anxa-nearby-filter-label {
    margin: 0 0 6px 1px;
    color: var(--text-muted, #64748b);
    font-size: 9px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: .85px;
}

.anxa-nearby-chips {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 1px 1px 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.anxa-nearby-chips::-webkit-scrollbar { display: none; }

.anxa-nearby-chip {
    flex: 0 0 auto;
    min-height: 32px;
    border: 1px solid rgba(0,51,160,.16);
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(255,255,255,.74);
    color: #173053;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
    transition: transform .15s ease, background .15s ease, color .15s ease;
}

html.rossonero-mode .anxa-nearby-chip {
    background: rgba(255,255,255,.07);
    color: #f8fafc;
    border-color: rgba(255,255,255,.12);
}

.anxa-nearby-chip:active { transform: scale(.97); }

.anxa-nearby-chip.active {
    background: #0033a0;
    border-color: #0033a0;
    color: #fff;
}

.anxa-nearby-chip-vetrina.active {
    background: linear-gradient(135deg, #7a0c12, #a51b24);
    border-color: #7a0c12;
}

.anxa-nearby-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 10px;
}



/* Toggle mappa: visibile solo su smartphone */
.anxa-nearby-map-toggle {
    display: none;
}

.anxa-nearby-map-wrap {
    position: relative;
    overflow: hidden;
    min-height: 330px;
    border-radius: 14px;
    background: #dfe8f1;
    border: 1px solid rgba(0,0,0,.08);
}

.anxa-nearby-map {
    width: 100%;
    height: 330px;
    z-index: 1;
}

.anxa-nearby-map-loading {
    position: absolute;
    z-index: 800;
    left: 10px;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: calc(100% - 20px);
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(0,18,64,.9);
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.anxa-nearby-spinner {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #ffd54f;
    border-radius: 50%;
    animation: anxaNearbySpin .75s linear infinite;
}

@keyframes anxaNearbySpin { to { transform: rotate(360deg); } }

.anxa-nearby-results-wrap {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--glass-border, rgba(0,0,0,.08));
    border-radius: 14px;
    background: rgba(255,255,255,.48);
}

html.rossonero-mode .anxa-nearby-results-wrap { background: rgba(0,0,0,.14); }

.anxa-nearby-results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 11px;
    background: rgba(0,51,160,.07);
    border-bottom: 1px solid var(--glass-border, rgba(0,0,0,.07));
}

.anxa-nearby-results-head strong {
    font-size: 11px;
    font-weight: 900;
}

.anxa-nearby-results-head span {
    color: var(--text-muted, #64748b);
    font-size: 9px;
    font-weight: 800;
}

.anxa-nearby-results {
    display: flex;
    flex-direction: column;
    max-height: 330px;
    overflow-y: auto;
}

.anxa-nearby-result {
    display: grid;
    grid-template-columns: 32px minmax(0,1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--glass-border, rgba(0,0,0,.07));
}

.anxa-nearby-result:last-child { border-bottom: 0; }

.anxa-nearby-result-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(0,51,160,.08);
    font-size: 15px;
}

.anxa-nearby-result-main { min-width: 0; }

.anxa-nearby-result-name {
    overflow: hidden;
    color: var(--text-main, #1e293b);
    font-size: 10.5px;
    line-height: 1.25;
    font-weight: 900;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.anxa-nearby-result-meta {
    margin-top: 2px;
    overflow: hidden;
    color: var(--text-muted, #64748b);
    font-size: 9px;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.anxa-nearby-result-distance {
    display: inline-block;
    margin-left: 4px;
    color: #0033a0;
    font-weight: 900;
}

html.rossonero-mode .anxa-nearby-result-distance { color: #ffd54f; }

.anxa-nearby-actions {
    display: flex;
    gap: 5px;
}

.anxa-nearby-action {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 5px 7px;
    background: #0033a0;
    color: #fff !important;
    font-size: 8.5px;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.anxa-nearby-action.secondary {
    background: rgba(0,51,160,.09);
    color: #0033a0 !important;
}

html.rossonero-mode .anxa-nearby-action.secondary {
    background: rgba(255,255,255,.08);
    color: #ffd54f !important;
}

.anxa-nearby-empty {
    padding: 22px 12px;
    color: var(--text-muted, #64748b);
    text-align: center;
    font-size: 10px;
    line-height: 1.45;
}

.anxa-nearby-note {
    margin-top: 9px;
    color: var(--text-muted, #64748b);
    font-size: 8.5px;
    line-height: 1.35;
}

/* Popup Leaflet */
.anxa-nearby-popup { min-width: 185px; }
.anxa-nearby-popup-title { font-size: 12px; font-weight: 900; line-height: 1.25; color: #14213d; }
.anxa-nearby-popup-address { margin-top: 4px; font-size: 10px; line-height: 1.3; color: #5f6b7a; }
.anxa-nearby-popup-extra { margin-top: 4px; font-size: 10px; font-weight: 800; color: #0033a0; }
.anxa-nearby-popup-actions { display:flex; gap:5px; flex-wrap:wrap; margin-top:8px; }
.anxa-nearby-popup-actions a { border-radius:7px; padding:5px 7px; background:#0033a0; color:#fff !important; font-size:9px; font-weight:900; text-decoration:none; }
.anxa-nearby-popup-actions a.secondary { background:#eef3fb; color:#0033a0 !important; }

.anxa-nearby-marker {
    width: 34px !important;
    height: 34px !important;
    margin-left: -17px !important;
    margin-top: -17px !important;
    display: grid !important;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #0033a0;
    box-shadow: 0 4px 12px rgba(0,0,0,.28);
    font-size: 15px;
}

.anxa-nearby-marker.vetrina { background: #7a0c12; }
.anxa-nearby-marker.user { background: #ffd54f; font-size: 13px; }

@media (min-width: 760px) {
    .anxa-nearby-head {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .anxa-nearby-locate { width: auto; }
    .anxa-nearby-main { grid-template-columns: minmax(0, 1.65fr) minmax(280px, .8fr); }
    .anxa-nearby-map, .anxa-nearby-map-wrap { height: 390px; min-height: 390px; }
    .anxa-nearby-results { max-height: 390px; }
}

@media (min-width: 1024px) {
    .anxa-nearby-section {
        width: calc(100% - 1.7rem);
        max-width: 1240px;
    }
    .anxa-nearby-card { padding: 16px; }
    .anxa-nearby-head h2 { font-size: 18px; }
    .anxa-nearby-head p { font-size: 12px; }
}


/* Mobile: elenco risultati espandibile, chiuso di default */
@media (max-width: 759px) {
    /* Mappa mobile: chiusa di default, apribile con freccia o geolocalizzazione */
    .anxa-nearby-map-toggle {
        width: 100%;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 9px 12px;
        border: 1px solid var(--glass-border, rgba(0,0,0,.08));
        border-radius: 12px;
        background: rgba(255,255,255,.72);
        color: var(--text-main, #1e293b);
        font-size: 11px;
        font-weight: 900;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    html.rossonero-mode .anxa-nearby-map-toggle {
        background: rgba(255,255,255,.07);
        color: #f8fafc;
        border-color: rgba(255,255,255,.12);
    }

    .anxa-nearby-map-toggle-arrow {
        color: #0033a0;
        font-size: 20px;
        line-height: 1;
        transition: transform .22s ease;
    }

    .anxa-nearby-map-toggle[aria-expanded="true"] .anxa-nearby-map-toggle-arrow {
        transform: rotate(180deg);
    }

    html.rossonero-mode .anxa-nearby-map-toggle-arrow {
        color: #ffd54f;
    }

    .anxa-nearby-map-wrap {
        display: none;
        min-height: 330px;
    }

    .anxa-nearby-map-wrap.is-open {
        display: block;
    }

    .anxa-nearby-results-wrap {
        transition: border-color .2s ease, background .2s ease;
    }

    .anxa-nearby-results-head {
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        padding-right: 36px;
        border-bottom: 0;
    }

    .anxa-nearby-results-head::after {
        content: '⌄';
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-54%) rotate(0deg);
        font-size: 18px;
        line-height: 1;
        font-weight: 900;
        color: #0033a0;
        transition: transform .22s ease;
    }

    .anxa-nearby-results-wrap.is-open .anxa-nearby-results-head {
        border-bottom: 1px solid var(--glass-border, rgba(0,0,0,.07));
    }

    .anxa-nearby-results-wrap.is-open .anxa-nearby-results-head::after {
        transform: translateY(-46%) rotate(180deg);
    }

    .anxa-nearby-results {
        display: none;
        max-height: 330px;
    }

    .anxa-nearby-results-wrap.is-open .anxa-nearby-results {
        display: flex;
    }

    html.rossonero-mode .anxa-nearby-results-head::after {
        color: #ffd54f;
    }
}

/* Blocco privacy: nessuna risorsa cartografica esterna viene caricata prima del consenso. */
.anxa-nearby-consent-box {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    background: rgba(245,248,252,.98);
    color: var(--text-main, #1e293b);
}
.anxa-nearby-consent-icon { font-size: 30px; line-height: 1; }
.anxa-nearby-consent-box strong { font-size: 14px; font-weight: 900; }
.anxa-nearby-consent-box span { max-width: 380px; font-size: 11px; line-height: 1.45; color: var(--text-muted, #64748b); }
.anxa-nearby-consent-box button {
    margin-top: 4px;
    border: 0;
    border-radius: 999px;
    padding: 9px 14px;
    background: #0033a0;
    color: #fff;
    font: inherit;
    font-size: 10px;
    font-weight: 900;
    cursor: pointer;
}
html.rossonero-mode .anxa-nearby-consent-box { background: rgba(19,19,21,.98); }
