/*
 * Booking box of the listings, and the totals of the cart and checkout. Ported from Mayan Agensea (same Brikk 3.3.1
 * and Routiz 3.3.1 stack): the booking calendar rules of its i18n/plugin/frontend.css and its
 * mayan-booking-skeleton.css, with the lrr- prefix. Loaded by functions.php on listings, cart and checkout.
 */

/* ---------------------------------------------------------------------------------------------------------------
 * Booking calendar: the nightly amount stays below each day number. Routiz squares each day with padding-top: 100%
 * and centres the number absolutely, so the price that Brikk adds below covered the number of the selected days.
 * ------------------------------------------------------------------------------------------------------------ */
.rz-calendar-booking .rz-calendar .rz-calendar-month .rz-days,
.rz-calendar-booking .rz-calendar .rz-calendar-month .rz-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}
.rz-calendar-booking .rz-calendar .rz-calendar-month .rz-days > li {
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
}
.rz-calendar-booking .rz-calendar .rz-calendar-month .rz-days > li > span {
    height: 26px;
    padding: 0;
    gap: 0;
    align-items: center;
    justify-content: center;
    line-height: 26px;
}
.rz-calendar-booking .rz-calendar .rz-calendar-month .rz-days > li > span > i {
    position: static;
    transform: none;
    line-height: inherit;
}
.rz-calendar-booking .rz-calendar .rz-calendar-month .rz-days > li > .cal-price {
    /* Keep the price above Routiz's selected-range background (z-index: 1). */
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 0 0 4px;
    /* Brikk marks its 10px price rule important too. */
    font-size: 9px !important;
    letter-spacing: -0.15px;
    line-height: 12px;
}
.rz-calendar-booking .rz-calendar .cal-price > .rz--amount,
.rz-calendar-booking .rz-calendar .cal-price > .rz--currency {
    /* Brikk forces every price span inline with !important. */
    display: block !important;
    position: static;
    height: auto;
    padding: 0;
    border-radius: 0;
    white-space: nowrap;
    line-height: 12px;
}
/* Continue the selected-day background through the price's bottom padding. */
.rz-calendar-booking .rz-calendar .rz-calendar-month .rz-days > li.rz--from-day > .cal-price,
.rz-calendar-booking .rz-calendar .rz-calendar-month .rz-days > li.rz--to-day > .cal-price {
    background: linear-gradient(90deg, var(--main), var(--main-shade));
    color: #fff;
}

/* ---------------------------------------------------------------------------------------------------------------
 * Placeholders while Routiz recalculates the quote (and WooCommerce the totals): the box keeps its height, so the
 * reservation button does not jump while the dates change.
 * ------------------------------------------------------------------------------------------------------------ */
:root {
    --lrr-skeleton-base: #ebe8e1;
    --lrr-skeleton-light: #f6f4ef;
}
.lrr-skeleton {
    background-color: var(--lrr-skeleton-base);
    background-image: linear-gradient(115deg, var(--lrr-skeleton-base) 25%, var(--lrr-skeleton-light) 48%, var(--lrr-skeleton-base) 72%);
    background-size: 240% 100%;
}
@media (prefers-reduced-motion: no-preference) {
    .lrr-skeleton {
        animation: lrr-skeleton-sweep 1.8s ease-in-out infinite;
    }
    @keyframes lrr-skeleton-sweep {
        from { background-position: 110% 0; }
        to { background-position: -80% 0; }
    }
}

[data-lrr-booking-loading="quote"],
[data-lrr-booking-loading="slots"] {
    min-height: var(--lrr-quote-height);
}

.lrr-booking-placeholder {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(3.5rem, 22%);
    align-content: center;
    gap: 12px 16px;
    min-height: 54px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    pointer-events: none;
}
.lrr-booking-placeholder > .lrr-skeleton {
    display: block;
    height: .8em;
    width: 100%;
    border-radius: .3em;
}
.lrr-booking-placeholder > :first-child { width: 54%; }
.lrr-booking-placeholder > :nth-child(3) { width: 36%; }

[data-lrr-booking-loading="slots"]:has(> .lrr-booking-placeholder) > :not(.lrr-booking-placeholder) {
    display: none;
}

[data-lrr-booking-loading="reviews"] > .lrr-booking-placeholder {
    grid-template-columns: 1fr;
    gap: 9px;
    padding-block: 14px;
}
[data-lrr-booking-loading="reviews"] > .lrr-booking-placeholder > :first-child { width: 28%; }
[data-lrr-booking-loading="reviews"] > .lrr-booking-placeholder > :nth-child(3) { width: 78%; }
[data-lrr-booking-loading="reviews"] > .lrr-booking-placeholder > :last-child { display: none; }

[data-lrr-booking-loading="amounts"] td .woocommerce-Price-amount:has(> .lrr-amount-placeholder) {
    display: inline-block;
    position: relative;
    color: transparent;
}
[data-lrr-booking-loading="amounts"] .woocommerce-Price-amount:has(> .lrr-amount-placeholder) > :not(.lrr-amount-placeholder) {
    opacity: 0;
}
.lrr-amount-placeholder {
    position: absolute;
    inset: 12% 0;
    border-radius: .3em;
    pointer-events: none;
}
/* WooCommerce keeps the fragment blocked while replacing it. Let its labels stay readable. */
[data-lrr-booking-loading="amounts"]:has(.lrr-amount-placeholder) > .blockOverlay {
    opacity: 0 !important;
}

/* Keep the reservation button in reach while the mobile drawer fills in the quote. */
@media (max-width: 767px) {
    .routiz .rz-single .rz-sidebar.rz-mobile-visible .rz-single-sidebar:has(.rz-mod-action[data-type="booking"]) {
        padding-bottom: calc(68px + env(safe-area-inset-bottom));
        scroll-padding-bottom: calc(68px + env(safe-area-inset-bottom));
    }
    .rz-sidebar.rz-mobile-visible .rz-mod-action[data-type="booking"] .rz-action-footer {
        position: fixed;
        inset: auto 0 0;
        z-index: 2;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        background: white;
        border-top: 1px solid rgba(0, 0, 0, .1);
    }
    .rz-sidebar.rz-mobile-visible .rz-mod-action[data-type="booking"] .rz-action-footer > .rz-button {
        width: 100%;
        max-width: 400px;
        min-height: 44px;
    }
}
