﻿/* ===========================================
   CART PAGE ANIMATIONS & MODERN UI
   =========================================== */

/* Toast Container Styles */
#toast-container {
    z-index: 9999 !important;
}

/* Toast Animation */
.toast {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Cart Item Animations */
.cart-item, .cart-item-mobile {
    transition: all 0.3s ease;
}

.cart-item.removing, .cart-item-mobile.removing {
    opacity: 0.5;
    transform: translateX(-20px);
}

/* Highlight Update Animation */
@keyframes highlightUpdate {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: #fff3cd;
    }
    100% {
        background-color: transparent;
    }
}

.highlight-update {
    animation: highlightUpdate 0.6s ease;
}

/* Cart Summary Animations */
.cart-summary {
    transition: all 0.3s ease;
}

.cart-summary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

/* Quantity Selector Improvements */
.quantity-selector {
    transition: all 0.2s ease;
}

.quantity-selector:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quantity-selector button {
    transition: all 0.2s ease;
}

.quantity-selector button:hover {
    background-color: #e9ecef !important;
    transform: scale(1.1);
}

.quantity-selector button:active {
    transform: scale(0.95);
}

.quantity-selector input:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

/* Remove Button Animations */
.remove-btn, .remove-item {
    transition: all 0.2s ease;
}

.remove-btn:hover, .remove-item:hover {
    transform: scale(1.1);
    color: #dc3545 !important;
}

.remove-btn:active, .remove-item:active {
    transform: scale(0.9);
}

.remove-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Checkout Button Enhancement */
.checkout-btn {
    position: relative;
    overflow: hidden;
}

.checkout-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.checkout-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Empty Cart Animation */
.empty-cart {
    animation: fadeInUp 0.5s ease;
}

.empty-cart i {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Cart Badge Pulse Animation */
.page-title .badge {
    transition: all 0.3s ease;
}

.page-title .badge.animate__animated {
    display: inline-block;
}

/* Product Image Hover Effect */
.product-image {
    transition: all 0.3s ease;
}

.product-image:hover {
    transform: scale(1.05);
}

/* Cart Table Row Hover */
.cart-table tbody tr {
    transition: background-color 0.2s ease;
}

.cart-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Mobile Cart Item Enhancement */
.cart-item-mobile {
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.cart-item-mobile:hover {
    border-left-color: #ffc107;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Promo Code Input Animation */
.promo-code .input-group {
    transition: all 0.3s ease;
}

.promo-code .input-group:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
    border-radius: 5px;
}

/* Continue Shopping Link */
.continue-shopping {
    position: relative;
    display: inline-block;
}

.continue-shopping::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #28a745;
    transition: width 0.3s ease;
}

.continue-shopping:hover::before {
    width: 100%;
}

/* Loading State for Buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Alert Enhancement */
.alert {
    border-left: 4px solid;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .cart-summary {
        position: sticky;
        bottom: 0;
        z-index: 100;
        margin-bottom: 0;
        border-radius: 10px 10px 0 0;
    }
    
    .checkout-btn {
        font-size: 1rem;
        padding: 12px;
    }
}

/* Modern Scrollbar for Cart Page */
.cart-page ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.cart-page ::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.cart-page ::-webkit-scrollbar-thumb {
    background: #ffc107;
    border-radius: 10px;
}

.cart-page ::-webkit-scrollbar-thumb:hover {
    background: #e0a800;
}

/* Confirmation Toast Styles */
.toast.bg-warning .btn-light {
    background-color: white;
    color: #333;
    font-weight: 600;
}

.toast.bg-warning .btn-light:hover {
    background-color: #f8f9fa;
}

.toast.bg-warning .btn-outline-light {
    border-color: white;
    color: white;
}

.toast.bg-warning .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Success/Error Toast Icons */
.toast .bi {
    font-size: 1.2rem;
    vertical-align: middle;
}

/* Cart Count Badge Animation */
@keyframes cartBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.cart-count.animate__bounce {
    animation: cartBounce 0.5s ease;
}

/* Shipping Estimate Section */
.cart-summary select:focus,
.cart-summary input:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
}

/* Item Subtotal Highlight */
.item-subtotal {
    font-weight: 600;
    color: #28a745;
    transition: all 0.3s ease;
}

/* Summary Row Enhancement */
.summary-row {
    transition: all 0.2s ease;
}

.summary-row:hover {
    background-color: #f8f9fa;
    padding-left: 5px;
    border-radius: 5px;
}

.summary-row.total {
    background-color: #f8f9fa;
    padding: 15px 10px;
    border-radius: 8px;
}

/* Free Shipping Alert */
.alert-info {
    border-left: 4px solid #0dcaf0;
    background-color: #cff4fc;
    border-color: #b6effb;
}

/* Product Details in Cart */
.product-details h5 {
    transition: color 0.2s ease;
}

.product-details h5:hover {
    color: #28a745;
}

/* Animate.css Integration */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.animate__animated.animate__pulse {
    animation: pulse 1s ease;
}

/* Modern Card Shadows */
.cart-table,
.cart-summary,
.cart-item-mobile {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease;
}

.cart-table:hover,
.cart-summary:hover,
.cart-item-mobile:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Shopping Cart Badge in Page Title */
.page-title .badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

/* Enhanced Product Info Section */
.product-info {
    position: relative;
}

.product-info::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.cart-item:hover .product-info::after {
    width: 100%;
}

/* Quantity Input Focus Effect */
.quantity-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Promo Code Success State */
.promo-code.success .input-group {
    border: 2px solid #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.2);
}

/* Cart Item Slide Out Animation */
@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

.cart-item.slide-out {
    animation: slideOut 0.4s ease forwards;
}
