/* Cart Sidebar Styles */
.cart-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99990; /* High z-index but below sidebar */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px; /* Hidden by default */
    width: 400px;
    height: 100%;
    height: 100vh; /* Fallback */
    height: 100dvh; /* Mobile browser friendly */
    background-color: #fff;
    z-index: 99999;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

.cart-sidebar.active {
    right: 0;
}

.cart-sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
}

.cart-sidebar-header h5 {
    font-weight: 600;
    color: #333;
}

.close-cart-sidebar {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f5f5f5;
}

.cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 15px;
    border: 1px solid #eee;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    margin-bottom: 5px;
    font-size: 0.95rem;
    line-height: 1.3;
}

.cart-item-title a {
    color: #333;
    text-decoration: none;
}

.cart-item-title a:hover {
    color: #007bff;
}

.cart-item-price {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.qty-btn {
    background: none;
    border: none;
    width: 25px;
    height: 25px;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background-color: #f5f5f5;
}

.quantity-control input {
    width: 30px;
    height: 25px;
    border: none;
    text-align: center;
    font-size: 0.9rem;
    padding: 0;
    -moz-appearance: textfield;
}

.quantity-control input::-webkit-outer-spin-button,
.quantity-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #dc3545; /* Bootstrap danger color */
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.remove-item-btn:hover {
    text-decoration: none;
    color: #bd2130;
}

.cart-sidebar-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background-color: #fff;
}

/* Success message animation */
.cart-success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for checkout button */
.btn-pulse {
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

/* Mobile responsiveness */
@media (max-width: 576px) {
    .cart-sidebar {
        width: 85%;
        max-width: 350px;
        right: -100%;
    }
    
    .cart-sidebar.active {
        right: 0;
    }

    .cart-sidebar-footer {
        padding-bottom: 80px; /* Extra padding for mobile bottom nav bars */
    }
}