/* ============================================================
   Festival Results Engine — fre-style.css
   v1.0.0
   ============================================================ */

/* ── Reset / Base ─────────────────────────────────────────── */
.fre-container *,
.fre-container *::before,
.fre-container *::after {
    box-sizing: border-box;
}

:root {
    /* Altezza della barra filtri mobile: il bottom sheet si ferma qui sopra. */
    --fre-bar-h: calc(80px + env(safe-area-inset-bottom));
}

.fre-container {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 'Helvetica Neue', Arial, sans-serif;
    color: #222;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 48px;
}

/* Lato su tutti i discendenti: Avada imposta font propri su h1-h6, p,
   input e button, quindi serve forzare il tutto.                      */
.fre-container,
.fre-container *,
.fre-wiz-overlay,
.fre-wiz-overlay *,
.fre-dropdown,
.fre-dropdown * {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 'Helvetica Neue', Arial, sans-serif !important;
}

/* ============================================================
   SEARCH WRAPPER & STICKY BAR
   ============================================================ */
.fre-search-wrapper {
    /* NON sticky: evita che la barra copra i risultati durante lo scroll */
    position: relative !important;
    top: auto !important;
    z-index: 99999 !important;
    margin-bottom: 40px;
    isolation: auto !important;
}

/* Barra principale — Opzione A */
.fre-main-search {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    transition: box-shadow .25s ease, border-color .25s ease;
    overflow: visible;
    position: relative;
    width: 100%;
    min-width: 0;
}

.fre-main-search:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.11);
    border-color: #ccc;
}

/* ── Singolo campo ────────────────────────────────────────── */
.fre-field {
    flex: 1;
    min-width: 0;
    padding: 13px 22px;
    cursor: pointer;
    transition: background .15s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 62px;
    position: relative;
    border-radius: 0;
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}
.fre-field:focus,
.fre-field *:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Separatori interni sottili invece di border-right pieno */
.fre-field + .fre-field::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 1px;
    background: #e8e8e8;
}

.fre-field:first-child { border-radius: 40px 0 0 40px; }

.fre-field:hover {
    background: #f8f8f8;
    border-radius: 40px;
    z-index: 1;
}
.fre-field:hover + .fre-field::before,
.fre-field.fre-active + .fre-field::before { opacity: 0; }

.fre-field.fre-active {
    background: #f8f8f8 !important;
    border-radius: 40px !important;
    z-index: 2;
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.fre-field-label {
    font-size: 10px;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    letter-spacing: .7px;
    margin-bottom: 4px;
}

.fre-field-input {
    border: none;
    background: transparent;
    font-size: 13px;
    color: #888;
    outline: none;
    width: 100%;
    min-width: 0;
    padding: 0;
    font-family: inherit;
}
.fre-field-input::placeholder { color: #bbb; }
.fre-field-input.fre-has-value,
.fre-field-input:focus { color: #111; font-weight: 500; }

.fre-field-value-display {
    font-size: 13px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.fre-field-value-display.fre-has-value { color: #111; font-weight: 500; }

/* ── Bottoni nella barra ──────────────────────────────────── */
.fre-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 4px;
    flex-shrink: 0;
}

.fre-search-btn,
.fre-reset-btn {
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, background .15s ease;
    flex-shrink: 0;
}

.fre-search-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: #9EBF44;
    color: #fff;
}
.fre-search-btn svg { width: 19px; height: 19px; }
.fre-search-btn:hover { background: #8aaa38; transform: scale(1.05); }
.fre-search-btn:active { transform: scale(.95); }

.fre-reset-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #888;
}
.fre-reset-btn svg { width: 15px; height: 15px; }
.fre-reset-btn:hover { border-color: #ccc; background: #f5f5f5; color: #333; }

/* ============================================================
   DROPDOWN
   ============================================================ */
.fre-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    box-shadow: 0 8px 28px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    padding: 20px;
    display: none;
    z-index: 99999;
    animation: freDropIn .18s ease-out;
}
.fre-dropdown.fre-dd-open { display: block; }

.fre-dropdown-wide {
    left: auto !important;
    right: auto !important;
    width: var(--fre-bar-width, 100%) !important;
    max-width: none !important;
}

@keyframes freDropIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fre-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.fre-dropdown-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.fre-dropdown-close {
    width: 28px;
    height: 28px;
    background: #f5f5f5;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #777;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.fre-dropdown-close:hover { background: #eaeaea; color: #222; }

/* ── Griglia opzioni (città / tipologia / sottotipo) ─────── */
.fre-grid-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
}

.fre-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 10px;
    border: 1.5px solid #ebebeb;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
    background: #fff;
    text-align: center;
    gap: 8px;
}
.fre-option:hover {
    border-color: #BD2E27;
    background: #fef8f8;
    transform: translateY(-1px);
}
.fre-option.fre-selected {
    border-color: #BD2E27;
    background: #fef5f5;
}
.fre-option-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    object-position: center;
    display: block;
}
.fre-option-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}
.fre-option.fre-selected .fre-option-name { color: #BD2E27; }
.fre-option.fre-selected .fre-option-img { filter: none; }

/* ── Date picker ─────────────────────────────────────────── */
.fre-date-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 28px;
}
.fre-col-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* Quick dates */
.fre-quick-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.fre-quick-btn {
    display: block;
    width: 100%;
    text-align: left;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all .18s ease;
    line-height: 1.3;
}
.fre-quick-btn strong { display: block; font-weight: 600; color: #222; }
.fre-quick-btn small  { display: block; color: #777; font-size: 11px; margin-top: 2px; }
.fre-quick-btn:hover {
    border-color: #c5c5c5;
    background: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.fre-quick-btn.fre-selected {
    border-color: #BD2F27;
    background: #fef5f5;
}
.fre-quick-btn.fre-selected strong { color: #BD2F27; }

/* ── Datepicker: stile condiviso desktop (#fre-calendar) e mobile (#fre-wiz-cal)
   Il mobile prima non aveva NESSUNA regola e mostrava lo stile grezzo di
   jQuery UI. L'intervallo ora è una fascia continua sulle celle <td>, non
   una fila di pillole staccate.                                            */
#fre-calendar .ui-datepicker,
#fre-wiz-cal .ui-datepicker {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: none;
    padding: 12px 10px;
    font-family: inherit;
    font-size: 13px;
    width: 100%;
}
#fre-calendar .ui-datepicker-header,
#fre-wiz-cal .ui-datepicker-header {
    background: none;
    border: none;
    font-weight: 700;
    color: #111;
    padding: 4px 0 12px;
    position: relative;
}
#fre-calendar .ui-datepicker-title,
#fre-wiz-cal .ui-datepicker-title { font-size: 15px; text-align: center; }

/* Celle attaccate: senza border-spacing la fascia non si spezza */
#fre-calendar .ui-datepicker table,
#fre-wiz-cal .ui-datepicker table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin: 0;
}
#fre-calendar .ui-datepicker th,
#fre-wiz-cal .ui-datepicker th {
    font-size: 11px;
    color: #9aa0a6;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 6px 0;
    text-align: center;
    border: none;
}
#fre-calendar .ui-datepicker td,
#fre-wiz-cal .ui-datepicker td {
    padding: 2px 0;
    border: none;
    background: transparent;
    text-align: center;
}
#fre-calendar .ui-datepicker td a,
#fre-calendar .ui-datepicker td span,
#fre-wiz-cal .ui-datepicker td a,
#fre-wiz-cal .ui-datepicker td span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 auto;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #2b2b2b;
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}
#fre-calendar .ui-datepicker td a:hover,
#fre-wiz-cal .ui-datepicker td a:hover { background: #f0f0f0; }

