/* ===========================================================================
   cb-bundle.css — COMPRE JUNTO da PDP (Castor Bezerra, 2026-08-18)

   Visual do bloco reformulado (snipplets/product/product-bundle.tpl +
   static/js/cb-bundle.js) nas cores da marca: azul royal #1E5FD8 e dourado
   #D4AF37. O bottom-sheet de variacao reusa .cb-sheet__* de cb-cart.css;
   aqui so entra o que e exclusivo do bloco (.cb-bundle*).
   Carregado apenas por templates/product.tpl (via snipplet).

   2026-08-22: o bloco nasce com [hidden] e so aparece quando a engine do app
   devolve sugestao (ver cb-bundle.js). A regra abaixo garante que [hidden]
   vence qualquer display herdado da coluna da PDP.
   =========================================================================== */

.cb-bundle[hidden] { display: none !important; }

.cb-bundle {
    --cbb-royal: #1e5fd8;
    --cbb-royal-dark: #164aad;
    --cbb-gold: #d4af37;
    --cbb-gold-soft: #f7ecc8;
    --cbb-ink: var(--rastreio-brand-ink, #0e1726);
    --cbb-muted: #5b6b84;
    --cbb-line: #dbe4f2;
    --cbb-bg: #f7faff;
    margin: 2.2rem auto;
    max-width: 980px;
    /* A coluna da PDP e flex/grid: sem isto o bloco vira fit-content e o piso e o
       min-content dele (rotulo de variacao com nowrap, ex. "Preto · Pelucia Bel"),
       que estoura a coluna e joga scroll horizontal na pagina inteira no mobile.
       Com width 100% + align-self stretch o max-width:100% do rotulo passa a ter
       base definida e o ellipsis volta a funcionar. */
    width: 100%;
    min-width: 0;
    align-self: stretch;
}
.cb-bundle * { box-sizing: border-box; }
/* garante que [hidden] vence os display:flex/inline-flex das classes abaixo */
.cb-bundle [hidden] { display: none !important; }

.cb-bundle__card {
    position: relative;
    background: #fff;
    border: 2px solid var(--cbb-royal);
    border-radius: 18px;
    padding: 2.1rem 1.4rem 1.35rem;
    box-shadow: 0 14px 34px -22px rgba(30, 95, 216, 0.45);
}

/* --------------------------------------------------------------- cabecalho */
.cb-bundle__ribbon {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: linear-gradient(135deg, #e8c96a 0%, var(--cbb-gold) 45%, #b8912a 100%);
    color: #241a02;
    font-weight: 800;
    font-size: 0.86rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.5rem 1.15rem;
    border-radius: 999px;
    box-shadow: 0 6px 16px -6px rgba(184, 145, 42, 0.75);
    white-space: nowrap;
}
.cb-bundle__ribbon svg { flex: 0 0 auto; }

.cb-bundle__head {
    text-align: center;
    margin-bottom: 1.15rem;
}
.cb-bundle__title {
    margin: 0 0 0.35rem;
    font-size: 1.28rem;
    line-height: 1.25;
    font-weight: 800;
    color: var(--cbb-ink);
}
.cb-bundle__pills {
    display: none;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.cb-bundle--promo .cb-bundle__pills { display: flex; }
.cb-bundle__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cbb-royal-dark);
    background: var(--cbb-bg);
    border: 1px solid var(--cbb-line);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
}
.cb-bundle__pill b { color: #9a7514; }

/* ------------------------------------------------------------------ itens */
.cb-bundle__row {
    display: flex;
    align-items: stretch;
    gap: 0.3rem;
}
.cb-bundle__item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--cbb-bg);
    border: 1px solid var(--cbb-line);
    border-radius: 14px;
    padding: 0.85rem;
    position: relative;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.cb-bundle__item:hover { border-color: var(--cbb-royal); }
.cb-bundle__item.is-off { opacity: 0.45; }
.cb-bundle__item.is-dead { opacity: 0.55; }
.cb-bundle__item--current { border-color: var(--cbb-royal); box-shadow: inset 0 0 0 1px var(--cbb-royal); }

.cb-bundle__check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cbb-muted);
    margin: 0 0 0.55rem;
    cursor: pointer;
}
.cb-bundle__check input {
    width: 17px;
    height: 17px;
    accent-color: var(--cbb-royal);
    cursor: pointer;
    flex: 0 0 auto;
}
.cb-bundle__item--current .cb-bundle__check { color: var(--cbb-royal-dark); font-weight: 800; }
/* ancora travada: card fixo, sem checkbox -- sempre no total */
.cb-bundle__check--locked { cursor: default; color: var(--cbb-royal-dark); font-weight: 800; }
.cb-bundle__check--locked svg { color: var(--cbb-royal); flex: 0 0 auto; }

