/**
 * Cliente Favorites System - Styles
 */

/* Favorite Button Base Styles */
.favorite-btn {
    position: absolute;
    z-index: 50; /* Higher z-index to appear above other elements */
    background: none;
    border: none;
    border-radius: 50%;
    width: 3.3rem;
    height: 3.3rem;
    display: flex; /* Always flex to center the icon */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    padding: 0;
    opacity: 0; /* Hidden by default, shown via JS when logged in */
    visibility: hidden;
    pointer-events: none;
    flex-shrink: 0; /* Don't shrink */
}

.favorite-btn.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Fallback visibility for card hearts when logged in (including combo cards). */
body.w_logged .product .variation_image_container > .favorite-btn.product-favorite {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Prevent button from blocking label clicks */
.favorite-btn:not(:hover):not(:focus) {
    pointer-events: auto; /* Only capture direct clicks */
}

.favorite-btn:hover {
}

.favorite-btn:active {
    transform: scale(0.95);
}

.favorite-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Heart Icon SVG */
body .favorite-btn svg {
    width: 100%;
    height: 100%;
    fill: white;
    stroke: rgb(0 0 0 / 15%);
    stroke-width: 1px;
    transition: all 0.3s ease;
    pointer-events: none; /* Let clicks pass through SVG to button */
}

.favorite-btn:hover svg {
}

/* Favorited State */
body .favorite-btn.is-favorited svg {
    fill: #e74c3c;
    stroke: #b13528;
}

body .favorite-btn.is-favorited {
}

/* Feedback Animation */
.favorite-btn.favorite-feedback {
    animation: favoritePulse 0.6s ease;
}

@keyframes favoritePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Presentacion Favorite Button Position */
/* Wrapper contains both button and label as siblings */
.radio_container_wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px; /* Space between heart and radio */
}

.radio_container {
    flex: 1; /* Take remaining space */
    position: relative;
}

/* Product-level favorite on cards and popup media */
.variation_image_container,
.product_popup_media {
    position: relative;
}

.favorite-btn.product-favorite {
    position: absolute;
    top: .5rem;
    left: .5rem;
    z-index: 70;
    /* transform: none !important; */
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0px 1rem 2rem rgb(0 0 0 / 13%);
}
.product_popup_box .favorite-btn.product-favorite {
    transform: translateX(-200%);
    width: 4.5rem;
    height: 4.5rem;
    top: 1rem;
    border: 0px solid #e7e7e7 !important;
    box-shadow: 0px 1rem 2rem rgb(0 0 0 / 13%);
    transition: visibility 0.4s linear, opacity 0.2s ease-out 0.2s, transform 0.2s ease-out 0.2s;
    opacity: 1;
    left: 1rem;
    border-radius: 1.3rem;
}
.product_popup_box .favorite-btn.product-favorite svg{
 width: 3rem;
 height: 3rem;
}

.favorite-btn.product-favorite:hover {
    transform: scale(1.06) !important;
}

.favorite-btn.product-favorite:active {
    transform: scale(0.95) !important;
}

body .favorite-btn.product-favorite svg {
    width: 1.8rem;
    height: 1.8rem;
    fill: #959595;
    stroke: none;
}

body .favorite-btn.product-favorite.is-favorited {
    background: white;
}

body .favorite-btn.product-favorite.is-favorited svg {
    fill: var(--color-red);
    stroke: none;
}

/* Button is now OUTSIDE the label, so it won't block clicks */
.favorite-btn.presentacion-favorite {
    position: relative; /* Changed from absolute */
    left: auto;
    top: auto;
    transform: none;
    flex-shrink: 0; /* Don't shrink the button */
    transform: none !important;
    /* box-shadow: rgba(0, 0, 0, 0.1) 2px 2px 6px; */
    line-height: 1rem;
}

.favorite-btn.presentacion-favorite:hover {
}

.favorite-btn.presentacion-favorite:active {
}

/* Variety Favorite Button Position */
.variety_details {
    position: relative;
}

.favorite-btn.variety-favorite {
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.favorite-btn.variety-favorite:hover {
    transform: translateY(-50%) scale(1.1);
}

.favorite-btn.variety-favorite:active {
    transform: translateY(-50%) scale(0.95);
}

/* Adjust variety_image to make space for favorite button */
.variety_details .variety_image {
    margin-left: 8px;
}

/* Mobile Responsive */
[data-theme="dark"] .favorite-btn {
    background: rgb(78, 78, 78);
    }
    
    [data-theme="dark"]   .favorite-btn:hover {
    }
    
    [data-theme="dark"]    .favorite-btn svg {
        stroke: #7e7e7e;
        fill: #424242;
    }
    
    [data-theme="dark"]   .favorite-btn:hover svg {
    }

/* Loading State */
.favorite-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top-color: #e74c3c;
    border-radius: 50%;
    animation: favoriteSpinner 0.8s linear infinite;
    opacity: 0;
}

.favorite-btn.loading svg {
    opacity: 0;
}

@keyframes favoriteSpinner {
    to { transform: rotate(360deg); }
}

/* Ensure proper stacking */
.product {
    position: relative;
}

/* Additional spacing adjustments for varieties */
.input-group .variety_details {
    display: flex;
    align-items: center;
    padding-left: 0; /* Make room for favorite button */
    align-content: center;
}

.variety_details .variety_image {
    margin-left: 0;
}

.variety_details .favorite-btn{
    display: flex;
    margin: 0;
    padding: 0;
    position: static;
    transform: none !important;
}

/* ========================================
   Favorites Filter Button (Search Bar)
   ======================================== */

/* Heart control lives on mobile bottom nav (#mobile-nav-favorites); keep #favorites-filter-btn in DOM for JS only */
.search_container #favorites-filter-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.favorites-filter-btn {
    position: static;
    right: 2rem;
    top: 50%;
    width: 3.8rem;
    height: 3.8rem;
    border-radius: 100%;
    background: none;
    display: none; /* Hidden by default, shown by JS when logged in */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    z-index: 10;
    line-height: 1rem;
    border: none;
    position: absolute;
    left: 1.3rem;
    top: 50%;
    transform: translate(0, -50%);
}

.favorites-filter-btn.show {
    display: inline-block;
}

.favorites-filter-btn svg {
    width: 100%;
    height: 100%;
    fill: #ffffff;
    stroke: rgb(0 0 0 / 20%);
    stroke-width: 1px;
    transition: all 0.3s ease;
}

.favorites-filter-btn:hover {
}

body .favorites-filter-btn.active {
    background: none;
}

body .favorites-filter-btn.active svg {
    fill: #e74c3c;
    stroke: #b13528;
}

/* Dark mode */
[data-theme="dark"]
    .favorites-filter-btn {
    }
    
    [data-theme="dark"] .favorites-filter-btn svg {
        stroke: #7e7e7e;
        fill: #424242;
    }

