/**
 * WC My Favorites - Clean Styles with Animations
 * Version: 2.0.0
 */

/* ========================================
   Reset stacking context creators on containers
   ======================================== */

.mfp-favorites-list,
.mfp-favorites-list ul.products,
.mfp-favorites-list ul.products li.product {
    transform: none !important;
    will-change: auto !important;
    contain: none !important;
    isolation: auto !important;
    mix-blend-mode: normal !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    perspective: none !important;
    transform-style: flat !important;
    clip-path: none !important;
    mask: none !important;
    -webkit-mask: none !important;
}

/* ========================================
   Heart Button - Minimal, Transparent Design
   ======================================== */

.mfp-heart-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none !important;
    background: transparent !important;
    cursor: pointer;
    transition: transform 0.3s ease;
    margin: 10px 0;
    box-shadow: none !important;
    outline: none !important;
}

.mfp-heart-button:hover {
    transform: scale(1.15);
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.mfp-heart-button:active {
    transform: scale(0.95);
}

/* Heart SVG Icons */
.mfp-heart-button svg {
    position: absolute;
    width: 24px;
    height: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mfp-heart-empty {
    color: #666;
    opacity: 1;
    transform: scale(1);
}

.mfp-heart-filled {
    color: #ff4458;
    opacity: 0;
    transform: scale(0);
}

/* Favorited State */
.mfp-heart-button.favorited {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.mfp-heart-button.favorited:hover {
    transform: scale(1.2);
    background: transparent !important;
    box-shadow: none !important;
}

.mfp-heart-button.favorited .mfp-heart-empty {
    opacity: 0;
    transform: scale(0);
}

.mfp-heart-button.favorited .mfp-heart-filled {
    color: #ffffff;
    opacity: 1;
    transform: scale(1);
    animation: heartBeat 0.6s ease;
}

/* Loading State */
.mfp-heart-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.mfp-heart-button.loading svg {
    animation: pulse 1s infinite;
}

/* Ripple Effect */
.mfp-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 68, 88, 0.3) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
}

.mfp-heart-button:active .mfp-ripple {
    animation: ripple 0.6s ease-out;
}

/* Animations */
@keyframes heartPop {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.3);
    }
    60% {
        transform: scale(0.95);
    }
    80% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes heartBeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    45% {
        transform: scale(0.9);
    }
    60% {
        transform: scale(1.1);
    }
    80% {
        transform: scale(0.95);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ========================================
   Favorites List Specific Styling
   ======================================== */

.wc-mfp-empty {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

.wc-mfp-empty .woocommerce-info {
    margin-bottom: 20px;
    font-size: 16px;
    color: #666;
}

/* Favorites Grid */
.mfp-favorites-list .products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 20px;
    list-style: none;
    padding: 0;
}

.mfp-favorites-list .product {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: visible; /* Changed from hidden to show the button */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    padding: 60px 15px 15px 15px; /* Add padding at top for the button */
}

.mfp-favorites-list .product:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Ensure product images don't overflow */
.mfp-favorites-list .product img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Remove Button Positioning */
.mfp-favorite-remove-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}

.mfp-favorite-remove-wrapper .mfp-heart-button {
    width: 40px;
    height: 40px;
    margin: 0;
    background: linear-gradient(135deg, #ff6b7a 0%, #ff4458 100%);
    backdrop-filter: blur(10px);
    border: 2px solid #ff4458;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mfp-favorite-remove-wrapper .mfp-heart-button:hover {
    background: linear-gradient(135deg, #ff8a99 0%, #ff6478 100%);
    border-color: #ff6478;
    box-shadow: 0 4px 12px rgba(255, 68, 88, 0.4);
    transform: scale(1.1);
}

.mfp-favorite-remove-wrapper .mfp-heart-button svg {
    width: 20px;
    height: 20px;
}

/* Always show filled heart in favorites list */
.mfp-favorite-remove-wrapper .mfp-heart-button.favorited .mfp-heart-filled {
    color: #ffffff;
    opacity: 1;
    transform: scale(1);
}

.mfp-favorite-remove-wrapper .mfp-heart-button.favorited .mfp-heart-empty {
    opacity: 0;
    transform: scale(0);
}

/* Removal Animation */
.product.removing {
    animation: fadeOutScale 0.4s ease-out;
    opacity: 0;
    transform: scale(0.9);
}

@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* ========================================
   Smooth Notifications
   ======================================== */

/* Override Avada child theme z-index values */
.product-fav-btn,
.product-postcard,
.product-postcard:hover,
.product-postcard * {
    z-index: 10 !important;
    position: relative !important;
}

/* Ensure product cards don't create new stacking contexts */
.product-postcard,
.products .product {
    transform: none !important;
    filter: none !important;
    will-change: auto !important;
}

/* Override Fusion/Avada extreme z-index values */
.fusion-woocommerce-quick-view-overlay,
.fusion-woocommerce-quick-view-container,
.fusion-woocommerce-quick-view-container .fusion-wqv-preview-image {
    z-index: 99999 !important; /* Lower than our notifications */
}

/* Notification styles - let JavaScript handle positioning for animations */
.mfp-notification {
    /* Only keep z-index to ensure it's above other elements */
    z-index: 10000000 !important; /* Higher than Fusion's highest (1000000) */
    /* All other styles handled by JavaScript for proper animation */
}

/* Notification styles handled by JavaScript for proper animations */
/* Removed CSS that was interfering with JS positioning */

/* ========================================
   Product Page Integration
   ======================================== */

.single-product .mfp-heart-button {
    margin: 15px 0;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .mfp-favorites-list .products {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .mfp-heart-button {
        width: 44px;
        height: 44px;
    }

    .mfp-favorite-remove-wrapper .mfp-heart-button {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .mfp-favorites-list .products {
        grid-template-columns: 1fr 1fr;
    }
}