/**
 * CF7 Booking Manager – Public CSS
 * Stili per il datepicker e feedback disponibilità.
 */

/* ── Campo data ────────────────────────────────────────────── */
input.cf7bm-date {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px !important;
}

input.cf7bm-date:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* ── Availability info ─────────────────────────────────────── */
.cf7bm-availability-info {
    display: block;
    font-size: 13px;
    margin-top: 6px;
    min-height: 20px;
    transition: color .2s;
}
.cf7bm-info-loading { color: #999; font-style: italic; }
.cf7bm-info-ok      { color: #2e7d32; font-weight: 600; }
.cf7bm-info-warn    { color: #e65100; font-weight: 600; }
.cf7bm-info-error   { color: #d63638; font-weight: 600; }

/* ── Flatpickr day coloring ────────────────────────────────── */

/* Griglia stile tabella: linee di intersezione tra le celle */
.flatpickr-days,
.flatpickr-weekdaycontainer,
.flatpickr-weekdays {
    width: 100%;
}
.dayContainer {
    border-top: 1px solid #e6e6e6;
    border-left: 1px solid #e6e6e6;
}
.flatpickr-day {
    border-radius: 0 !important;
    border-right: 1px solid #e6e6e6;
    border-bottom: 1px solid #e6e6e6;
    position: relative;
}
/* Righello dei giorni della settimana allineato alla griglia */
.flatpickr-weekday {
    border-right: 1px solid #e6e6e6;
    color: #fff !important;
    font-weight: 600;
    opacity: 1 !important;
    background: #1f2937 !important;
}
.flatpickr-weekdays {
    border-left: 1px solid #e6e6e6;
    background: #1f2937 !important;
}

/* Stati giorno: sfondo diretto sulla cella per contrasto stabile */
.cf7bm-day-closed,
.cf7bm-day-full,
.cf7bm-day-almost,
.cf7bm-day-partial {
    font-weight: 600;
}

/* Giorni chiusi (chiusure/festività) → rosso */
.cf7bm-day-closed {
    background: #8a1f1f !important;
    color: #fff !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}
.cf7bm-day-closed:hover  { background: #6f1818 !important; }

/* Giorni pieni (overbooking) → rosso chiaro + testo sbarrato */
.cf7bm-day-full {
    background: #b42318 !important;
    color: #fff !important;
    text-decoration: line-through;
    cursor: not-allowed !important;
    opacity: 1 !important;
}
.cf7bm-day-full:hover    { background: #8f1b13 !important; }

/* Giorni quasi pieni (≥70%) → arancione */
.cf7bm-day-almost {
    background: #fff3e0 !important;
    border: 1px solid #c56a00 !important;
    color: #7a2e00 !important;
}
.cf7bm-day-almost:hover  { background: #ffe0b2 !important; }

/* Giorni con prenotazioni parziali → verde leggero */
.cf7bm-day-partial {
    background: #e8f5e9 !important;
    color: #1f4d2b !important;
}
.cf7bm-day-partial:hover { background: #d8ecd9 !important; }

/* ── Flatpickr override ────────────────────────────────────── */
.flatpickr-calendar {
    box-shadow: 0 4px 20px rgba(0,0,0,.15) !important;
    border-radius: 8px !important;
    border: 1px solid #e0e0e0 !important;
}
/* Evita che gli stili globali del tema deformino la select del mese */
.flatpickr-calendar .flatpickr-current-month .flatpickr-monthDropdown-months {
    width: auto !important;
    margin: 0 !important;
    padding: 0 20px 0 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
}
.flatpickr-calendar .flatpickr-months {
    margin-bottom: 4px !important;
}
/* Giorno selezionato: badge quadrato interno blu */
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: #2271b1 !important;
    border-color: #e6e6e6 !important;
    color: #fff !important;
}
/* Hover generico solo sui giorni "normali": non tocca i giorni colorati
   (chiusi/pieni/quasi-pieni/parziali) così il numero resta sempre leggibile */
.flatpickr-day:not(.cf7bm-day-closed):not(.cf7bm-day-full):not(.cf7bm-day-almost):not(.cf7bm-day-partial):not(.selected):hover {
    background: #e3f2fd !important;
}
/* I giorni disabled di flatpickr che hanno anche la nostra classe restano rossi */
.flatpickr-day.flatpickr-disabled {
    color: #595959 !important;
    opacity: 1 !important;
    background: #f1f3f5 !important;
    border-color: #d0d5db !important;
    font-weight: 600 !important;
}
.flatpickr-day.flatpickr-disabled.cf7bm-day-closed,
.flatpickr-day.flatpickr-disabled.cf7bm-day-full {
    color: #fff !important;
    opacity: 1 !important;
}
.flatpickr-day.flatpickr-disabled.cf7bm-day-closed {
    background: #8a1f1f !important;
    border-color: #d0d5db !important;
}
.flatpickr-day.flatpickr-disabled.cf7bm-day-full {
    background: #b42318 !important;
    border-color: #d0d5db !important;
}
.flatpickr-day.flatpickr-disabled.cf7bm-day-full {
    text-decoration: line-through;
}

.cf7bm-view-inline .flatpickr-day.prevMonthDay:not(.cf7bm-day-closed):not(.cf7bm-day-full),
.cf7bm-view-inline .flatpickr-day.nextMonthDay:not(.cf7bm-day-closed):not(.cf7bm-day-full) {
    color: #595959 !important;
    opacity: 1 !important;
    background: #f1f3f5 !important;
    border-color: #d0d5db !important;
}

.cf7bm-view-inline .flatpickr-calendar.inline .flatpickr-day.flatpickr-disabled:not(.cf7bm-day-closed):not(.cf7bm-day-full) {
    color: #595959 !important;
    opacity: 1 !important;
    background: #f1f3f5 !important;
    border-color: #d0d5db !important;
}

/* ── Multi-step form ───────────────────────────────────────── */
.cf7bm-form {
    max-width: 640px;
    margin: 0 auto;
}
.cf7bm-progress {
    list-style: none;
    display: flex;
    gap: .5rem;
    margin: 0 0 1.5rem;
    padding: 0;
}
.cf7bm-progress li {
    flex: 1;
    font-size: .82rem;
    font-weight: 600;
    color: #4b5563;
    text-align: center;
    padding: .5rem .25rem;
    border-bottom: 3px solid #cfd6dd;
}
.cf7bm-progress li span {
    display: inline-flex;
    width: 1.4rem;
    height: 1.4rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #5b6673;
    color: #fff;
    margin-right: .3rem;
    font-size: .8rem;
}
.cf7bm-progress li.is-active {
    color: #0066cc;
    border-bottom-color: #0066cc;
}
.cf7bm-progress li.is-active span {
    background: #0066cc;
}
.cf7bm-progress li.is-done {
    color: #2e7d32;
    border-bottom-color: #2e7d32;
}
.cf7bm-progress li.is-done span {
    background: #2e7d32;
}
.cf7bm-step {
    display: none;
    margin: 0 0 1rem;
}
.cf7bm-step.is-active {
    display: block;
}
.cf7bm-step-title {
    margin: .25rem 0;
}
.cf7bm-step-desc {
    color: #5a6b7b;
    margin: .25rem 0 1rem;
}
.cf7bm-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1.25rem;
}
.cf7bm-btn,
.cf7bm-actions input[type=submit] {
    background: #0066cc;
    color: #fff;
    border: 0;
    padding: .65rem 1.4rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
}
.cf7bm-btn:hover,
.cf7bm-actions input[type=submit]:hover {
    background: #0055aa;
}
.cf7bm-ghost {
    background: #eef1f4;
    color: #33475b;
}
.cf7bm-ghost:hover {
    background: #e0e5ea;
}
.cf7bm-prev {
    margin-right: auto;
}
.cf7bm-recap-table {
    width: 100%;
    border-collapse: collapse;
    margin: .5rem 0 1rem;
}
.cf7bm-recap-table th,
.cf7bm-recap-table td {
    text-align: left;
    padding: .6rem .8rem;
    border-bottom: 1px solid #e6e9ec;
    vertical-align: top;
}
.cf7bm-recap-table th {
    width: 35%;
    color: #5a6b7b;
    font-weight: 600;
}
.cf7bm-invalid {
    outline: 2px solid #d32f2f !important;
    outline-offset: 1px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
    input.cf7bm-date {
        width: 100%;
        box-sizing: border-box;
    }
}

/* ── Legenda colori ────────────────────────────────────────── */
.cf7bm-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    margin-top: 12px;
    padding: 10px 12px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 13px;
    color: #444;
}
.cf7bm-legend-title {
    font-weight: 700;
    color: #1d2327;
}
.cf7bm-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cf7bm-legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #ccc;
    flex-shrink: 0;
}
.cf7bm-legend-free    { background: #fff; }
.cf7bm-legend-partial { background: #e8f5e9; border-color: #a5d6a7; }
.cf7bm-legend-almost  { background: #fff3e0; border-color: #ff9800; }
.cf7bm-legend-full    { background: #ef5350; border-color: #ef5350; }
.cf7bm-legend-closed  { background: #8a1f1f; border-color: #8a1f1f; }

/* ═══════════════════════════════════════════════════════════
   FORM LAYOUT – Stile Booking Form
   ═══════════════════════════════════════════════════════════ */
.cf7bm-booking-form {
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 32px 36px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.cf7bm-booking-form h3 {
    margin: 0 0 20px;
    font-size: 20px;
    font-weight: 700;
    color: #1d2327;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}
.cf7bm-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 28px 0 8px;
}

/* ── Griglia campi ──────────────────────────────────────────── */
.cf7bm-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
}
.cf7bm-form-col {
    flex: 1;
    min-width: 0;
}
.cf7bm-form-full {
    flex-direction: column;
}

/* ── Labels ─────────────────────────────────────────────────── */
.cf7bm-booking-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}
.cf7bm-booking-form .required {
    color: #d63638;
    font-weight: 700;
}

/* ── Campi input ────────────────────────────────────────────── */
.cf7bm-booking-form input[type="text"],
.cf7bm-booking-form input[type="email"],
.cf7bm-booking-form input[type="tel"],
.cf7bm-booking-form input[type="url"],
.cf7bm-booking-form input[type="date"],
.cf7bm-booking-form select,
.cf7bm-booking-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    color: #333;
    background: #fafafa;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
    margin-top: 4px;
}
.cf7bm-booking-form input:focus,
.cf7bm-booking-form select:focus,
.cf7bm-booking-form textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,.15);
    background: #fff;
    outline: none;
}
.cf7bm-booking-form textarea {
    min-height: 90px;
    resize: vertical;
}
.cf7bm-booking-form select {
    appearance: auto;
    cursor: pointer;
}

/* ── Privacy ────────────────────────────────────────────────── */
.cf7bm-privacy {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 8px;
}
.cf7bm-privacy label {
    font-weight: 400;
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.cf7bm-privacy input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}
.cf7bm-privacy a {
    color: #2271b1;
    text-decoration: underline;
}

/* ── Bottone submit ─────────────────────────────────────────── */
.cf7bm-form-actions {
    text-align: center;
    margin-top: 24px;
}
.cf7bm-submit-btn,
.cf7bm-booking-form input[type="submit"] {
    display: inline-block;
    background: #2271b1;
    color: #fff !important;
    border: none;
    padding: 14px 48px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    letter-spacing: .3px;
}
.cf7bm-submit-btn:hover,
.cf7bm-booking-form input[type="submit"]:hover {
    background: #135e96;
    transform: translateY(-1px);
}
.cf7bm-submit-btn:active,
.cf7bm-booking-form input[type="submit"]:active {
    transform: translateY(0);
}

/* ── Messaggi CF7 ───────────────────────────────────────────── */
.cf7bm-booking-form .wpcf7-response-output {
    border-radius: 8px !important;
    padding: 14px 20px !important;
    font-size: 15px;
    margin: 20px 0 0 !important;
}
.cf7bm-booking-form .wpcf7-not-valid-tip {
    color: #d63638;
    font-size: 12px;
    margin-top: 4px;
}
.cf7bm-booking-form .wpcf7-not-valid {
    border-color: #d63638 !important;
}

/* FORM MULTI-STEP: Errori CF7 su tutti i campi invalidi */
.cf7bm-form input.wpcf7-not-valid,
.cf7bm-form textarea.wpcf7-not-valid,
.cf7bm-form select.wpcf7-not-valid {
    border: 2px solid #d63638 !important;
}
.cf7bm-form .wpcf7-not-valid-tip {
    color: #d63638 !important;
    font-size: 12px;
    margin-top: 4px;
}
.cf7bm-form .wpcf7-form-control-wrap.wpcf7-not-valid input,
.cf7bm-form .wpcf7-form-control-wrap.wpcf7-not-valid textarea,
.cf7bm-form .wpcf7-form-control-wrap.wpcf7-not-valid select {
    border: 2px solid #d63638 !important;
}

/* Generico per tutti i form CF7 */
.wpcf7-form .wpcf7-not-valid {
    border-color: #d63638 !important;
    border-width: 2px !important;
}
.wpcf7-form .wpcf7-not-valid-tip {
    color: #d63638;
    font-size: 12px;
    margin-top: 4px;
}

/* Stile per la classe cf7bm-invalid (aggiunta dal tema) */
.cf7bm-form input.cf7bm-invalid,
.cf7bm-form textarea.cf7bm-invalid,
.cf7bm-form select.cf7bm-invalid {
    border: 2px solid #d63638 !important;
}
.cf7bm-form input.cf7bm-invalid:focus,
.cf7bm-form textarea.cf7bm-invalid:focus,
.cf7bm-form select.cf7bm-invalid:focus {
    border: 2px solid #d63638 !important;
    box-shadow: 0 0 0 0.2rem rgba(214, 54, 56, 0.25) !important;
}
.cf7bm-form .cf7bm-invalid {
    border-color: #d63638 !important;
}

/* Captcha matematico */
.dbi-captcha-question {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

/* Input del captcha */
.cf7bm-captcha-input {
    display: block !important;
    width: 100% !important;
    margin-bottom: 8px !important;
    max-width: none !important;
    box-sizing: border-box;
}

/* Rimuovi width eccessivo da CF7 */
input.cf7bm-captcha-input[size] {
    width: 100% !important;
}

/* Messaggio di errore del captcha */
.cf7bm-captcha-input + .wpcf7-not-valid-tip {
    display: block;
    margin-top: 6px;
    margin-bottom: 12px;
}

/* Paragrafo del captcha - spazio per il messaggio di errore */
.cf7bm-step p:has([name="captcha-math"]) {
    margin-bottom: 20px;
}

/* Pulsanti azioni - clearfix per errori */
.cf7bm-actions {
    clear: both;
    margin-top: 20px;
}

/* ── Spinner invio ──────────────────────────────────────────── */
.cf7bm-booking-form .wpcf7-spinner {
    margin-top: 12px;
}

/* ── Responsive form ────────────────────────────────────────── */
@media (max-width: 600px) {
    .cf7bm-booking-form {
        padding: 20px 18px;
        border-radius: 8px;
    }
    .cf7bm-form-row {
        flex-direction: column;
        gap: 0;
    }
    .cf7bm-form-col {
        margin-bottom: 14px;
    }
    .cf7bm-submit-btn,
    .cf7bm-booking-form input[type="submit"] {
        width: 100%;
        padding: 14px;
    }
}

/* ═══════════════════════════════════════════════════════════
   EVENTO – Info + Sezione Prenotazione
   ═══════════════════════════════════════════════════════════ */
.cf7bm-event-info {
    background: #f0f6fc;
    border: 1px solid #c3d8ed;
    border-left: 4px solid #2271b1;
    border-radius: 8px;
    padding: 20px 24px;
    margin: 24px 0;
}
.cf7bm-event-info ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cf7bm-event-info li {
    padding: 6px 0;
    font-size: 15px;
    color: #333;
}
.cf7bm-event-info li strong {
    color: #1d2327;
}

.cf7bm-event-booking-section {
    margin: 32px 0;
    padding: 28px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.cf7bm-event-booking-section > h3 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
}

.cf7bm-remaining-spots {
    font-size: 15px;
    font-weight: 600;
    color: #2271b1;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: #e8f5e9;
    border-radius: 6px;
    display: inline-block;
}

.cf7bm-event-full {
    background: #fce4ec;
    border: 1px solid #ef9a9a;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    margin: 24px 0;
}
.cf7bm-event-full p {
    font-size: 16px;
    font-weight: 600;
    color: #c62828;
    margin: 0;
}
/* ── Fasce orarie (time slots) ─────────────────────────────── */
.cf7bm-slots {
    margin-top: 10px;
}
.cf7bm-slot-label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}
.cf7bm-slot-select {
    min-width: 240px;
    padding: 6px 8px;
}
.cf7bm-slot-select option:disabled {
    color: #b71c1c;
}

/* ═══════════════════════════════════════════════════════════
   VISTA CALENDARIO ESTESO (inline) – [booking_date view:inline]
   ═══════════════════════════════════════════════════════════ */

/* Nascondi il campo di testo: il calendario è sempre visibile */
.cf7bm-view-inline input.cf7bm-date {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Calendario flatpickr esteso più grande e centrato */
.cf7bm-view-inline .flatpickr-calendar.inline {
    margin: 4px auto 0;
    box-shadow: 0 2px 12px rgba(0,0,0,.08) !important;
}
.cf7bm-view-inline .flatpickr-calendar.inline,
.cf7bm-view-inline .flatpickr-days,
.cf7bm-view-inline .flatpickr-rContainer,
.cf7bm-view-inline .flatpickr-days .dayContainer {
    width: 100% !important;
    max-width: 460px;
}
.cf7bm-view-inline .flatpickr-day {
    max-width: none;
    height: 44px;
    line-height: 44px;
    font-size: 15px;
}
/* Badge colorati proporzionati alle celle più grandi della vista estesa */
.cf7bm-view-inline .cf7bm-day-closed::before,
.cf7bm-view-inline .cf7bm-day-full::before,
.cf7bm-view-inline .cf7bm-day-almost::before,
.cf7bm-view-inline .cf7bm-day-partial::before,
.cf7bm-view-inline .flatpickr-day.selected::before {
    inset: 5px;
    border-radius: 8px;
}

/* ── Griglia fasce orarie (pulsanti) ───────────────────────── */
.cf7bm-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 6px;
}
.cf7bm-slot-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 8px;
    border: 1px solid #c3d8ed;
    border-radius: 8px;
    background: #f0f6fc;
    color: #1d2327;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
.cf7bm-slot-btn:hover {
    background: #e3f2fd;
    border-color: #2271b1;
}
.cf7bm-slot-btn.is-selected {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}
.cf7bm-slot-btn.is-full {
    background: #fce4ec;
    border-color: #ef9a9a;
    color: #c62828;
    cursor: not-allowed;
    opacity: .8;
    text-decoration: line-through;
}
.cf7bm-slot-time {
    font-weight: 700;
    font-size: 15px;
}
.cf7bm-slot-meta {
    font-size: 12px;
    opacity: .85;
}
