/**
 * CSS cho hiệu ứng bay vào giỏ hàng
 */

/* Animation rung cho icon giỏ hàng */
@keyframes cartShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* Hiệu ứng bay cho sản phẩm */
.flying-cart-item {
    animation: flyToCart 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.flying-product-item {
    animation: flyToCart 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Keyframes cho hiệu ứng bay */
@keyframes flyToCart {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0.7;
    }
}

/* Hiệu ứng pulse cho nút thêm vào giỏ hàng khi click */
.them_gio:active,
.add_to_cart:active,
.q_add_to_cart:active {
    animation: buttonPulse 0.3s ease-in-out;
}

@keyframes buttonPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Hiệu ứng loading cho nút thêm vào giỏ hàng */
.them_gio.loading,
.add_to_cart.loading,
.q_add_to_cart.loading {
    position: relative;
    pointer-events: none;
}

.them_gio.loading::after,
.add_to_cart.loading::after,
.q_add_to_cart.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hiệu ứng bounce cho số lượng giỏ hàng */
.count_item {
    transition: all 0.3s ease;
}

.count_item.updated {
    animation: countBounce 0.6s ease-in-out;
}

@keyframes countBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Hiệu ứng fade in cho thông báo */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.cart-notification.show {
    transform: translateX(0);
}

.cart-notification.error {
    background: #f44336;
}

/* Hiệu ứng cho icon giỏ hàng khi có sản phẩm mới */
.shopcart_control a,
.cart_mobile .button-cart {
    transition: all 0.3s ease;
}

.shopcart_control a:hover,
.cart_mobile .button-cart:hover {
    transform: scale(1.05);
}

/* Hiệu ứng cho nút thêm vào giỏ hàng khi hover */
.them_gio:hover,
.add_to_cart:hover,
.q_add_to_cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
transition: all 0.3s ease;
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    .flying-cart-item,
    .flying-product-item {
        width: 30px !important;
        height: 30px !important;
        font-size: 14px !important;
    }
    
    .cart-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        transform: translateY(-100%);
    }
    
    .cart-notification.show {
        transform: translateY(0);
    }
    
    /* Tối ưu hiệu ứng rung cho mobile */
    @keyframes cartShake {
        0%, 100% { transform: translateX(0); }
        10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
        20%, 40%, 60%, 80% { transform: translateX(2px); }
    }
    
    /* Hiệu ứng cho icon giỏ hàng mobile */
    .button-cart {
        transition: all 0.3s ease;
    }
    
    .button-cart:hover {
        transform: scale(1.05);
    }
    
    /* Đảm bảo icon giỏ hàng mobile có thể được tìm thấy */
    .cart_mobile .button-cart {
        position: relative;
        z-index: 1000;
    }
    
    /* Tối ưu animation cho mobile */
    .flying-cart-item {
        transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
}

/* Hiệu ứng cho sản phẩm trong danh sách */
.li_product:hover .product-action {
    transform: translateY(0);
}

.product-action {
    transition: transform 0.3s ease;
}

/* Hiệu ứng loading overlay */
.cart-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.1);
    z-index: 9998;
    display: none;
}

.cart-loading-overlay.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Hiệu ứng cho icon giỏ hàng khi có animation */
.shopcart_control a.animating,
.cart_mobile .button-cart.animating {
    animation: cartGlow 0.6s ease-in-out;
}

@keyframes cartGlow {
    0%, 100% { 
        box-shadow: 0 0 0 rgba(229, 57, 53, 0);
    }
    50% { 
        box-shadow: 0 0 20px rgba(229, 57, 53, 0.6);
    }
}

/* Ẩn thông báo loading khi thêm vào giỏ hàng thành công */
.cart-success-loading .load_process {
    display: none !important;
}

.cart-success-loading .load_overlay {
    display: none !important;
}

/* Tối ưu hiệu ứng cho thêm vào giỏ hàng */
.them_gio:not(.disabled):active,
.add_to_cart:not(.disabled):active,
.q_add_to_cart:not(.disabled):active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}