/**
 * Event Booking Pro - Frontend Calendar Styles
 *
 * @package EventBookingPro
 */

/* ===================================
   CSS VARIABLES (override from settings)
   =================================== */
:root {
    /* Brand colors — luxury warm (allineato al tema admin) */
    --ebp-primary: #ED8936;        /* warm orange */
    --ebp-primary-soft: #FFEDCC;   /* crema */
    --ebp-primary-dark: #C2570F;   /* dark orange (hover) */
    --ebp-secondary: #4A5568;
    --ebp-accent: #ED8936;
    --ebp-button: #ED8936;
    --ebp-button-hover: #DD7322;
    /* Status colors */
    --ebp-available: #38A169;
    --ebp-partial: #ED8936;
    --ebp-full: #E53E3E;
    --ebp-blocked: #A0AEC0;
    /* Surface colors */
    --ebp-text: #1A202C;
    --ebp-text-light: #4A5568;
    --ebp-border: #E2E8F0;
    --ebp-background: #FFFFFF;
    --ebp-background-alt: #F7FAFC;
    /* Header giorni settimana (Lun Mar Mer ...) */
    --ebp-dow-color: #4A5568;
    --ebp-dow-bg: transparent;
    /* Shape */
    --ebp-radius: 10px;
    --ebp-radius-sm: 6px;
    --ebp-radius-lg: 16px;
    --ebp-max-width: 1000px;
    /* Typography */
    --ebp-font: inherit;
    --ebp-font-heading: inherit;
    --ebp-font-size-base: 15px;
    --ebp-font-size-sm: 13px;
    --ebp-font-size-lg: 18px;
    /* Spacing */
    --ebp-space-1: 4px;
    --ebp-space-2: 8px;
    --ebp-space-3: 12px;
    --ebp-space-4: 16px;
    --ebp-space-6: 24px;
    --ebp-space-8: 32px;
    /* Shadow */
    --ebp-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
    --ebp-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --ebp-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.10);
    --ebp-card-shadow: 0 20px 60px rgba(0, 0, 0, 0.20), 0 8px 20px rgba(0, 0, 0, 0.12);
    /* Spacing applicabili (settate dal widget control) */
    --ebp-calendar-gap: 8px;
    --ebp-slot-padding: 14px;
    /* Animation */
    --ebp-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   WRAPPER
   =================================== */
.ebp-booking-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: var(--ebp-font);
    font-size: var(--ebp-font-size-base);
    color: var(--ebp-text);
    position: relative;
    box-sizing: border-box;
}

/* --ebp-max-width: si applica al contenuto interno (calendario/card/lista),
   centrato. Il wrapper esterno occupa tutto lo spazio disponibile (100%)
   per integrarsi con qualsiasi container Elementor. */
.ebp-booking-wrapper .ebp-calendar-section,
.ebp-booking-wrapper .ebp-card,
.ebp-booking-wrapper .ebp-split-container,
.ebp-booking-wrapper .ebp-strip-wrapper,
.ebp-booking-wrapper .ebp-strip-slots,
.ebp-booking-wrapper .ebp-agenda,
.ebp-booking-wrapper .ebp-popover-field,
.ebp-booking-wrapper .ebp-inline-slots,
.ebp-booking-wrapper .ebp-inline-form,
.ebp-booking-wrapper .ebp-event-header,
.ebp-booking-wrapper .ebp-editorial-hero,
.ebp-booking-wrapper .ebp-next-available-banner,
.ebp-booking-wrapper .ebp-agenda-controls {
    max-width: var(--ebp-max-width);
    margin-left: auto;
    margin-right: auto;
}

.ebp-booking-wrapper *,
.ebp-booking-wrapper *::before,
.ebp-booking-wrapper *::after {
    box-sizing: border-box;
}

/* ===================================
   EVENT HEADER
   =================================== */
.ebp-event-header {
    margin-bottom: 30px;
    text-align: center;
}

.ebp-event-title {
    font-size: 2em;
    font-weight: 700;
    color: var(--ebp-text);
    margin: 0 0 15px 0;
}

.ebp-event-description {
    font-size: 1.1em;
    color: var(--ebp-text-light);
    line-height: 1.6;
}

/* ===================================
   CALENDAR SECTION
   =================================== */
.ebp-calendar-section {
    background: var(--ebp-background);
    border: 1px solid var(--ebp-border);
    border-radius: var(--ebp-radius);
    padding: 20px;
    box-shadow: var(--ebp-shadow);
}

.ebp-calendar-header h3 {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    color: var(--ebp-text);
}

