/* Wishlist Button Styles - Complete with Gallery Integration */

/* Base styles for all wishlist buttons */
.custom-wishlist-wrapper {
    position: relative;
    margin: 10px 0;
}

.custom-wishlist-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.custom-wishlist-btn:hover {
    background: #fff;
    border-color: #ff4d4d;
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.custom-wishlist-wrapper.custom-wishlist-shortcode .custom-wishlist-btn {
    background: transparent;
    border: none;
    width: auto;
    height: auto;
    padding: 0;
    box-shadow: none;
}

.custom-wishlist-wrapper.custom-wishlist-shortcode .custom-wishlist-btn .wishlist-icon {
    font-size: 20px;
    color: #5D5D5D;
}

.custom-wishlist-wrapper.custom-wishlist-shortcode .wishlist-tooltip,
.custom-wishlist-wrapper.custom-wishlist-shortcode .wishlist-text {
    display: none;
}

.custom-wishlist-btn.icon-only {
    background: transparent;
    border: none;
    width: auto;
    height: auto;
    padding: 0;
    box-shadow: none;
}

.custom-wishlist-btn.icon-only,
.custom-wishlist-btn.icon-only .wishlist-icon {
    font-size: 24px;
    color: #ff4d4d;
}

.custom-wishlist-btn.icon-only .wishlist-tooltip,
.custom-wishlist-btn.icon-only .wishlist-text {
    display: none;
}

.custom-wishlist-btn .wishlist-icon {
    font-size: 20px;
    transition: all 0.3s ease;
}

.custom-wishlist-btn:not(.active) .wishlist-icon {
    color: #999;
}

.custom-wishlist-btn.active .wishlist-icon {
    color: #ff4d4d;
}

.custom-wishlist-btn.active .wishlist-icon {
    animation: heartBeat 0.3s ease;
}

/* Tooltip */
.wishlist-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    pointer-events: none;
    font-weight: normal;
}

.custom-wishlist-btn:hover .wishlist-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Single Product Button (Standard Position) */
.custom-wishlist-btn.single {
    border-radius: 8px;
    width: auto;
    height: auto;
    padding: 12px 24px;
    gap: 12px;
}

.custom-wishlist-btn.single .wishlist-text {
    font-size: 14px;
    font-weight: 600;
}

/* ============================================ */
/* GALLERY OVERLAY STYLES - MAIN GALLERY INTEGRATION */
/* ============================================ */

/* Make gallery container relative for absolute positioning */
.woocommerce-product-gallery {
    position: relative;
}

.woocommerce-product-gallery .flex-viewport,
.woocommerce-product-gallery .woocommerce-product-gallery__wrapper {
    position: relative;
}

/* Gallery overlay wrapper positioning */
.custom-wishlist-wrapper.gallery-overlay-wrapper {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 999;
    margin: 0;
    display: block !important;
}

/* Gallery overlay button styling */
.custom-wishlist-btn.gallery-overlay {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    width: 48px;
    height: 48px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.custom-wishlist-btn.gallery-overlay .wishlist-icon {
    font-size: 22px;
}

/* For zoom button compatibility */
.woocommerce-product-gallery__trigger {
    top: 15px !important;
    right: 70px !important;
    z-index: 1000 !important;
}

/* Shop loop button positioning */
.custom-wishlist-wrapper.shop-loop {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    margin: 0;
}

/* Product image container needs relative positioning */
.woocommerce-loop-product__link,
.product-image-wrapper {
    position: relative;
    display: block;
}

/* Gallery thumbnail area button */
.custom-wishlist-wrapper.gallery-thumbnail {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 99;
}

/* Elementor specific gallery handling */
.elementor-widget-woocommerce-product-images .woocommerce-product-gallery {
    position: relative;
}

.elementor-widget-woocommerce-product-images .custom-wishlist-wrapper.gallery-overlay-wrapper {
    position: absolute;
    z-index: 999;
}

/* Responsive adjustments for gallery */
@media (max-width: 768px) {
    .custom-wishlist-wrapper.gallery-overlay-wrapper {
        top: 10px;
        right: 10px;
    }
    
    .custom-wishlist-btn.gallery-overlay {
        width: 38px;
        height: 38px;
    }
    
    .custom-wishlist-btn.gallery-overlay .wishlist-icon {
        font-size: 18px;
    }
    
    .woocommerce-product-gallery__trigger {
        top: 10px !important;
        right: 58px !important;
    }
}

/* RTL Support */
.rtl .custom-wishlist-wrapper.gallery-overlay-wrapper {
    right: auto;
    left: 15px;
}

.rtl .woocommerce-product-gallery__trigger {
    right: auto !important;
    left: 70px !important;
}

/* ============================================ */
/* WISHLIST PAGE STYLES */
/* ============================================ */

.custom-wishlist-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.custom-wishlist-page h2 {
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
}

.wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.wishlist-item {
    position: relative;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: #fff;
}

.wishlist-item:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.wishlist-item img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
}

.wishlist-item h3 {
    font-size: 16px;
    margin: 15px 0 10px;
    font-weight: 500;
}

.wishlist-item-price {
    color: #e74c3c;
    font-weight: bold;
    font-size: 18px;
    margin: 10px 0;
}

.wishlist-item-price.out-of-stock {
    color: #999;
    font-size: 14px;
}

.remove-from-wishlist {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ff4d4d;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-from-wishlist:hover {
    background: #ff4d4d;
    color: white;
    transform: scale(1.1);
}

.add-to-cart-from-wishlist {
    margin-top: 15px;
    width: 100%;
    text-align: center;
    background: #333;
    color: white;
    padding: 10px;
    border-radius: 6px;
    display: inline-block;
    text-decoration: none;
    transition: all 0.3s ease;
}

.add-to-cart-from-wishlist:hover {
    background: #ff4d4d;
    color: white;
}

.empty-wishlist {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
}

.empty-wishlist a {
    color: #ff4d4d;
    text-decoration: none;
    font-weight: 600;
}

.empty-wishlist a:hover {
    text-decoration: underline;
}

/* Loading State */
.custom-wishlist-btn.loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

.custom-wishlist-btn.loading .wishlist-icon {
    animation: spin 1s linear infinite;
}

/* Wishlist count badge */
.wishlist-count-badge {
    display: inline-block;
    background: #ff4d4d;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    text-align: center;
    line-height: 18px;
    margin-left: 5px;
}

/* Animations */
@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}