/* ──────────────────────────────────────────────────────────────────────────
   WooYoo Bundles — frontend styles (v1.1.0)

   Principles:
     - Self-contained .wyb-* prefix so no theme collisions.
     - Mobile-first; modal becomes a bottom sheet under 600px.
     - Uses currentColor where possible so the styles read as part of the
       host theme rather than overriding it.
     - No per-product prices anywhere — bundles are fixed-price; only the
       footer total is shown.
   ────────────────────────────────────────────────────────────────────────── */

/* ── Builder root ────────────────────────────────────────────────────── */
.wyb-builder {
    margin: 1rem 0 2rem;
}

/* ── Slot card ──────────────────────────────────────────────────────── */
.wyb-slot {
    background: #fff;
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.wyb-slot__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.wyb-slot__title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.wyb-slot__index {
    flex: 0 0 auto;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #f0f2f5;
    color: #333;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 500;
}
.wyb-slot__label {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wyb-slot__counter {
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    padding: 0.3rem 0.7rem;
    background: #f0f2f5;
    border-radius: 999px;
    white-space: nowrap;
}
.wyb-slot__counter--complete {
    background: #e7f7ec;
    color: #0a7f3a;
}
.wyb-slot__empty {
    color: #888;
    font-style: italic;
    margin: 0;
}

/* ── Device card (single product, slim 80px image) ──────────────────── */
.wyb-device {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 520px) {
    .wyb-device { grid-template-columns: 64px 1fr; gap: 0.75rem; }
}
.wyb-device__image {
    aspect-ratio: 1;
    border-radius: 8px;
    background: #f0f2f5;
    overflow: hidden;
}
.wyb-device__image img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.wyb-device__info { min-width: 0; }
.wyb-device__name {
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 0.6rem;
}

.wyb-device__status {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    padding: 0.4rem 0.7rem;
    background: #f6f7f9;
    border-radius: 6px;
}
.wyb-device__status--oos {
    background: #fdecea;
    color: #c0392b;
}

/* ── Inline pills (non-colour variation attributes) ─────────────────── */
.wyb-pills {
    display: block;
    margin-bottom: 0.75rem;
}
.wyb-pills__label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}
.wyb-pills__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.wyb-pill {
    border: 1px solid #ccd0d5;
    background: #fff;
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
    color: inherit;
    line-height: 1.2;
    font-family: inherit;
}
.wyb-pill:hover { border-color: #0a7f3a; color: #0a7f3a; }
.wyb-pill--active {
    background: #0a7f3a;
    color: #fff;
    border-color: #0a7f3a;
}

/* ── Colour CTA + chosen badge ──────────────────────────────────────── */
.wyb-device__colour {
    margin-top: 0.25rem;
}
.wyb-colour-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease;
    color: inherit;
    font-family: inherit;
}
.wyb-colour-cta:hover { border-color: #0a7f3a; color: #0a7f3a; }
.wyb-colour-cta__chev { color: #888; }

.wyb-colour-chosen {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: #e7f7ec;
    border: 1px solid #c4e8d0;
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    font-size: 0.9rem;
    color: #0a7f3a;
}
.wyb-colour-chosen__thumb {
    width: 28px; height: 28px;
    border-radius: 50%;
    background-color: #f0f2f5;
    background-size: cover;
    background-position: center;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #0a7f3a;
    flex: 0 0 auto;
}
.wyb-colour-chosen__text { color: #0a7f3a; }
.wyb-colour-chosen__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.8;
}
.wyb-colour-chosen__change {
    background: transparent;
    border: 0;
    color: #086b30;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    margin-left: 0.25rem;
    font-family: inherit;
}

/* ── Compact list (fixed slots + category modal) ─────────────────────
   Same DOM shape on the page and inside the modal so the styles work
   in both contexts. */
.wyb-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.wyb-list__row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0.65rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #fff;
    transition: background 0.1s ease, border-color 0.1s ease;
}
.wyb-list__row:hover {
    background: #f6fbf8;
    border-color: #e4e6eb;
}
.wyb-list__row--has {
    border-color: #c4e8d0;
    background: #e7f7ec;
}
.wyb-list__row--has:hover { background: #ddf2e3; border-color: #0a7f3a; }
.wyb-list__row--oos { opacity: 0.55; }

.wyb-list__image {
    width: 48px; height: 48px;
    border-radius: 6px;
    background-color: #f0f2f5;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}
.wyb-list__image img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.wyb-list__main {
    display: flex; flex-direction: column;
    min-width: 0;
    gap: 0.2rem;
}
.wyb-list__top {
    display: flex; align-items: center; gap: 0.5rem;
    min-width: 0;
}
.wyb-list__name {
    font-size: 0.92rem;
    font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0;
}
.wyb-list__badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: #fdf3e7;
    color: #b95900;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex: 0 0 auto;
}
.wyb-list__badge--oos {
    background: #fdecea;
    color: #c0392b;
}

.wyb-list__variants {
    display: flex; flex-wrap: wrap; gap: 0.3rem;
    margin-top: 0.1rem;
}
.wyb-list__pill {
    border: 1px solid #ccd0d5;
    background: #fff;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.1s ease;
    color: inherit;
    font-family: inherit;
    line-height: 1.2;
}
.wyb-list__pill:hover { border-color: #0a7f3a; color: #0a7f3a; }
.wyb-list__pill--active {
    background: #0a7f3a; color: #fff; border-color: #0a7f3a;
}
.wyb-list__pill--active:hover {
    background: #086b30; border-color: #086b30; color: #fff;
}
.wyb-list__pill--colour {
    background: #fafbfc;
    font-weight: 500;
}

/* Right-side controls cell — Add / count + bin */
.wyb-list__controls {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
}
.wyb-list__add {
    background: #0a7f3a; color: #fff;
    border: 0; border-radius: 6px;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease;
}
.wyb-list__add:hover { background: #086b30; }
.wyb-list__add:disabled { background: #c3c4c7; cursor: not-allowed; }
.wyb-list__oos-text {
    font-size: 0.8rem;
    color: #c0392b;
    font-weight: 500;
}

.wyb-list__count {
    min-width: 28px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1d2327;
}

.wyb-list__bin {
    width: 32px; height: 32px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #ccd0d5;
    color: #666;
    cursor: pointer;
    display: inline-flex;
    align-items: center; justify-content: center;
    padding: 0;
    transition: all 0.12s ease;
    font-family: inherit;
}
.wyb-list__bin:hover {
    background: #fdecea;
    border-color: #c0392b;
    color: #c0392b;
}
.wyb-list__bin svg { width: 16px; height: 16px; }

/* ── Category slot on the page ─────────────────────────────────────── */
.wyb-cat {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.wyb-cat__empty {
    padding: 1.25rem;
    background: #f9fafb;
    border: 1px dashed #ccd0d5;
    border-radius: 8px;
    text-align: center;
    color: #50575e;
    font-size: 0.95rem;
}
.wyb-cat__cta {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: #fff;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.95rem; font-weight: 500;
    cursor: pointer;
    color: inherit;
    transition: border-color 0.12s ease, color 0.12s ease;
    font-family: inherit;
}
.wyb-cat__cta:hover { border-color: #0a7f3a; color: #0a7f3a; }
.wyb-cat__cta-icon {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #0a7f3a;
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.wyb-cat__picks {
    display: flex; flex-direction: column;
    gap: 0.4rem;
    background: #f9fafb;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    padding: 0.5rem;
}
.wyb-cat__pick {
    display: grid;
    grid-template-columns: 36px 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.4rem 0.5rem;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e4e6eb;
}
.wyb-cat__pick-image {
    width: 36px; height: 36px;
    border-radius: 6px;
    background-color: #f0f2f5;
    background-size: cover;
    background-position: center;
}
.wyb-cat__pick-main {
    display: flex; flex-direction: column;
    min-width: 0;
}
.wyb-cat__pick-name {
    font-size: 0.9rem; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wyb-cat__pick-variant {
    font-size: 0.78rem;
    color: #666;
}
.wyb-cat__pick-qty {
    font-size: 0.85rem;
    color: #666;
    background: #f0f2f5;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
}
.wyb-cat__pick-remove {
    background: transparent; border: 0;
    width: 28px; height: 28px; border-radius: 50%;
    color: #666; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0;
    transition: background 0.12s ease, color 0.12s ease;
    font-family: inherit;
}
.wyb-cat__pick-remove:hover { background: #fdecea; color: #c0392b; }
.wyb-cat__pick-remove svg { width: 14px; height: 14px; }

/* ── Footer / CTA ───────────────────────────────────────────────────── */
.wyb-builder__footer {
    background: #fff;
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem 1rem;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.wyb-builder__summary { display: flex; flex-direction: column; min-width: 0; }
.wyb-builder__summary-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #888;
}
.wyb-builder__summary-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0a7f3a;
}
.wyb-builder__cta { grid-column: 2; }
.wyb-builder__cta:disabled { opacity: 0.5; cursor: not-allowed; }
.wyb-builder__hint {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.85rem;
    color: #666;
    text-align: right;
}

/* ── Modal ──────────────────────────────────────────────────────────── */
.wyb-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(20, 25, 30, 0.55);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    z-index: 1000000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.wyb-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}
.wyb-modal-backdrop[hidden] { display: none; }
body.wyb-modal-open { overflow: hidden; }

.wyb-modal {
    background: #fff;
    border-radius: 14px;
    max-width: 720px; width: 100%;
    max-height: calc(100vh - 2rem);
    display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    transform: translateY(8px) scale(0.99);
    transition: transform 0.2s ease;
    overflow: hidden;
    color: #1d2327;
}
.wyb-modal-backdrop.is-open .wyb-modal { transform: none; }

@media (max-width: 600px) {
    .wyb-modal-backdrop {
        padding: 0;
        align-items: flex-end;
    }
    .wyb-modal {
        max-height: 92vh;
        border-radius: 14px 14px 0 0;
    }
}

.wyb-modal__header {
    padding: 1rem 1.25rem 0.85rem;
    border-bottom: 1px solid #e4e6eb;
}
.wyb-modal__top {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}
.wyb-modal__title { margin: 0 0 0.15rem; font-size: 1.15rem; font-weight: 600; }
.wyb-modal__subtitle { margin: 0; font-size: 0.85rem; color: #666; }
.wyb-modal__close {
    background: transparent; border: 0;
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    font-size: 1.5rem; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.12s ease;
    font-family: inherit;
    flex: 0 0 auto;
}
.wyb-modal__close:hover { background: #f0f2f5; }

.wyb-modal__search {
    position: relative;
}
.wyb-modal__search-input {
    width: 100%;
    padding: 0.6rem 0.9rem 0.6rem 2.4rem;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fafbfc;
    transition: border-color 0.12s ease, background 0.12s ease;
    box-sizing: border-box;
}
.wyb-modal__search-input:focus {
    outline: 0;
    border-color: #0a7f3a;
    background: #fff;
    box-shadow: 0 0 0 3px #e7f7ec;
}
.wyb-modal__search-icon {
    position: absolute; left: 0.85rem; top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 0.95rem;
    pointer-events: none;
}
.wyb-modal__search-clear {
    position: absolute; right: 0.5rem; top: 50%;
    transform: translateY(-50%);
    background: #f0f2f5; border: 0; cursor: pointer;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #666; font-size: 0.8rem;
    font-family: inherit;
}
.wyb-modal__search-clear[hidden] { display: none; }

.wyb-modal__hint {
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
    color: #666;
    line-height: 1.4;
}

.wyb-modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.65rem 0.85rem;
    background: #fafbfc;
}
.wyb-modal__loading,
.wyb-modal__no-results {
    padding: 2rem 1rem;
    text-align: center;
    color: #666;
    font-size: 0.95rem;
}
.wyb-modal__load-more {
    display: block;
    width: 100%;
    margin-top: 0.65rem;
    padding: 0.65rem;
    border: 1px solid #ccd0d5;
    background: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #1d2327;
    font-family: inherit;
}
.wyb-modal__load-more:hover {
    border-color: #0a7f3a;
    color: #0a7f3a;
}

.wyb-modal__footer {
    border-top: 1px solid #e4e6eb;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center; justify-content: space-between;
    gap: 1rem;
    background: #fff;
}
.wyb-modal__footer-info {
    font-size: 0.9rem;
    color: #666;
}
.wyb-modal__footer-info strong { color: #1d2327; }
.wyb-modal__done {
    background: #0a7f3a;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s ease, box-shadow 0.12s ease;
}
.wyb-modal__done:hover:not(:disabled) { background: #086b30; }
.wyb-modal__done:disabled { opacity: 0.5; cursor: not-allowed; }
.wyb-modal__done--ready {
    box-shadow: 0 0 0 3px #e7f7ec;
}

/* ── Modal grid (Design A — colour modal) ───────────────────────────── */
.wyb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.85rem;
}
.wyb-grid__tile {
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    text-align: left;
    padding: 0;
    font-family: inherit;
    color: inherit;
    position: relative;
    display: flex;
    flex-direction: column;
}
.wyb-grid__tile:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: #ccd0d5;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.wyb-grid__tile--selected {
    border-color: #0a7f3a;
    box-shadow: 0 0 0 4px #e7f7ec;
}
.wyb-grid__tile--oos { opacity: 0.5; cursor: not-allowed; }
.wyb-grid__image {
    width: 100%;
    aspect-ratio: 1;
    background-color: #f0f2f5;
    background-size: cover;
    background-position: center;
    display: block;
}
.wyb-grid__name {
    padding: 0.5rem 0.7rem 0.2rem;
    font-size: 0.9rem; font-weight: 500;
}
.wyb-grid__meta {
    padding: 0 0.7rem 0.5rem;
    font-size: 0.75rem;
    color: #888;
    min-height: 0.85rem;
}
.wyb-grid__check {
    position: absolute; top: 0.5rem; right: 0.5rem;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #0a7f3a; color: #fff;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(10, 127, 58, 0.4);
}

/* ── Cart line grouping (existing behaviour, unchanged) ─────────────── */
.wyb-cart-line-subitem {
    color: #666;
    font-size: 0.9rem;
    padding-left: 1.25rem;
    margin-top: 0.15rem;
}
.wyb-cart-qty-locked {
    color: #888;
    font-size: 0.9rem;
}

/* ── Bundle list shortcode ──────────────────────────────────────────── */
.wyb-bundle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}
.wyb-bundle-card {
    display: block;
    background: #fff;
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.wyb-bundle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
.wyb-bundle-card__image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}
.wyb-bundle-card__body {
    padding: 0.75rem 1rem 1rem;
}
.wyb-bundle-card__title {
    margin: 0 0 0.3rem;
    font-size: 1rem;
    font-weight: 500;
}
