/**
 * AJAX Add to Cart Styles for NAF Theme
 * Button states, animations, and cart badge effects
 */

/* Add to Cart Button States */
.single_add_to_cart_button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.single_add_to_cart_button.loading {
    background-color: var(--naf-primary) !important;
    color: white !important;
    cursor: not-allowed;
}

.single_add_to_cart_button.added {
    background-color: var(--naf-success) !important;
    color: white !important;
    border-color: var(--naf-success) !important;
}

.single_add_to_cart_button.error {
    background-color: var(--naf-error) !important;
    color: white !important;
    border-color: var(--naf-error) !important;
}

.single_add_to_cart_button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 15px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Cart Badge Animations - use existing theme badge styling */

.cart-badge-pulse {
    animation: badgePulse 0.6s ease-in-out;
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); background-color: var(--naf-primary); }
    100% { transform: scale(1); }
}

.cart-animate-bounce {
    animation: cartBounce 0.6s ease-in-out;
}

@keyframes cartBounce {
    0%, 20%, 60%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    80% { transform: translateY(-5px); }
}

/* Add to Cart Success Notice */
.naf-cart-notice {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 350px;
    min-width: 280px;
}

.naf-cart-notice.success {
    border-left: 4px solid var(--naf-success);
}

.naf-cart-notice.show {
    transform: translateY(0);
    opacity: 1;
}

.naf-cart-notice .notice-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.naf-cart-notice .notice-content i {
    color: var(--naf-success);
    font-size: 18px;
    flex-shrink: 0;
}

.naf-cart-notice .notice-content span {
    color: var(--naf-gray-800);
    font-weight: 500;
    line-height: 1.4;
}

.naf-cart-notice .notice-close {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--naf-gray-400);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.naf-cart-notice .notice-close:hover {
    color: var(--naf-gray-800);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .naf-cart-notice {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
    }
    
    /* Cart badge mobile adjustments handled by header.css */
}

/* Button hover effects */
.single_add_to_cart_button:hover:not(.loading):not(.added):not(.error) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.single_add_to_cart_button.added:hover {
    background-color: var(--naf-success) !important;
    opacity: 0.9;
}

/* Quantity input styling enhancements */
.quantity {
    position: relative;
}

.quantity label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--naf-gray-800);
}

.quantity .qty {
    border-radius: 6px;
    border: 2px solid var(--naf-gray-200);
    padding: 10px 15px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    width: 80px;
    text-align: center;
}

.quantity .qty:focus {
    outline: none;
    border-color: var(--naf-primary);
    box-shadow: 0 0 0 3px var(--naf-primary-100);
}