/**
 * Product Icons Styling
 * Displays wishlist and custom taxonomy icons on the right side of archive products
 * 
 * Version: 1.1.0
 * - Wishlist button integrated with ACL system via #wsh1 ID
 * - Direct HTML rendering (no shortcode overhead)
 * - ACL controls visibility: display none/block based on permissions
 * - Optimized performance with static rendering
 */

/* Make sure parent product item has position relative */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
li.product,
.product,
article.product,
.bde-loop-item,
.swiper-slide {
    position: relative !important;
}

/* Archive product icons container - positioned on the right side */
.product-icons-wrapper {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    z-index: 999 !important;
    align-items: flex-end !important;
    pointer-events: auto !important; /* Allow clicks on icons */
}

/* Prevent parent product link from capturing clicks on icons */
.product-icons-wrapper,
.product-icons-wrapper * {
    pointer-events: auto !important;
}

/* Additional selectors for WooCommerce and Breakdance */
.woocommerce ul.products li.product .product-icons-wrapper,
.woocommerce-page ul.products li.product .product-icons-wrapper,
article.product .product-icons-wrapper,
.bde-loop-item .product-icons-wrapper,
.swiper-slide .product-icons-wrapper {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    z-index: 10 !important;
}

/* Individual icon container */
.product-icons-wrapper .icon-container {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: auto; /* Ensure clickable */
}

.product-icons-wrapper .icon-container:hover {
    transform: scale(1.1);
}

/* Icon image styling */
.product-icons-wrapper .icon-container .icon-svg {
    width: 40px;
    height: 40px !important;
    margin: 0;
    padding: 0;
    object-fit: contain;
    pointer-events: none; /* Prevent clicks on image */
}

/* Tooltip styling */
.product-icons-wrapper .icon-container .tooltip-text {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 10px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

.product-icons-wrapper .icon-container:hover .tooltip-text {
    opacity: 1;
    visibility: visible;
    margin-right: 12px;
}

/* Active state for mobile tooltip (click to show) */
.product-icons-wrapper .icon-container.tooltip-active .tooltip-text {
    opacity: 1;
    visibility: visible;
    margin-right: 12px;
}

/* Tooltip arrow */
.product-icons-wrapper .icon-container .tooltip-text::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid rgba(0, 0, 0, 0.9);
}

/* Wishlist icon specific styling */
.product-icons-wrapper .wishlist-icon {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
    border: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer; /* Ensure cursor shows clickable */
}

.product-icons-wrapper .wishlist-icon:hover {
    transform: scale(1.1);
}

.product-icons-wrapper .wishlist-icon .add-to-wishlist-abtn,
.product-icons-wrapper .wishlist-icon .wishlist-login-trigger {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: auto; /* Allow wishlist clicks */
}

.product-icons-wrapper .wishlist-icon .add-to-wishlist-abtn .heart-icon,
.product-icons-wrapper .wishlist-icon .wishlist-login-trigger .heart-icon {
    width: 20px;
    height: 20px;
}

.product-icons-wrapper .wishlist-icon .add-to-wishlist-abtn .heart-icon path,
.product-icons-wrapper .wishlist-icon .wishlist-login-trigger .heart-icon path {
    fill: none;
    stroke: #000;
    stroke-width: 2;
    transition: all 0.3s ease;
}

/* Hover effect - fill heart slightly */
.product-icons-wrapper .wishlist-icon:hover .add-to-wishlist-abtn .heart-icon path,
.product-icons-wrapper .wishlist-icon:hover .wishlist-login-trigger .heart-icon path {
    fill: rgba(255, 86, 79, 0.3);
    stroke: #000;
}

/* Active/Added state - filled red heart (when product is in wishlist) */
.product-icons-wrapper .wishlist-icon .add-to-wishlist-abtn.wishlisted .heart-icon path,
.product-icons-wrapper .wishlist-icon .add-to-wishlist-abtn.active .heart-icon path,
.product-icons-wrapper .wishlist-icon .add-to-wishlist-abtn.added-to-wishlist .heart-icon path {
    fill: #FF564F !important;
    stroke: #FF564F !important;
}

.product-icons-wrapper .wishlist-icon .wishlist-text {
    display: none; /* Hide text in archive view, show only icon */
}

