/* An explicit `display` on a class beats the UA stylesheet's
   [hidden] { display: none }, so setting el.hidden in JS was being silently
   ignored on .bundle-modal__totals (display: flex) -- the summary kept showing
   a stale "2 items - $34" after everything was deselected. Scoped so it cannot
   affect anything outside these components. */
.bundle-modal [hidden],
.bundle-bar [hidden],
.bundle-bar[hidden] {
    display: none !important;
}

/* Bundle selection.
   The detail page contributes ONE line (.bundle-prompt); everything else lives
   in a modal, so the page never changes height. The seller-profile bar below
   still uses the inline card styles. */

/* Reads as a link, not a control: muted blue at rest with NO underline, fully
   underlined on hover. #0061a1 is the blue this page already uses for the
   watchlist control beside Buy Now. */
.bundle-prompt {
    /* Keep this independently adjustable from the CTA row's own gap. */
    --bundle-prompt-inline-inset: 2px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
    width: calc(
        100% - var(--bundle-prompt-inline-inset) - var(--bundle-prompt-inline-inset)
    );
    padding: 4px 10px;
    background: #f7f9fb;
    border: 1px solid #dfe3e8;
    border-radius: 5px;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
    color: #0061a1;
    text-align: left;
    cursor: pointer;
    margin-top: 16px;
    margin-bottom: -6px;
    margin-inline: var(--bundle-prompt-inline-inset);
}

.bundle-prompt:hover .bundle-prompt__text,
.bundle-prompt:focus-visible .bundle-prompt__text {
    text-decoration: underline;
}

/* The upcoming-item watchlist strip reuses this line; once saved it is a
   confirmation, not a control. */
.bundle-prompt.upcoming-watch-prompt:disabled {
    color: #444;
    cursor: default;
}

.bundle-prompt.upcoming-watch-prompt:disabled .bundle-prompt__text {
    text-decoration: none;
}

.bundle-prompt__content {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.bundle-prompt__icon {
    flex: 0 0 auto;
}

/* The element after the prompt is an EMPTY <h3 class="customHeaders"> used as a
   spacer, worth ~35px of padding, line box and margin. Collapse it only when it
   follows the prompt: that h3 renders on every item page, so an unscoped
   :empty rule would reflow listings with no bundle prompt at all. */
.bundle-prompt + .customHeaders {
    padding-top: 0;
    margin-bottom: 0;
    font-size: 0;
    line-height: 0;
}

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

.bundle-modal__dialog {
    max-width: 640px;
    width: min(640px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
}

/* Edge to edge: .detail-modal__body carries 26px side padding, which left the
   grid floating inside the dialog. The grid IS the body here. */
.bundle-modal__body {
    padding: 0;
}

/* Grid rather than a horizontal scroller: the inline row clipped its last
   card, and vertical is the natural scroll direction inside a dialog. */
/* One continuous grid, not a set of floating cards: no gap, no per-card radius,
   shared hairlines. Cells butt together so the eye reads a table of choices. */
.bundle-modal__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid #e6e9ed;
}

.bundle-modal__cell {
    display: flex;
    align-items: stretch;
    min-width: 0;
}

/*
 * NO height: 100% here.
 *
 * It was the cause of the overlapping grid: inside a grid item the row height
 * is derived from the card's content, while the card asked for a percentage of
 * that row. The content contribution goes indefinite, the cell under-sizes, and
 * every card spilled 26px past its cell into the row below.
 *
 * Height is now uniform by construction instead -- one line of title, one line
 * of meta -- so rows cannot go ragged in the first place.
 */
.bundle-modal__card {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 14px;
    border: 0;
    border-right: 1px solid #e6e9ed;
    border-bottom: 1px solid #e6e9ed;
    border-radius: 0;
    background: #fff;
    cursor: pointer;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}

.bundle-modal__card:hover {
    background: #f7f9fb;
}

/* An inset ring rather than a border: with no gap between cells a border would
   shift its neighbours by a pixel as selection changes. */
.bundle-modal__card:has(.bundle-modal__checkbox:checked) {
    background: #f2f7ff;
    box-shadow: inset 0 0 0 1px #0b63ce;
}

.bundle-modal__card--unavailable {
    opacity: 0.45;
    cursor: not-allowed;
}

.bundle-modal__checkbox {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #0b63ce;
}

.bundle-modal__thumb {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: #eef1f4;
}

.bundle-modal__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bundle-modal__meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    flex: 1 1 auto;
}

/* The badge must sit OUTSIDE the truncating span, or the title's ellipsis
   clips it away entirely -- which is what happened when it was inline. */
