.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    max-width: 100vw;
    height: var(--fs-cart-vh, 100vh);
    height: var(--fs-cart-vh, 100dvh);
    max-height: var(--fs-cart-vh, 100dvh);
    background: #ffffff;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
}

.cart-sidebar.open {
    transform: translateX(0);
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--fs-cart-vh, 100vh);
    height: var(--fs-cart-vh, 100dvh);
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.show {
    opacity: 1;
    visibility: visible;
}

body.cart-sidebar-open {
    overflow: hidden;
    touch-action: none;
}

.cart-header {
    padding: 24px;
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    margin: 0;
}

.cart-sidebar-notice,
.single-page-cart-confirmation {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    color: #047857;
    font-size: 0.86rem;
    font-weight: 800;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height 0.22s ease, margin-top 0.22s ease, opacity 0.22s ease, transform 0.22s ease;
}

.cart-sidebar-notice.is-visible,
.single-page-cart-confirmation.is-visible {
    max-height: 24px;
    margin-top: 7px;
    opacity: 1;
    transform: translateY(0);
}

.cart-sidebar-notice i,
.single-page-cart-confirmation i {
    color: #10b981;
}

.cart-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.cart-close:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: rotate(90deg);
}

.cart-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

.cart-footer {
    flex: 0 0 auto;
    padding: 18px 24px calc(18px + env(safe-area-inset-bottom));
    border-top: 2px solid var(--primary-light);
    background: #fffbf0;
    box-shadow: 0 -12px 30px rgba(17, 24, 39, 0.08);
    z-index: 2;
}

.cart-footer .btn-primary {
    width: 100%;
}

.cart-footer-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    color: var(--text-sub);
    font-size: 0.9rem;
    font-weight: 700;
}

.cart-footer-summary-mobile-only {
    display: none;
}

.cart-footer-summary strong {
    color: var(--accent);
    font-size: 1.15rem;
    font-weight: 900;
    white-space: nowrap;
}

.cart-checkout-label-mobile {
    display: none;
}

.cart-proceed-btn {
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: var(--radius-pill, 999px);
    background: var(--primary);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(251, 191, 36, 0.3);
    transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, color 0.22s ease, opacity 0.22s ease;
}

.cart-proceed-btn:not(:disabled):hover {
    background: var(--primary-dark);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(217, 119, 6, 0.34);
}

.cart-proceed-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none;
}

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

.cart-sidebar-item {
    min-width: 0;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
}

.cart-sidebar-item-head,
.cart-sidebar-item-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.cart-sidebar-item-head {
    align-items: flex-start;
    margin-bottom: 8px;
}

.cart-sidebar-item-copy {
    min-width: 0;
}

.cart-sidebar-item-platform {
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.cart-sidebar-item-category {
    color: var(--text-sub);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.cart-sidebar-remove {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-sidebar-remove:hover {
    background: #fee2e2;
}

.cart-sidebar-item-meta {
    align-items: center;
}

.cart-sidebar-item-quantity {
    color: var(--primary-dark);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.cart-sidebar-item-price {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 800;
    white-space: nowrap;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-sub);
}

.cart-empty i {
    font-size: 4rem;
    color: var(--primary-light);
    margin-bottom: 20px;
}

.cart-empty p {
    font-size: 1.1rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .cart-sidebar {
        width: 100vw;
        max-width: 100vw;
    }

    .cart-header {
        flex: 0 0 auto;
        padding: 14px 16px;
    }

    .cart-header h2 {
        font-size: 1.25rem;
    }

    .cart-content {
        flex: 1 1 auto;
        min-height: 0;
        padding: 14px;
        padding-bottom: calc(252px + env(safe-area-inset-bottom));
    }

    .cart-footer {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        box-sizing: border-box;
        min-height: calc(236px + env(safe-area-inset-bottom));
        padding: 10px 14px calc(34px + env(safe-area-inset-bottom));
        background: rgba(255, 251, 240, 0.98);
        backdrop-filter: blur(12px);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .cart-footer-summary {
        align-items: flex-start;
        flex: 0 0 auto;
        margin-bottom: 14px;
        font-size: 0.85rem;
    }

    .cart-footer-summary-mobile-only {
        display: flex;
    }

    .cart-footer-summary strong {
        font-size: 1.05rem;
    }

    .cart-proceed-btn {
        flex: 0 0 52px;
        min-height: 52px;
        font-size: 1rem;
        box-shadow: 0 12px 26px rgba(217, 119, 6, 0.24);
    }

    .cart-checkout-label-full {
        display: none;
    }

    .cart-checkout-label-mobile {
        display: inline;
    }

    .cart-sidebar-item {
        padding: 14px;
    }

    .cart-sidebar-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .cart-sidebar-item-price {
        white-space: normal;
    }

    .cart-empty {
        padding: 40px 20px;
    }

    .cart-empty i {
        font-size: 3rem;
        margin-bottom: 15px;
    }

    .cart-empty p {
        font-size: 1rem;
    }
}
