/**
 * AJAX Add to Cart Styles
 * Beautiful notification and button animations
 */

/* Success Notification */
#mgs-add-to-cart-notification {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 99999;
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    color: white;
    padding: 20px 28px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(229, 57, 53, 0.4), 0 6px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(450px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 400px;
    border: 2px solid rgba(255, 255, 255, 0.25);
}

#mgs-add-to-cart-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.mgs-notification-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mgs-notification-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    flex-shrink: 0;
    animation: mgs-icon-pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mgs-notification-icon svg {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.mgs-notification-message {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Button States */
/* Default button state - Red from the start */
button.single_add_to_cart_button {
    background-color: #e53935 !important;
    border-color: #c62828 !important;
    transition: all 0.3s ease;
}

button.single_add_to_cart_button:hover {
    background-color: #c62828 !important;
    border-color: #b71c1c !important;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3);
}

button.single_add_to_cart_button.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
    background-color: #e53935 !important;
}

button.single_add_to_cart_button.loading .mgs-spinner {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 8px;
    animation: mgs-spinner 1s linear infinite;
}

button.single_add_to_cart_button.loading .mgs-spinner svg {
    display: block;
}

button.single_add_to_cart_button.added {
    background-color: #c62828 !important;
    border-color: #b71c1c !important;
    transform: scale(1.05);
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(183, 28, 28, 0.4);
}

button.single_add_to_cart_button.added .mgs-checkmark {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 8px;
    animation: mgs-checkmark-pop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

button.single_add_to_cart_button.added .mgs-checkmark svg {
    display: block;
}

/* Animations */
@keyframes mgs-icon-pop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.15) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}
@keyframes mgs-spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes mgs-checkmark-pop {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #mgs-add-to-cart-notification {
        top: auto;
        bottom: 90px;
        right: 15px;
        left: 15px;
        max-width: none;
        padding: 18px 22px;
        transform: translateY(250px);
    }
    
    #mgs-add-to-cart-notification.show {
        transform: translateY(0);
    }
    
    .mgs-notification-message {
        font-size: 15px;
    }
    
    .mgs-notification-icon {
        width: 32px;
        height: 32px;
    }
    
    .mgs-notification-content {
        gap: 14px;
    }
    
    /* Fix add to cart button on mobile - make it full width */
    .single-product div.product form.cart {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .single-product div.product form.cart .quantity {
        width: 100%;
        margin-bottom: 0;
    }
    
    .single-product div.product form.cart .quantity input.qty {
        width: 100%;
        max-width: none;
        padding: 12px;
        font-size: 16px;
    }
    
    .single-product div.product form.cart button.single_add_to_cart_button {
        width: 100% !important;
        margin: 0 !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
    }
    
    /* Ensure variations are stacked properly too */
    .single-product .variations_form .variations {
        margin-bottom: 12px;
    }
    
    .single-product .variations_form .single_variation_wrap {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
}

/* Cart icon update animation */
.site-header-cart .cart-contents .count {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.site-header-cart .cart-contents .count.updated {
    animation: mgs-bounce 0.6s ease;
}

@keyframes mgs-bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

/* Optional: Hide "View Cart" notice if WooCommerce shows it */
.woocommerce-message {
    display: none !important;
}

/* Show a minimal version if you want to keep some feedback */
body.single-product .woocommerce-message {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

body.single-product .woocommerce-message .button {
    display: none;
}

/* Desktop - ensure button and quantity are inline */
@media (min-width: 769px) {
    .single-product div.product form.cart {
        display: flex;
        align-items: flex-end;
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .single-product div.product form.cart .quantity {
        margin-bottom: 0;
        flex: 0 0 auto;
    }
    
    .single-product div.product form.cart button.single_add_to_cart_button {
        flex: 1 1 auto;
        min-width: 200px;
    }
}

/* Make sure variations work well */
.single-product .variations_form .variations {
    margin-bottom: 1.5em;
}

.single-product .variations_form .single_variation_wrap {
    margin-bottom: 1em;
}
