/* =========================================================================
   CL Upsell — Carosello Suggerimenti Cart
   Palette: Giallo #f5c140 · Blu #0a2838 · Crema #fffef6 · Testo #000
   Mobile-first
   ========================================================================= */

.cl-upsell-carousel {
    width: 100%;
    margin: 24px 0;
}

.cl-upsell-carousel-heading {
    font-size: 20px;
    font-weight: 800;
    color: #0a2838;
    margin: 0 0 6px;
    line-height: 1.2;
}

.cl-upsell-carousel-subheading {
    font-size: 14px;
    color: #0a2838;
    margin: 0 0 16px;
    line-height: 1.4;
}

/* ── VIEWPORT + SCROLL ──────────────────────────────────────────────────── */
.cl-upsell-carousel-viewport {
    position: relative;
}

.cl-upsell-carousel-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 12px;
    scrollbar-width: thin;
}

.cl-upsell-carousel-track::-webkit-scrollbar {
    height: 6px;
}
.cl-upsell-carousel-track::-webkit-scrollbar-thumb {
    background: #0a2838;
    border-radius: 3px;
}
.cl-upsell-carousel-track::-webkit-scrollbar-track {
    background: #e8e8e8;
}

/* Loading state durante refresh full carousel (post cart change) */
.cl-upsell-carousel-track--refreshing {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* ── NAV ARROWS ─────────────────────────────────────────────────────────── */
.cl-upsell-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: #f5c140;
    color: #0a2838;
    border: none;
    border-radius: 50%;
    padding: 0;
    /* Centratura geometrica del glifo `›` (font-metric off-center, serve flex) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(10, 40, 56, 0.3);
    transition: transform 0.15s ease, background 0.15s ease;
}
.cl-upsell-carousel-prev { padding-right: 2px; } /* `‹` glifo è leggermente shift a destra */
.cl-upsell-carousel-next { padding-left: 2px; }  /* `›` glifo è leggermente shift a sinistra */
.cl-upsell-carousel-nav:hover {
    transform: translateY(-50%) scale(1.08);
    background: #e0ae30;
}
.cl-upsell-carousel-nav:disabled {
    opacity: 0;
    pointer-events: none;
}
.cl-upsell-carousel-prev { left: -8px; }
.cl-upsell-carousel-next { right: -8px; }

/* ── CARD ───────────────────────────────────────────────────────────────── */
.cl-upsell-card {
    position: relative;
    flex: 0 0 260px;
    background: #fffef6;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.cl-upsell-card:hover {
    border-color: #f5c140;
    box-shadow: 0 4px 16px rgba(245, 193, 64, 0.18);
    transform: translateY(-2px);
}

/* Flash visivo quando i prezzi vengono aggiornati post add_to_cart */
.cl-upsell-card--just-updated {
    animation: cl-upsell-flash 0.8s ease;
}
@keyframes cl-upsell-flash {
    0%   { box-shadow: 0 0 0 0 rgba(245, 193, 64, 0.0); }
    30%  { box-shadow: 0 0 0 4px rgba(245, 193, 64, 0.55); }
    100% { box-shadow: 0 0 0 0 rgba(245, 193, 64, 0.0); }
}

.cl-upsell-card-savings-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f5c140;
    color: #0a2838;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 1;
}

.cl-upsell-card-thumb {
    width: 100%;
    aspect-ratio: 3 / 2;
    background: #f0f0f0;
    overflow: hidden;
}
.cl-upsell-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cl-upsell-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.cl-upsell-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #0a2838;
    margin: 0;
    line-height: 1.25;
    /* clamp 2 righe — anche titoli lunghi occupano max 2 righe, posizione prezzo invariata */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Prezzo allineato in BASSO a destra della card, sopra il pulsante. margin-top:auto
   lo spinge in fondo allo spazio rimasto, indipendentemente dalla lunghezza del titolo */
.cl-upsell-card-price {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.cl-upsell-card-price-original {
    color: #0a2838;
    opacity: 0.55;
    font-size: 13px;
    text-decoration: line-through;
}

.cl-upsell-card-price-final {
    font-size: 18px;
    font-weight: 800;
    color: #0a2838;
}

.cl-upsell-card-add {
    background: #f5c140;
    color: #0a2838;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    min-height: 44px; /* tap target mobile */
    transition: background-color 0.15s ease;
}
.cl-upsell-card-add:hover,
.cl-upsell-card-add:focus-visible {
    background: #e0ae30;
    outline: none;
}
.cl-upsell-card-add:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* ── Placeholder editor ─────────────────────────────────────────────────── */
.cl-upsell-placeholder {
    padding: 32px;
    background: #fffef6;
    border: 2px dashed #f5c140;
    border-radius: 8px;
    text-align: center;
    color: #0a2838;
    font-size: 14px;
}

/* ── MOBILE (< 600px) ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .cl-upsell-card { flex: 0 0 220px; }
    .cl-upsell-card-title { font-size: 14px; }
    .cl-upsell-card-price-final { font-size: 16px; }
    /* arrows nascoste su mobile, l'utente fa swipe */
    .cl-upsell-carousel-nav { display: none; }
}
