/*
 * Phone layout (<= 576px) for the booking engine: results page, cart and extras step.
 * Loaded LAST by includes/head.php, so these rules win over the theme's own sheets without a fight.
 * Desktop and tablet layouts are untouched; the only rules outside the media query are the test-banner
 * variants and the dark-mode buttons (Batu olive instead of the dark theme's blue, at every width).
 * Mockup: WINX docs/drafts/BE_mobile_redesign_mockup_2026-11-25.html
 */

/* ---- Every width ---- */
#mpgs-test-mode-indicator .tmi-short { display: none; }

.cart-hold-chip {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--success-color, #28a745) !important;
    background: var(--success-light, rgba(40, 167, 69, 0.1));
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
}
.cart-hold-chip.expiring-soon {
    color: var(--warning-color, #b26a00) !important;
    background: var(--warning-light, rgba(255, 193, 7, 0.15));
}

/* Cart amounts carry their own symbol (cart-ui.js money()); the page's currency updater refills these spans */
#cartFooter .currency-symbol { display: none !important; }

/* Dark mode: filled buttons in Batu olive (the dark theme's accent is blue) */
[data-theme="dark"] .fluent-btn-primary,
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-book:not(.disabled) {
    background: #6b8a3a !important;
    border-color: #6b8a3a !important;
    color: #fff !important;
}
[data-theme="dark"] .fluent-btn-primary:hover,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-book:not(.disabled):hover {
    background: #7a9b45 !important;
    border-color: #7a9b45 !important;
}
[data-theme="dark"] .btn-outline-primary {
    color: #a9c46e !important;
    border-color: #6b8a3a !important;
}
[data-theme="dark"] .btn-outline-primary.active,
[data-theme="dark"] .btn-outline-primary:active {
    background: #6b8a3a !important;
    color: #fff !important;
}

@media (max-width: 576px) {

    /* ---- Test banner: one line ---- */
    #mpgs-test-mode-indicator {
        padding: 4px 8px !important;
        font-size: 11.5px !important;
        border-bottom-width: 1px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #mpgs-test-mode-indicator .tmi-long { display: none; }
    #mpgs-test-mode-indicator .tmi-short { display: inline; }

    /* ---- Results: date / price controls bar ---- */
    #selectionDetailsPricing small,
    .tax-toggle-wrapper .form-check-label,
    .currency-selector {
        font-size: 12px !important;
    }
    #selectionDetailsPricing span {
        font-size: 14px !important;
    }
    .pricing-mode-buttons .btn {
        font-size: 13px !important;
        padding: 5px 12px !important;
    }
    /* "Show:" and "Currency:" say what the controls already show */
    small:has(+ .pricing-mode-buttons),
    small:has(+ .currency-selector) {
        display: none !important;
    }
    /* Dates and Per night / Total stay full width, then Include Tax and currency side by side */
    .row:has(> .col-auto .tax-toggle-wrapper) {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        row-gap: 8px !important;
    }
    .row:has(> .col-auto .tax-toggle-wrapper) > .col,
    .row:has(> .col-auto .tax-toggle-wrapper) > .col-auto:has(.pricing-mode-buttons) {
        flex: 0 0 100% !important;
        width: 100% !important;
    }
    .row:has(> .col-auto .tax-toggle-wrapper) > .col-auto {
        flex: 0 0 auto !important;
        width: auto !important;
        margin-top: 0 !important;
    }
    .row:has(> .col-auto .tax-toggle-wrapper) > .col-auto:last-child { margin-left: auto !important; }
    .pricing-mode-buttons { display: flex !important; width: 100%; }
    .pricing-mode-buttons .btn { flex: 1 1 0; }
    .currency-selector {
        font-weight: 600;
        min-width: 0;
        width: auto !important;
    }

    /* ---- Results: villa card ---- */
    /* Compact: about half the height of the stacked desktop card */
    .room-card-clean { position: relative; }
    .room-card-clean > .row,
    .room-card-clean .room-content-section { position: static !important; } /* so the gallery button sits on the picture */
    .room-image-section,
    .room-image-clean { height: 180px !important; min-height: 0 !important; }
    .room-title-overlay { padding: 12px 60px 24px 14px !important; }
    .room-content-section { padding: 12px !important; }
    .room-header-clean,
    .room-amenities-clean,
    .room-package-clean { margin-bottom: 10px !important; }

    /* Price block: availability as one line, price under it, no inner boxes */
    .room-pricing-enhanced {
        padding: 10px 12px !important;
        margin: 0 !important;
        display: block !important;
    }
    .price-left-info {
        padding: 0 !important;
        margin: 0 0 4px !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }
    .availability-tag-enhanced { gap: 6px !important; }
    .room-card-clean .price-left-info .availability-tag-enhanced i { font-size: 15px !important; width: auto !important; height: auto !important; }
    .room-card-clean .price-left-info .availability-tag-enhanced .availability-text { margin: 0 !important; font-size: 13px !important; }
    .price-right-main {
        padding: 0 !important;
        display: flex !important;
        flex-wrap: wrap;
        align-items: baseline;
        column-gap: 6px;
        text-align: left !important;
    }
    .tax-info-api { flex-basis: 100%; }

    /* Amenities: one row that swipes sideways */
    .amenities-list {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        gap: 6px !important;
        padding-bottom: 2px;
        scrollbar-width: none;
    }
    .amenities-list::-webkit-scrollbar { display: none; }
    .amenity-badge {
        flex: none !important;
        font-size: 12px !important;
        padding: 4px 8px !important;
        margin: 0 !important;
        white-space: nowrap;
    }

    /* Rate terms: 3 lines, tap to read all (rooms-cards.js toggles .open) */
    .package-selection { margin-bottom: 8px !important; }
    .package-label { margin-bottom: 4px !important; }
    .package-benefits { padding: 8px 10px !important; margin-top: 0 !important; }
    .benefits-title { font-size: 13px !important; margin-bottom: 4px !important; }
    .rate-description-text {
        display: -webkit-box !important;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        margin-bottom: 0 !important;
        padding: 6px 10px 0 !important; /* no bottom padding, or a 4th line shows through it */
        font-size: 13px !important;
        line-height: 1.45 !important;
        cursor: pointer;
    }
    .rate-description-text.open { display: block !important; }
    .benefits-list-redesigned:has(.rate-description-text)::after {
        content: "Read more";
        display: block;
        margin-top: 4px;
        font-size: 12.5px;
        font-weight: 600;
        color: var(--primary-color, #556B2F);
    }
    .benefits-list-redesigned:has(.rate-description-text.open)::after { content: "Show less"; }

    /* Guests: the labels say it, so no heading */
    .occupancy-controls { margin-top: 10px !important; padding: 0 !important; background: transparent !important; border: 0 !important; }
    .occupancy-subtitle { display: none !important; }
    .occupancy-item { padding: 4px 2px !important; }
    .occupancy-item label { margin-bottom: 2px; }

    /* Photo gallery: an icon button on the picture */
    .room-actions-clean { margin-top: 0 !important; }
    .btn-gallery {
        position: absolute !important;
        top: 10px;
        right: 10px;
        z-index: 4;
        width: 40px !important;
        height: 40px;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.45) !important;
        border: 0 !important;
        color: #fff !important;
    }
    .btn-gallery i { font-size: 18px !important; margin: 0 !important; }

    .price-tag-large { font-size: 1.6rem !important; }
    .price-period { font-size: 13px !important; }
    .tax-info-api { font-size: 12.5px !important; }
    .availability-tag-enhanced { font-size: 13px !important; }
    .package-label { font-size: 13px !important; }
    .package-dropdown { font-size: 14px !important; }

    .occupancy-subtitle {
        font-size: 12.5px !important;
        text-transform: none !important;
        letter-spacing: normal !important;
    }
    .occupancy-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        gap: 6px !important;
    }
    .occupancy-item {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        border: 1px solid var(--border-color, #edebe9);
        border-radius: 10px;
        padding: 6px 2px !important;
        text-align: center;
    }
    .occupancy-item label {
        display: block;
        font-size: 12px !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        line-height: 1.25;
        margin-bottom: 4px;
    }
    .occupancy-item label small {
        display: block;
        font-size: 11px !important;
    }
    .occupancy-item .stepper-control,
    .room-quantity-stepper {
        justify-content: center;
        gap: 4px;
    }
    .stepper-btn {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        border-radius: 50% !important;
        font-size: 16px !important;
        padding: 0 !important;
    }
    .stepper-input {
        width: 26px !important;
        font-size: 15px !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }

    .room-actions-clean {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    .booking-controls {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100%;
    }
    .room-quantity-section {
        flex: none !important;
        display: flex;
        align-items: stretch;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        min-height: 0 !important;
    }
    .quantity-control {
        display: flex !important;
        align-items: center;
        gap: 4px;
        border: 1px solid var(--border-color, #edebe9);
        border-radius: 12px;
        padding: 0 6px !important;
        min-height: 46px;
        background: transparent !important;
    }
    .quantity-control label {
        font-size: 13px !important;
        margin: 0 !important;
        white-space: nowrap;
    }
    .quantity-control label i { display: none; }
    .room-quantity-stepper .stepper-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
    }
    .btn-book {
        flex: 1 1 auto !important;
        width: auto !important;
        min-height: 46px;
        font-size: 15px !important;
        border-radius: 12px !important;
    }

    /* ---- Results: "1 stay planned" becomes a bottom bar ---- */
    body { padding-bottom: 76px; }
    .cart-sticky-summary {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        max-width: none !important;
        animation: none !important;
    }
    .cart-sticky-summary .cart-sticky-content {
        border-radius: 14px 14px 0 0 !important;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    .cart-sticky-summary .cart-sticky-tab,
    #cartStickyMinimize,
    #cartStickyExpand,
    #cartStickyExpanded {
        display: none !important;
    }
    .cart-sticky-collapsed { padding: 10px 14px !important; }
    .cart-sticky-collapsed > .d-flex { align-items: center !important; }
    .cart-sticky-collapsed .d-flex.gap-2 {
        flex-direction: row !important;
        width: auto !important;
    }
    .cart-sticky-count { font-size: 12.5px !important; }
    .cart-sticky-total { font-size: 17px !important; }
    #openCartModalBtn {
        font-size: 15px !important;
        font-weight: 600;
        padding: 10px 16px !important;
        border-radius: 12px !important;
        width: auto !important;
    }
    #openCartModalBtn::after { content: " View cart"; }

    /* ---- Cart: full-screen sheet ---- */
    #cartModal .modal-dialog {
        margin: 0 !important;
        max-width: none !important;
        width: 100% !important;
        height: 100%;
        min-height: 100%;
        align-items: stretch;
    }
    #cartModal .modal-content {
        margin: 0 !important;
        border-radius: 0 !important;
        min-height: 100dvh;
        max-height: 100dvh;
    }
    body:has(#mpgs-test-mode-indicator) #cartModal .modal-content,
    body:has(#mpgs-test-mode-indicator) #addOnStep .aos-card {
        padding-top: 26px;
    }
    #cartModal .modal-header { padding: 10px 14px !important; }
    #cartModal .modal-title { font-size: 17px !important; }
    #cartModal .modal-body { padding: 10px 14px !important; }
    #cartModal .cart-hold-notice { display: none !important; }
    .cart-price-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    .cart-price-bar .form-select { width: auto !important; }
    .cart-price-bar .form-check { align-items: center; gap: 8px; } /* the theme drops the switch's left padding here, so drop its -2.5em pull too */
    .cart-price-bar .form-check-input { margin: 0 !important; flex: none; }

    .cart-item { padding: 10px 12px !important; }
    .cart-item-image img,
    .cart-item-image {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px;
    }
    .cart-item-title {
        font-size: 15px !important;
        letter-spacing: normal !important;
        text-transform: none !important;
        line-height: 1.3;
    }
    .cart-item-meta .d-flex { gap: 4px !important; }
    .cart-item-meta .d-flex > span {
        font-size: 12px;
        background: var(--background-secondary, #f5f4f3);
        color: var(--text-secondary, #605e5c);
        border-radius: 6px;
        padding: 2px 6px;
        white-space: nowrap;
    }
    .cart-item-meta .text-muted { font-size: 12.5px !important; }
    .cart-item .price-amount { font-size: 16px !important; }
    .cart-item .price-breakdown { font-size: 12px !important; }
    .cart-item-links button { font-size: 13.5px !important; }

    /* Footer: Villas / Extras / Tax / Total, then a full-width button */
    #cartFooter { padding: 10px 14px 14px !important; }
    #cartItemsCount,
    #cartBreakdownText { display: none !important; }
    #cartFooter .small,
    #cartSubtotalBeforeTax,
    #cartTaxAmount,
    #cartExtrasRow .text-muted {
        font-size: 13.5px !important;
    }
    #cartFooter .pt-3.border-top {
        display: grid !important;
        grid-template-columns: 1fr auto;
        align-items: baseline;
        gap: 2px 8px !important;
        padding-top: 8px !important;
    }
    #cartFooter .pt-3.border-top > .d-flex { display: contents !important; }
    #cartFooter .pt-3.border-top > .d-flex > div { text-align: right !important; }
    #cartFooter .h5 { font-size: 17px !important; margin: 0 !important; }
    #cartSubtotal {
        font-size: 20px !important;
        text-shadow: none !important;
        color: var(--text-primary, #323130) !important;
    }
    #cartTotalConverted { font-size: 12px !important; }
    #proceedToCheckout {
        grid-column: 1 / -1;
        width: 100%;
        min-height: 48px;
        margin-top: 8px;
        font-size: 15px !important;
        border-radius: 12px !important;
    }

    /* ---- Extras step: full-screen sheet ---- */
    #addOnStep { padding: 0 !important; align-items: stretch !important; }
    #addOnStep .aos-card {
        max-width: none !important;
        max-height: none !important;
        height: 100dvh;
        border-radius: 0 !important;
    }
    #addOnStep header,
    #addOnStep footer { padding: 10px 14px !important; }
    #addOnStep header h5 { font-size: 17px; }
    #addOnStepBody { padding: 10px 14px !important; }
    .aos-sethead { flex-wrap: wrap; }
    .aos-sethead b { font-size: 15px; }
    .aos-addon { padding: 10px 12px !important; }
    .aos-info { flex-basis: 100% !important; }
    .aos-ctrl {
        justify-content: flex-start !important;
        width: 100%;
        gap: 10px !important;
    }
    .aos-line { margin-left: auto; min-width: 0 !important; }
    #addOnStep footer > .d-flex { width: 100%; }
    #addOnStepBack { flex: 0 0 96px; }
    #addOnStepNext { flex: 1 1 auto; min-height: 46px; }
}
