/* ==========================================================================
   Buy Now / variant picker modal
   --------------------------------------------------------------------------
   One accent drives the modal, the product cards and the checkout. Change
   --brand-accent alone to reskin all three (e.g. back to the logo navy
   #15204E).
   ========================================================================== */
:root {
    --brand-accent: #0B4DA2;
    --brand-accent-dark: #093F86;

    --bn-accent: var(--brand-accent);
    --bn-media-bg: #F0F5FC;
    --bn-ink: #16203A;
    --bn-muted: #7B8499;
    --bn-line: #E4E9F2;
    --bn-chip: #EDF1F8;
    --bn-radius: 16px;
}

/* ---- shell -------------------------------------------------------------- */
#variable-modal { display: none; }
#variable-modal.show {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100001;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* #page-overlay is z-index 9999 and sits AFTER this element in the DOM, so
       anything <= 9999 gets painted over by it and the modal looks like it
       never opened. Stay above it. */
    background: rgba(12, 18, 38, .5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    overflow-y: auto;
}
/* style.css styles .modal-view as its own fixed, padded, white box — undo all
   of that here so the modal is not wrapped in a second panel. */
#variable-modal.show .modal-view {
    position: static;
    width: 100%;
    max-width: 680px;
    margin: auto;
    transform: none;
    background: transparent;
    padding: 0;
    border: 0;
    border-radius: 0;
    z-index: auto;
    top: auto;
    left: auto;
}

