/**
 * BeautyConnection — Variations Modal (Preturi page)
 *
 * Modal shell only — overlay, dialog box, header, close button, scroll
 * behavior. Card styles inside the modal come from variable-cards.css
 * (descendant selectors of the shared #bc-variable-cards parent ID).
 */

/* Modal root — full viewport, hidden by default via the [hidden] attribute. */
.bc-var-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.bc-var-modal[hidden] {
    display: none;
}

/* Backdrop (separate clickable layer behind the dialog). */
.bc-var-modal__overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.6);
    cursor: pointer;
}

/* Dialog box — centered card. Internal scroll lives on .bc-var-modal__body
   so the header and (eventually) any sticky footer stay in place. */
.bc-var-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 720px;
    max-height: calc( 100vh - 100px);
    background: #fff;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    box-sizing: border-box;
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

@media (max-width: 767px) {
    .bc-var-modal {
        padding: 0;
    }

    .bc-var-modal__dialog {
        max-width: 94%;
        max-height: calc(90vh - 80px);
        height: 100%;
        border-radius: 20px;
        margin-top: 10px;
    }
}

/* Header — fixed top row of the dialog (close button + title).
   position:relative + z-index lets the box-shadow paint over the
   scrolling body content below. */
.bc-var-modal__header {
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Scrollable body — the form lives here and gets its own vertical scroll. */
.bc-var-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 32px 24px;
}

@media (max-width: 767px) {
    .bc-var-modal__header {
        padding: 16px;
    }

    .bc-var-modal__body {
        padding: 0 16px 24px;
    }
}

/* Title — same Prata serif treatment as the rest of the brand. */
.bc-var-modal__title {
    font-family: var(--bc-font-heading);
    font-weight: 400;
    line-height: 1.2;
    color: var(--bc-black);
    margin: 0;
    font-size: 22px !important;
    flex: 1 1 auto;
    min-width: 0;
}
#bc-variable-cards p.bc-var-attribute__label {
    font-size: 18px !important;
    font-family: var(--bc-font-body);
    margin: 15px 0;
}

.bc-var-modal .bc-var-attribute {
    margin-bottom: 20px !important;
}
.bc-var-modal .reset_variations.bc-var-reset {
    display: none !important;
}

/* Close button — sits at the right end of the sticky header. */
.bc-var-modal__close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: 0;
    border-radius: 50%;
    color: var(--bc-black) !important;
    cursor: pointer;
    padding: 0 !important;
    transition: background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.bc-var-modal__close:hover,
.bc-var-modal__close:focus-visible {
    background: rgba(10, 10, 10, 0.06);
    outline: none;
}

/* Body scroll lock applied by JS when a modal is open. */
body.bc-var-modal-open {
    overflow: hidden;
}

/* Variations form inside the modal — strip top margin from the cloned
   card form so the title sits flush above the cards. variable-cards.css
   adds 48px bottom margin to .bc-var-attribute which we keep. */
.bc-var-modal .bc-variations-form {
    margin: 0;
}

/* Add-to-cart button — mirrors `#bc-variable-cards .single_add_to_cart_button`
   from variable-cards.css so the modal CTA matches the single product page,
   without needing the WC class names that attract slow click handlers. */
.bc-var-modal__add-to-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    padding: 20px 36px !important;
    background: #0A0A0A !important;
    color: #FFFFFF;
    border: none;
    border-radius: 100px;
    font-size: 24px !important;
    font-weight: 700 !important;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    height: auto !important;
}

.bc-var-modal__add-to-cart:hover:not(:disabled),
.bc-var-modal__add-to-cart:focus-visible:not(:disabled) {
    background: #2a2a2a;
    outline: none;
}

.bc-var-modal__add-to-cart:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .bc-var-modal__add-to-cart {
        font-size: 18px;
        padding: 16px 28px;
    }
}

.bc-var-modal__add-to-cart.is-loading {
    opacity: 0.7;
    cursor: progress;
}

/* Selected-variation total — appears above the add-to-cart button once a
   variation is matched. JS toggles the [hidden] attribute. */
.bc-var-modal__total {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 16px;
    font-family: var(--bc-font-body);
    color: var(--bc-black);
}

.bc-var-modal__total[hidden] {
    display: none;
}

.bc-var-modal__total-label {
    font-size: 18px;
    font-weight: 500;
}

.bc-var-modal__total-amount {
    font-size: 24px;
    font-weight: 700;
}

.bc-var-modal__total-suffix {
    font-size: 18px;
    font-weight: 500;
}

/* Inline error message below the cards, above the add-to-cart button. */
.bc-var-modal__error {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(235, 0, 86, 0.08);
    color: #EB0056;
    font-family: var(--bc-font-body);
    font-size: 14px;
    line-height: 1.4;
}

.bc-var-modal__error[hidden] {
    display: none;
}