/* ===================================
   FULLCALENDAR OVERRIDES
   =================================== */
.ebp-calendar .fc {
    font-family: var(--ebp-font);
}

/* Specificity boostata via .ebp-booking-wrapper per battere FullCalendar
   senza usare !important — così Elementor/Divi/temi custom possono sempre overridare */
.ebp-booking-wrapper .ebp-calendar .fc-toolbar-title {
    font-size: 1.4em;
    text-transform: capitalize;
}

/* Bridge var FullCalendar 6.x: collego le sue var interne alle nostre.
   Permette ai control widget di stilare frecce nav + bottone Oggi senza
   battere CSS rules (FC le legge dalle proprie var, non da regole override). */
.ebp-booking-wrapper .ebp-calendar {
    --fc-button-bg-color:           var(--ebp-nav-button-bg, var(--ebp-primary));
    --fc-button-border-color:       var(--ebp-nav-button-bg, var(--ebp-primary));
    --fc-button-text-color:         var(--ebp-nav-button-text, #fff);
    --fc-button-hover-bg-color:     var(--ebp-nav-button-hover, var(--ebp-button-hover));
    --fc-button-hover-border-color: var(--ebp-nav-button-hover, var(--ebp-button-hover));
    --fc-button-active-bg-color:    var(--ebp-nav-button-hover, var(--ebp-button-hover));
    --fc-button-active-border-color: var(--ebp-nav-button-hover, var(--ebp-button-hover));
}

.ebp-booking-wrapper .ebp-calendar .fc .fc-button-primary {
    background: var(--ebp-nav-button-bg, var(--ebp-primary));
    border-color: var(--ebp-nav-button-bg, var(--ebp-primary));
    color: var(--ebp-nav-button-text, #fff);
    border-radius: var(--ebp-radius-sm);
    transition: background var(--ebp-transition);
}

.ebp-booking-wrapper .ebp-calendar .fc .fc-button-primary:hover,
.ebp-booking-wrapper .ebp-calendar .fc .fc-button-primary:not(:disabled):active,
.ebp-booking-wrapper .ebp-calendar .fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--ebp-nav-button-hover, var(--ebp-button-hover));
    border-color: var(--ebp-nav-button-hover, var(--ebp-button-hover));
    color: var(--ebp-nav-button-text, #fff);
}

.ebp-booking-wrapper .ebp-calendar .fc .fc-button-primary:focus {
    box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.25);
}

.ebp-booking-wrapper .ebp-calendar .fc-daygrid-day-number {
    font-weight: 600;
    color: var(--ebp-text);
}

/* Header giorni settimana FullCalendar (Lun Mar Mer ...) — control widget dow_*_color */
.ebp-booking-wrapper .ebp-calendar .fc-col-header-cell {
    background: var(--ebp-dow-bg);
}

.ebp-booking-wrapper .ebp-calendar .fc-col-header-cell-cushion {
    color: var(--ebp-dow-color);
    text-decoration: none;
}

.ebp-booking-wrapper .ebp-calendar .fc .fc-day-today {
    background: var(--ebp-background-alt);
}

.ebp-calendar .fc-daygrid-day-events {
    margin-top: 2px;
}

/* ===================================
   SLOT EVENT STYLING
   =================================== */
.ebp-slot-event {
    padding: calc(var(--ebp-slot-padding) / 3) calc(var(--ebp-slot-padding) / 1.75);
    border-radius: calc(var(--ebp-radius) / 2);
    cursor: pointer;
    transition: transform var(--ebp-transition), box-shadow var(--ebp-transition);
    font-size: 0.85em;
    text-align: center;
    margin: 1px 2px;
}

