/* ==========================================================================
   CART / PDP — contextual upsell ("Spesso comprati insieme" / "Completa ordine")
   Default = light surfaces (PDP white). Dark overrides under .ca-page (carrello).
   ========================================================================== */

.cart-upsell {
    margin: 2rem 0 2.5rem;
    padding: 1.35rem 1.25rem 1.4rem;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.cart-upsell__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.95rem;
    border-bottom: 1px solid #f0f0f0;
}

.cart-upsell__title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.02em;
    line-height: 1.25;
    position: relative;
    padding-left: 14px;
}

.cart-upsell__title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 3px;
    border-radius: 2px;
    background: var(--primary, #e02020);
}

.cart-upsell__subtitle {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #5c6370;
    max-width: 44rem;
    padding-left: 14px;
}

.cart-upsell__vehicle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0.55rem 0 0 14px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #9f1239;
    background: #fff1f2;
    border: 1px solid #fecdd3;
}

.cart-upsell--bundle {
    border-color: #fde68a;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 42%);
}

.cart-upsell__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.cart-upsell__badge--bundle {
    color: #92400e;
    background: #fffbeb;
    border-color: #fcd34d;
}

.cart-upsell__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cart-upsell__body--with-kit {
    gap: 16px;
}

/* ── Kit card (light) ───────────────────────────────────────────────── */
.cart-upsell__kit-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 1rem 1.1rem;
    border-radius: 8px;
    background: linear-gradient(155deg, #fff7ed 0%, #fffbeb 55%, #fff 100%);
    border: 1px solid #fcd34d;
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.1);
}

.cart-upsell__kit-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #b45309;
    background: #ffedd5;
    border: 1px solid #fdba74;
}

.cart-upsell__kit-card-eyebrow {
    display: block;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b45309;
    margin-bottom: 4px;
}

.cart-upsell__kit-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.cart-upsell__kit-card-vehicle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: #9f1239;
}

.cart-upsell__kit-card-hint {
    margin: 8px 0 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #57534e;
}

.cart-upsell__kit-card-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
    padding: 0.7rem 0.9rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    text-decoration: none;
    color: #fff !important;
    background: #d97706;
    border: 1px solid #b45309;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.cart-upsell__kit-card-cta:hover {
    background: #b45309;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(217, 119, 6, 0.28);
}

/* ── Product grid ───────────────────────────────────────────────────── */
.cart-upsell__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    flex: 1;
    min-width: 0;
    align-items: stretch;
}

.cart-upsell__item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    height: 100%;
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 8px;
    padding: 8px 8px 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cart-upsell__item:hover {
    border-color: #e0e0e0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    background: #fff;
}

/* Product card: natural height; free space goes above the pinned CTA */
.cart-upsell__item .product-card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    height: auto !important;
    flex: 0 1 auto;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
}

.cart-upsell__item .product-card__image {
    flex-shrink: 0;
}

.cart-upsell__item .product-card__info {
    flex: 0 1 auto;
}

.cart-upsell__item .product-card__footer {
    flex-shrink: 0;
}

/* Keep title height consistent (max 2 lines) so buttons align across the row */
.cart-upsell__item .product-card__name {
    min-height: 2.6em;
    margin-bottom: 0;
}

.cart-upsell__item .product-card__name h3 {
    margin: 0;
    font-size: inherit;
    line-height: 1.3;
}