/* Weekend: solo il testo cambia, così non compete con la fascia */
#fre-calendar .ui-datepicker td.fre-weekend a,
#fre-wiz-cal .ui-datepicker td.fre-weekend a { color: #c05c0a; font-weight: 700; }

/* Giorni fuori mese e disabilitati: smorzati */
#fre-calendar .ui-datepicker td.ui-datepicker-other-month a,
#fre-wiz-cal .ui-datepicker td.ui-datepicker-other-month a { color: #c8c8c8; font-weight: 400; }

/* ── Fascia dell'intervallo, dipinta sul <td> ─────────────────────
   Il fondo copre l'intera cella e le celle sono adiacenti, quindi
   i giorni risultano collegati fra loro invece che isolati.        */
#fre-calendar .ui-datepicker td.fre-in-range,
#fre-wiz-cal .ui-datepicker td.fre-in-range { background: #fbe3e2; }

#fre-calendar .ui-datepicker td.fre-in-preview,
#fre-wiz-cal .ui-datepicker td.fre-in-preview { background: #f6ecec; }

/* Estremi: mezza fascia + pallino pieno, arrotondati solo all'esterno */
#fre-calendar .ui-datepicker td.fre-range-start,
#fre-wiz-cal .ui-datepicker td.fre-range-start {
    background: linear-gradient(to right, transparent 50%, #fbe3e2 50%);
}
#fre-calendar .ui-datepicker td.fre-range-end,
#fre-wiz-cal .ui-datepicker td.fre-range-end {
    background: linear-gradient(to left, transparent 50%, #fbe3e2 50%);
}
/* Un solo giorno selezionato: nessuna mezza fascia da mostrare */
#fre-calendar .ui-datepicker td.fre-range-start.fre-range-pending,
#fre-wiz-cal .ui-datepicker td.fre-range-start.fre-range-pending { background: transparent; }

#fre-calendar .ui-datepicker td.fre-range-start a,
#fre-calendar .ui-datepicker td.fre-range-end a,
#fre-wiz-cal .ui-datepicker td.fre-range-start a,
#fre-wiz-cal .ui-datepicker td.fre-range-end a,
#fre-calendar .ui-datepicker td.fre-range-start a:hover,
#fre-calendar .ui-datepicker td.fre-range-end a:hover,
#fre-wiz-cal .ui-datepicker td.fre-range-start a:hover,
#fre-wiz-cal .ui-datepicker td.fre-range-end a:hover {
    background: #BD2F27;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(189,47,39,.32);
}

/* In attesa del secondo click: il giorno pulsa per dire "manca la fine" */
#fre-calendar .ui-datepicker td.fre-range-pending a,
#fre-wiz-cal .ui-datepicker td.fre-range-pending a {
    animation: fre-day-pulse 1.5s ease-out infinite;
}
@keyframes fre-day-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(189,47,39,.55); }
    70%  { box-shadow: 0 0 0 10px rgba(189,47,39,0); }
    100% { box-shadow: 0 0 0 0 rgba(189,47,39,0); }
}

/* ui-state-active di jQuery UI non deve sovrascrivere la nostra fascia */
#fre-calendar .ui-state-active,
#fre-wiz-cal .ui-state-active { background: transparent; border: none; }

/* Frecce mese: target grandi e simmetrici */
#fre-calendar .ui-datepicker .ui-datepicker-prev,
#fre-calendar .ui-datepicker .ui-datepicker-next,
#fre-wiz-cal .ui-datepicker .ui-datepicker-prev,
#fre-wiz-cal .ui-datepicker .ui-datepicker-next {
    top: 0;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    width: 34px; height: 34px;
    cursor: pointer;
}
#fre-calendar .ui-datepicker .ui-datepicker-prev-hover,
#fre-calendar .ui-datepicker .ui-datepicker-next-hover,
#fre-wiz-cal .ui-datepicker .ui-datepicker-prev-hover,
#fre-wiz-cal .ui-datepicker .ui-datepicker-next-hover {
    background: #e8e8e8;
    border-color: #ddd;
    top: 0;
}

