/**
 * Single Product AJAX Add to Cart Styles
 */

/* Loading state for add to cart button */
.single_add_to_cart_button.loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

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

/* Success state for add to cart button */
.single_add_to_cart_button.added {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.single_add_to_cart_button.added::before {
    content: '✓ ';
    font-weight: bold;
}

/* Spin animation for loading state */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Add to cart message styles */
.add-to-cart-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    z-index: 9999;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    animation: slideInRight 0.3s ease-out;
}

.add-to-cart-message.success {
    background-color: #28a745;
    color: white;
}

.add-to-cart-message.error {
    background-color: #dc3545;
    color: white;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Prevent form submission during loading */
.single-product-cart form.loading {
    pointer-events: none;
}

/* Quantity input styling during AJAX */
.single-product-cart .quantity input:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .add-to-cart-message {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}