/* Make sure parent product item has position relative */
.woocommerce ul.products li.product {
    position: relative;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .woocommerce ul.products li.product .product-icons-wrapper {
        top: 5px;
        right: 5px;
        gap: 6px;
    }
    
    .product-icons-wrapper .icon-container {
        width: 36px;
        height: 36px;
    }
    
    .product-icons-wrapper .wishlist-icon {
        width: 36px;
        height: 36px;
    }
    
    .product-icons-wrapper .wishlist-icon .add-to-wishlist-abtn .heart-icon {
        width: 18px;
        height: 18px;
    }
    
    .product-icons-wrapper .icon-container .icon-svg {
        width: 30px;
        height: 20px;
    }
    
    /* Show tooltips only on click (with .tooltip-active class) */
    .product-icons-wrapper .icon-container:hover .tooltip-text {
        opacity: 0;
        visibility: hidden;
    }
    
    /* Active state shows tooltip on mobile */
    .product-icons-wrapper .icon-container.tooltip-active .tooltip-text {
        opacity: 1 !important;
        visibility: visible !important;
        margin-right: 12px;
    }
}

/* Alternative: If using grid layout */
.woocommerce .products.columns-3 li.product .product-icons-wrapper,
.woocommerce .products.columns-4 li.product .product-icons-wrapper,
.woocommerce .products.columns-5 li.product .product-icons-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Breakdance specific overrides (if needed) */
.breakdance .woocommerce ul.products li.product .product-icons-wrapper {
    /* Breakdance-specific adjustments if necessary */
}

/* ============================================================================
   SHORTCODE INLINE STYLES - Product Icons Inline Container
   ============================================================================ */

