/* Vetrina prodotti a scorrimento (componente CBProductShowcase), grafica «Le offerte che convengono oggi».
   Tutto sotto .cb-ps: funziona su qualsiasi pagina (home, area Cashback), senza dipendere da #products. */

.cb-ps {
    --cb-ps-ink: #142c47;
    --cb-ps-muted: #6a7c92;
    --cb-ps-line: #dfe6f3;
    --cb-ps-accent: var(--hb-light-blue, #006ef7);
    --cb-ps-red: var(--hb-red, #ff334c);
    --cb-ps-green: #0b9d3e;          /* verde del prezzo Hubix, piu' scuro del brand per leggibilita' */
    --cb-ps-gap: 14px;
    --cb-ps-per-view: 6;             /* card visibili per riga, ridotte sotto */
    --cb-ps-title-size: 26px;
    margin: 0 0 2.5rem;
    color: var(--cb-ps-ink);
}

/* ---------- Intestazione ---------- */
.cb-ps-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 16px;
}

.cb-ps-heading {
    min-width: 0;
}

.cb-ps-title {
    margin: 0;
    font-size: var(--cb-ps-title-size);
    font-weight: 700;
    line-height: 1.2;
    color: var(--cb-ps-ink);
}

.cb-ps-accent {
    color: var(--cb-ps-accent);
}

.cb-ps-subtitle {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--cb-ps-ink);
}

.cb-ps-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.cb-ps-more {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cb-ps-accent);
    text-decoration: none;
    white-space: nowrap;
}

.cb-ps-more:hover {
    text-decoration: underline;
}

.cb-ps-more .bi {
    font-size: 11px;
}

.cb-ps-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--cb-ps-line);
    border-radius: 50%;
    background: #fff;
    color: var(--cb-ps-ink);
    font-size: 12px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.cb-ps-nav:hover:not(:disabled) {
    border-color: var(--cb-ps-accent);
    color: var(--cb-ps-accent);
}

.cb-ps-nav:disabled {
    opacity: .4;
    cursor: default;
}

/* Tutte le card gia' visibili: niente frecce */
.cb-ps-static .cb-ps-nav {
    display: none;
}

.cb-ps-more:focus-visible,
.cb-ps-nav:focus-visible,
.cb-ps-card:focus-visible {
    outline: 3px solid var(--cb-ps-accent);
    outline-offset: 2px;
}

/* ---------- Striscia scorrevole ---------- */
.cb-ps-track {
    display: flex;
    gap: var(--cb-ps-gap);
    margin: 0;
    /* spazio per ombra e outline delle card, senza tagliarli */
    padding: 4px 4px 10px;
    margin-left: -4px;
    margin-right: -4px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 4px;
    scrollbar-width: none;
}

.cb-ps-track::-webkit-scrollbar {
    display: none;
}

.cb-ps-item {
    flex: 0 0 calc((100% - (var(--cb-ps-per-view) - 1) * var(--cb-ps-gap)) / var(--cb-ps-per-view));
    min-width: 0;
    scroll-snap-align: start;
}

/* ---------- Card ---------- */
.cb-ps-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px;
    background: #fff;
    /* border: 1px solid var(--cb-ps-line); */
    border-radius: 12px;
    color: var(--cb-ps-ink);
    text-decoration: none;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
    border: 2px solid var(--hb-light-gray-2);
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .06);
}

.cb-ps-card:hover {
    color: var(--cb-ps-ink);
    border-color: #c9d6ec;
    box-shadow: 0 6px 18px rgba(20, 44, 71, .10);
    transform: translateY(-2px);
}

.cb-ps-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 140px;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 8px;
}

.cb-ps-img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Immagine del feed non raggiungibile (cb-card.js aggiunge .is-broken) */
.cb-ps-img img.is-broken {
    visibility: hidden;
}

.cb-ps-img:has(img.is-broken) {
    background: #f4f4f6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 16 16' fill='%23b3bfcf'%3E%3Cpath d='M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z'/%3E%3Cpath d='M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z'/%3E%3C/svg%3E") center / 40px no-repeat;
}