.cb-bundle__thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--cbb-line);
    margin-bottom: 0.6rem;
}
.cb-bundle__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cb-bundle__badge {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: linear-gradient(135deg, #e8c96a, var(--cbb-gold) 60%, #b8912a);
    color: #241a02;
    font-size: 0.74rem;
    font-weight: 800;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    box-shadow: 0 4px 10px -4px rgba(184, 145, 42, 0.8);
}

.cb-bundle__name {
    font-size: 0.83rem;
    line-height: 1.3;
    color: var(--cbb-ink);
    margin: 0 0 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 600;
}
.cb-bundle__name a { color: inherit; text-decoration: none; }
.cb-bundle__name a:hover { text-decoration: underline; }

.cb-bundle__variant {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    font-size: 0.72rem;
    color: var(--cbb-muted);
    margin: 0 0 0.4rem;
}
.cb-bundle__variant-label {
    background: #fff;
    border: 1px solid var(--cbb-line);
    border-radius: 999px;
    padding: 0.14rem 0.5rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cb-bundle__variant-btn {
    appearance: none;
    border: 0;
    background: none;
    color: var(--cbb-royal);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.14rem 0.2rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.cb-bundle__variant-btn:hover { color: var(--cbb-royal-dark); }

.cb-bundle__prices {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.cb-bundle__old {
    font-size: 0.78rem;
    color: var(--cbb-muted);
    text-decoration: line-through;
}
.cb-bundle__price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--cbb-royal-dark);
}

.cb-bundle__plus {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--cbb-royal);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 4px 10px -4px rgba(30, 95, 216, 0.8);
}

/* ------------------------------------------------------------------ rodape */
.cb-bundle__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.15rem;
    border-top: 1px dashed var(--cbb-line);
    padding-top: 1rem;
}
.cb-bundle__totals {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: var(--cbb-ink);
}
.cb-bundle__count { font-weight: 600; color: var(--cbb-muted); }
.cb-bundle__total-old { color: var(--cbb-muted); text-decoration: line-through; font-size: 0.9rem; }
.cb-bundle__total { color: var(--cbb-royal-dark); font-size: 1.35rem; font-weight: 800; }
.cb-bundle__save {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--cbb-gold-soft);
    border: 1px solid #e3cd8b;
    color: #7a5c10;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
}
.cb-bundle__save b { font-weight: 800; }

.cb-bundle__add {
    appearance: none;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--cbb-royal) 0%, var(--cbb-royal-dark) 100%);
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    line-height: 1.1;
    box-shadow: 0 10px 22px -10px rgba(30, 95, 216, 0.85);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.cb-bundle__add:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cb-bundle__add:focus-visible { outline: 3px solid var(--cbb-gold); outline-offset: 2px; }
.cb-bundle__add[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.cb-bundle__add.is-loading { opacity: 0.75; cursor: progress; }

.cb-bundle__fine {
    display: none;
    margin: 0.7rem 0 0;
    font-size: 0.74rem;
    line-height: 1.45;
    color: var(--cbb-muted);
    text-align: center;
}
.cb-bundle--promo .cb-bundle__fine { display: block; }

/* rodape do sheet proprio (so o botao confirmar, centralizado) */
.cb-bundle-sheet__foot { justify-content: stretch; }
.cb-bundle-sheet__foot .js-cb-bsheet-ok { flex: 1 1 auto; justify-content: center; }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 640px) {
    .cb-bundle { margin: 1.5rem auto; }
    .cb-bundle__card { padding: 1.6rem 0.7rem 1rem; border-radius: 14px; }
    .cb-bundle__ribbon { font-size: 0.72rem; padding: 0.4rem 0.85rem; }
    .cb-bundle__title { font-size: 1.02rem; }
    .cb-bundle__pill { font-size: 0.7rem; padding: 0.24rem 0.55rem; }
    .cb-bundle__row { gap: 0.15rem; }
    .cb-bundle__item { padding: 0.45rem 0.4rem; border-radius: 10px; }
    .cb-bundle__check { font-size: 0.6rem; gap: 0.25rem; margin-bottom: 0.35rem; }
    .cb-bundle__check input { width: 14px; height: 14px; }
    .cb-bundle__check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cb-bundle__name { font-size: 0.68rem; }
    .cb-bundle__variant { font-size: 0.62rem; }
    .cb-bundle__badge { font-size: 0.62rem; padding: 0.12rem 0.4rem; }
    .cb-bundle__old { font-size: 0.66rem; }
    .cb-bundle__price { font-size: 0.8rem; }
    .cb-bundle__plus { width: 20px; height: 20px; font-size: 0.85rem; }
    .cb-bundle__foot { flex-direction: column; align-items: stretch; text-align: center; gap: 0.7rem; }
    .cb-bundle__totals { justify-content: center; font-size: 0.88rem; }
    .cb-bundle__total { font-size: 1.15rem; }
    .cb-bundle__add { width: 100%; justify-content: center; padding: 0.8rem; }
    .cb-bundle__fine { font-size: 0.66rem; }
}
