.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
}

.clear-cart-btn,
.remove-btn {
    border: none;
    border-radius: 10px;
    background: #d90000;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.clear-cart-btn {
    height: 44px;
    padding: 0 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.remove-btn {
    width: 120px;
    height: 42px;
    padding: 0 18px;
    flex-shrink: 0;
}

.clear-cart-btn:disabled,
.remove-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.cart-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cart-item,
.summary-box,
.empty-cart {
    background: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
    border-radius: 18px;
}

.cart-item {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
}

.cart-item-main {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.cart-item-extra-box {
    width: 100%;
}

.cart-item.removing {
    animation: removeItemAnim 0.25s ease forwards;
}

@keyframes removeItemAnim {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
}

.cart-item.is-busy {
    pointer-events: none;
}

.cart-item-image img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    border-radius: 14px;
    display: block;
    background: #eee;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.cart-item-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.variant-form,
.cart-item-quantity-form,
.extras-form {
    width: 100%;
}

.cart-item-controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.cart-item-controls-row .variant-form {
    flex: 1;
    min-width: 180px;
}

.cart-item-quantity-form {
    width: 150px;
    flex: 0 0 150px;
}

.cart-item-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    margin-top: 2px;
}

.cart-item-total {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 12px;
    width: 100%;
    padding-top: 4px;
}

.cart-item-total-label {
    font-size: 15px;
    font-weight: 700;
    color: #444;
}

.item-price {
    font-size: 20px;
    font-weight: 700;
    text-align: right;
    color: #1f8f39;
}

.summary-box {
    padding: 20px;
    gap: 16px;
    position: sticky;
    top: 118px;
    display: flex;
    flex-direction: column;
}

.summary-title {
    font-size: 20px;
    font-weight: 700;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 16px;
}

.summary-total {
    font-weight: 700;
    color: #1f8f39;
    font-size: 22px;
}

.checkout-btn,
.continue-link {
    height: 48px;
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.checkout-btn:hover,
.continue-link:hover {
    opacity: 0.94;
}

.checkout-btn {
    background: #1f8f39;
}

.checkout-btn.is-disabled {
    background: #bdbdbd;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.7;
}

.continue-link {
    gap: 10px;
    background: #111;
}

.empty-cart {
    padding: 40px 24px;
    text-align: center;
    font-size: 18px;
    color: #555;
}

.cart-item-flavors {
    font-size: 14px;
    line-height: 1.4;
    color: #666;
}

/* =========================
   CART TUB PREVIEW
========================= */

.cart-tub-preview {
    width: 100%;
    height: 190px;

    display: grid;
    overflow: hidden;

    border: 2px solid #111;
    border-radius: 24px 24px 30px 30px;

    background: #eee;

    box-shadow:
        inset 0 -10px 0 rgba(0, 0, 0, 0.05),
        0 6px 16px rgba(0, 0, 0, 0.08);
}

.cart-tub-flavor {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.55);
}

.cart-tub-flavor:last-child {
    border-right: 0;
}

.cart-tub-flavor img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    border-radius: 0 !important;
}

@media (max-width: 1080px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .summary-box {
        position: static;
    }
}

/* Da 461px fino a 1080px:
   info a sinistra, preview a destra */
@media (min-width: 521px) and (max-width: 1080px) {
    .cart-item-main {
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 20px;
        align-items: start;
    }

    .cart-item-image img,
    .cart-tub-preview {
        height: 190px;
    }
}

/* Variante compatta tra 461px e 760px */
@media (min-width: 521px) and (max-width: 760px) {
    .cart-item-main {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .cart-item-image img,
    .cart-tub-preview {
        height: 190px;
    }

    .cart-item-title {
        font-size: 18px;
    }

    .cart-item-controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .cart-item-controls-row .variant-form,
    .cart-item-quantity-form {
        width: 100%;
        min-width: 0;
        flex: 0 0 auto;
    }
}

/* Da 460px in giù:
   tutto in colonna */
@media (max-width: 520px) {
    .cart-item-main {
        grid-template-columns: 1fr;
    }

    .cart-item-info,
    .cart-item-image {
        order: initial;
    }

    .cart-item-image img,
    .cart-tub-preview {
        height: 240px;
    }

    .cart-item-controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .cart-item-controls-row .variant-form,
    .cart-item-quantity-form {
        width: 100%;
        min-width: 0;
        flex: 0 0 auto;
    }

    .cart-item-footer {
        align-items: stretch;
    }

    .cart-item-total {
        justify-content: space-between;
    }

    .remove-btn {
        width: 100%;
    }
}


/* Da 401px a 520px:
   price-select e quantity-selector restano sulla stessa riga */
@media (min-width: 401px) and (max-width: 520px) {
    .cart-item-controls-row {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .cart-item-controls-row .variant-form {
        flex: 1;
        min-width: 0;
        width: auto;
    }

    .cart-item-quantity-form {
        width: 150px;
        flex: 0 0 150px;
    }
}

@media (max-width: 400px) {

    .page-title {
        font-size: 24px;
    }
}

@media (max-width: 380px) {
    .cart-tub-preview {
        height: clamp(150px, 58vw, 210px);
    }

    .cart-tub-flavor img {
        height: 100%;
        object-fit: cover;
    }

    .cart-item-image > img {
        height: clamp(150px, 58vw, 210px);
        object-fit: cover;
    }
}

@media (max-width: 366px) {

    .page-title {
        font-size: 20px;
    }

    .clear-cart-btn {
        width: 44px;
        padding: 0;
        gap: 0;
    }

    .clear-cart-btn-text {
        display: none;
    }
}
