.ms-cart-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-dark);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.ms-side-cart {
    position: fixed;
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: 420px;
    max-width: 90vw;
    background: var(--white);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    -webkit-transform: translateX(calc(100% + 20px));
    transform: translateX(calc(100% + 20px));
    transition: -webkit-transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 30px var(--overlay-medium);
    overflow: hidden;
}

.ms-side-cart.active {
    -webkit-transform: translateX(0);
    transform: translateX(0);
}

.ms-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 16px;
    border-bottom: 1.5px solid var(--border-default);
    flex-shrink: 0;
}

.ms-cart-title {
    font-family: var(--font-family);
    font-size: var(--fs-18);
    font-weight: var(--font-weight-bold);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ms-cart-title-badge {
    width: 22px;
    height: 22px;
    background: var(--button-primary-bg);
    color: var(--white);
    border-radius: 50%;
    font-size: var(--fs-11);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ms-cart-close {
    background: transparent;
    border: 1px solid var(--overlay-medium);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-18);
    color: var(--text);
    transition: background 0.2s;
}

.ms-cart-close:hover { background: var(--overlay-light); }

.ms-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
}

.ms-cart-items { padding: 16px 0; }

.ms-cart-item {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 14px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.ms-cart-item:last-child { border-bottom: none; }

.ms-cart-item-img {
    width: 70px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-light);
    border: 1px solid var(--border-default);
}

.ms-cart-item-info { min-width: 0; }

.ms-cart-item-name {
    font-family: var(--font-family);
    font-size: var(--fs-14);
    font-weight: var(--font-weight-bold);
    color: var(--text);
    margin: 0 0 4px;
    line-height: 1.3;
}

.ms-cart-item-price {
    font-family: var(--font-family);
    font-size: var(--fs-13);
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.ms-cart-item-remove {
    background: none;
    border: none;
    font-family: var(--font-family);
    font-size: var(--fs-12);
    color: var(--text-light);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    text-align: left;
}

.ms-cart-item-remove:hover { color: var(--primary); }

.ms-cart-item-qty {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.ms-cart-qty-input {
    width: 52px;
    height: 36px;
    border: 1.5px solid var(--border-medium);
    border-radius: 6px;
    text-align: center;
    font-family: var(--font-family);
    font-size: var(--fs-14);
    font-weight: 500;
    color: var(--text);
    -moz-appearance: textfield;
    appearance: textfield;
}

.ms-cart-qty-input::-webkit-outer-spin-button,
.ms-cart-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.ms-cart-upsells { padding: 14px 0 20px; }

.ms-cart-upsells-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ms-cart-upsells-title {
    font-family: var(--font-family);
    font-size: var(--fs-14);
    font-weight: 500;
    color: var(--text);
}

.ms-cart-upsells-nav {
    display: flex;
    gap: 6px;
}

.ms-cart-nav-btn {
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--border-medium);
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-14);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.ms-cart-nav-btn:hover { border-color: var(--text); color: var(--text); }

.ms-cart-upsells-track-wrap { overflow: hidden; }

.ms-cart-upsells-track {
    display: flex;
    gap: 10px;
    transition: transform 0.3s ease;
}

.ms-cart-upsell-card {
    flex: 0 0 calc(50% - 5px);
    border: 1.5px solid var(--border-default);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ms-cart-upsell-card:hover { border-color: var(--border-strong); }

.ms-cart-upsell-inner {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ms-cart-upsell-img {
    width: 48px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--bg-light);
    flex-shrink: 0;
}

.ms-cart-upsell-info { min-width: 0; }

.ms-cart-upsell-name {
    font-family: var(--font-family);
    font-size: var(--fs-12);
    font-weight: var(--font-weight-bold);
    color: var(--text);
    text-transform: uppercase;
    line-height: 1.3;
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ms-cart-upsell-price {
    font-family: var(--font-family);
    font-size: var(--fs-12);
    color: var(--text-gray-600);
}

.ms-cart-upsell-add {
    background-color: var(--white);
    border: 1.5px solid var(--border-medium);
    border-radius: 20px;
    padding: 5px 14px;
    font-family: var(--font-family);
    font-size: var(--fs-12);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.ms-cart-upsell-add:hover {
    background: var(--text);
    color: var(--white);
    border-color: var(--text);
}

.ms-cart-footer {
    padding: 16px 20px 24px;
    border-top: 1.5px solid var(--border-default);
    flex-shrink: 0;
}

.ms-cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ms-cart-total-label {
    font-family: var(--font-family);
    font-size: var(--fs-18);
    font-weight: var(--font-weight-bold);
    color: var(--text);
}

.ms-cart-total-price {
    font-family: var(--font-family);
    font-size: var(--fs-18);
    font-weight: var(--font-weight-bold);
    color: var(--text);
}

.ms-cart-tax-note {
    font-family: var(--font-family);
    font-size: var(--fs-12);
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ms-cart-tax-note a {
    color: var(--text);
    text-decoration: underline;
}

.ms-cart-order-note {
    font-family: var(--font-family);
    font-size: var(--fs-13);
    color: var(--text-secondary);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 14px;
    display: block;
}

.ms-cart-checkout-btn {
    width: 100%;
    height: 56px;
    background: var(--button-primary-bg);
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: var(--fs-16);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: opacity 0.2s;
    text-decoration: none;
}

.ms-cart-checkout-btn:hover { opacity: 0.88; color: var(--white); }

.ms-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    gap: 12px;
    color: var(--text-light);
    font-family: var(--font-family);
    font-size: var(--fs-14);
}
.ms-cart-empty svg { color: var(--border-medium); }
.ms-cart-empty strong { font-size: var(--fs-16); color: var(--text-gray-500); font-weight: 600; }
.ms-cart-empty span { color: var(--text-gray-600); }
.ms-cart-empty a {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 24px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--fs-14);
    transition: opacity 0.2s;
}
.ms-cart-empty a:hover { opacity: 0.85; }

@media (max-width: 768px) {
    .ms-side-cart {
        top: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
        -webkit-transform: translateX(100%);
        transform: translateX(100%);
    }

    .ms-side-cart.active {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
}