/* Slot bloccato (status='blocked' lato server) */
.ebp-slot-event.blocked,
.fc-event.blocked {
    background: var(--ebp-blocked);
    color: var(--ebp-button-text, #fff);
    cursor: not-allowed;
    opacity: 0.7;
}

.ebp-slot-event:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ebp-slot-event:focus {
    outline: 2px solid var(--ebp-primary);
    outline-offset: 2px;
}

.ebp-slot-event.available {
    background: var(--ebp-available);
    color: var(--ebp-button-text, #fff);
}

.ebp-slot-event.partial {
    background: var(--ebp-partial);
    color: #333;
}

.ebp-slot-event.full {
    background: var(--ebp-full);
    color: var(--ebp-button-text, #fff);
    cursor: not-allowed;
    opacity: 0.7;
}

.ebp-slot-event .slot-time {
    font-weight: 600;
}

.ebp-slot-event .slot-status {
    font-size: 0.9em;
    opacity: 0.9;
}

/* ===================================
   LEGEND
   =================================== */
.ebp-calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--ebp-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: var(--ebp-text-light);
}

.legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-item .dot.available { background: var(--ebp-available); }
.legend-item .dot.partial { background: var(--ebp-partial); }
.legend-item .dot.full { background: var(--ebp-full); }

/* ===================================
   BOOKING PANEL
   =================================== */
/* ===================================
   MODAL — overlay centered
   =================================== */
.ebp-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ebp-modal[aria-hidden="false"] {
    display: flex;
    opacity: 1;
}

.ebp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--ebp-modal-backdrop, rgba(15, 23, 42, 0.55));
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.ebp-modal-content {
    position: relative;
    background: var(--ebp-background);
    border-radius: var(--ebp-radius);
    box-shadow: var(--ebp-card-shadow, 0 20px 60px rgba(0, 0, 0, 0.25), 0 8px 20px rgba(0, 0, 0, 0.15));
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    overflow: hidden auto;
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.ebp-modal[aria-hidden="false"] .ebp-modal-content {
    transform: scale(1);
}

@media (max-width: 640px) {
    .ebp-modal {
        padding: 0;
    }
    .ebp-modal-content {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    /* Mobile bottom-sheet: opt-in via data-ebp-mobile-sheet="yes".
       Foglio che sale dal basso, stile iOS/Android nativo. */
    .ebp-modal[data-ebp-mobile-sheet="yes"] {
        align-items: flex-end;
    }
    .ebp-modal[data-ebp-mobile-sheet="yes"] .ebp-modal-content {
        max-height: 92vh;
        height: auto;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
    }
    .ebp-modal[data-ebp-mobile-sheet="yes"][aria-hidden="false"] .ebp-modal-content {
        transform: translateY(0);
    }
    .ebp-modal[data-ebp-mobile-sheet="yes"] .ebp-modal-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: var(--ebp-border, #CBD5E0);
        border-radius: 999px;
        margin: 8px auto 0;
    }
}

/* Handle drag visivo nascosto su desktop, mostrato solo in modalita bottom-sheet mobile */
.ebp-modal-handle {
    display: none;
}

/* ===================================
   AUTO-SUGGEST BANNER (prossimo slot disponibile)
   Mostrato sopra il calendario in tutti i layout quando data-ebp-auto-suggest="yes".
   =================================== */
.ebp-next-available-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin: 0 0 16px;
    background: linear-gradient(135deg, var(--ebp-primary-soft, #FFF3E6) 0%, var(--ebp-background-alt, #F7FAFC) 100%);
    border: 1px solid var(--ebp-primary, #ED8936);
    border-radius: var(--ebp-radius, 10px);
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.10);
}

.ebp-next-available-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ebp-primary, #ED8936);
    color: var(--ebp-button-text, #fff);
    border-radius: 50%;
}

.ebp-next-available-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 14px;
    color: var(--ebp-text, #1A202C);
}

.ebp-next-available-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ebp-text-light, #4A5568);
    font-weight: 600;
}

.ebp-next-available-when {
    font-size: 16px;
    font-weight: 700;
}

.ebp-next-available-seats {
    font-size: 13px;
    color: var(--ebp-text-light, #4A5568);
}

.ebp-next-available-cta {
    flex: 0 0 auto;
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 999px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .ebp-next-available-banner {
        flex-wrap: wrap;
    }
    .ebp-next-available-cta {
        flex: 1 1 100%;
        margin-top: 4px;
    }
}

/* legacy class — non piu' usata, ma mantenuta per safety */
.ebp-booking-panel {
    background: var(--ebp-background);
}

.ebp-panel-header {
    background: var(--ebp-primary-soft); /* crema soft */
    color: var(--ebp-text);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--ebp-primary-dark);
}

.ebp-panel-header h3 {
    margin: 0;
    font-size: 1.2em;
    color: var(--ebp-text);
}

.ebp-panel-close {
    background: none;
    border: none;
    color: var(--ebp-text);
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity var(--ebp-transition);
}

.ebp-panel-close:hover {
    opacity: 1;
}

.ebp-panel-content {
    padding: 25px;
}

/* ===================================
   SELECTED SLOT
   =================================== */
.ebp-selected-slot {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--ebp-background-alt);
    border-radius: var(--ebp-radius);
    margin-bottom: 20px;
}

.ebp-slot-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ebp-accent);
    flex-shrink: 0;
}

.ebp-slot-icon svg {
    width: 32px;
    height: 32px;
}

.ebp-slot-details {
    flex: 1;
}

.ebp-slot-date {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--ebp-text);
    text-transform: capitalize;
}

