/* 
Theme Name: Hello Elementor Child
Theme URI: https://github.com/elementor/hello-theme-child/
Description: Hello Elementor Child is a child theme of Hello Elementor, created by Elementor team
Author: Elementor Team
Author URI: https://elementor.com/
Template: hello-elementor
Version: 2.0.0
Text Domain: hello-elementor-child
License: GNU General Public License v3 or later.
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: flexible-header, custom-colors, custom-menu, custom-logo, editor-style, featured-images, rtl-language-support, threaded-comments, translation-ready
*/

/* Add your custom styles here */

/* Esconder botões dos cards de produtos WooCommerce */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button,
.woocommerce ul.products li.product .product_type_simple,
.woocommerce ul.products li.product .product_type_variable,
.woocommerce ul.products li.product .product_type_grouped,
.woocommerce ul.products li.product .product_type_external {
    display: none !important;
}

/* Esconder botões em elementos relacionados */
.woocommerce .products .product .button,
.woocommerce .products .product .add_to_cart_button {
    display: none !important;
}

/* Garantir que os botões fiquem escondidos em diferentes layouts */
.woocommerce-loop-product__link + .button,
.woocommerce .product .woocommerce-loop-product__link + .button {
    display: none !important;
}

/* Circle with cart icon for product cards hover */
.woocommerce ul.products li.product {
    position: relative;
    overflow: hidden;
}

.product-hover-cart {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: white;
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
}

/* Default cart icon */
.product-hover-cart {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="none" stroke="%23000" stroke-width="2" stroke-linejoin="round" stroke-miterlimit="10" d="M11,19L6.4,4.5C6.2,3.6,5.3,3,4.4,3H2"/><path fill="none" stroke="%23000" stroke-width="2" stroke-linejoin="round" stroke-miterlimit="10" d="M26,23H8.4c-1.1,0-2-0.9-2-2v0c0-1.1,0.9-1.8,2-2L29,16V6H11"/><circle fill="none" stroke="%23000" stroke-width="2" stroke-linejoin="round" stroke-miterlimit="10" cx="11" cy="28" r="1"/><circle fill="none" stroke="%23000" stroke-width="2" stroke-linejoin="round" stroke-miterlimit="10" cx="24" cy="28" r="1"/></svg>');
}

/* Loading spinner icon */
.product-hover-cart.loading {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="14" fill="none" stroke="%23000" stroke-width="2" stroke-dasharray="24" stroke-dashoffset="0"><animate attributeName="stroke-dashoffset" values="0;48;0" dur="1.5s" repeatCount="indefinite"/><animateTransform attributeName="transform" type="rotate" values="0 16 16;360 16 16" dur="2s" repeatCount="indefinite"/></circle></svg>');
}

/* Success checkmark icon */
.product-hover-cart.success {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="none" stroke="%23000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M6 16l6 6L26 10"/></svg>');
}

/* Error icon */
.product-hover-cart.error {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="none" stroke="%23000" stroke-width="2" stroke-linecap="round" d="M8 8l16 16M24 8L8 24"/></svg>');
}

.woocommerce ul.products li.product:hover .product-hover-cart {
    opacity: 1;
    visibility: visible;
}
add_filter( 'woocommerce_checkout_fields', 'remover_validacao_codigo_postal' );
function remover_validacao_codigo_postal( $fields ) {

    // Torna o código postal opcional
    $fields['billing']['billing_postcode']['required'] = false;

    // Remove a validação de formato
    $fields['billing']['billing_postcode']['validate'] = array();

    return $fields;
}

add_filter( 'woocommerce_default_address_fields', 'desativar_validacao_padrao_postcode' );
function desativar_validacao_padrao_postcode( $fields ) {

    // Remove validação do WooCommerce para todos os países
    if ( isset( $fields['postcode'] ) ) {
        $fields['postcode']['validate'] = array();
        $fields['postcode']['required'] = false;
    }

    return $fields;
}