/*
 * Public CSS for Booking MT - "Purple Screen Design" (V 1.4.4)
 * - Slot Hover: Zoom, Bottom Line, White BG
 * - Popup: Custom Colors, Tall Inputs
 */

:root {
    /* DEFAULT COLORS (Overridden by PHP if set in backend) */
    --bmt-primary: #8e44ad;       /* Purple */
    --bmt-secondary: #2c3e50;     /* Dark Blue/Grey */
    --bmt-text: #333;
    --bmt-bg: #fff;
    --bmt-light: #f8f9fa;
    --bmt-border: #e2e4e7;
    --bmt-success: #28a745;
    --bmt-danger: #dc3545;
    --bmt-occupied-btn: #ecf0f1;
    --bmt-occupied-text: #bdc3c7;
    
    /* Popup Colors (Defaults if not set) */
    --bmt-popup-title: #2c3e50;
    --bmt-popup-text: #333;

    /* Dimensions & Effects */
    --bmt-radius: 12px;
    --bmt-shadow: 0 4px 15px rgba(0,0,0,0.05);
    --bmt-font-title: "Playfair Display", Georgia, "Times New Roman", serif;
    --bmt-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.booking-mt-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    font-family: var(--bmt-font-body);
    color: var(--bmt-text);
    box-sizing: border-box;
}

.booking-mt-wrapper * {
    box-sizing: border-box;
}

/* --- Layout Structure --- */
.booking-mt-main-layout {
    display: flex;
    gap: 30px;
    align-items: stretch; /* Aligns tops */
}

/* Calendar Section */
#booking-mt-calendar {
    flex: 2;
    min-width: 340px;
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    border: none;
    /* Ensure it has a stable height for the flex sibling to match if needed, 
       but usually calendar height is dynamic based on content */
}

/* Slots Panel Section */
.booking-mt-slots-panel {
    flex: 1;
    min-width: 300px;
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    border: none;
    display: none; /* Hidden initially */
    flex-direction: column;
    
    /* Dynamic Height Matching Calendar */
    max-height: 100%; /* Should not exceed parent flex height */
    /* Remove fixed height: 600px */
    position: relative;
    overflow: hidden; /* Hide overflow from children */
}

.booking-mt-slots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
    flex-shrink: 0; /* Header doesn't shrink */
}

.booking-mt-slots-header h3 {
    margin: 0;
    font-family: var(--bmt-font-title);
    font-size: 1.4em;
    color: var(--bmt-primary);
    font-weight: 700;
}

.booking-mt-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #ccc;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}
.booking-mt-close-btn:hover {
    color: var(--bmt-primary);
}

/* Slots Grid - Vertical List with Scroll */
.booking-mt-slots-grid {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spacing between slots */
    overflow-y: auto;
    padding: 10px; /* Padding for hover effects */
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--bmt-primary) #f0f0f0;
}

/* Webkit Scrollbar */
.booking-mt-slots-grid::-webkit-scrollbar {
    width: 6px;
}
.booking-mt-slots-grid::-webkit-scrollbar-track {
    background: #f0f0f0;
}
.booking-mt-slots-grid::-webkit-scrollbar-thumb {
    background-color: var(--bmt-primary);
    border-radius: 10px;
}

/* Scroll Hint Arrow */
.booking-mt-scroll-hint {
    text-align: center;
    color: var(--bmt-primary);
    font-size: 24px;
    animation: bounce 2s infinite;
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    pointer-events: none;
    opacity: 0.8;
    background: linear-gradient(to bottom, transparent, #fff);
    padding-top: 20px;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-10px);}
    60% {transform: translateY(-5px);}
}

/* --- Slot Item Styling --- */
.booking-mt-slot-item {
    background: #fff;
    border: 1px solid #e2e4e7; /* Light Grey Default */
    box-shadow: none;
    padding: 20px 25px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27), border-color 0.3s ease; /* Zoom bounce */
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: visible; /* Needed for scale */
    margin-bottom: 5px;
}

/* Bottom Line Animation */
.booking-mt-slot-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px; /* Thickness of bottom line */
    background-color: var(--bmt-primary);
    transition: width 0.3s ease, left 0.3s ease;
    border-radius: 0 0 12px 12px; /* Follow corners if needed, or flat */
}

/* Hover State */
.booking-mt-slot-item:hover:not(.occupied) {
    background-color: #fff !important; /* FORCE WHITE BG */
    border-color: var(--bmt-primary); /* Purple Border */
    transform: scale(1.05); /* ZOOM Effect "Uscire dallo schermo" */
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 10; /* Bring to front */
}

/* Hover Bottom Line Expansion */
.booking-mt-slot-item:hover:not(.occupied)::after {
    width: 100%;
    left: 0;
}

/* Occupied Slot */
.booking-mt-slot-item.occupied {
    background-color: #fcfcfc;
    border: 1px solid #f0f0f0;
    cursor: not-allowed;
    opacity: 0.6;
}

.booking-mt-slot-time {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--bmt-text);
}
.booking-mt-slot-item.occupied .booking-mt-slot-time {
    color: #ccc;
    text-decoration: line-through;
}

/* "PRENOTA" Button */
.booking-mt-slot-action {
    background-color: transparent; /* Default transparent or light */
    color: var(--bmt-primary);
    border: 1px solid var(--bmt-primary);
    padding: 8px 25px;
    border-radius: 50px;
    font-size: 0.9em;
    font-weight: 700;
    text-transform: capitalize;
    transition: all 0.2s;
}

/* Hover Button */
.booking-mt-slot-item:hover:not(.occupied) .booking-mt-slot-action {
    background-color: var(--bmt-primary);
    color: #fff;
    border-color: var(--bmt-primary);
}

