/* Cart Sidebar Styles */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100%;
    background: var(--card);
    z-index: 1000;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--ghost);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-count-badge {
    background: var(--ghost);
    color: var(--text);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: normal;
}

.cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--ghost);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
    color: var(--text);
    text-decoration: none;
}

.cart-item-price {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid var(--ghost);
    border-radius: 4px;
}

.quantity-btn {
    background: none;
    border: none;
    padding: 4px 10px;
    cursor: pointer;
    color: var(--text);
    font-size: 16px;
}

.quantity-btn:hover {
    background: var(--ghost);
}

.quantity-display {
    padding: 0 8px;
    font-size: 14px;
    min-width: 24px;
    text-align: center;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.remove-btn:hover {
    color: #ef4444;
}

.cart-footer {
    padding: 20px;
    border-top: 2px solid var(--accent);
    background: var(--card);
    gap: 0px;
    align-items: self-start;
    margin-top: 15px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--muted);
}

.cart-total-row.final {
    color: var(--text);
    padding: 5px;
    border-radius: 12px;
    margin-top: 5px;
    margin-bottom: 5px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.cart-total-row.final>div:first-child {
    font-size: 1.1rem;
    text-align: left;
    flex: 1;
}

.cart-total-row.final #drawer-cart-total {
    color: #15be4d;
    text-align: right;
}

.checkout-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: var(--card);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.checkout-btn:hover {
    opacity: 0.9;
}

.empty-cart-message {
    text-align: center;
    padding: 40px 0;
    color: var(--muted);
}

@media (max-width: 500px) {
    .cart-sidebar {
        width: 100%;
        height: auto;
        max-height: 85vh;
        /* Leave some space at top to show it's an overlay */
        top: auto;
        bottom: -100%;
        /* Hidden below view */
        right: 0;
        left: 0;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        /* Shadow sliding up */
    }

    .cart-sidebar.open {
        right: 0;
        /* RESET: Keep right 0 to prevent conflict */
        bottom: 0;
        /* Slide to open */
    }

    /* Modern "Handle" for the sheet */
    .cart-header {
        position: relative;
        justify-content: center;
        border-bottom: none;
        /* Cleaner look */
        padding-bottom: 0;
    }

    .cart-header::after {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 5px;
        background: var(--ghost);
        border-radius: 3px;
    }

    .cart-header h3 {
        width: 100%;
        justify-content: space-between;
    }
}