/* Riga di istruzioni sopra il calendario */
.fre-cal-hint {
    margin: 0 0 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: #8a8a8a;
    text-align: center;
    letter-spacing: .01em;
}
.fre-cal-hint.fre-cal-hint-active { color: #BD2F27; }

.fre-cal-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.fre-cal-btn {
    flex: 1;
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.fre-cal-btn:hover { background: #f3f4f6; }
.fre-cal-btn-primary {
    background: #111;
    border-color: #111;
    color: #fff;
}
.fre-cal-btn-primary:hover { background: #333; border-color: #333; }

/* ============================================================
   SEZIONE RISULTATI
   ============================================================ */
.fre-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.fre-results-count { font-size: 15px; color: #444; }
.fre-results-count strong { color: #111; font-weight: 700; }
.fre-results-count em { color: #BD2F27; font-style: normal; }

.fre-clear-link {
    background: none;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.fre-clear-link:hover { background: #f3f4f6; border-color: #aaa; color: #222; }

/* ── Card Grid ────────────────────────────────────────────── */
.fre-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

/* ── Singola card ─────────────────────────────────────────── */
.fre-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    transition: transform .22s ease, box-shadow .22s ease;
}
.fre-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 36px rgba(0,0,0,.13);
}

/* Immagine */
.fre-card-media {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
    position: relative;
}
.fre-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.fre-card:hover .fre-card-img { transform: scale(1.05); }

.fre-card-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 56px;
    color: #ccc;
}

/* Badge tipologia — sovrapposto sull'immagine */
/* Overlay badge — indipendente da overflow:hidden del parent */
.fre-badge-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    pointer-events: none !important;
    z-index: 20 !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: 14px !important;
}

.fre-badge {
    pointer-events: auto;
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    color: #fff !important;
    border-radius: 28px;
    padding: 5px 12px;
    text-transform: capitalize;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* Body card */
.fre-card-body {
    padding: 18px 18px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

/* Titolo card — desktop.
   È un <h3>: Avada impone font-size/weight sugli heading, quindi
   serve il prefisso body + !important.                            */
.fre-card-title,
body .fre-container .fre-card-title {
    font-size: 28px !important;
    font-weight: 600 !important;
    color: #222323;
    margin: 0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fre-card-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Info: luogo, data, durata */
.fre-card-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 4px;
}
.fre-card-luogo,
.fre-card-date,
.fre-card-durata {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #777;
    font-weight: 500;
}
.fre-card-luogo {
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .4px;
    color: #555;
    text-transform: uppercase;
}
.fre-card-luogo svg,
.fre-card-date svg,
.fre-card-durata svg { flex-shrink: 0; color: #aaa; }

/* Footer: disponibilità */
.fre-card-footer {
    display: flex;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* Disponibilità */
.fre-disp {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}
.fre-disp-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}
.fre-disp-ended { color: #888; }
.fre-disp-ended .fre-disp-dot { background: #aaa; }
.fre-disp-none  { color: #c0392b; }
.fre-disp-none  .fre-disp-dot { background: #FF0000; }
.fre-disp-few   { color: #e67e22; }
.fre-disp-few   .fre-disp-dot { background: #FFA500; }
.fre-disp-ok    { color: #027a00; }
.fre-disp-ok    .fre-disp-dot { background: #029100; }

/* ── Loading ──────────────────────────────────────────────── */
.fre-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 64px 20px;
    grid-column: 1 / -1;
    font-size: 15px;
    color: #888;
}
.fre-loading-inline { padding: 24px; }
.fre-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top-color: #BD2F27;
    border-radius: 50%;
    animation: freSpin .8s linear infinite;
    flex-shrink: 0;
}
@keyframes freSpin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────── */
.fre-empty-state {
    padding: 64px 20px;
    grid-column: 1 / -1;
}
/* text-align forzato: Avada sovrascrive l'allineamento sui <p>/<h3> */
body .fre-container .fre-empty-state,
body .fre-container .fre-empty-state h3,
body .fre-container .fre-empty-state p,
body #fre-results-grid .fre-empty-state p {
    text-align: center !important;
}
/* Avada (.fusion-post-content p / .post-content p) forza margin:0 0 20px,
   azzerando i margini laterali: il <p> con max-width restava a sinistra. */
body .fre-container .fre-empty-state p,
body #fre-results-grid .fre-empty-state p {
    margin-left: auto !important;
    margin-right: auto !important;
}
.fre-empty-icon { font-size: 56px; margin-bottom: 16px; }
.fre-empty-state h3 { font-size: 22px; font-weight: 700; color: #222; margin: 0 0 10px; }
.fre-empty-state p  { font-size: 15px; color: #777; line-height: 1.5; margin: 0 auto 24px; max-width: 440px; }

.fre-btn-secondary {
    background: none;
    border: 1.5px solid #333;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.fre-btn-secondary:hover { background: #333; color: #fff; }

/* ── Load more ────────────────────────────────────────────── */
.fre-load-more-wrap {
    text-align: center;
    margin-top: 36px;
}
.fre-load-more-btn {
    background: #fff;
    border: 1.5px solid #333;
    border-radius: 10px;
    padding: 13px 36px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    font-family: inherit;
    transition: all .18s;
}
.fre-load-more-btn:hover { background: #333; color: #fff; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* Card mobile: nascoste sopra 1100px (desktop) via media query esplicita */
@media (min-width: 1101px) and (hover: hover) and (pointer: fine) {
    .fre-container .fre-mob-cards,
    body .fre-container .fre-mob-cards {
        display: none !important;
    }
}
@media (max-width: 768px) {
    .fre-search-wrapper {
        position: relative !important;
        top: auto !important;
        z-index: 1 !important;
        margin-bottom: 22px !important;
        isolation: auto !important;
    }

    /* Barra collassata: solo pill + bottone cerca */
    .fre-main-search {
        flex-direction: row !important;
        align-items: center !important;
        border-radius: 40px !important;
        min-height: 52px !important;
        padding: 0 6px 0 16px !important;
    }

    /* Nasconde TUTTI i campi e i loro separatori */
    .fre-field,
    .fre-field + .fre-field::before,
    .fre-field-search,
    .fre-reset-btn {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        opacity: 0 !important;
        position: absolute !important;
        pointer-events: none !important;
    }

    /* Card mobili visibili (specificità alta per battere il display:none desktop) */
    .fre-container .fre-mob-cards,
    body .fre-container .fre-mob-cards {
        display: flex !important;
        flex: 1 1 auto !important;
        gap: 5px !important;
        min-width: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        pointer-events: auto !important;
        align-items: stretch !important;
    }
    .fre-mob-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        flex: 1 !important;
        min-width: 0 !important;
        padding: 11px 4px !important;
        min-height: 62px !important;
        border: 1px solid #e4e4e4 !important;
        border-radius: 14px !important;
        background: #f7f7f7 !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    .fre-mob-card.fre-mob-card-active {
        border-color: #BD2E27 !important;
        background: #fef5f5 !important;
    }
    .fre-mob-card i {
        font-size: 21px !important;
        color: #999 !important;
    }
    .fre-mob-card.fre-mob-card-active i { color: #BD2E27 !important; }
    .fre-mob-card-val {
        font-size: 11px !important;
        font-weight: 600 !important;
        color: #aaa !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        text-align: center !important;
        padding: 0 2px !important;
    }
    .fre-mob-card.fre-mob-card-active .fre-mob-card-val,
    .fre-mob-card-val.fre-has-value { color: #222 !important; font-weight: 700 !important; }

    /* Bottone cerca: card verde squadrata come le altre */
    .fre-container .fre-btn-group,
    body .fre-container .fre-btn-group {
        margin-left: 5px !important;
    }
    .fre-container .fre-search-btn,
    body .fre-container .fre-search-btn {
        width: 58px !important;
        min-width: 58px !important;
        align-self: stretch !important;
        height: auto !important;
        min-height: 62px !important;
        border-radius: 14px !important;
        flex-shrink: 0 !important;
        background: #9EBF44 !important;
        border: 1px solid #9EBF44 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transform: none !important;
    }
    .fre-container .fre-search-btn svg,
    body .fre-container .fre-search-btn svg {
        width: 24px !important;
        height: 24px !important;
        stroke: #fff !important;
    }

    /* Reset accanto al Cerca: compare solo quando ci sono filtri attivi
       (visibilità gestita da JS con .toggle(), quindi niente display qui). */
    .fre-container .fre-reset-btn,
    body .fre-container .fre-reset-btn {
        width: 46px !important;
        min-width: 46px !important;
        align-self: stretch !important;
        height: auto !important;
        min-height: 62px !important;
        margin-right: 6px !important;
        border-radius: 14px !important;
        flex-shrink: 0 !important;
        background: #f2f2f2 !important;
        border: 1px solid #e0e0e0 !important;
        color: #777 !important;
        align-items: center !important;
        justify-content: center !important;
        transform: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        pointer-events: auto !important;
    }
    .fre-container .fre-reset-btn svg,
    body .fre-container .fre-reset-btn svg {
        width: 17px !important;
        height: 17px !important;
    }

    .fre-btn-group {
        display: flex !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        pointer-events: auto !important;
    }

    /* Griglia risultati */
    .fre-results-grid { grid-template-columns: 1fr; gap: 16px; }
    .fre-results-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .fre-date-grid { grid-template-columns: 1fr; gap: 20px; }
    .fre-quick-dates { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .fre-container { padding: 0 10px 32px; }
    .fre-grid-options { grid-template-columns: repeat(2, 1fr); }
    .fre-card-body { padding: 14px; }
}

/* ── Titolo card: scalatura responsive ────────────────────────
   Desktop 28px. Sotto i 1024px le colonne si stringono prima che
   la griglia passi a colonna singola (768px), quindi c'è uno step
   intermedio per evitare che il titolo occupi tutta la card.     */
@media (max-width: 1024px) {
    body .fre-container .fre-card-title { font-size: 25px !important; }
}
@media (max-width: 768px) {
    /* griglia a colonna singola: card a tutta larghezza */
    body .fre-container .fre-card-title {
        font-size: 23px !important;
        line-height: 1.28;
    }
}
@media (max-width: 480px) {
    body .fre-container .fre-card-title {
        font-size: 20px !important;
        line-height: 1.3;
        -webkit-line-clamp: 3;   /* schermi stretti: più respiro sui titoli lunghi */
    }
}

/* ── Accessibility ────────────────────────────────────────── */
.fre-field:focus-within {
    outline: 2px solid #BD2F27;
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ── Campo ricerca testo ──────────────────────────────────── */
.fre-field-search {
    flex: 1.4;
    cursor: text;
    justify-content: center;
}

.fre-field-search .fre-field-input {
    cursor: text;
    font-size: 13px;
}

.fre-field-search.fre-active {
    background: #f8f8f8;
}

@media (max-width: 768px) {
    .fre-field-search { flex: unset; }
}

/* ── Lock scroll durante il wizard mobile ─────────────────── */
body.fre-mob-open { overflow: hidden !important; position: fixed !important; width: 100% !important; }

/* ── Header risultati actions ─────────────────────────────── */
.fre-results-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Toggle switch */
.fre-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.fre-toggle-track {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    background: #ddd;
    border-radius: 11px;
    transition: background .2s ease;
    flex-shrink: 0;
}
.fre-toggle-track input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.fre-toggle-track input:checked + .fre-toggle-thumb { transform: translateX(16px); }
.fre-toggle-track:has(input:checked) { background: #029100; }
.fre-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.fre-toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: #444;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .fre-results-actions { flex-wrap: wrap; gap: 10px; }
}

/* ── Icona sottotipo sulla card ───────────────────────────── */
.fre-card-subtype {
    position: absolute !important;
    bottom: 10px !important;
    right: 10px !important;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.92);
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    z-index: 10;
}
.fre-card-subtype-img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

/* ── Fasce orarie nel dropdown Quando ────────────────────── */
.fre-time-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fre-time-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s;
    width: 100%;
}
.fre-time-btn:hover { border-color: #BD2E27; background: #fef8f8; }
.fre-time-btn.fre-selected { border-color: #BD2E27; background: #fef5f5; }
.fre-time-icon { font-size: 20px; flex-shrink: 0; }
.fre-time-label {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    display: block;
    line-height: 1.2;
}
.fre-time-range {
    font-size: 11px;
    color: #888;
    display: block;
}
.fre-time-btn.fre-selected .fre-time-label { color: #BD2E27; }

@media (max-width: 768px) {
    .fre-date-grid { grid-template-columns: 1fr !important; }
    .fre-results-actions { flex-wrap: wrap; gap: 8px; }
    .fre-sort-select { width: 100%; }
}

/* ── Fix z-index Avada ────────────────────────────────────── */
/* Il dropdown vive dentro #main; il footer (#footer) è un fratello
   che arriva DOPO nel DOM. Con z-index:auto su entrambi, nell'area
   in cui il dropdown scende sopra il footer vinceva il footer.
   Soluzione: azzeriamo gli stacking-context superflui e portiamo
   #main sopra #footer, così tutto il contenuto (dropdown incluso)
   resta sopra al footer.                                          */
#wrapper,
#boxed-wrapper,
.fusion-wrapper,
.fusion-header-wrapper,
.fusion-page-title-bar {
    z-index: auto !important;
}

body #main {
    position: relative !important;
    z-index: 2 !important;
}

body #footer,
body .fusion-footer,
body .fusion-footer-copyright-area,
body .fusion-footer-widget-area,
body .fusion-tb-footer {
    position: relative !important;
    z-index: 1 !important;
}

.fre-search-wrapper { isolation: auto !important; }
.fre-dropdown.fre-dd-open { z-index: 99999 !important; }

/* ── Wizard Mobile ────────────────────────────────────────── */
/* ── Bottom sheet: sale dal basso, sopra la barra filtri ──── */
.fre-wiz-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);   /* pagina in trasparenza sopra il pannello */
    z-index: 2147483000;           /* sotto la barra: resta visibile in fondo */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;      /* ancora il foglio in basso */
    overflow: hidden;
    animation: fre-fade-in .2s ease;
}
.fre-wiz-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 74dvh;              /* lascia intravedere la pagina sopra */
    background: #fff;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,.18);
    margin-bottom: var(--fre-bar-h);  /* si ferma sopra la barra filtri */
    animation: fre-sheet-up .28s cubic-bezier(.22,.9,.3,1);
}
/* Maniglia */
.fre-sheet-grip {
    flex-shrink: 0;
    width: 40px;
    height: 4px;
    border-radius: 3px;
    background: #d8d8d8;
    margin: 9px auto 2px;
}
@keyframes fre-sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
@keyframes fre-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Header */
.fre-wiz-header {
    flex-shrink: 0;
    padding: 16px 16px 14px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}
.fre-wiz-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border: 1.5px solid #e0e0e0;
    border-radius: 50%;
    background: #f8f8f8;
    font-size: 18px; line-height: 1;
    color: #666; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.fre-wiz-title {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin: 0 0 4px;
    padding-right: 44px;
}
.fre-wiz-sub {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* Content */
.fre-wiz-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
}

/* Opzioni lista (città, attività, preferenze) */
.fre-wiz-opt {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .1s;
}
.fre-wiz-opt:active { background: #fef8f8; }
.fre-wiz-opt-sel   { background: #fef5f5; }
.fre-wiz-opt-img {
    width: 40px; height: 40px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
    display: block;
}
span.fre-wiz-opt-img {
    background: #f0f0f0;
}
.fre-wiz-opt-name {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: #222;
}
.fre-wiz-opt-sel .fre-wiz-opt-name { color: #BD2E27; font-weight: 600; }
.fre-wiz-check {
    width: 22px; height: 22px;
    border: 1.5px solid #ddd;
    border-radius: 50%;
    flex-shrink: 0;
}
.fre-wiz-opt-sel .fre-wiz-check {
    background: #BD2E27;
    border-color: #BD2E27;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* Date step */
.fre-wiz-dates { padding: 16px; }
.fre-wiz-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #999;
    margin: 0 0 10px;
}
.fre-wiz-date-opt {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.fre-wiz-date-opt strong { font-size: 15px; font-weight: 600; color: #111; }
.fre-wiz-date-opt small  { font-size: 12px; color: #888; }
.fre-wiz-date-sel {
    border-color: #BD2E27;
    background: #fef5f5;
}
.fre-wiz-date-sel strong { color: #BD2E27; }

/* Footer */
.fre-wiz-footer {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid #f0f0f0;
    background: #fff;
}
/* "Rimuovi filtro": presente in tutti i pannelli */
.fre-panel-clear {
    flex: 1;
    padding: 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.fre-panel-clear:disabled {
    opacity: .4;
    cursor: default;
}
/* "Applica": solo nel pannello "Quando" */
.fre-panel-apply {
    flex: 2;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: #BD2E27;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.fre-panel-apply:active { opacity: .85; }

/* ── Fascia oraria nel wizard ─────────────────────────────── */
.fre-wiz-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.fre-wiz-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .15s, background .15s;
}
.fre-wiz-slot:active { background: #fef8f8; }
.fre-wiz-slot-sel {
    border-color: #BD2E27;
    background: #fef5f5;
}
.fre-wiz-slot-label {
    font-size: 15px;
    font-weight: 600;
    color: #222;
}
.fre-wiz-slot-sel .fre-wiz-slot-label { color: #BD2E27; }
.fre-wiz-slot-range {
    font-size: 12px;
    color: #999;
}
.fre-wiz-slot-sel .fre-wiz-slot-range { color: #BD2E27; opacity: .7; }

/* ============================================================
   FIX DEFINITIVO MOBILE/TABLET — barra ricerca non fissa
   ------------------------------------------------------------
   1) Disattiva sticky/fixed anche se qualche CSS precedente resta in cache.
   2) Allarga il breakpoint a tablet/telefono (fino a 1100px e device touch).
   3) Mostra solo la pill compatta su mobile, mai la barra completa.
   ============================================================ */
@media (max-width: 1100px), (hover: none) and (pointer: coarse) {
    /* Barra filtri ancorata in fondo allo schermo */
    .fre-container .fre-search-wrapper,
    body .fre-container .fre-search-wrapper {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 2147483601 !important;   /* sempre sopra il foglio */
        margin: 0 !important;
        padding: 8px 10px !important;
        padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
        background: #fff !important;
        border-top: 1px solid #ececec !important;
        box-shadow: 0 -4px 18px rgba(0,0,0,.10) !important;
        isolation: auto !important;
        transform: none !important;
    }

    /* Spazio in fondo alla pagina per non finire sotto la barra */
    .fre-container { padding-bottom: calc(var(--fre-bar-h) + 28px) !important; }

    .fre-container .fre-main-search,
    body .fre-container .fre-main-search {
        position: relative !important;
        z-index: 1 !important;
        flex-direction: row !important;
        align-items: stretch !important;
        border-radius: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .fre-container .fre-field,
    .fre-container .fre-field-search,
    .fre-container .fre-field + .fre-field::before,
    body .fre-container .fre-field,
    body .fre-container .fre-field-search,
    body .fre-container .fre-field + .fre-field::before {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        opacity: 0 !important;
        position: absolute !important;
        pointer-events: none !important;
    }

    .fre-container .fre-mob-cards,
    body .fre-container .fre-mob-cards {
        display: flex !important;
        flex: 1 1 auto !important;
        align-items: center !important;
        gap: 8px !important;
        min-width: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        pointer-events: auto !important;
    }

    .fre-container .fre-btn-group,
    body .fre-container .fre-btn-group {
        display: flex !important;
        flex: 0 0 auto !important;
        align-items: stretch !important;
        margin-left: 6px !important;
        padding: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        pointer-events: auto !important;
    }

    .fre-container .fre-results-header,
    .fre-container .fre-results-grid,
    body .fre-container .fre-results-header,
    body .fre-container .fre-results-grid {
        position: relative !important;
        z-index: 1 !important;
    }
}

/* ============================================================
   MOBILE UX — revisione pannelli, chip, feedback
   ------------------------------------------------------------
   Blocco aggiunto in coda: sovrascrive per posizione, senza
   toccare le regole precedenti. Contiene il fix del bottone
   reset, la barra strumenti mobile, i chip dei filtri attivi,
   il bottom sheet ridimensionato e la densità delle card.
   ============================================================ */

/* ── 1. Fix reset ─────────────────────────────────────────────
   Sotto i 768px il bottone era spento da `display:none !important`
   nella lista dei campi nascosti. Lo stile inline del JS non poteva
   vincere contro !important, quindi la visibilità passa da una
   classe con specificità e importanza sufficienti.                */
.fre-reset-btn { display: none; }
.fre-container .fre-reset-btn.fre-reset-on,
body .fre-container .fre-reset-btn.fre-reset-on {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    pointer-events: auto !important;
    overflow: visible !important;
}

/* ── 2. Bottone cerca: contatore filtri e stato "da aggiornare" ── */
.fre-search-btn { position: relative; }
.fre-search-btn[data-count]:not([data-count=""])::after {
    content: attr(data-count);
    position: absolute;
    top: -3px; right: -3px;
    min-width: 19px; height: 19px;
    padding: 0 4px;
    border-radius: 10px;
    background: #BD2E27;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 19px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
/* Filtri cambiati dopo l'ultima ricerca: l'anello segnala che
   il risultato a schermo non è più aggiornato.                  */
.fre-search-btn-dirty {
    animation: fre-btn-ring 1.8s ease-out infinite;
}
@keyframes fre-btn-ring {
    0%   { box-shadow: 0 0 0 0 rgba(158,191,68,.65); }
    70%  { box-shadow: 0 0 0 12px rgba(158,191,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(158,191,68,0); }
}
.fre-bar-pulse { animation: fre-bar-shake .45s ease; }
@keyframes fre-bar-shake {
    0%,100% { transform: translateX(0); }
    25%     { transform: translateX(-5px); }
    75%     { transform: translateX(5px); }
}

/* ── 3. Toast ─────────────────────────────────────────────────── */
.fre-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--fre-bar-h) + 16px);
    transform: translateX(-50%) translateY(14px);
    max-width: min(90vw, 420px);
    padding: 12px 18px;
    border-radius: 12px;
    background: #222;
    color: #fff;
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 8px 26px rgba(0,0,0,.28);
    opacity: 0;
    pointer-events: none;
    z-index: 2147483640;
    transition: opacity .22s ease, transform .22s ease;
}
.fre-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 4. Barra strumenti mobile (ricerca testo + chip) ─────────── */
.fre-mobile-tools { display: none; }

.fre-mob-search {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 13px;
    height: 46px;
    border: 1px solid #e2e2e2;
    border-radius: 23px;
    background: #fff;
}
.fre-mob-search:focus-within {
    border-color: #BD2F27;
    box-shadow: 0 0 0 3px rgba(189,47,39,.10);
}
.fre-mob-search svg { width: 18px; height: 18px; color: #999; flex-shrink: 0; }
.fre-container .fre-mob-search input,
body .fre-container .fre-mob-search input {
    flex: 1;
    min-width: 0;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    font-size: 16px !important;   /* < 16px fa zoomare iOS al focus */
    color: #222 !important;
}
.fre-mob-search input::-webkit-search-cancel-button { display: none; }
.fre-mob-search-clear {
    width: 26px; height: 26px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #eee;
    color: #666;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Chip filtri attivi */
.fre-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}
.fre-chips[hidden] { display: none; }
.fre-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
    padding: 5px 5px 5px 12px;
    border: 1px solid #f0d5d3;
    border-radius: 20px;
    background: #fef5f5;
}
.fre-chip-label {
    font-size: 13px;
    font-weight: 600;
    color: #BD2E27;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fre-chip-x {
    width: 22px; height: 22px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #BD2E27;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.fre-chip-x:active { background: rgba(189,46,39,.14); }

/* ── 5. Bottom sheet: appoggiato sopra la barra, barra sempre viva ──
   La barra filtri NON viene oscurata né disattivata: l'overlay si
   ferma alla sua altezza, così si passa da un pannello all'altro
   toccando direttamente l'altra scheda, senza chiudere prima.      */
.fre-wiz-overlay {
    bottom: var(--fre-bar-h) !important;   /* il velo scuro si ferma sopra la barra */
    z-index: 2147483590 !important;        /* sotto la barra (2147483601) */
}
.fre-wiz-inner {
    /* percentuale dell'overlay, non del viewport: l'overlay ora finisce
       sopra la barra, quindi un valore in dvh sborderebbe in alto. */
    max-height: 92%;
    margin-bottom: 0;
    background: #fff !important;
    will-change: transform;
}
/* Sfondo forzato su tutte le fasce: con i temi che azzerano i
   background sui contenitori il foglio diventava trasparente.   */
.fre-wiz-overlay .fre-wiz-header,
.fre-wiz-overlay .fre-wiz-content,
.fre-wiz-overlay .fre-wiz-footer { background: #fff; }

/* Il footer del foglio è sopra la barra: niente safe-area qui,
   la gestisce già la barra sottostante. */
.fre-wiz-footer { padding-bottom: 14px !important; }

/* Scheda della barra il cui pannello è aperto */
.fre-container .fre-mob-card.fre-mob-card-open,
body .fre-container .fre-mob-card.fre-mob-card-open {
    border-color: #BD2E27 !important;
    background: #fff !important;
    box-shadow: 0 0 0 2px rgba(189,46,39,.18) !important;
}
.fre-container .fre-mob-card.fre-mob-card-open i,
body .fre-container .fre-mob-card.fre-mob-card-open i { color: #BD2E27 !important; }

.fre-wiz-content {
    overscroll-behavior: contain;
    padding-bottom: 4px;
}
.fre-sheet-grip {
    width: 46px;
    height: 5px;
    margin: 10px auto 2px;
    cursor: grab;
}
/* L'header è l'area di presa del gesto: niente selezione testo. */
.fre-wiz-header { touch-action: none; user-select: none; -webkit-user-select: none; }

/* Le opzioni sono <button>: azzero lo stile nativo e alzo il target
   di tocco a 56px, il minimo per non sbagliare riga col pollice.    */
.fre-container .fre-wiz-opt,
.fre-wiz-overlay .fre-wiz-opt {
    width: 100%;
    min-height: 56px;
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid #f5f5f5;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
}
.fre-wiz-overlay .fre-wiz-opt:focus-visible,
.fre-wiz-overlay .fre-wiz-slot:focus-visible,
.fre-wiz-overlay .fre-wiz-date-opt:focus-visible {
    outline: 2px solid #BD2F27;
    outline-offset: -2px;
}
.fre-wiz-opt-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 16px;
    font-weight: 700;
}
.fre-wiz-overlay .fre-wiz-date-opt,
.fre-wiz-overlay .fre-wiz-slot {
    width: 100%;
    text-align: left;
    background: #fff;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    min-height: 52px;
}
.fre-wiz-overlay .fre-wiz-slot { align-items: center; }

/* Campo di filtro città: resta agganciato in alto durante lo scroll */
.fre-wiz-filter {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 6px 16px 12px;
    background: #fff;
    box-shadow: 0 6px 8px -6px rgba(0,0,0,.10);
}
.fre-wiz-overlay .fre-wiz-filter-input {
    width: 100%;
    height: 44px;
    padding: 0 14px !important;
    border: 1px solid #e2e2e2 !important;
    border-radius: 22px !important;
    background: #fafafa !important;
    font-size: 16px !important;
    color: #222 !important;
    outline: none !important;
    box-shadow: none !important;
}
.fre-wiz-overlay .fre-wiz-filter-input:focus {
    border-color: #BD2F27 !important;
    background: #fff !important;
}
.fre-wiz-nomatch {
    padding: 26px 16px;
    text-align: center;
    color: #999;
    font-size: 14px;
}
.fre-wiz-nomatch[hidden] { display: none; }

/* Altezza minima comoda per i bottoni del foglio */
.fre-panel-clear, .fre-panel-apply { min-height: 50px; }

/* ── 6. Mobile: layout, densità, sticky ───────────────────────── */
@media (max-width: 1100px), (hover: none) and (pointer: coarse) {

    /* Barra strumenti visibile e agganciata in alto */
    .fre-container .fre-mobile-tools,
    body .fre-container .fre-mobile-tools {
        display: block !important;
        position: sticky;
        top: 0;
        z-index: 30;
        padding: 10px 0 12px;
        margin-bottom: 4px;
        background: #fff;
    }

    /* Card della barra: target più alti, etichette leggibili */
    .fre-container .fre-mob-card,
    body .fre-container .fre-mob-card {
        min-height: 60px !important;
        padding: 9px 3px !important;
        gap: 4px !important;
        border-radius: 15px !important;
    }
    .fre-container .fre-mob-card i,
    body .fre-container .fre-mob-card i { font-size: 20px !important; }
    .fre-container .fre-mob-card-val,
    body .fre-container .fre-mob-card-val { font-size: 10.5px !important; }

    .fre-container .fre-search-btn,
    body .fre-container .fre-search-btn { min-height: 60px !important; }
    .fre-container .fre-reset-btn.fre-reset-on,
    body .fre-container .fre-reset-btn.fre-reset-on {
        width: 44px !important;
        min-width: 44px !important;
        min-height: 60px !important;
        border-radius: 15px !important;
        background: #f2f2f2 !important;
        border: 1px solid #e0e0e0 !important;
        color: #777 !important;
        margin-right: 6px !important;
    }

    /* Intestazione risultati: colonna, contatore in evidenza */
    .fre-container .fre-results-header,
    body .fre-container .fre-results-header {
        gap: 12px;
        padding-bottom: 12px;
    }
    .fre-container .fre-results-actions,
    body .fre-container .fre-results-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 12px;
    }

    /* Card più compatte: l'immagine 4/3 lasciava entrare poco più
       di un risultato per schermata.                              */
    .fre-container .fre-results-grid,
    body .fre-container .fre-results-grid { gap: 14px !important; }
    .fre-container .fre-card-media,
    body .fre-container .fre-card-media { aspect-ratio: 16 / 10; }
    .fre-container .fre-card-body,
    body .fre-container .fre-card-body { padding: 13px 14px 11px; gap: 6px; }
    .fre-container .fre-card-footer,
    body .fre-container .fre-card-footer { padding-top: 9px; }
    .fre-container .fre-card:hover,
    body .fre-container .fre-card:hover { transform: none; box-shadow: 0 2px 8px rgba(0,0,0,.07); }

    /* Il "Carica altri" finiva a filo della barra fissa */
    .fre-container .fre-load-more-wrap,
    body .fre-container .fre-load-more-wrap { padding-bottom: 12px; }
    .fre-container .fre-load-more-btn,
    body .fre-container .fre-load-more-btn { width: 100%; min-height: 52px; }
}

@media (max-width: 400px) {
    /* Schermi stretti: le quattro etichette non ci stanno più.
       Restano le icone, il valore scelto lo dicono i chip.       */
    .fre-container .fre-mob-card-val,
    body .fre-container .fre-mob-card-val { font-size: 10px !important; }
    .fre-container .fre-mob-cards,
    body .fre-container .fre-mob-cards { gap: 5px !important; }
}

/* ── Calendario su mobile: celle da 44px ──────────────────────────
   Le celle a 36px vanno bene col mouse ma non col pollice: sotto i
   1100px si allargano fino al minimo raccomandato per il tocco.   */
@media (max-width: 1100px), (hover: none) and (pointer: coarse) {
    #fre-wiz-cal .ui-datepicker,
    #fre-calendar .ui-datepicker { padding: 10px 6px; }

    #fre-wiz-cal .ui-datepicker td a,
    #fre-wiz-cal .ui-datepicker td span,
    #fre-calendar .ui-datepicker td a,
    #fre-calendar .ui-datepicker td span {
        width: 42px;
        height: 42px;
        font-size: 15px;
    }
    #fre-wiz-cal .ui-datepicker td,
    #fre-calendar .ui-datepicker td { padding: 1px 0; }

    #fre-wiz-cal .ui-datepicker-title,
    #fre-calendar .ui-datepicker-title { font-size: 16px; }

    #fre-wiz-cal .ui-datepicker .ui-datepicker-prev,
    #fre-wiz-cal .ui-datepicker .ui-datepicker-next,
    #fre-calendar .ui-datepicker .ui-datepicker-prev,
    #fre-calendar .ui-datepicker .ui-datepicker-next {
        width: 40px; height: 40px;
    }

    .fre-cal-hint { font-size: 13.5px; margin-bottom: 10px; }

    /* Su schermi stretti la mezza fascia degli estremi sarebbe
       più stretta del pallino: si allarga il raggio del gradiente. */
    #fre-wiz-cal .ui-datepicker td.fre-range-start {
        background: linear-gradient(to right, transparent 46%, #fbe3e2 46%);
    }
    #fre-wiz-cal .ui-datepicker td.fre-range-end {
        background: linear-gradient(to left, transparent 46%, #fbe3e2 46%);
    }
}

/* ============================================================
   MOBILE — barra filtri e card orizzontali
   ------------------------------------------------------------
   Due interventi: la barra in basso guadagna gerarchia e un
   solo colore d'azione; le card dei risultati passano al
   formato orizzontale, che triplica i risultati per schermata.
   ============================================================ */

@media (max-width: 1100px), (hover: none) and (pointer: coarse) {

    /* ── Barra: profondità ──────────────────────────────────
       Il fondo va sul wrapper, che è l'elemento fisso a tutta
       larghezza. Metterlo su .fre-main-search — che è interno
       e volutamente trasparente — disegnava una seconda barra
       bianca dentro la prima.                                */
    .fre-container .fre-search-wrapper,
    body .fre-container .fre-search-wrapper {
        background: rgba(255,255,255,.88) !important;
        -webkit-backdrop-filter: saturate(180%) blur(14px);
        backdrop-filter: saturate(180%) blur(14px);
        border-top: 1px solid rgba(0,0,0,.07) !important;
        box-shadow: 0 -6px 22px rgba(0,0,0,.09) !important;
    }
    /* L'interno resta trasparente e senza ombra */
    .fre-container .fre-main-search,
    body .fre-container .fre-main-search {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    /* ── Icone delle schede filtro ──────────────────────────
       SVG inline al posto del webfont Tabler, che non veniva
       servito e lasciava le schede senza icona.              */
    .fre-container .fre-mob-card .fre-mob-card-icon,
    body .fre-container .fre-mob-card .fre-mob-card-icon {
        width: 21px !important;
        height: 21px !important;
        flex: 0 0 auto !important;
        color: #6b6862 !important;
        display: block !important;
    }
    .fre-container .fre-mob-card.fre-mob-card-active .fre-mob-card-icon,
    body .fre-container .fre-mob-card.fre-mob-card-active .fre-mob-card-icon {
        color: #BD2F27 !important;
    }

    /* ── Schede filtro: vuoto vs impostato ──────────────────
       Prima erano quattro box identici in grigio chiaro con
       testo #aaa, sotto la soglia di leggibilità. Ora il
       filtro impostato è bianco con bordo rosso e mostra il
       valore in scuro; quello vuoto resta un grigio caldo. */
    .fre-container .fre-mob-card,
    body .fre-container .fre-mob-card {
        background: #f4f2ef !important;
        border: 1px solid #e4e0da !important;
        transition: background .16s ease, border-color .16s ease !important;
    }
    .fre-container .fre-mob-card i,
    body .fre-container .fre-mob-card i { color: #6b6862 !important; }

    .fre-container .fre-mob-card-val,
    body .fre-container .fre-mob-card-val {
        color: #57544f !important;
        font-size: 11.5px !important;
        font-weight: 500 !important;
    }

    .fre-container .fre-mob-card.fre-mob-card-active,
    body .fre-container .fre-mob-card.fre-mob-card-active {
        background: #fff !important;
        border: 1.5px solid #BD2F27 !important;
        /* Il filtro impostato mostra un valore, non un segnaposto:
           gli serve più larghezza degli altri. */
        flex: 1.35 !important;
    }
    .fre-container .fre-mob-card.fre-mob-card-active i,
    body .fre-container .fre-mob-card.fre-mob-card-active i { color: #BD2F27 !important; }
    .fre-container .fre-mob-card.fre-mob-card-active .fre-mob-card-val,
    body .fre-container .fre-mob-card.fre-mob-card-active .fre-mob-card-val {
        color: #1f1f1f !important;
        font-weight: 700 !important;
    }
    .fre-container .fre-mob-card:active,
    body .fre-container .fre-mob-card:active { background: #ebe8e3 !important; }

    /* ── Un solo colore d'azione ────────────────────────────
       Il verde passa alla disponibilità, dove porta un
       significato. Qui resta il rosso del marchio.          */
    .fre-container .fre-search-btn,
    body .fre-container .fre-search-btn {
        background: #BD2F27 !important;
        border-color: #BD2F27 !important;
    }
    .fre-container .fre-search-btn:active,
    body .fre-container .fre-search-btn:active { background: #a5271f !important; }
    .fre-search-btn[data-count]:not([data-count=""])::after {
        background: #1f1f1f;
    }
    .fre-search-btn-dirty { animation: fre-btn-ring-red 1.8s ease-out infinite; }
    @keyframes fre-btn-ring-red {
        0%   { box-shadow: 0 0 0 0 rgba(189,47,39,.55); }
        70%  { box-shadow: 0 0 0 12px rgba(189,47,39,0); }
        100% { box-shadow: 0 0 0 0 rgba(189,47,39,0); }
    }

    /* ── Card risultati in orizzontale ──────────────────────
       Attive solo con .fre-view-compact sulla griglia: senza
       quella classe restano le card verticali classiche.
       L'interruttore è nell'intestazione dei risultati.      */
    .fre-container .fre-results-grid,
    body .fre-container .fre-results-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    .fre-container .fre-view-compact .fre-card,
    body .fre-container .fre-view-compact .fre-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        min-height: 142px;
    }
    .fre-container .fre-view-compact .fre-card-media,
    body .fre-container .fre-view-compact .fre-card-media {
        /* 96px invece di 108: l'occhiello ha bisogno della larghezza */
        flex: 0 0 96px !important;
        width: 96px !important;
        aspect-ratio: auto !important;
        align-self: stretch;
    }
    .fre-container .fre-view-compact .fre-card-body,
    body .fre-container .fre-view-compact .fre-card-body {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 11px 13px 10px !important;
        gap: 4px !important;
        display: flex;
        flex-direction: column;
    }
    .fre-container .fre-view-compact .fre-card-title,
    body .fre-container .fre-view-compact .fre-card-title {
        font-size: 15px !important;
        line-height: 1.26 !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    /* Testo introduttivo: due righe, tagliate col troncamento */
    .fre-container .fre-view-compact .fre-card-excerpt,
    body .fre-container .fre-view-compact .fre-card-excerpt {
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 12px !important;
        line-height: 1.4 !important;
        margin: 0 !important;
    }

    .fre-container .fre-view-compact .fre-card-info,
    body .fre-container .fre-view-compact .fre-card-info {
        gap: 4px 10px !important;
        font-size: 11.5px !important;
    }
    .fre-container .fre-view-compact .fre-card-footer,
    body .fre-container .fre-view-compact .fre-card-footer {
        margin-top: auto !important;
        padding-top: 7px !important;
        border-top: none !important;
    }
    .fre-container .fre-badge,
    body .fre-container .fre-badge { font-size: 9.5px !important; padding: 3px 7px !important; }
    .fre-container .fre-view-compact .fre-card-subtype,
    body .fre-container .fre-view-compact .fre-card-subtype { display: none !important; }

    /* Esaurito o terminato: si capisce a colpo d'occhio cosa saltare */
    .fre-container .fre-card[data-disp="none"] .fre-card-media,
    .fre-container .fre-card[data-disp="ended"] .fre-card-media,
    body .fre-container .fre-card[data-disp="none"] .fre-card-media,
    body .fre-container .fre-card[data-disp="ended"] .fre-card-media {
        filter: saturate(.35);
        opacity: .72;
    }
    .fre-container .fre-card[data-disp="none"] .fre-card-title,
    .fre-container .fre-card[data-disp="ended"] .fre-card-title,
    body .fre-container .fre-card[data-disp="none"] .fre-card-title,
    body .fre-container .fre-card[data-disp="ended"] .fre-card-title { color: #6e6e6e !important; }
}

/* ── Calendario: via l'arancione dei weekend ─────────────────
   Adesso che l'intervallo è una fascia rossa continua, un
   secondo colore su sabati e domeniche la disturba.         */
#fre-calendar .ui-datepicker td.fre-weekend a,
#fre-wiz-cal .ui-datepicker td.fre-weekend a { color: #2b2b2b; font-weight: 700; }
#fre-calendar .ui-datepicker td.fre-range-start a,
#fre-calendar .ui-datepicker td.fre-range-end a,
#fre-wiz-cal .ui-datepicker td.fre-range-start a,
#fre-wiz-cal .ui-datepicker td.fre-range-end a { color: #fff; }

/* ── Interruttore vista compatta / classica ────────────────── */
.fre-view-switch {
    display: none;                 /* solo mobile: su desktop la griglia è a colonne */
    align-items: center;
    gap: 6px;
    padding: 6px 11px 6px 9px;
    border: 1px solid #e0dcd6;
    border-radius: 18px;
    background: #f4f2ef;
    color: #57544f;
    font-family: 'Lato', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.fre-view-switch svg { width: 16px; height: 16px; flex: 0 0 auto; }
.fre-view-switch:active { background: #ebe8e3; }

/* Si mostra l'icona della vista in cui si passerebbe, non di quella attuale */
.fre-view-switch .fre-view-ico-cards   { display: none; }
body.fre-view-is-cards .fre-view-switch .fre-view-ico-cards   { display: block; }
body.fre-view-is-cards .fre-view-switch .fre-view-ico-compact { display: none; }

@media (max-width: 1100px), (hover: none) and (pointer: coarse) {
    .fre-container .fre-view-switch,
    body .fre-container .fre-view-switch { display: inline-flex !important; }

    /* Una riga sola: i tre comandi si stringono invece di andare a capo */
    .fre-container .fre-results-actions,
    body .fre-container .fre-results-actions {
        flex-wrap: nowrap !important;
        gap: 8px !important;
        width: 100%;
        justify-content: space-between !important;
    }
    .fre-container .fre-results-actions > *,
    body .fre-container .fre-results-actions > * { white-space: nowrap !important; }

    .fre-container .fre-view-switch,
    body .fre-container .fre-view-switch {
        font-size: 12px !important;
        padding: 5px 10px 5px 8px !important;
        gap: 5px !important;
        flex: 0 0 auto !important;
    }
    .fre-container .fre-view-switch svg,
    body .fre-container .fre-view-switch svg { width: 15px !important; height: 15px !important; }

    .fre-container .fre-toggle-wrap,
    body .fre-container .fre-toggle-wrap { gap: 7px !important; flex: 0 0 auto !important; }
    .fre-container .fre-toggle-label,
    body .fre-container .fre-toggle-label { font-size: 12px !important; }

    .fre-container .fre-clear-link,
    body .fre-container .fre-clear-link {
        font-size: 12px !important;
        padding: 5px 11px !important;
        flex: 0 0 auto !important;
    }
}