/* Occupied Button */
.booking-mt-slot-item.occupied .booking-mt-slot-action {
    background-color: #f0f0f0;
    color: #ccc;
    border-color: #f0f0f0;
}

/* --- FullCalendar Toolbar --- */
.fc-header-toolbar {
    margin-bottom: 30px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fc-toolbar-title {
    font-family: var(--bmt-font-title);
    font-size: 2em !important;
    font-weight: 400 !important;
    color: #000;
}

.fc-button-primary {
    background-color: var(--bmt-secondary) !important;
    border-color: var(--bmt-secondary) !important;
    color: #fff !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    text-transform: capitalize !important;
}

.fc-dayGridMonth-button.fc-button-active {
    background-color: var(--bmt-primary) !important;
    border-color: var(--bmt-primary) !important;
}

.fc-timeGridWeek-button {
    background-color: var(--bmt-secondary) !important;
    opacity: 1;
}

.fc-today-button {
    background-color: #95a5a6 !important;
    border-color: #95a5a6 !important;
}

.fc-theme-standard td, .fc-theme-standard th {
    border-color: #f0f0f0 !important;
}
.fc-col-header-cell {
    padding: 15px 0 !important;
    color: #7f8c8d;
    text-transform: lowercase;
    font-weight: 600;
}
.fc-daygrid-day-number {
    color: #7f8c8d;
    padding: 10px !important;
}
.fc-day-today {
    background-color: rgba(142, 68, 173, 0.05) !important;
}
.fc-daygrid-event {
    display: none;
}

/* --- Modal (Popup) Styling --- */
.booking-mt-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.booking-mt-modal[style*="display: block"], 
.booking-mt-modal[style*="display: flex"] {
    display: flex !important;
}

.booking-mt-modal-content {
    background-color: #fff;
    margin: 20px;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 500px; /* Slightly wider */
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

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

.booking-mt-modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* POPUP TITLE CUSTOMIZABLE */
.booking-mt-modal-header h3 {
    margin: 0;
    font-family: var(--bmt-font-title);
    color: var(--bmt-popup-title); /* Custom Color */
    font-size: 1.6em;
    font-weight: 700;
}

.booking-mt-close-modal {
    font-size: 28px;
    color: #ccc;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}
.booking-mt-close-modal:hover {
    color: var(--bmt-primary);
}

.booking-mt-modal-body {
    padding: 30px;
}

/* Summary Box */
.booking-mt-summary {
    background: rgba(0,0,0,0.02); /* Very light grey/transparent */
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid #f0f0f0;
}

.booking-mt-summary p {
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
}

/* LABELS (Data, Ora, Servizio) - BOLD & CUSTOM COLOR */
.booking-mt-summary p strong {
    font-weight: 700;
    color: var(--bmt-popup-title); /* Same as title color per request? "colore che si possa decidere da backend" */
}

/* VALUES - NORMAL & CUSTOM COLOR */
.booking-mt-summary p span {
    font-weight: 400; /* Normal */
    color: var(--bmt-popup-text); /* Custom Text Color */
}

/* Form Styling */
.booking-mt-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}
.booking-mt-form-group {
    flex: 1;
    margin-bottom: 20px;
}

/* TALLER INPUTS */
.booking-mt-form-control {
    width: 100%;
    padding: 0 20px; /* Horizontal padding */
    height: 55px; /* Fixed high height (approx double standard) */
    line-height: 55px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    background-color: #fcfcfc;
    transition: all 0.2s;
    color: var(--bmt-text);
}
textarea.booking-mt-form-control {
    height: auto;
    padding-top: 15px;
    line-height: 1.5;
}

.booking-mt-form-control:focus {
    border-color: var(--bmt-primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.1);
    outline: none;
}

.booking-mt-btn {
    width: 100%;
    padding: 18px;
    background-color: var(--bmt-primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 5px 15px rgba(142, 68, 173, 0.3);
    transition: transform 0.2s;
}

.booking-mt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(142, 68, 173, 0.4);
}

/* Contact Info (Nome, Email, Tel) */
.booking-mt-modal-footer-info {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9em;
    color: #888;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .booking-mt-main-layout {
        flex-direction: column;
    }
    
    .booking-mt-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .fc-header-toolbar {
        flex-direction: column;
        align-items: center !important;
        gap: 10px;
    }
    
    .fc-toolbar-title {
        font-size: 1.5em !important;
        margin-bottom: 5px;
    }
    
    .fc-toolbar-chunk:last-child {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Mobile Slots Panel */
    .booking-mt-slots-panel {
        width: 100%;
        margin-top: 20px;
        height: auto;
        max-height: 80vh; /* Allow it to be tall but scrollable on mobile */
        padding: 20px;
    }
    
    .booking-mt-slot-item:hover:not(.occupied) {
        transform: scale(1.02); /* Less zoom on mobile */
    }

    /* Mobile Popup Adjustments */
    .booking-mt-modal-content {
        width: 95%;
        margin: 10px;
        padding: 0;
        max-height: 95vh;
    }

    .booking-mt-modal-header {
        padding: 15px 20px;
    }
    
    .booking-mt-modal-header h3 {
        font-size: 1.3em;
    }

    .booking-mt-modal-body {
        padding: 20px;
    }

    /* Compact Summary on Mobile */
    .booking-mt-summary {
        padding: 15px;
        margin-bottom: 15px;
    }
    .booking-mt-summary p {
        margin: 4px 0; /* Reduced margin */
        font-size: 14px;
    }

    .booking-mt-form-control {
        height: 45px; /* Slightly smaller on mobile */
        line-height: 45px;
        font-size: 14px;
    }
    
    .booking-mt-btn {
        padding: 14px;
        font-size: 16px;
    }
}