/* Product icons inline container (for shortcodes) */
.product-icons-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.product-icons-inline .icon-container {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.product-icons-inline .icon-container:hover {
    transform: scale(1.1);
}

.product-icons-inline .icon-container .icon-svg {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.product-icons-inline .icon-container .tooltip-text {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.product-icons-inline .icon-container:hover .tooltip-text {
    opacity: 1;
    visibility: visible;
}

/* ============================================================================
   EXPIRY AFTER OPENING (Galiojimas po atidarymo)
   ============================================================================ */

.product-expiry-icons {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.product-expiry-icons .bde-icon-box1 {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.product-expiry-icons .ee-iconbox-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.product-expiry-icons .ee-iconbox-icon svg {
    width: 18px;
    height: 18px;
    color: #333;
}

.product-expiry-icons .ee-iconbox-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
}

/* ============================================================================
   COMBINED INFO CONTAINER (badges + icons + expiry)
   ============================================================================ */

/* Badges + Icons inline container */
.product-info-inline {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.product-info-inline .badges-inline,
.product-info-inline .product-icons-inline {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Complete info container (badges + icons + expiry) */
.product-complete-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.product-complete-info .info-badges,
.product-complete-info .info-icons,
.product-complete-info .info-expiry {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Inline expiry styling within combined container */
.product-complete-info .product-expiry-icons {
    margin: 0;
}

.product-complete-info .product-expiry-icons .bde-icon-box1 {
    padding: 8px 12px;
}

.product-complete-info .product-expiry-icons .ee-iconbox-icon {
    width: 20px;
    height: 20px;
}

.product-complete-info .product-expiry-icons .ee-iconbox-text {
    font-size: 13px;
}

/* ============================================================================
   WISHLIST BUTTON (for single product page shortcode)
   ============================================================================ */

/* Make add to cart form flex container for side-by-side buttons */
.woocommerce div.product form.cart {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

/* Ensure quantity and add to cart button stay together */
.woocommerce div.product form.cart .quantity {
    margin-right: 0;
}

.woocommerce div.product form.cart button.single_add_to_cart_button {
    margin: 0;
    
    min-width: 200px;
}

/* Wishlist wrapper for ACL control (ID: wsh1) */
.wishlist-wrapper {
    display: block;
}

/* Wishlist button container */
.wishlist-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Wishlist button styling - icon only */
.wishlist-icon .add-to-wishlist-btn,
.wishlist-icon .wishlist-login-trigger {
    background: #ffffff;
    border: 1px solid #000000;
    border-radius: 50%;
    padding: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
}

.wishlist-icon .add-to-wishlist-btn:hover,
.wishlist-icon .wishlist-login-trigger:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Wishlisted state */
.wishlist-icon .add-to-wishlist-btn.wishlisted {
    background: #fff0ef;
    border-color: #ff564f;
    color: #ff564f;
}

.wishlist-icon .add-to-wishlist-btn.wishlisted:hover {
    background: #ffe5e3;
    border-color: #ff3d36;
}

/* Heart icon */
.wishlist-icon .add-to-wishlist-btn .heart-icon,
.wishlist-icon .wishlist-login-trigger .heart-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

/* Heart icon path styling */
.wishlist-icon .add-to-wishlist-btn .heart-icon path,
.wishlist-icon .wishlist-login-trigger .heart-icon path {
    fill: none;
    stroke: #000;
    stroke-width: 2;
    transition: all 0.3s ease;
}

/* Hover effect on heart */
.wishlist-icon .add-to-wishlist-btn:hover .heart-icon path,
.wishlist-icon .wishlist-login-trigger:hover .heart-icon path {
    fill: rgba(255, 86, 79, 0.3);
    stroke: #000;
}

/* Wishlisted state - filled red heart */
.wishlist-icon .add-to-wishlist-btn.wishlisted .heart-icon path {
    fill: #FF564F !important;
    stroke: #FF564F !important;
}

.wishlist-icon .add-to-wishlist-btn:hover .heart-icon,
.wishlist-icon .wishlist-login-trigger:hover .heart-icon {
    transform: scale(1.1);
}

.wishlist-icon .add-to-wishlist-btn.wishlisted .heart-icon {
    animation: heartBeat 0.6s ease;
}

/* Text label - hidden, show only heart icon */
.wishlist-icon .add-to-wishlist-btn .wishlist-text,
.wishlist-icon .wishlist-login-trigger .wishlist-text {
    display: none;
}

/* Heart beat animation */
@keyframes heartBeat {
    0%, 100% {
        transform: scale(1);
    }
    20% {
        transform: scale(1.25);
    }
    40% {
        transform: scale(1.1);
    }
}

/* Loading state (optional) */
.wishlist-icon .add-to-wishlist-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .product-icons-inline {
        gap: 8px;
    }
    
    .product-icons-inline .icon-container {
        width: 36px;
        height: 36px;
    }
    
    .product-icons-inline .icon-container .icon-svg {
        width: 32px;
        height: 32px;
    }
    
    .product-expiry-icons {
        gap: 10px;
    }

    
    .product-expiry-icons .ee-iconbox-text {
        font-size: 13px;
    }
    
    .product-complete-info {
        gap: 15px;
    }
    
    /* Wishlist button mobile - full width with text */
    .wishlist-icon .add-to-wishlist-btn,
    .wishlist-icon .wishlist-login-trigger {
        padding: 14px 20px;
        width: 100%;
        height: auto;
        border-radius: 4px;
        gap: 10px;
    }
    
    .wishlist-icon .add-to-wishlist-btn .heart-icon,
    .wishlist-icon .wishlist-login-trigger .heart-icon {
        width: 24px;
        height: 24px;
    }
    
    .wishlist-icon .add-to-wishlist-btn .wishlist-text,
    .wishlist-icon .wishlist-login-trigger .wishlist-text {
        display: inline-block;
        font-size: 15px;
        font-weight: 500;
        line-height: 1;
    }
    
    /* Mobile: Stack buttons vertically */
    .woocommerce div.product form.cart {
        flex-direction: column;
        align-items: stretch;
    }
    
    .woocommerce div.product form.cart button.single_add_to_cart_button {
        min-width: 100%;
    }
    
    .woocommerce div.product form.cart .wishlist-icon {
        width: 100%;
        justify-content: stretch;
    }
}

/* ============================================================================
   PHONE SPECIFIC - Portrait & Landscape
   ============================================================================ */

@media (max-width: 896px) {
    /* Product page wishlist - full width button with text and icon */
    .single-product .wishlist-icon {
        width: 100%;
        display: flex;
    }
    
    .single-product .wishlist-icon .add-to-wishlist-btn,
    .single-product .wishlist-icon .wishlist-login-trigger {
        width: 100%;
        border-radius: 50px;
        padding: 15px 20px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 10px;
        height: auto;
        min-height: 50px;
    }
    
    /* ACL controls visibility via #wsh1 and #wsh2 IDs in acl.php */
    .single-product #wsh1,
    .single-product #wsh2 {
        width: 100%;
    }
    
    .single-product .wishlist-icon .add-to-wishlist-btn .wishlist-text,
    .single-product .wishlist-icon .wishlist-login-trigger .wishlist-text {
        display: inline-block !important;
        font-size: 15px;
        font-weight: 500;
        line-height: 1.2;
    }
    
    .single-product .wishlist-icon .add-to-wishlist-btn .heart-icon,
    .single-product .wishlist-icon .wishlist-login-trigger .heart-icon {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }
}
