/* =============================================
   WC Quantity Bundles — Frontend Card Styles
   Amazon-style bundle selector, polished UI
   ============================================= */

:root {
    --wcqb-primary: #2563eb;
    --wcqb-primary-dark: #1d4ed8;
    --wcqb-primary-bg: #eff6ff;
    --wcqb-primary-border: #bfdbfe;
    --wcqb-green: #059669;
    --wcqb-green-bg: #ecfdf5;
    --wcqb-orange: #ea580c;
    --wcqb-badge-bg: #ea580c;
    --wcqb-badge-text: #fff;
    --wcqb-text-dark: #0f172a;
    --wcqb-text: #334155;
    --wcqb-text-muted: #64748b;
    --wcqb-border: #e2e8f0;
    --wcqb-border-hover: #cbd5e1;
    --wcqb-bg: #ffffff;
    --wcqb-bg-hover: #f8fafc;
    --wcqb-radius: 12px;
    --wcqb-radius-sm: 8px;
    --wcqb-transition: all .2s ease;
}

/* ── Container ── */
.wcqb-bundle-selector {
    margin: 0 0 24px;
    width: 100%;
    max-width: 100%;
}

/* ── Header ── */
.wcqb-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--wcqb-text-dark);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--wcqb-primary);
}
.wcqb-header-icon {
    display: flex;
    color: var(--wcqb-primary);
}

/* ── Cards wrapper ── */
.wcqb-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Individual Card ── */
.wcqb-card {
    position: relative;
    background: var(--wcqb-bg);
    border: 2px solid var(--wcqb-border);
    cursor: pointer;
    transition: var(--wcqb-transition);
    overflow: visible;
}
/* Stack cards with shared borders */
.wcqb-card:first-child {
    border-radius: var(--wcqb-radius) var(--wcqb-radius) 0 0;
}
.wcqb-card:last-child {
    border-radius: 0 0 var(--wcqb-radius) var(--wcqb-radius);
}
.wcqb-card:only-child {
    border-radius: var(--wcqb-radius);
}
.wcqb-card + .wcqb-card {
    border-top: none;
}

/* Hover */
.wcqb-card:hover {
    background: var(--wcqb-bg-hover);
    border-color: var(--wcqb-border-hover);
    z-index: 1;
}
.wcqb-card:hover + .wcqb-card {
    /* keep visual continuity */
}

/* Active / Selected */
.wcqb-card--active {
    background: var(--wcqb-primary-bg) !important;
    border-color: var(--wcqb-primary) !important;
    z-index: 2;
    box-shadow: 0 0 0 1px var(--wcqb-primary);
}
.wcqb-card--active + .wcqb-card {
    border-top: 2px solid var(--wcqb-border);
}

/* ── Badge ── */
.wcqb-card__badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--wcqb-badge-bg);
    color: var(--wcqb-badge-text);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 3px 14px;
    border-radius: 20px;
    white-space: nowrap;
    line-height: 1.4;
    box-shadow: 0 2px 6px rgba(234, 88, 12, .25);
    z-index: 5;
}

/* ── Card inner layout ── */
.wcqb-card__inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
}

/* ── Radio circle ── */
.wcqb-card__radio {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    transition: var(--wcqb-transition);
}
.wcqb-card--active .wcqb-card__radio {
    border-color: var(--wcqb-primary);
    background: var(--wcqb-primary);
}
.wcqb-radio__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    transition: var(--wcqb-transition);
}
.wcqb-card--active .wcqb-radio__dot {
    background: #fff;
}

/* ── Body ── */
.wcqb-card__body {
    flex: 1;
    min-width: 0;
}
.wcqb-card__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--wcqb-text-dark);
    line-height: 1.3;
}
.wcqb-card__subtitle {
    font-size: 12px;
    color: var(--wcqb-text-muted);
    margin-top: 2px;
    font-style: italic;
}

/* ── Cross-sell item list ── */
.wcqb-card__items {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.wcqb-card__item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--wcqb-text);
}
.wcqb-card__item-check {
    font-weight: 700;
    color: var(--wcqb-green);
    font-size: 13px;
}
.wcqb-card__item-img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--wcqb-border);
}

/* ── Variant selectors ── */
.wcqb-card__variants {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--wcqb-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wcqb-variant-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wcqb-variant-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--wcqb-text);
    white-space: nowrap;
    min-width: 48px;
}
.wcqb-variant-row select {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--wcqb-border);
    border-radius: var(--wcqb-radius-sm);
    font-size: 12px;
    background: #fff;
    max-width: 200px;
    cursor: pointer;
}

/* Variant thumbnail — shows when option selected */
.wcqb-variant-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid var(--wcqb-primary-border);
    flex-shrink: 0;
    transition: opacity .2s, transform .2s;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.wcqb-variant-thumb--hidden {
    display: none;
}

/* ── Price column ── */
.wcqb-card__price-col {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
    min-width: 80px;
}
.wcqb-card__price-was {
    font-size: 13px;
    color: var(--wcqb-text-muted);
    text-decoration: line-through;
}
.wcqb-card__price-was .woocommerce-Price-amount { color: inherit; }
.wcqb-card__price-now {
    font-size: 20px;
    font-weight: 800;
    color: var(--wcqb-text-dark);
    line-height: 1.2;
}
.wcqb-card--active .wcqb-card__price-now {
    color: var(--wcqb-primary-dark);
}
.wcqb-card__price-now .woocommerce-Price-amount {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}
.wcqb-card__savings {
    display: inline-block;
    background: var(--wcqb-green-bg);
    color: var(--wcqb-green);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.wcqb-card__per-unit {
    font-size: 11px;
    color: var(--wcqb-text-muted);
    margin-top: 1px;
}
.wcqb-card__per-unit .woocommerce-Price-amount {
    color: inherit;
    font-size: inherit;
}

/* ── Cart locked qty ── */
.wcqb-locked-qty {
    font-weight: 600;
    display: inline-block;
    padding: 4px 12px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 13px;
    color: var(--wcqb-text);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .wcqb-card__inner {
        padding: 12px 14px;
        gap: 10px;
    }
    .wcqb-card__title { font-size: 14px; }
    .wcqb-card__price-now { font-size: 17px; }
    .wcqb-card__price-col { min-width: 70px; }
    .wcqb-card__badge {
        font-size: 9px;
        padding: 2px 10px;
    }
    .wcqb-variant-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .wcqb-variant-row select { max-width: 100%; }
}

/* ── Theme compatibility resets ── */
.wcqb-bundle-selector *,
.wcqb-bundle-selector *::before,
.wcqb-bundle-selector *::after {
    box-sizing: border-box;
}
.wcqb-bundle-selector img {
    max-width: 100%;
    height: auto;
}

/* ── Disabled Add to Cart button ── */
.wcqb-btn-disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    position: relative;
}

/* ── Helper message: "Select a bundle" ── */
.wcqb-select-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    line-height: 1.4;
}
.wcqb-select-msg__icon {
    font-size: 16px;
    flex-shrink: 0;
}
