/* Universal Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

.Calendhar_widget {
    position: fixed;
    right: 20px;
    bottom: 170px;
    z-index: 99;
}

.Calendhar_btn {
    width: 55px;
    height: 55px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transition: transform 0.2s ease;
}

.Calendhar_btn:hover {
    transform: scale(1.08);
}

.Calendhar_btn svg {
    width: 28px;
    height: 28px;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease-in-out;
    z-index: 99999;
    padding: 16px;
}

.popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-overlay.active .popup-card {
    transform: scale(1);
}

.popup-card {
    background: #ffffff;
    padding: 32px;
    border-radius: 12px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
    -webkit-overflow-scrolling: touch;
}

.popup-close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    text-decoration: none;
    color: #64748b;
    line-height: 1;
}

.popup-close-btn:hover {
    color: #1e293b;
}

.popup-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    color: #0f172a;
}

#bookingForm {
    width: 100%;
    overflow: visible;
}

.form-field {
    margin-bottom: 18px;
    text-align: left;
    width: 100%;
}

.form-field-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.form-field.half {
    flex: 1;
    min-width: 0;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #334155;
}

.form-field input,
.form-field select {
    width: 100%;
    height: 44px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 15px;
    background-color: #f8fafc;
    color: #0f172a;
}

/* Flatpickr date and time input styling */
#bookingDate,
#bookingTime,
#bookingForm .flatpickr-input {
    width: 100%;
    height: 44px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #f8fafc;
    color: #334155;
    font-size: 15px;
    box-sizing: border-box;
}

/* Keep the Flatpickr time picker positioned correctly */
.flatpickr-calendar.open {
    z-index: 100001 !important;
}

/* Prevent time picker from being clipped by the popup */
.popup-card {
    overflow: visible;
}

/* Keep the popup within the screen */
.popup-overlay {
    overflow-y: auto;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: #08324b;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
}

.btn-submit:hover {
    background: #e1e5f0;
}

.btn-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.form-messages-container {
    margin-top: 14px;
}

.msg-alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    line-height: 1.4;
}

.msg-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.msg-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .popup-card {
        padding: 20px 16px;
    }

    .form-field-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Lock background scrolling when modal is active */
body.modal-open,
html.modal-open {
    overflow: hidden !important;
    /* height: 100vh; */
    touch-action: none; /* Disables scroll gestures on mobile touchscreens */
}


/* Light placeholder text in the table booking form */
#bookingForm input::placeholder,
#bookingForm textarea::placeholder {
    color: #a8adb5 !important;
    opacity: 1;
}

/* Keep the text entered by users darker */
#bookingForm input,
#bookingForm textarea {
    display: block;
  width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  box-sizing: border-box !important;
  padding: 8px 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  background-color: #f8fafc !important;
  color: #334155 !important;
  font-family: inherit;
  font-size: 15px !important;
  line-height: normal !important;
}

/* Placeholder styling for select dropdowns */
#bookingForm select:invalid {
    color: #a8adb5;
}

/* Selected dropdown value */
#bookingForm select:valid {
    color: #334155;
}
/* Flatpickr time selector */
.flatpickr-calendar.hasTime.noCalendar {
    width: 165px !important;
    min-width: 165px !important;
    box-sizing: border-box;
    z-index: 100001 !important;
}

.flatpickr-calendar.hasTime.noCalendar .flatpickr-time {
    width: 100%;
    height: 40px;
    max-height: 40px;
    display: flex;
    align-items: center;
}

.flatpickr-calendar.hasTime.noCalendar .flatpickr-time .numInputWrapper {
    flex: 1;
    height: 40px;
}

.flatpickr-calendar.hasTime.noCalendar .flatpickr-time input {
    height: 38px;
    padding: 0;
    text-align: center;
    font-size: 14px;
}
/* Keep date and time fields visually consistent */
#bookingDate,
#bookingTime {
    display: block;
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
    padding: 8px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    background-color: #f8fafc !important;
    color: #334155 !important;
    font-family: inherit;
    font-size: 15px !important;
    line-height: normal !important;
}

/* Keep both fields equally sized */
.form-field-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.form-field-row .form-field.half {
    flex: 1 1 0;
    min-width: 0;
}
/* Date and Time Fields */
#bookingDate,
#bookingTime {
    display: block;
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
    padding: 8px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    background-color: #f8fafc !important;
    color: #334155 !important;
    font-family: inherit;
    font-size: 15px !important;
    line-height: normal !important;
}

#bookingTime {
    cursor: pointer;
}
.form-field-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.form-field-row .form-field.half {
    flex: 1 1 0;
    min-width: 0;
}
.form-field.half:has(#bookingTime) {
    position: relative;
}
/* Time dropdown positioning */
#bookingForm .form-field.half:has(#bookingTime) {
    position: relative !important;
}

#bookingForm .form-field.half:has(#bookingTime) .custom-time-dropdown {
    display: block !important;
    position: absolute !important;

    top: auto !important;
    bottom: calc(100% - 23px) !important;
    left: 0 !important;

    width: 100% !important;
    height: 144px !important;
    min-height: 144px !important;
    max-height: 144px !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;

    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    z-index: 100002 !important;

    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Hide dropdown when closed */
#bookingForm .custom-time-dropdown[hidden] {
    display: none !important;
}

/* Individual time slots */
#bookingForm .custom-time-option {
    display: block !important;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;

    padding: 0 !important;
    margin: 0 !important;
    border: none !important;

    background: #FFFFFF !important;
color: #000000 !important;

    text-align: center !important;
    line-height: 36px !important;
    font-size: 15px !important;
    cursor: pointer;
}
#bookingForm .custom-time-option:hover,
#bookingForm .custom-time-option.selected {
    background: #000000 !important;
    color: #FFFFFF !important;
}

#bookingForm .custom-time-option:hover,
#bookingForm .custom-time-option.selected {
    background: #e8efed !important;
    color: #133a2f !important;
}

/* Hide dropdown completely until the time field is clicked */
#bookingForm .form-field.half:has(#bookingTime) .custom-time-dropdown[hidden] {
    display: none !important;
    visibility: hidden !important;
}