/* Offer suggestions. Layout sizes itself to the suggestion box (container queries), not the screen.
   Most rules are wrapped in :where() so any custom CSS on these classes overrides them; settings feed in
   through --wcco-s-* variables and empty settings fall back to the theme. */

:where(.wcco-suggest) {
    container-type: inline-size;
    margin: 0 0 16px;
    padding: 14px 16px;
    background: var(--wcco-s-bg, rgba(0, 0, 0, .03));
    color: var(--wcco-s-text, inherit);
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: var(--wcco-s-radius, 8px);
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}
:where(.wcco-suggest[hidden]) { display: none; }

/* The box around product page suggestions: divider, then a background with the heading and the card(s) */
:where(.wcco-offer-box) { margin: var(--wcco-b-above, 20px) 0 0; clear: both; }
:where(.wcco-offer-box[hidden]) { display: none; }
:where(.wcco-offer-box__divider) { border: 0; border-top: var(--wcco-b-divider-size, 1px) solid var(--wcco-b-divider, rgba(0, 0, 0, .15)); margin: 0 0 var(--wcco-b-below, 20px); height: 0; background: none; }
:where(.wcco-offer-box__inner) { background: var(--wcco-b-bg, rgba(0, 0, 0, .06)); border-radius: var(--wcco-b-radius, 20px); padding: var(--wcco-b-padding, 18px); padding-top: var(--wcco-b-pad-top, var(--wcco-b-padding, 18px)); }
:where(.wcco-offer-box__heading) { text-align: var(--wcco-b-heading-align, center); color: var(--wcco-b-heading, inherit); font-size: var(--wcco-b-heading-size, 1.4em); line-height: 1.25; }
/* Theme heading margins (h3) would add space above the heading: set them here, firmly */
.wcco-offer-box .wcco-offer-box__heading { margin: 0 0 var(--wcco-b-heading-gap, 14px); padding: 0; }
:where(.wcco-offer-box .wcco-suggest) { background: var(--wcco-s-bg, #fff); border: 0; margin: 0 0 12px; }
:where(.wcco-offer-box .wcco-suggest:last-child) { margin-bottom: 0; }

/* Two columns: image | details */
:where(.wcco-suggest__inner) {
    display: grid;
    grid-template-columns: clamp(72px, var(--wcco-s-img-w, 35%), 320px) minmax(0, 1fr);
    gap: 12px 18px;
    align-items: stretch;
}
:where(.wcco-suggest__image) { position: relative; min-height: 96px; }
/* The whole picture, sized to its own shape and centred in its column, so the rounded corners sit on the picture.
   Strong enough to beat theme and cart image rules (e.g. the Elementor Cart widget's "table.cart img { width: 55px }"). */
.wcco-suggest .wcco-suggest__inner .wcco-suggest__image img.wcco-suggest__img {
    position: absolute;
    inset: 0;
    display: block;
    margin: auto;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    float: none;
    box-shadow: none;
    border-radius: calc(var(--wcco-s-radius, 8px) / 2);
}

/* Details, centred against the image */
:where(.wcco-suggest__text) { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; line-height: 1.4; }
:where(.wcco-suggest__tag) { align-self: flex-start; font-size: 11px; font-weight: 600; line-height: 1.6; padding: var(--wcco-s-tag-pv, 2px) var(--wcco-s-tag-ph, 9px); border-radius: var(--wcco-s-tag-radius, 4px); background: var(--wcco-s-tag, rgba(0, 0, 0, .08)); color: var(--wcco-s-tag-text, inherit); }
:where(.wcco-suggest__title) { font-weight: 600; font-size: clamp(1em, 3.2cqi, 1.2em); }
:where(.wcco-suggest__contents) { display: flex; flex-direction: column; gap: 1px; font-size: .95em; opacity: .85; }
:where(.wcco-suggest__price) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 2px; font-weight: 600; font-size: 1.05em; }
:where(.wcco-suggest__price del) { font-weight: 400; opacity: .6; font-size: .9em; }
/* Badge inside suggestions: even padding, text centred */
.wcco-suggest .wcco-suggest__badge,
.wcco-pick .wcco-suggest__badge { display: inline-flex; align-items: center; padding: var(--wcco-badge-pv, 3px) var(--wcco-badge-ph, 9px); margin: 0; font-size: .72em; line-height: 1.25; white-space: nowrap; }
/* Browsers that support it trim the font's unused space above capitals and below the baseline, so the text sits exactly in the middle */
@supports (text-box: trim-both cap alphabetic) {
    .wcco-suggest .wcco-suggest__badge,
    .wcco-pick .wcco-suggest__badge { display: block; padding: calc(var(--wcco-badge-pv, 3px) + 2px) var(--wcco-badge-ph, 9px); text-box: trim-both cap alphabetic; }
}
:where(.wcco-suggest__saving) { font-weight: 600; color: #2e7d32; }
:where(.wcco-suggest__button) { margin-top: 10px; width: 100%; white-space: normal; }
:where(.wcco-suggest--btn-auto .wcco-suggest__button) { width: auto; align-self: flex-start; }

/* Compact product layout: image | details | button */
:where(.wcco-suggest--product:not(.wcco-suggest--stacked) .wcco-suggest__inner) { grid-template-columns: clamp(64px, var(--wcco-s-img-w, 20%), 160px) minmax(0, 1fr) auto; align-items: center; }
:where(.wcco-suggest--product:not(.wcco-suggest--stacked) .wcco-suggest__button) { margin-top: 0; width: auto; white-space: nowrap; }
:where(.wcco-suggest--product:not(.wcco-suggest--stacked) .wcco-suggest__contents) { display: block; }

/* Cart: its own full-width row under the cart line (moved there by the script) */
:where(.wcco-suggest--cart) { margin: 0; font-size: .92em; }
:where(.wcco-suggest--cart .wcco-suggest__inner) { grid-template-columns: clamp(64px, var(--wcco-s-img-w, 25%), 200px) minmax(0, 1fr); }
:where(.wcco-suggest--cart .wcco-suggest__text) { display: block; }
:where(.wcco-suggest--cart .wcco-suggest__tag) { display: inline-block; margin-right: 6px; vertical-align: middle; }
:where(.wcco-suggest--cart .wcco-suggest__line) { display: block; margin: 8px 0 0; }
:where(.wcco-suggest--cart .wcco-suggest__actions) { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 14px; }
:where(.wcco-suggest--cart .wcco-suggest__button) { margin-top: 0; width: auto; }
:where(.wcco-suggest__dismiss) { font-size: 12px; opacity: .75; }
tr.wcco-suggest-row > td { padding-top: 0; text-align: left; }
.woocommerce table.shop_table_responsive tr.wcco-suggest-row td::before,
.woocommerce-page table.shop_table_responsive tr.wcco-suggest-row td::before { content: none; display: none; }

/* Narrow boxes (phones, narrow columns): thumbnail beside the tag and title, everything else full width underneath */
@container (max-width: 380px) {
    :where(.wcco-suggest__inner),
    :where(.wcco-suggest--cart .wcco-suggest__inner),
    :where(.wcco-suggest--product:not(.wcco-suggest--stacked) .wcco-suggest__inner) { grid-template-columns: 56px minmax(0, 1fr); gap: 8px 12px; align-items: center; }
    :where(.wcco-suggest__text),
    :where(.wcco-suggest--cart .wcco-suggest__text) { display: contents; }
    :where(.wcco-suggest__image) { grid-column: 1; grid-row: 1 / span 2; width: 56px; height: 56px; min-height: 0; }
    .wcco-suggest .wcco-suggest__inner .wcco-suggest__image img.wcco-suggest__img { border-radius: min(calc(var(--wcco-s-radius, 8px) / 2), 8px); }
    :where(.wcco-suggest__tag) { grid-column: 2; grid-row: 1; align-self: end; justify-self: start; margin: 0; }
    :where(.wcco-suggest__title) { grid-column: 2; grid-row: 2; align-self: start; }
    :where(.wcco-suggest__text:not(:has(.wcco-suggest__tag)) .wcco-suggest__title) { grid-row: 1 / span 2; align-self: center; }
    :where(.wcco-suggest__contents),
    :where(.wcco-suggest__price),
    :where(.wcco-suggest__saving),
    :where(.wcco-suggest__line),
    :where(.wcco-suggest__actions),
    :where(.wcco-suggest__button) { grid-column: 1 / -1; }
    :where(.wcco-suggest__contents),
    :where(.wcco-suggest--cart .wcco-suggest__line) { margin-top: 4px; }
    :where(.wcco-suggest__button),
    :where(.wcco-suggest--product:not(.wcco-suggest--stacked) .wcco-suggest__button),
    :where(.wcco-suggest--cart .wcco-suggest__button) { width: 100%; margin-top: 10px; white-space: normal; }
    :where(.wcco-suggest--cart .wcco-suggest__actions) { flex-direction: column; align-items: stretch; text-align: center; gap: 8px; margin-top: 6px; }
}

/* Option popup */
:where(.wcco-pick) { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; }
:where(.wcco-pick__backdrop) { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
:where(.wcco-pick__dialog) { position: relative; background: #fff; color: #1d2327; border-radius: var(--wcco-s-radius, 8px); padding: 22px 20px 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); text-align: left; }
:where(.wcco-pick__head) { display: grid; grid-template-columns: clamp(80px, 30%, 140px) minmax(0, 1fr); gap: 14px; align-items: center; margin: 0 28px 16px 0; }
:where(.wcco-pick__image) { position: relative; aspect-ratio: 1; }
.wcco-pick .wcco-pick__image img { position: absolute; inset: 0; display: block; margin: auto; width: auto; height: auto; max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: none; }
:where(.wcco-pick__name) { font-size: 1.15em; font-weight: 600; margin: 4px 0; }
:where(.wcco-pick__price) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 1.1em; font-weight: 600; }
:where(.wcco-pick__price del) { opacity: .6; font-weight: 400; font-size: .85em; }
:where(.wcco-pick__line) { margin-bottom: 18px; }
:where(.wcco-pick__line-name) { font-weight: 600; margin-bottom: 8px; }
/* Each option on its own row (themes often make labels inline) */
.wcco-pick .wcco-pick__field { display: block; width: 100%; margin: 0 0 14px; font-size: .9em; }
.wcco-pick .wcco-pick__field:last-of-type { margin-bottom: 4px; }
.wcco-pick .wcco-pick__field select { display: block; width: 100%; max-width: none; margin-top: 4px; }
:where(.wcco-pick__error) { color: #b32d2e; font-size: 12px; }

/* Option buttons (setting "Popup options: Option buttons") */
:where(.wcco-pick__pills) { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.wcco-pick button.wcco-pick__pill {
    display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 12px; min-height: 0;
    background: #fff; color: #1d2327; border: 1px solid #c3c4c7; border-radius: 999px; box-shadow: none;
    font: inherit; font-size: .9em; line-height: 1.3; text-transform: none; letter-spacing: normal; cursor: pointer;
}
.wcco-pick button.wcco-pick__pill:hover { background: #f6f7f7; color: #1d2327; border-color: #8c8f94; }
.wcco-pick button.wcco-pick__pill[aria-pressed="true"] { border-color: #1d2327; box-shadow: inset 0 0 0 1px #1d2327; background: #fff; color: #1d2327; }
.wcco-pick button.wcco-pick__pill:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.wcco-pick .wcco-pick__dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); flex: none; }
.wcco-pick .wcco-pick__swatch-img { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; flex: none; }
.wcco-pick .wcco-pick__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Close (x) and "No thanks": plain controls, not theme buttons */
.wcco-pick button.wcco-pick__x,
.wcco-pick button.wcco-pick__no {
    background: transparent; border: 0; box-shadow: none; border-radius: 0; color: inherit; min-height: 0; width: auto;
    font: inherit; text-transform: none; letter-spacing: normal; cursor: pointer;
}
.wcco-pick button.wcco-pick__x { position: absolute; top: 6px; right: 8px; padding: 6px 10px; font-size: 26px; line-height: 1; opacity: .6; }
.wcco-pick button.wcco-pick__x:hover,
.wcco-pick button.wcco-pick__x:focus { background: transparent; color: inherit; opacity: 1; }
.wcco-pick button.wcco-pick__no { display: block; margin: 10px auto 0; padding: 4px 8px; font-size: .9em; text-decoration: underline; opacity: .75; }
.wcco-pick button.wcco-pick__no:hover,
.wcco-pick button.wcco-pick__no:focus { background: transparent; color: inherit; opacity: 1; }
.wcco-pick button.wcco-pick__confirm { display: block; width: 100%; margin-top: 6px; }

/* Cart: "Includes:" label a little smaller than the product name; the items under it are smaller again */
:where(.woocommerce-cart-form dl.variation dt.variation-Includes, .woocommerce-mini-cart dl.variation dt.variation-Includes) { font-size: calc(1em - 1px); }
