/* ============================================
   PUBLIC BOOKING MODAL - DEMO
   Using shared component styles
   ============================================ */

/* Gradient background for booking page */
body {
    background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-accent) 100%);
    min-height: 100vh;
}

/* Main container */
.booking-main {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}

/* Booking modal - specific width override */
.booking-modal {
    max-width: 600px;
}

/* Field rows for side-by-side fields */
.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

/* Employee avatar in dropdown */
.employee-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.employee-avatar-icon {
    width: 32px !important;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Success modal styling */
.success-modal {
    max-width: 450px !important;
}

.success-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 6px 8px;
}

.success-icon {
    font-size: 4rem;
    color: var(--c-brand);
    margin-top: 40px;
}

.success-header .modal-title {
    color: var(--c-brand);
}

.appointment-details {
    margin-top: 16px;
}

.appointment-details p {
    margin: 8px 0;
    line-height: 1.8;
}

/* Success modal details box */
.appointment-details-box {
    margin-top: 1rem;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 8px;
}

.appointment-details-box p {
    margin: 8px 0;
}

.appointment-details-box strong {
    font-weight: 600;
    color: #374151;
}

/* Empty state styling for dropdowns */
.dropdown-empty-state {
    color: #999;
    font-style: italic;
    cursor: default !important;
    pointer-events: none;
}

/* Selected state for dropdown items */
.custom-dropdown-menu li.selected {
    background: var(--c-gray-100);
    color: var(--c-brand);
    font-weight: var(--font-weight-medium);
}

.custom-dropdown-menu li.selected:hover {
    background: var(--c-gray-100);
    color: var(--c-brand);
}

/* Responsive adjustments - Mobile full-screen optimization */
@media (max-width: 768px) {
    /* Full-screen modal treatment */
    .booking-modal,
    .success-modal {
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Modal body should flex to fill space */
    .booking-modal .modal-body {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    /* Form should fill modal body */
    #bookingForm {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        min-height: 0 !important;
    }

    /* Description field container should grow to fill remaining space */
    .field:has(#appointmentDescription) {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 0 !important;
        min-height: 0 !important;
    }

    /* Description textarea fills its container */
    #appointmentDescription {
        flex: 1 !important;
        min-height: 60px !important;
        height: 100% !important;
        resize: none !important;
    }

    /* Ensure modal-background allows full-screen modal */
    .modal-background {
        background: rgba(0, 0, 0, 0.3);
    }

    /* Keep cancel button visible on mobile */

    /* Keep time fields and date/employee fields side-by-side on mobile */
    .field-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 8px;
    }

    /* Custom width distribution for specific field pairs */
    /* Phone (40%) and Email (60%) */
    .field-row:has(#attendeePhone) {
        grid-template-columns: 40% 60%;
    }

    /* Date (40%) and Employee (60%) */
    .field-row:has(#appointmentDate) {
        grid-template-columns: 40% 60%;
    }

    /* Start Time (40%) and End Time (60%) */
    .field-row:has(#appointmentStartTime) {
        grid-template-columns: 40% 60%;
    }

    /* Reduce font sizes for mobile */
    .modal-title {
        font-size: 1.25rem; /* 20px */
    }

    .field label {
        font-size: 0.875rem; /* 14px */
        margin-bottom: 4px;
    }

    .field .input,
    .field input,
    .field select,
    .field textarea,
    .custom-dropdown-btn,
    .custom-dropdown-text {
        font-size: 0.8125rem !important; /* 13px - match dropdown size */
        padding: 6px 10px !important;
        height: 36px !important;
        min-height: 36px !important;
        line-height: 1.2 !important;
    }

    /* Date field wrapper positioning */
    .field:has(input[type="date"]),
    .field:has(input[type="time"]),
    .field:has(input[type="datetime-local"]) {
        position: relative !important;
    }

    /* Fix date input specifically */
    .field input[type="date"],
    .field input[type="time"],
    .field input[type="datetime-local"] {
        font-size: 0.8125rem !important; /* 13px - match dropdown */
        padding: 6px 40px 6px 10px !important;
        height: 36px !important;
        display: block !important;
    }

    /* Center the date field arrow vertically - position relative to input field */
    .field:has(input[type="date"])::after,
    .field:has(input[type="time"])::after,
    .field:has(input[type="datetime-local"])::after {
        position: absolute !important;
        bottom: auto !important;
        top: auto !important;
        /* Position from bottom of field container */
        bottom: 13px !important; /* Half of 36px input height minus half of arrow height (6px) = 18px - 3px = 15px, but adjusted */
        transform: none !important;
        right: 12px !important;
        border-left: 5px solid transparent !important;
        border-right: 5px solid transparent !important;
        border-top: 6px solid var(--c-brand) !important;
    }

    /* Ensure dropdown caret is vertically centered */
    .custom-dropdown-btn {
        display: flex !important;
        align-items: center !important;
        line-height: 1 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .custom-dropdown-text {
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        height: 100% !important;
    }

    .custom-dropdown-caret {
        align-self: center !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Match dropdown menu font size */
    .custom-dropdown-menu,
    .custom-dropdown-item {
        font-size: 0.8125rem !important; /* 13px */
    }

    /* Regular textareas stay fixed, but description will flex (see above) */
    .field textarea:not(#appointmentDescription) {
        min-height: 50px !important;
        height: 50px !important;
        padding: 6px 10px !important;
    }

    /* Already set above - keeping for reference */

    /* Compact field spacing */
    .field {
        margin-bottom: 8px;
    }

    /* Footer buttons - same row, custom widths */
    .modal-footer {
        flex-direction: row;
        gap: 8px;
        padding-bottom: 60px !important;
    }

    .modal-footer .btn {
        padding: 12px;
        font-size: 0.9375rem; /* 15px */
    }

    /* Cancel button 40% width */
    .modal-footer #btnCancel {
        width: 40%;
    }

    /* Book Appointment button 60% width */
    .modal-footer #btnSubmit {
        width: 60%;
    }

    /* Reduce modal header/body/footer padding */
    .booking-modal .modal-header {
        padding: 10px 16px;
    }

    .booking-modal .modal-body {
        padding: 0 16px;
    }

    .booking-modal .modal-footer {
        padding: 10px 16px;
    }
}