.cart-upsell__item .product-card__name a,
.cart-upsell__item .product-card__name h3 {
    color: #1a1a1a !important;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cart-upsell__item .product-card__price,
.cart-upsell__item .product-card__price--current,
.cart-upsell__item .product-card__price--new {
    color: #e02020 !important;
}

.cart-upsell__item .product-card__price--old {
    color: #9ca3af !important;
}

.cart-upsell__item .product-card__meta,
.cart-upsell__item .product-card__meta-value,
.cart-upsell__item .label-mono {
    color: #6b7280 !important;
}

/* Reserved band so cards with/without reason share the same CTA baseline */
.cart-upsell__reason {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #6b7280;
    line-height: 1.35;
    padding: 2px 4px 0;
    min-height: 2.4em;
    flex-shrink: 0;
}

/* When no reason is present, keep empty spacer via ::before on item without reason */
.cart-upsell__item:not(:has(.cart-upsell__reason))::before {
    content: "";
    display: block;
    min-height: 2.4em;
    flex-shrink: 0;
}

.cart-upsell__reason--bundle {
    display: inline-flex;
    align-items: flex-start;
    gap: 5px;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 5px 8px;
}

.cart-upsell__reason--bundle i {
    margin-top: 1px;
    flex-shrink: 0;
    color: #d97706;
}

.cart-upsell__item--bundle {
    border-color: #fde68a;
    background: #fffdf5;
}

.cart-upsell__item--bundle .cart-upsell__quick-add-btn {
    background: #d97706;
}

.cart-upsell__item--bundle .cart-upsell__quick-add-btn:hover {
    background: #b45309;
}

/* CTA always pinned to the bottom of the tile (same Y for every card in the row) */
.cart-upsell__quick-add {
    margin: auto 0 0;
    padding: 0 2px;
    flex-shrink: 0;
    width: 100%;
}

.cart-upsell__quick-add-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.6rem 0.75rem;
    border: none;
    border-radius: 6px;
    background: var(--ca-accent, #e02020);
    color: #fff !important;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.cart-upsell__quick-add-btn:hover {
    background: #c41a1a;
    transform: translateY(-1px);
}

/* Hide noisy card chrome in compact upsell tiles */
.cart-upsell__item .product-card__actions-list {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.cart-upsell__item .product-card__action--compare,
.cart-upsell__item .product-card__action--wishlist {
    /* keep actions usable but subtle */
}

@media (min-width: 768px) {
    .cart-upsell {
        padding: 1.5rem 1.4rem 1.55rem;
    }

    .cart-upsell__body--with-kit {
        flex-direction: row;
        align-items: stretch;
    }

    .cart-upsell__kit-card {
        flex: 0 0 230px;
        max-width: 250px;
    }

    .cart-upsell__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (min-width: 1100px) {
    .cart-upsell__body:not(.cart-upsell__body--with-kit) .cart-upsell__grid,
    .cart-upsell__body--with-kit .cart-upsell__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .cart-upsell {
        padding: 1rem 0.85rem 1.1rem;
    }

    .cart-upsell__header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .cart-upsell__badge {
        align-self: flex-start;
    }
}

/* ==========================================================================
   Dark theme — carrello / area cliente (.ca-page)
   ========================================================================== */
.ca-page .cart-upsell {
    margin-top: 2.5rem;
    padding: 1.35rem 0 0;
    background: transparent;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    box-shadow: none;
}

.ca-page .cart-upsell__header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.ca-page .cart-upsell__title {
    color: #fff;
}

.ca-page .cart-upsell__title::before {
    background: #e02020;
}

.ca-page .cart-upsell__subtitle {
    color: rgba(255, 255, 255, 0.58);
}

.ca-page .cart-upsell__vehicle {
    color: #fecdd3;
    background: rgba(224, 32, 32, 0.14);
    border-color: rgba(248, 113, 113, 0.35);
}

.ca-page .cart-upsell--bundle {
    background: transparent;
    border-top-color: rgba(245, 158, 11, 0.28);
}

.ca-page .cart-upsell__badge {
    color: #fca5a5;
    background: rgba(224, 32, 32, 0.14);
    border-color: rgba(224, 32, 32, 0.3);
}

.ca-page .cart-upsell__badge--bundle {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.3);
}

.ca-page .cart-upsell__kit-card {
    background: linear-gradient(155deg, rgba(245, 158, 11, 0.16) 0%, rgba(224, 32, 32, 0.08) 100%);
    border-color: rgba(245, 158, 11, 0.32);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.ca-page .cart-upsell__kit-card-icon {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.3);
}

.ca-page .cart-upsell__kit-card-eyebrow {
    color: #fcd34d;
}

.ca-page .cart-upsell__kit-card-title {
    color: #fff;
}

.ca-page .cart-upsell__kit-card-vehicle {
    color: #fca5a5;
}

.ca-page .cart-upsell__kit-card-hint {
    color: rgba(255, 255, 255, 0.62);
}

.ca-page .cart-upsell__item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.ca-page .cart-upsell__item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.ca-page .cart-upsell__item .product-card {
    background: transparent !important;
}

.ca-page .cart-upsell__item .product-card__name a,
.ca-page .cart-upsell__item .product-card__name h3 {
    color: #f3f4f6 !important;
}

.ca-page .cart-upsell__item .product-card__meta,
.ca-page .cart-upsell__item .product-card__meta-value,
.ca-page .cart-upsell__item .label-mono {
    color: rgba(255, 255, 255, 0.5) !important;
}

.ca-page .cart-upsell__item .product-card__price--old {
    color: rgba(255, 255, 255, 0.4) !important;
}

.ca-page .cart-upsell__reason {
    color: rgba(255, 255, 255, 0.5);
}

.ca-page .cart-upsell__reason--bundle {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.28);
}

.ca-page .cart-upsell__reason--bundle i {
    color: #fbbf24;
}

.ca-page .cart-upsell__item--bundle {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.06);
}

/* Empty cart spacing */
.ca-empty + .cart-upsell,
.ca-page .cart-upsell--empty {
    margin-top: 3rem;
    border-top: none;
    padding-top: 0;
}
