/**
 * Bundle selector.
 *
 * Colours come from the theme's own tokens so the selector follows any future
 * palette change; the fallbacks keep it legible if the stylesheet load order
 * ever puts this first.
 */

/**
 * Honour the hidden attribute.
 *
 * Both the bar and the modal are laid out with display:flex, and a class
 * selector outranks the browser's own [hidden]{display:none}. Without this the
 * modal is visible on page load and cannot be closed - toggling el.hidden has
 * no visual effect at all.
 */
.rendigo-bundle-bar[hidden],
.rendigo-bundle-modal[hidden] {
    display: none !important;
}

/* ------------------------------------------------------------------ cards */

.rendigo-product-card.is-selected .rendigo-product-card__inner {
    outline: 2px solid var(--color-dark-blue, #002C4F);
    outline-offset: 2px;
    border-radius: inherit;
}

.rendigo-product-card.is-disabled {
    opacity: .45;
    filter: grayscale(1);
    transition: opacity .2s ease, filter .2s ease;
}

.rendigo-product-card.is-disabled .rendigo-product-card__button {
    pointer-events: none;
}

/**
 * Matches .rendigo-product-card__button exactly (full width, 48px, same radius
 * and type) so the two buttons stack as one control, and sits under it.
 */
.rendigo-product-card__select {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 48px;
    margin-top: 8px;
    padding: 12px 16px;
    gap: 8px;
    border: 1px solid var(--color-dark-blue, #002C4F);
    border-radius: 999px;
    background: transparent;
    color: var(--color-dark-blue, #002C4F);
    font-family: inherit;
    font-size: var(--button-font-size, 14px);
    font-weight: var(--button-font-weight, 700);
    line-height: var(--button-line-height, 1.2);
    text-transform: uppercase;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.rendigo-product-card__select:hover:not(:disabled) {
    background: var(--color-dark-blue, #002C4F);
    color: var(--color-white, #fff);
}

/* selected: solid, so it reads as "in the bundle" rather than "clickable" */
.rendigo-product-card__select[aria-pressed="true"] {
    background: var(--color-dark-blue, #002C4F);
    border-color: var(--color-dark-blue, #002C4F);
    color: var(--color-white, #fff);
}

/* hovering a selected one offers removal, so warn with the brand orange */
.rendigo-product-card__select[aria-pressed="true"]:hover:not(:disabled) {
    background: var(--color-orange, #FB5000);
    border-color: var(--color-orange, #FB5000);
    color: var(--color-white, #fff);
}

.rendigo-product-card__select:disabled {
    cursor: not-allowed;
    opacity: .5;
}

/* --- the two label states, animated by the shared .btn-xy ------------------ */

/**
 * Must out-specify the theme's own `.btn-xy__text-wrap { display: inline-flex }`
 * in style.css. That rule is also 0-1-0 and style.css loads AFTER this file, so
 * a bare `.rendigo-product-card__select-state { display: none }` loses and BOTH
 * labels render side by side, each clipped by the wrap.
 */
.rendigo-product-card__select .rendigo-product-card__select-state {
    display: none;
}

/**
 * Grid, not the shared absolute positioning, so the wrap is as wide as the
 * WIDER of the two labels. .btn-xy__text--next is absolutely positioned in
 * style.css, which is fine where both labels are the same word - here
 * "Eemalda toode" is wider than "Valitud" and would be clipped by the wrap's
 * overflow:hidden. Both labels share one grid cell, so the wrap sizes to the
 * widest and the transforms still animate normally.
 */
.rendigo-product-card__select[aria-pressed="false"] .rendigo-product-card__select-state--pick,
.rendigo-product-card__select[aria-pressed="true"]  .rendigo-product-card__select-state--on {
    display: grid;
    align-items: center;
    justify-items: center;
}

.rendigo-product-card__select .btn-xy__text {
    grid-area: 1 / 1;
    white-space: nowrap;
}

.rendigo-product-card__select .btn-xy__text--next {
    position: static;
}

/**
 * Touch: there is no hover, so the animation is switched off and the label that
 * fits the state is simply shown.
 *
 * Unselected -> "Vali toode".  Selected -> "Eemalda toode", NOT "Valitud":
 * without a hover state "Valitud" tells the shopper what is true but not what
 * they can do, leaving no way to discover that tapping again removes it.
 *
 * ⚠️ These MUST out-specify the theme's hover rules. `.btn-xy:hover
 * .btn-xy__text--current` in `style.css` is 0-3-0; a plain
 * `.rendigo-product-card__select .btn-xy__text--current` reset is only 0-2-0 and
 * loses, so after a tap the current label slid out of view while --next was
 * hidden and the button went BLANK until the next tap elsewhere. Chaining
 * `.btn-xy` onto the button class and repeating the pseudo-class takes these to
 * 0-4-0.
 */
@media (hover: none) {
    .rendigo-product-card__select.btn-xy .btn-xy__text--current,
    .rendigo-product-card__select.btn-xy:hover .btn-xy__text--current,
    .rendigo-product-card__select.btn-xy:focus .btn-xy__text--current,
    .rendigo-product-card__select.btn-xy:focus-visible .btn-xy__text--current,
    .rendigo-product-card__select.btn-xy .btn-xy__text--next,
    .rendigo-product-card__select.btn-xy:hover .btn-xy__text--next,
    .rendigo-product-card__select.btn-xy:focus .btn-xy__text--next,
    .rendigo-product-card__select.btn-xy:focus-visible .btn-xy__text--next {
        transform: none;
    }

    /* unselected: "Vali toode" - the second copy exists only to animate */
    .rendigo-product-card__select .rendigo-product-card__select-state--pick .btn-xy__text--next {
        display: none;
    }

    /* selected: show the action, "Eemalda toode", in place of "Valitud" */
    .rendigo-product-card__select .rendigo-product-card__select-state--on .btn-xy__text--current {
        display: none;
    }
}

/* ------------------------------------------------------- bundle KKK ------ */

/**
 * The block's own rule is `.rendigo-faq { padding: 12px 0 48px }`. Doubling the
 * class beats it (0-2-0 vs 0-1-0) whichever stylesheet the browser loads last,
 * and the --bundle modifier keeps the change off every other FAQ block.
 */
.rendigo-faq.rendigo-faq--bundle {
    padding: 48px 0 48px;
}

/* ------------------------------------- product page: back to the bundle --- */

/**
 * Replaces RnB's booking form on a product reached from a bundle card. Same
 * metrics as the theme's primary button, and it borrows .btn-xy for the hover
 * animation so it reads as a normal site button.
 */
.rendigo-bundle-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 48px;
    margin: 8px 0 16px;
    padding: 12px 28px;
    border-radius: 999px;
    background: var(--color-neon-green, #E5EF4F);
    color: var(--color-dark-blue, #002C4F);
    font-size: var(--button-font-size, 14px);
    font-weight: var(--button-font-weight, 700);
    line-height: var(--button-line-height, 1.2);
    text-transform: uppercase;
    text-decoration: none;
}

.rendigo-bundle-back:hover,
.rendigo-bundle-back:focus {
    color: var(--color-dark-blue, #002C4F);
    text-decoration: none;
}

/**
 * Retire the "Broneeri" accordion in bundle context.
 *
 * rendigo-product-details wraps .ct-product-add-to-cart in a collapsible panel
 * from JS, so our button ended up hidden behind a toggle the shopper had to open
 * first. Hiding the toggle and unwrapping the panel leaves the button sitting
 * exactly where "Broneeri" was - no timing race with the script that builds it.
 */
body.rendigo-bundle-context .rendigo-booking-accordion__toggle {
    display: none;
}

body.rendigo-bundle-context .rendigo-booking-accordion__panel,
body.rendigo-bundle-context .rendigo-booking-accordion__panel[hidden] {
    display: block !important;   /* beats the plugin's own [hidden] !important */
    border: 0;
    padding: 0;
    border-radius: 0;
}

body.rendigo-bundle-context .rendigo-booking-accordion {
    margin-top: 24px;
}

/* ...and take over the toggle's exact footprint, so it reads as a replacement */
body.rendigo-bundle-context .rendigo-bundle-back {
    width: 100%;
    justify-content: space-between;
    min-height: 0;
    margin: 0;
    padding: 22px 24px;
    font-size: 18px;
    line-height: 1;
    letter-spacing: 0.02em;
}

/* ------------------------------------------------------------- sticky bar */

.rendigo-bundle-bar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 900;
    background: var(--color-dark-blue, #002C4F);
    color: var(--color-white, #fff);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .18);
}

.rendigo-bundle-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 20px;
}

.rendigo-bundle-bar__status {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.rendigo-bundle-bar__count {
    font-size: 16px;
    font-weight: 600;
}

.rendigo-bundle-bar__dates,
.rendigo-bundle-bar__hint {
    font-size: 14px;
    opacity: .85;
}

.rendigo-bundle-bar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------- buttons */

.rendigo-bundle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: opacity .18s ease, background .18s ease, color .18s ease;
}

.rendigo-bundle-btn--primary {
    background: var(--color-neon-green, #E5EF4F);
    color: var(--color-dark-blue, #002C4F);
}

.rendigo-bundle-btn--ghost {
    background: transparent;
    border-color: currentColor;
    color: inherit;
}

.rendigo-bundle-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------ modal */

body.rendigo-bundle-modal-open {
    overflow: hidden;
}

.rendigo-bundle-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rendigo-bundle-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 20, 40, .55);
}

.rendigo-bundle-modal__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 26px 24px 24px;
    border-radius: 18px;
    background: var(--color-white, #fff);
    color: var(--color-dark-blue, #002C4F);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .3);
}

.rendigo-bundle-modal__x {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.rendigo-bundle-modal__x:hover {
    background: var(--color-gray, #F3F1EF);
}

.rendigo-bundle-modal__title {
    margin: 0 0 18px;
    font-size: 20px;
    font-weight: 600;
}

.rendigo-bundle-modal__foot {
    margin-top: 18px;
}

.rendigo-bundle-modal__foot .rendigo-bundle-btn {
    width: 100%;
}

/* --------------------------------------------------------------- calendar */

.rendigo-bundle-cal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.rendigo-bundle-cal__label {
    font-size: 15px;
    font-weight: 600;
}

.rendigo-bundle-cal__nav {
    width: 32px;
    height: 32px;
    border: 1px solid var(--color-lighter-gray, #CCD6D5);
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.rendigo-bundle-cal__nav:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.rendigo-bundle-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.rendigo-bundle-cal__wd {
    padding: 4px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    opacity: .6;
}

.rendigo-bundle-cal__day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: var(--color-gray, #F3F1EF);
    color: inherit;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.rendigo-bundle-cal__day:hover:not(:disabled) {
    background: var(--color-lighter-gray, #CCD6D5);
}

.rendigo-bundle-cal__day:disabled {
    background: transparent;
    color: var(--color-lighter-gray, #CCD6D5);
    text-decoration: line-through;
    cursor: not-allowed;
}

.rendigo-bundle-cal__day.is-between {
    background: var(--color-neon-green, #E5EF4F);
    opacity: .5;
}

.rendigo-bundle-cal__day.is-start,
.rendigo-bundle-cal__day.is-end {
    background: var(--color-dark-blue, #002C4F);
    color: var(--color-white, #fff);
    font-weight: 600;
}

/* ----------------------------------------------------------------- fields */

.rendigo-bundle-fields {
    margin-top: 16px;
    display: grid;
    gap: 8px;
}

.rendigo-bundle-field {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--color-gray, #F3F1EF);
}

.rendigo-bundle-field__label {
    font-size: 13px;
    font-weight: 600;
}

.rendigo-bundle-field__value {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.rendigo-bundle-field__time {
    padding: 5px 8px;
    border: 1px solid var(--color-lighter-gray, #CCD6D5);
    border-radius: 8px;
    background: var(--color-white, #fff);
    font: inherit;
    font-size: 14px;
}

/* ------------------------------------------------------------------ lisad */

.rendigo-bundle-extras {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--color-lighter-gray, #CCD6D5);
}

.rendigo-bundle-extras__title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.rendigo-bundle-extras__hint {
    margin: 0 0 12px;
    font-size: 13px;
    opacity: .7;
}

.rendigo-bundle-extra {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 6px;
    border-radius: 10px;
    background: var(--color-gray, #F3F1EF);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.3;
}

.rendigo-bundle-extra__box {
    width: 18px;
    height: 18px;
    accent-color: var(--color-dark-blue, #002C4F);
    cursor: pointer;
}

.rendigo-bundle-extra__price {
    white-space: nowrap;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.rendigo-bundle-extra__qty {
    padding: 4px 6px;
    border: 1px solid var(--color-lighter-gray, #CCD6D5);
    border-radius: 8px;
    background: var(--color-white, #fff);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.rendigo-bundle-extras__sum {
    margin-top: 10px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
}

/* ------------------------------------------------------------------ notes */

.rendigo-bundle-note {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--color-gray, #F3F1EF);
    font-size: 14px;
    line-height: 1.45;
}

.rendigo-bundle-note--price {
    background: var(--color-neon-green, #E5EF4F);
    font-weight: 600;
}

.rendigo-bundle-note--warn {
    background: #FFF4E5;
}

.rendigo-bundle-note--error {
    background: #FDE7E3;
    color: #8A2418;
}

/* ----------------------------------------------------------------- mobile */

@media (max-width: 640px) {
    .rendigo-bundle-bar__inner {
        padding: 12px 16px;
        gap: 10px;
    }

    .rendigo-bundle-bar__actions {
        width: 100%;
    }

    .rendigo-bundle-bar__actions .rendigo-bundle-btn {
        flex: 1 1 auto;
    }

    .rendigo-bundle-modal {
        padding: 0;
        align-items: flex-end;
    }

    .rendigo-bundle-modal__panel {
        max-width: none;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }
}
