/* MHBO Booking Modal — Shell, Overlay, Drawer, Animations */

/* ── Overlay ─────────────────────────────────────────────── */
.mhbo-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.mhbo-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Drawer ──────────────────────────────────────────────── */
.mhbo-modal-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 99999;
    box-sizing: border-box;
    width: min(560px, 100vw);
    height: 100dvh;
    background: var(--mhbo-bg, #ffffff);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    overflow: hidden;
}

.mhbo-modal-overlay.is-open .mhbo-modal-drawer {
    transform: translateX(0);
}

/* ── Header ──────────────────────────────────────────────── */
.mhbo-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--mhbo-border, rgba(26, 54, 93, 0.15));
    flex-shrink: 0;
    background: var(--mhbo-primary, #1a365d);
    color: #fff;
}

.mhbo-modal-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
}

.mhbo-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.mhbo-modal-close:hover,
.mhbo-modal-close:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ── Body (scrollable) ───────────────────────────────────── */
.mhbo-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px;
    box-sizing: border-box;
    scroll-padding-top: 16px;
}

.mhbo-modal-body::-webkit-scrollbar {
    width: 5px;
}

.mhbo-modal-body::-webkit-scrollbar-thumb {
    background: var(--mhbo-primary, #1a365d);
    border-radius: 4px;
}

/* Modal Payment Options & Coupon Spacing Fix */
.mhbo-modal-body .mhbo-deposit-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0 28px;
}

.mhbo-modal-body .mhbo-payment-card {
    width: 100%;
    min-width: 100%;
    margin-bottom: 0 !important;
}

.mhbo-modal-body .mhbo-coupon-wrapper {
    margin-top: 32px !important;
    padding-top: 24px !important;
    border-top: 1px dashed #e5e7eb !important;
}

.mhbo-modal-body .mhbo-coupon-wrapper label {
    margin-bottom: 10px !important;
}

/* ── Loading state ───────────────────────────────────────── */
.mhbo-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 24px;
    color: var(--mhbo-text-light, #64748b);
    font-size: 0.9rem;
}

.mhbo-modal-close svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.5;
}

.mhbo-modal-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--mhbo-border, rgba(26, 54, 93, 0.15));
    border-top-color: var(--mhbo-primary, #1a365d);
    border-radius: 50%;
    animation: mhboSpin 0.7s linear infinite;
}

@keyframes mhboSpin {
    to { transform: rotate(360deg); }
}

/* ── Error state ─────────────────────────────────────────── */
.mhbo-modal-error {
    margin: 24px 0;
    padding: 16px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: var(--mhbo-radius, 12px);
    color: #991b1b;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── Mobile: bottom drawer ───────────────────────────────── */
@media (max-width: 768px) {
    .mhbo-modal-drawer {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 92dvh;
        border-radius: var(--mhbo-radius-lg, 24px) var(--mhbo-radius-lg, 24px) 0 0;
        transform: translateY(100%);
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
    }

    .mhbo-modal-overlay.is-open .mhbo-modal-drawer {
        transform: translateY(0);
    }

    /* Drag handle indicator */
    .mhbo-modal-header::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.4);
        border-radius: 2px;
    }

    .mhbo-modal-header {
        position: relative;
        padding-top: 24px;
    }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .mhbo-modal-overlay,
    .mhbo-modal-drawer {
        transition: none;
    }

    .mhbo-modal-spinner {
        animation-duration: 1.5s;
    }
}

/* Mobile Optimization for Coupon Section */
@media screen and (max-width: 480px) {
    /* 1. Force the row wrapper to stack vertically instead of side-by-side */
    div.mhbo-coupon-input-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    /* 2. Make the input field span the full container width */
    input.mhbo-coupon-code-input {
        width: 100% !important;
        min-height: 44px !important; /* Makes it easy to tap on phones */
        font-size: 16px !important;  /* Prevents iOS from auto-zooming on focus */
    }

    /* 3. Make both buttons expand fully and sit nicely underneath */
    button.mhbo-coupon-apply-btn,
    button.mhbo-coupon-remove-btn {
        width: 100% !important;
        min-height: 44px !important;
        margin: 0 !important;
        padding: 10px 16px !important;
        text-align: center !important;
        justify-content: center !important;
    }
}

/* Mobile Optimization for Booking/Tax Breakdown Table */
@media screen and (max-width: 480px) {
    /* 1. Eliminate heavy parent margins that push the table out of bounds */
    div.mhbo-tax-breakdown-container {
        margin: 15px 0 !important;
        padding: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 2. Force the table to behave fluidly and consistently */
    table#mhbo-tax-breakdown-table {
        width: 100% !important;
        table-layout: fixed !important; /* Forces strict adherence to defined column widths */
    }

    /* 3. Divide columns cleanly: 55% for names, 45% for prices */
    table#mhbo-tax-breakdown-table th:first-child,
    table#mhbo-tax-breakdown-table td:first-child {
        width: 55% !important;
        text-align: left !important;
        font-size: 13px !important;
        padding: 8px 4px !important;
    }

    table#mhbo-tax-breakdown-table th:last-child,
    table#mhbo-tax-breakdown-table td:last-child {
        width: 45% !important;
        text-align: right !important;
        font-size: 13px !important;
        padding: 8px 4px !important;
        /* 4. Stop the currency symbols and digits from breaking line */
        white-space: nowrap !important; 
    }

    /* 5. Tweak header text spacing */
    table#mhbo-tax-breakdown-table th {
        font-size: 11px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }
    
    /* 6. Clean up the bottom VAT registration line alignment */
    p.mhbo-tax-registration {
        font-size: 11px !important;
        margin-top: 8px !important;
        text-align: left !important;
    }
}

/* iOS Safari zoom fix for form fields */
@media screen and (max-width: 768px) {
    .mhbo-booking-modal input,
    .mhbo-booking-modal select,
    .mhbo-booking-modal textarea {
        font-size: 16px !important;
    }
}
