/**
 * Elementor Products Widget Integration Styles
 * 
 * Additional styles for modified cart buttons and cart icon color changes
 */

/* Ensure smooth transitions for button text changes */
.elementor-widget-wc-products .add_to_cart_button,
.elementor-products .add_to_cart_button {
    transition: all 0.3s ease;
}

/* Style for buttons with changed text */
.elementor-widget-wc-products .add_to_cart_button.defox-cart-added,
.elementor-products .add_to_cart_button.defox-cart-added {
    background-color: #28a745;
    border-color: #28a745;
}

/* Ensure text remains visible during transitions */
.elementor-widget-wc-products .add_to_cart_button.defox-cart-added:hover,
.elementor-products .add_to_cart_button.defox-cart-added:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Cart icon color changes when products are in cart - ONLY for images and SVG, NOT text */
.defox-cart-has-products i,
.defox-cart-has-products svg {
    color: #e30613 !important;
    fill: #e30613 !important;
}

/* Specific styles for Astra Builder HTML elements (custom cart icons) */
.ast-header-html-1.defox-cart-has-products img,
.ast-header-html-1.defox-cart-has-products a img {
    filter: invert(22%) sepia(94%) saturate(7300%) hue-rotate(-3deg) brightness(94%) contrast(101%) !important;
}

/* Alternative CSS filter approach for cart images */
.defox-cart-has-products img[src*="cart"],
.defox-cart-has-products img[alt*="cart"],
a[href*="/koszyk"].defox-cart-has-products img,
a[href*="cart"].defox-cart-has-products img {
    filter: invert(22%) sepia(94%) saturate(7300%) hue-rotate(-3deg) brightness(94%) contrast(101%) !important;
}

/* DO NOT change text color - only icons and images */
.defox-cart-has-products {
    /* No color change for text elements */
}

/* Specific selectors for common cart icon implementations */
.ast-cart-menu-wrap.defox-cart-has-products .ast-cart-menu,
.ast-cart-menu-wrap.defox-cart-has-products .ast-cart-menu i,
.ast-cart-menu-wrap.defox-cart-has-products .ast-cart-menu svg {
    color: #e30613 !important;
    fill: #e30613 !important;
}

/* Elementor cart widget */
.elementor-widget-woocommerce-cart.defox-cart-has-products,
.elementor-widget-woocommerce-cart.defox-cart-has-products i,
.elementor-widget-woocommerce-cart.defox-cart-has-products svg {
    color: #e30613 !important;
    fill: #e30613 !important;
}

/* Generic cart selectors */
.cart-contents.defox-cart-has-products,
.cart-contents.defox-cart-has-products *,
.woocommerce-cart-link.defox-cart-has-products,
.woocommerce-cart-link.defox-cart-has-products * {
    color: #e30613 !important;
    fill: #e30613 !important;
}

/* Ensure transitions for cart icon color changes */
.ast-cart-menu-wrap,
.elementor-widget-woocommerce-cart,
.cart-contents,
.woocommerce-cart-link,
.shopping-cart,
.cart-icon,
.header-cart,
.mini-cart {
    transition: color 0.3s ease, fill 0.3s ease;
}

.ast-cart-menu-wrap *,
.elementor-widget-woocommerce-cart *,
.cart-contents *,
.woocommerce-cart-link *,
.shopping-cart *,
.cart-icon *,
.header-cart *,
.mini-cart * {
    transition: color 0.3s ease, fill 0.3s ease;
}

/* Debug styles (only visible when WP_DEBUG is true) */
.defox-cart-added {
    position: relative;
}

.defox-cart-added::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 4px;
    background: orange;
    border-radius: 50%;
    opacity: 0;
}

/* Show debug indicator only when WP_DEBUG is enabled */
body.wp-debug .defox-cart-added::after {
    opacity: 1;
}

/* Debug indicator for cart icons */
.defox-cart-has-products::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    background: orange;
    border-radius: 50%;
    opacity: 0;
    z-index: 9999;
}

/* Show debug indicator for cart icons only when WP_DEBUG is enabled */
body.wp-debug .defox-cart-has-products::before {
    opacity: 1;
}
