.cart-sidebar {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: stretch;
    justify-content: flex-end;
}

.cart-sidebar.is-open { display: flex; }

.cart-sidebar .cart-overlay {
    position: absolute;
    inset: 0;
    background: rgba(18, 30, 43, .42);
    cursor: pointer;
}

.cart-sidebar > .cart-content {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(430px, 100vw);
    height: 100%;
    flex-direction: column;
    background: #f4f6f8;
    box-shadow: -8px 0 30px rgba(18, 30, 43, .18);
    animation: cartSlideIn .22s ease-out;
}

@keyframes cartSlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.cart-sidebar .cart-header {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e1e6ea;
    background: #fff;
    padding: 16px 20px;
}

.cart-sidebar .cart-header h3 {
    margin: 0;
    color: #17202c;
    font-size: 22px;
    font-weight: 900;
}

.cart-sidebar .cart-close {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #75808a;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
}

.cart-sidebar .cart-close:hover { background: #edf1f3; color: #17202c; }

.cart-sidebar .cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-sidebar .cart-item {
    position: relative;
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 13px;
    margin: 0 0 10px;
    border: 1px solid #e0e5e9;
    border-radius: 8px;
    background: #fff;
    padding: 12px 40px 12px 12px;
}

.cart-sidebar .item-image {
    width: 82px;
    height: 92px;
    overflow: hidden;
    border: 1px solid #edf0f2;
    border-radius: 6px;
    background: #fff;
}

.cart-sidebar .item-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.cart-sidebar .item-details {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.cart-sidebar .item-details h4 {
    display: -webkit-box;
    overflow: hidden;
    margin: 1px 0 5px;
    color: #17202c;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cart-sidebar .item-unit-price {
    margin: 0;
    color: #77828c;
    font-size: 11px;
}

.cart-sidebar .item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

.cart-sidebar .item-quantity {
    border-radius: 4px;
    background: #eef7f6;
    color: #087e7c;
    font-size: 11px;
    font-weight: 800;
    padding: 5px 7px;
}

.cart-sidebar .item-price {
    color: #17202c;
    font-size: 14px;
    font-weight: 900;
}

.cart-sidebar .item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1c4c0;
    border-radius: 50%;
    background: #fff5f4;
    color: #c9463b;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.cart-sidebar .item-remove:hover { border-color: #c9463b; background: #c9463b; color: #fff; }

.cart-sidebar .cart-empty-state {
    border: 1px dashed #ccd5dc;
    border-radius: 8px;
    background: #fff;
    padding: 44px 20px;
    text-align: center;
}

.cart-sidebar .cart-empty-state p { margin: 0 0 16px; color: #66727d; font-size: 14px; }

.cart-sidebar .cart-summary {
    flex-shrink: 0;
    border-top: 1px solid #e0e5e9;
    background: #fff;
    padding: 13px 20px;
}

.cart-sidebar .summary-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #66727d;
    font-size: 13px;
    padding: 7px 0;
}

.cart-sidebar .summary-row.total {
    margin-top: 5px;
    border-top: 1px solid #e0e5e9;
    color: #17202c;
    font-size: 16px;
    font-weight: 900;
    padding-top: 12px;
}

.cart-sidebar .cart-buttons {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 8px;
    flex-shrink: 0;
    border-top: 1px solid #e0e5e9;
    background: #fff;
    padding: 13px 20px max(13px, env(safe-area-inset-bottom));
}

.cart-sidebar .cart-buttons .btn {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 900;
    padding: 10px 12px;
    text-align: center;
    text-decoration: none;
}

.cart-sidebar .btn-view-cart { border: 1px solid #ccd5dc; background: #fff; color: #17202c; }
.cart-sidebar .btn-place-order { border: 1px solid #ffd315; background: #ffd315; color: #17202c; }
.cart-sidebar .btn-view-cart:hover { border-color: #03918f; color: #03918f; }
.cart-sidebar .btn-place-order:hover { background: #f1c500; color: #17202c; }

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    width: 20px;
    min-width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.cart-icon-active { color: #03918f; }

@media (max-width: 480px) {
    .cart-sidebar > .cart-content { width: 100vw; }
    .cart-sidebar .cart-header { min-height: 64px; padding: 13px 14px; }
    .cart-sidebar .cart-header h3 { font-size: 19px; }
    .cart-sidebar .cart-items { padding: 12px; }
    .cart-sidebar .cart-item { grid-template-columns: 70px minmax(0, 1fr); padding: 10px 38px 10px 10px; }
    .cart-sidebar .item-image { width: 70px; height: 80px; }
    .cart-sidebar .cart-summary { padding: 10px 14px; }
    .cart-sidebar .cart-buttons { padding: 10px 14px max(10px, env(safe-area-inset-bottom)); }
}
