/* =============================================
   Weigang Booking Modal — Clean CSS

   Width chain:
   - Desktop: __container = 500px → __content = 100% → form = 100% → wrapper = 100%
   - Mobile:  __container = 95%  → __content = 100% → form = 100% → wrapper = 100%

   ALL width control happens on __container. Everything inside is 100%.
   ============================================= */

/* ─── Base: Hidden modal ─── */
.weigang-booking-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.weigang-booking-modal.is-open {
    display: flex !important;
    pointer-events: auto;
}

/* ─── Overlay (dark backdrop) ─── */
.weigang-booking-modal__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.weigang-booking-modal.is-open .weigang-booking-modal__overlay {
    opacity: 1;
}

/* ─── Container: Width controlled via inline style in footer.php ─── */
.weigang-booking-modal__container {
    position: relative;
    /* width: 500px; max-width: 92%; — set inline in footer.php for load-order safety */
    max-height: 92vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 32px 80px rgba(5, 12, 32, 0.55), 0 12px 32px rgba(5, 12, 32, 0.35);
    overflow: visible;
    animation: modalSlideUp 0.25s ease;
    z-index: 100000;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Header: Hidden ─── */
.weigang-booking-modal__header,
.weigang-booking-modal__title {
    display: none;
}

/* ─── Close button: Fixed on container, above content ─── */
.weigang-booking-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.9);
    color: #333;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100001;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.weigang-booking-modal__close svg {
    width: 18px;
    height: 18px;
}

.weigang-booking-modal__close:hover {
    background: #f3f4f6;
    transform: scale(1.08);
}

/* ─── Content area: Scrollable, full width of container ─── */
.weigang-booking-modal__content {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 92vh;
    padding: 0;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* ─── Booking form inside modal: Strip all constraints, fill container ─── */
.weigang-booking-modal .custom-booking-form-container,
.weigang-booking-modal .custom-booking-form-container.booking-form-hybrid {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

.weigang-booking-modal .latepoint-booking-form-element {
    max-width: 100% !important;
    width: 100% !important;
}

.weigang-booking-modal .booking-form-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    position: static !important;
    border-radius: 0 !important;
    display: block !important;
}

.weigang-booking-modal .latepoint-lightbox-w {
    padding: 0 !important;
    margin: 0 !important;
}

/* Address banner hidden in modal */
.weigang-booking-modal .weigang-address-banner {
    display: none !important;
}

/* ─── Loader ─── */
.weigang-booking-modal__loader {
    text-align: center;
    padding: 60px 20px;
}

/* ─── Body scroll lock ─── */
body.modal-open {
    overflow: hidden;
}

/* =============================================
   MOBILE (< 640px): Container fills screen
   ============================================= */
@media (max-width: 640px) {
    .weigang-booking-modal__container {
        width: 96%;
        max-width: none;
        max-height: 95vh;
        border-radius: 14px;
    }

    .weigang-booking-modal__content {
        padding: 0;
        max-height: calc(95vh - 10px);
    }

    .weigang-booking-modal .booking-form-wrapper {
        padding: 14px !important;
        min-height: auto !important;
    }

    .weigang-booking-modal__close {
        top: 8px;
        right: 8px;
        width: 30px;
        height: 30px;
    }

    .weigang-booking-modal__close svg {
        width: 16px;
        height: 16px;
    }
}