.ebp-slot-time {
    color: var(--ebp-primary);
    font-weight: 500;
}

/* ===================================
   AVAILABILITY INFO
   =================================== */
.ebp-availability-info {
    text-align: center;
    margin-bottom: 20px;
}

.ebp-available-count {
    font-size: 2em;
    font-weight: 700;
    color: var(--ebp-available);
}

.ebp-available-label {
    display: block;
    color: var(--ebp-text-light);
}

/* ===================================
   SEATS SELECTOR
   =================================== */
.ebp-seats-selector {
    margin-bottom: 25px;
}

.ebp-seats-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    text-align: center;
}

.ebp-seats-control {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.ebp-seats-btn {
    width: 44px;
    height: 44px;
    border: 2px solid var(--ebp-primary);
    background: white;
    color: var(--ebp-primary);
    font-size: 1.5em;
    font-weight: bold;
    border-radius: var(--ebp-radius);
    cursor: pointer;
    transition: all var(--ebp-transition);
    /* Centratura caratteri +/- */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.ebp-seats-btn:hover {
    background: var(--ebp-primary);
    color: var(--ebp-button-text, #fff);
}

.ebp-seats-input {
    width: 80px;
    height: 44px;
    text-align: center;
    font-size: 1.3em;
    font-weight: 600;
    border: 2px solid var(--ebp-border);
    border-radius: var(--ebp-radius);
    /* Centratura numero */
    line-height: 1;
    padding: 0;
    box-sizing: border-box;
}

/* ===================================
   PRICE SUMMARY
   =================================== */
.ebp-price-summary {
    background: var(--ebp-background-alt);
    padding: 15px;
    border-radius: var(--ebp-radius);
    margin-bottom: 20px;
}

.ebp-price-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.ebp-price-row.total {
    border-top: 1px solid var(--ebp-border);
    margin-top: 10px;
    padding-top: 10px;
    font-weight: 700;
    font-size: 1.1em;
}

/* ===================================
   ACTION BUTTON
   =================================== */
.ebp-btn {
    display: block;
    width: 100%;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: var(--ebp-radius);
    cursor: pointer;
    transition: all var(--ebp-transition);
}

.ebp-btn-primary {
    background: var(--ebp-button);
    color: var(--ebp-button-text, #fff);
}

.ebp-btn-primary:hover:not(:disabled) {
    background: var(--ebp-button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ebp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loading .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ebp-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ===================================
   MESSAGES
   =================================== */
.ebp-messages {
    margin-top: 15px;
}

.ebp-message {
    padding: 12px 15px;
    border-radius: var(--ebp-radius);
    font-size: 0.95em;
}

.ebp-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ebp-message-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.ebp-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ===================================
   LOADING OVERLAY
   =================================== */
.ebp-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.ebp-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--ebp-border);
    border-top-color: var(--ebp-primary);
    border-radius: 50%;
    animation: ebp-spin 1s linear infinite;
}

/* ===================================
   SUBTITLE / HINT TEXT
   Applica --ebp-secondary a tutti i sotto-testi descrittivi cross-layout.
   =================================== */
.ebp-calendar-subtitle,
.ebp-popover-label,
.ebp-card-subtitle,
.ebp-split-right-hint,
.ebp-strip-empty,
.ebp-time-stepper-availability,
.ebp-card-time-label,
.ebp-card-seats-label {
    color: var(--ebp-secondary);
}

/* ===================================
   GAP CALENDARIO (slot pills, strip giorni)
   Applica --ebp-calendar-gap come spaziatura tra elementi del calendario.
   =================================== */
.ebp-slot-pills,
.ebp-strip {
    gap: var(--ebp-calendar-gap);
}

/* ===================================
   ERROR MESSAGE
   =================================== */
.ebp-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: var(--ebp-radius);
    border: 1px solid #f5c6cb;
    text-align: center;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
    .ebp-booking-wrapper {
        padding: 15px;
    }

    .ebp-event-title {
        font-size: 1.5em;
    }

    .ebp-calendar-legend {
        flex-wrap: wrap;
        gap: 10px;
    }

    .ebp-slot-event {
        font-size: 0.75em;
        padding: 2px 4px;
    }

    .ebp-panel-content {
        padding: 15px;
    }

    .ebp-seats-btn {
        width: 40px;
        height: 40px;
    }

    .ebp-seats-input {
        width: 60px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .ebp-calendar .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .ebp-selected-slot {
        flex-direction: column;
        text-align: center;
    }

    .ebp-calendar-legend {
        flex-direction: column;
        align-items: center;
    }
}