.buynow-modal {
    position: relative;
    background: #fff;
    border-radius: var(--bn-radius);
    box-shadow: 0 30px 70px -25px rgba(10, 16, 40, .5);
    overflow: hidden;
    animation: bnPop .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes bnPop {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

/* ---- close -------------------------------------------------------------- */
/* style.css draws the cross with span::before/::after on the first span and
   hides the second, so override that shape rather than fight it. */
.buynow-modal .close-variable-button {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 3;
    width: 32px; height: 32px;
    padding: 0;
    border: 0; border-radius: 50%;
    background: #EFF2F8;
    cursor: pointer;
    transition: background .16s, transform .16s;
}
.buynow-modal .close-variable-button:hover { background: #DDE4EF; transform: rotate(90deg); }
.buynow-modal .close-variable-button span {
    position: relative;
    display: block;
    width: 32px; height: 32px;
    border-radius: 50%;
    background-color: transparent;
}
.buynow-modal .close-variable-button span:last-child { display: none; }
.buynow-modal .close-variable-button span::before,
.buynow-modal .close-variable-button span::after {
    content: '';
    position: absolute;
    height: 2px; width: 14px;
    border-radius: 2px;
    background-color: var(--bn-ink);
    top: 15px; left: 9px;
}
.buynow-modal .close-variable-button span::before { transform: rotate(45deg); }
.buynow-modal .close-variable-button span::after  { transform: rotate(-45deg); }

/* ---- layout ------------------------------------------------------------- */
.buynow-grid { display: grid; grid-template-columns: 200px 1fr; }

.buynow-media {
    background: #f0f7ff;
    padding: 20px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #ededed;
}
.buynow-media img {
    width: 100%;
    /* style.css sets a global img{height:100%}, which defeats aspect-ratio */
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: top center;
    border-radius: 10px;
    background: #fff;
    transition: opacity .18s;
}
.buynow-media img.bn-swap { opacity: .35; }

.buynow-body { padding: 26px 26px 24px; min-width: 0;  background: #f4faff;}

/* ---- type --------------------------------------------------------------- */
.buynow-title {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -.012em;
    color: var(--bn-ink);
    margin: 0 40px 9px 0;
}
.buynow-price { display: flex; align-items: baseline; gap: 9px; margin: 0 0 6px; flex-wrap: wrap; }
.bn-new { font-size: 21px; font-weight: 700; color: var(--bn-accent); letter-spacing: -.02em; }
.bn-old { font-size: 13.5px; color: #9AA3B8; }

/* ---- rows --------------------------------------------------------------- */
.buynow-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 15px 0;
    border-top: 1px solid var(--bn-line);
    margin-top: 14px;
}
.buynow-row:first-of-type { margin-top: 16px; }
.buynow-label {
    flex: 0 0 92px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .085em;
    text-transform: uppercase;
    color: var(--bn-muted);
}
.bn-row-options { align-items: flex-start; }
.bn-row-options .buynow-label { padding-top: 9px; }
.buynow-chips { display: flex; flex-wrap: wrap; gap: 10px; flex: 1; min-width: 0; }

/* ---- option chips ------------------------------------------------------- */
.buynow-chips .selector-item { position: relative; margin: 0; border: 3px solid #e4e8ef;
    padding: calc(0.25rem * .5);     min-width: 48px;     border-radius: 8px;}
.buynow-chips .selector-item_radio {
    position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.buynow-chips .selector-item_label {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 46px;
    padding: 6px 14px;
    margin: 0;
    cursor: pointer;
    border: 0px solid #e4e8ef;
    border-radius: 5px;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: #23324F;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
    user-select: none;
    line-height: 1.25;
}
.buynow-chips .selector-item_label:hover { background: #023ea1;
    color: #fff; }
.buynow-chips .selector-item_radio:checked + .selector-item_label {
    background: var(--bn-accent);
    border-color: var(--bn-accent);
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(11, 77, 162, .9);
}
.buynow-chips .selector-item_radio:focus-visible + .selector-item_label {
    outline: 2px solid var(--bn-accent); outline-offset: 2px;
}

/* ---- quantity ----------------------------------------------------------- */
.buynow-qty {
    display: inline-flex; align-items: center;
    border: 1.5px solid var(--bn-line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.bn-qty-btn {
    width: 44px; height: 40px;
    border: 0; background: #fff; color: var(--bn-ink);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.bn-qty-btn:hover:not(:disabled) { background: #F1F4FA; color: var(--bn-accent); }
.bn-qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.bn-qty-input {
    width: 54px; height: 40px;
    border: 0;
    border-left: 1.5px solid var(--bn-line);
    border-right: 1.5px solid var(--bn-line);
    text-align: center;
    font-size: 15px; font-weight: 700; color: var(--bn-ink);
    background: #fff;
    -moz-appearance: textfield;
}
.bn-qty-input:focus { outline: none; background: #FAFBFE; }
.bn-qty-input::-webkit-outer-spin-button,
.bn-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.buynow-stock { font-size: 12.5px; color: var(--bn-muted); font-weight: 500; }
.buynow-stock.bn-low { color: #C0392B; font-weight: 600; }

/* ---- cta ---------------------------------------------------------------- */
.buynow-modal .buynow-cta,
.buynow-cta {
    width: 100%;
    margin-top: 20px;
    height: 48px;
    border: 0; border-radius: 9px;
    cursor: pointer;
    background: var(--bn-accent);
    color: #fff;
    font-size: 13.5px; font-weight: 700; letter-spacing: .07em;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: background .16s, transform .16s, box-shadow .16s;
    box-shadow: 0 14px 30px -14px rgba(11, 77, 162, .75);
}
.buynow-cta:hover:not(:disabled) { background: var(--brand-accent-dark); transform: translateY(-1px); }
.buynow-cta:active:not(:disabled) { transform: translateY(0); }
.buynow-cta:disabled {
    background: #C9D0DF; color: #fff; cursor: not-allowed; box-shadow: none; transform: none;
}
.buynow-cta.bn-loading { pointer-events: none; opacity: .75; }

.buynow-hint { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--bn-muted); }
.buynow-hint.bn-error { color: #C0392B; font-weight: 600; }
.buynow-hint.bn-ready { display: none; }

.auth-alert, .auth-status { display: none; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 640px) {
    #variable-modal.show { padding: 0; align-items: flex-end; }
    #variable-modal.show .modal-view { max-width: 100%; }
    .buynow-modal { border-radius: 18px 18px 0 0; max-height: 94vh; overflow-y: auto; }
    .buynow-grid { grid-template-columns: 1fr; }
    .buynow-media { padding: 20px 20px 0; background: #fff; }
    .buynow-media img { aspect-ratio: 3 / 4; height: auto; max-height: 230px; width: auto; margin: 0 auto; }
    .buynow-body { padding: 18px 20px 24px; }
    .buynow-title { font-size: 17px; margin-right: 38px; }
    .bn-new { font-size: 19px; }
    .buynow-label { flex-basis: 100%; margin-bottom: -6px; }
    .bn-row-options .buynow-label { padding-top: 0; }
    .buynow-cta { height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
    .buynow-modal { animation: none; }
    .buynow-close:hover { transform: none; }
}