.cb-ps-brand {
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cb-ps-name {
    display: -webkit-box;
    min-height: 2.6em;
    margin: 2px 0 8px;
    overflow: hidden;
    font-size: 11.5px;
    line-height: 1.3;
    color: var(--cb-ps-muted);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cb-ps-price {
    margin-top: auto;
    font-size: 11px;
    color: var(--cb-ps-muted);
}

.cb-ps-price b {
    font-size: 16px;
    font-weight: 700;
    color: var(--cb-ps-ink);
    font-variant-numeric: tabular-nums;
}

.cb-ps-cashback {
    display: block;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--cb-ps-red);
    color: #fff;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-ps-cashback span {
    font-size: 16px;
}

@media(min-width: 991px){
    .cb-ps-cashback {
        font-size: 15px;
    }
}

.cb-ps-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    margin-top: 8px;
}

.cb-ps-hubix {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* color: var(--cb-ps-green); */
    color: var(--color-secondary);
    line-height: 1.15;
}

.cb-ps-hubix-label {
    font-size: 10.5px;
    font-weight: 700;
}

.cb-ps-hubix-value {
    font-size: 17px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cb-ps-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 28px;
    height: 28px;
    margin-left: auto;
    /* border: 1.5px solid var(--cb-ps-ink); */
    border-radius: 7px;
    font-size: 14px;
    transition: background-color .15s ease, color .15s ease;
}

.cb-ps-card:hover {
    border-color: var(--border-soft);
}

/* .cb-ps-card:hover .cb-ps-cart {
    background: var(--cb-ps-ink);
    background: var(--color-primary);
    color: #fff;
} */

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
    .cb-ps { --cb-ps-per-view: 5; }
}

@media (max-width: 991.98px) {
    .cb-ps { --cb-ps-per-view: 4; }
}

@media (max-width: 767.98px) {
    .cb-ps {
        --cb-ps-per-view: 3;
        --cb-ps-gap: 12px;
        --cb-ps-title-size: 22px;
    }
}

/* Telefono: 2 card e la terza che si intravede (si capisce che si scorre); frecce nascoste, si usa il dito */
@media (max-width: 575.98px) {
    .cb-ps {
        --cb-ps-per-view: 2.25;
        --cb-ps-gap: 10px;
        --cb-ps-title-size: 20px;
    }

    .cb-ps-head {
        align-items: flex-start;
    }

    .cb-ps-subtitle {
        font-size: 13px;
    }

    .cb-ps-nav {
        display: none;
    }

    .cb-ps-more {
        margin: 4px 0 0;
    }

    .cb-ps-img {
        height: 110px;
    }

    .cb-ps-card {
        padding: 10px;
    }

    .cb-ps-hubix-value {
        font-size: 15px;
    }
}

/* ---------- Pagina Prodotti ----------
   styleCB.css stilizza tutti gli h2, button e a dentro #products (selettori con id, piu' forti delle
   classi: maiuscolo, 15px, niente bordi, colore dei link). Qui la vetrina torna al suo aspetto. */
#products .cb-ps .cb-ps-title,
#products .cb-ps .cb-ps-title:hover {
    font-size: var(--cb-ps-title-size);
    font-weight: 700;
    line-height: 1.2;
    text-transform: none;
    color: var(--cb-ps-ink);
    word-break: normal;
}

#products .cb-ps a.cb-ps-more {
    color: var(--cb-ps-accent);
}

#products .cb-ps a.cb-ps-card,
#products .cb-ps a.cb-ps-card:hover {
    color: var(--cb-ps-ink);
}

#products .cb-ps button.cb-ps-nav {
    font-size: 12px;
    line-height: 1;
    text-transform: none;
    color: var(--cb-ps-ink);
    border: 1px solid var(--cb-ps-line);
}

#products .cb-ps button.cb-ps-nav:hover:not(:disabled) {
    color: var(--cb-ps-accent);
    border-color: var(--cb-ps-accent);
}

@media (prefers-reduced-motion: reduce) {
    .cb-ps-card,
    .cb-ps-card:hover {
        transition: none;
        transform: none;
    }
}