.bundle-modal__title-row {
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Single line, always. A wrapping title was what made the rows uneven. */
.bundle-modal__title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bundle-modal__price {
    display: block;
    font-size: 12px;
    line-height: 1.35;
    color: #5c6470;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bundle-modal__dot {
    color: #a8b0ba;
}

.bundle-modal__condition {
    color: #6b7480;
}

/* Inline on the title row, so the anchor card is the same height as the rest. */
.bundle-modal__badge {
    flex: 0 0 auto;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: #eef3fb;
    color: #0b63ce;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.bundle-modal__notice {
    margin: 0;
    padding: 10px 14px 0;
    font-size: 13px;
    color: #8a5300;
}

/* The scroll arrows scroll the DIALOG, not an inner body, so without this the
   CTA would scroll out of view. Mirrors .detail-modal__header, which is already
   sticky at the top. */
.bundle-modal__footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 12px 20px 16px;
    border-top: 1px solid #e2e5e9;
    background: #fff;
}

/* Keep the down arrow clear of the sticky footer. */
.bundle-modal__scroll-down {
    bottom: var(--bundle-modal-footer-h, 96px);
}

.bundle-modal__totals {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 15px;
    font-weight: 700;
}

.bundle-modal__savings {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #1a7f3c;
}

.bundle-modal__hint {
    margin: 4px 0 0;
    font-size: 13px;
    color: #5c6470;
}

/* Deliberately a copy of .checkout-confirm (checkout.css), not a reference to
   it: the item detail page does not load checkout.css, and pulling the whole
   checkout stylesheet onto it to share one button would be the wrong trade.
   Every value here must stay in step with that rule -- including the
   -webkit-text-stroke, which is what the checkout CTA uses in place of
   font-weight. */
.bundle-modal__cta {
    width: 100%;
    margin-top: 10px;
    /* Between .buy-button and .checkout-confirm: same blue, tighter box than
       the checkout slab, but with enough height to carry a full-width CTA. */
    padding: 10px 16px;
    border: none;
    border-radius: 999px;
    background-color: #007acd;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    -webkit-text-stroke: 0.8px rgba(255, 255, 255, 0.8);
}

.bundle-modal__cta:hover {
    background-color: #35a0e7;
}

.bundle-modal__cta:disabled {
    background-color: #c6c6c6;
    cursor: not-allowed;
    -webkit-text-stroke: 0;
}

@media (max-width: 600px) {
    .bundle-modal__grid { grid-template-columns: 1fr; }
}

/* Seller-profile controls mirror Watchlist Compare. Keep these values in sync
   with watchlist-compare.css without loading its tray/page rules here. */
.seller-profile-page .media-slider:has(.bundle-select) { position: relative; }

.seller-profile-page .listing.is-bundle-selected {
    border-color: #b3deff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.seller-profile-page .bundle-select {
    white-space: nowrap;
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 11;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 26px;
    padding: 3px 10px;
    border: 1px solid #7a8794;
    border-radius: 999px;
    background: #ffffff;
    color: #263746;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateX(-50%);
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.seller-profile-page .bundle-select:hover {
    border-color: #003660;
    background: #edf6fc;
    color: #003660;
}

.seller-profile-page .media-slider:has(.item-selling-deadline-label) .bundle-select {
    top: 34px;
}

.seller-profile-page .bundle-select.is-selected {
    border-color: #003660;
    background: #dceefa;
    color: #003660;
}

.seller-profile-page .bundle-select i[hidden] {
    display: none;
}

.seller-profile-page .bundle-select:focus-visible,
.bundle-bar button:focus-visible {
    outline: 3px solid rgba(0, 93, 153, 0.35);
    outline-offset: 2px;
}

body.seller-profile-body.seller-bundle-bar-visible .seller-profile-page {
    padding-bottom: var(--seller-bundle-bar-space, 180px);
}

.seller-profile-page .bundle-select:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.bundle-bar {
    box-sizing: border-box;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--seller-bundle-footer-lift, 0px));
    z-index: 60;
    width: min(560px, calc(100% - 24px));
    padding: 12px 16px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #dfe3e8;
    box-shadow: 0 6px 24px rgba(16, 24, 40, 0.16);
}

.bundle-bar__totals {
    gap: 12px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 15px;
    font-weight: 700;
}

.bundle-bar__savings {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #1a7f3c;
}

.bundle-bar__notice {
    margin: 4px 0 0;
    font-size: 13px;
    color: #8a5300;
}

.bundle-bar__total {
    margin-left: auto;
}

.bundle-strip__clear,
.bundle-bar__retry {
    border: 0;
    padding: 4px 0;
    background: transparent;
    color: #0061a1;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}
