/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Cart Button */
.cart-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cart-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.cart-button:active {
    transform: scale(0.95);
}

.cart-button i {
    font-size: 1.5rem;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--error-color);
    color: var(--white);
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.cart-count.bounce {
    animation: bounce 0.3s ease;
}

/* Cart Modal */
.cart-modal {
    max-width: 600px;
    width: 90%;
    margin: 2rem auto;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--secondary-color);
}

/* Cart Items Container */
.cart-items {
    max-height: 400px;
    overflow-y: auto;
    margin: 1rem 0;
    padding: 0 1rem;
}

.cart-items::-webkit-scrollbar {
    width: 8px;
}

.cart-items::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

/* Cart Item */
.cart-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    animation: slideIn 0.3s ease;
    background: var(--white);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.cart-item:hover {
    background: var(--gray-50);
}

.cart-item-image {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cart-item:hover .cart-item-image img {
    transform: scale(1.1);
}

.cart-item-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.cart-item-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Quantity Controls */
.quantity-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--gray-100);
    color: var(--secondary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.quantity-btn:hover:not(:disabled) {
    background: var(--gray-200);
    transform: translateY(-1px);
}

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity {
    font-weight: 600;
    min-width: 2rem;
    text-align: center;
}

.remove-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--error-color-light);
    color: var(--error-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: auto;
}

.remove-btn:hover {
    background: var(--error-color);
    color: var(--white);
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
    animation: fadeIn 0.3s ease;
}

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

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

/* Cart Summary */
.cart-summary {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 1.5rem;
    border-radius: 0 0 20px 20px;
}

.cart-subtotal,
.cart-delivery,
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.cart-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--gray-200);
}

/* Checkout Button */
.checkout-btn {
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    border: none;
    border-radius: 12px;
    background: var(--primary-color);
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkout-btn:hover:not(:disabled) {
    background: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.checkout-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cart-modal {
        width: 95%;
        margin: 1rem auto;
    }
    
    .cart-item {
        grid-template-columns: auto 1fr;
        gap: 1rem;
    }
    
    .cart-item-image {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .cart-button {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }
    
    .cart-count {
        min-width: 20px;
        height: 20px;
        font-size: 0.75rem;
    }
    
    .cart-header {
        padding: 1rem;
    }
    
    .cart-title {
        font-size: 1.25rem;
    }
    
    .cart-item-title {
        font-size: 1rem;
    }
    
    .cart-item-price {
        font-size: 1.1rem;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .cart-button {
        border: 2px solid var(--white);
    }
    
    .cart-count {
        border: 2px solid var(--white);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .cart-button,
    .cart-item,
    .quantity-btn,
    .remove-btn,
    .checkout-btn {
        transition: none;
    }
}