/* Field toast messages now use shared .field-error-message from forms.css */

/* Extra small screens - additional refinements */
@media (max-width: 375px) {
    /* Modal title font size stays consistent - removed override */

    .field label {
        font-size: 0.8125rem; /* 13px */
        margin-bottom: 3px;
    }

    .field .input,
    .field input,
    .field select,
    .field textarea,
    .custom-dropdown-btn,
    .custom-dropdown-text {
        font-size: 0.75rem !important; /* 12px - smaller for tiny screens */
        padding: 4px 8px !important;
        height: 30px !important;
        min-height: 30px !important;
        line-height: 1.2 !important;
    }

    /* Date field wrapper positioning for small screens */
    .field:has(input[type="date"]),
    .field:has(input[type="time"]),
    .field:has(input[type="datetime-local"]) {
        position: relative !important;
    }

    /* Fix date input specifically for small screens */
    .field input[type="date"],
    .field input[type="time"],
    .field input[type="datetime-local"] {
        font-size: 0.75rem !important; /* 12px */
        padding: 4px 36px 4px 8px !important;
        height: 30px !important;
        display: block !important;
    }

    /* Center the date field arrow vertically for small screens - position from bottom */
    .field:has(input[type="date"])::after,
    .field:has(input[type="time"])::after,
    .field:has(input[type="datetime-local"])::after {
        position: absolute !important;
        bottom: auto !important;
        top: auto !important;
        /* Position from bottom: half of input height (15px) minus half of arrow height (2.5px) */
        bottom: 12px !important;
        transform: none !important;
        right: 10px !important;
        border-left: 4px solid transparent !important;
        border-right: 4px solid transparent !important;
        border-top: 5px solid var(--c-brand) !important;
    }

    /* Ensure dropdown caret is vertically centered at small sizes */
    .custom-dropdown-btn {
        display: flex !important;
        align-items: center !important;
        line-height: 1 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .custom-dropdown-text {
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        height: 100% !important;
    }

    .custom-dropdown-caret {
        align-self: center !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Match dropdown menu font size */
    .custom-dropdown-menu,
    .custom-dropdown-item {
        font-size: 0.75rem !important; /* 12px */
        padding: 5px 8px !important;
    }

    /* Description field container grows on small screens too */
    .field:has(#appointmentDescription) {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 0 !important;
        min-height: 0 !important;
    }

    /* Description textarea fills its container on small screens */
    #appointmentDescription {
        flex: 1 !important;
        min-height: 50px !important;
        height: 100% !important;
        resize: none !important;
        padding: 4px 8px !important;
    }

    /* Other textareas stay fixed */
    .field textarea:not(#appointmentDescription) {
        min-height: 40px !important;
        height: 40px !important;
        padding: 4px 8px !important;
    }

    .field {
        margin-bottom: 6px;
    }

    /* Keep time fields and date/employee fields side-by-side on small screens */
    .field-row {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin-bottom: 6px;
    }

    .custom-dropdown-item {
        padding: 5px 8px;
    }

    /* Modal header padding stays consistent - removed override */
    .booking-modal .modal-body,
    .booking-modal .modal-footer {
        padding: 8px 12px;
    }
}
