/* =========================================
   MODULE: WOOCOMMERCE BUTTONS (CLEAN V4)
   ========================================= */

/* 
    ================================================================
    ESTILOS AÑADIDOS - CLASES ADICIONALES
    ================================================================
    1. is-style-woo-general
    2. is-style-woo-glow
    3. is-style-woo-glow-inverse
    4. is-style-woo-animated
    5. is-style-woo-full-title-witdh
    ================================================================
*/


/* --- 0. FIX NUCLEAR: Ocultar "View Cart" --- */
.wp-block-woocommerce-product-button .added_to_cart,
.wp-block-woocommerce-product-button a.added_to_cart,
.wp-block-woocommerce-product-button .wc-block-components-product-button__button+span {
    display: none !important;
    position: absolute !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}


/* =========================================================
   1. FÍSICA COMPARTIDA (TITÁN LOGIC)
   ========================================================= */

.is-style-woo-general .wc-block-components-product-button__button,
.is-style-woo-general .wc-block-components-button,
.wc-block-components-product-button__button.is-style-woo-general,
.is-style-woo-general.wc-block-mini-cart__footer-checkout,

.is-style-woo-glow .wc-block-components-product-button__button,
.is-style-woo-glow .wc-block-components-button,
.wc-block-components-product-button__button.is-style-woo-glow,
.is-style-woo-glow.wc-block-mini-cart__footer-checkout,

.is-style-woo-glow-inverse .wc-block-components-product-button__button,
.is-style-woo-glow-inverse .wc-block-components-button,
.wc-block-components-product-button__button.is-style-woo-glow-inverse,
.wc-block-components-button.is-style-woo-glow-inverse,
.is-style-woo-glow-inverse.wc-block-mini-cart__footer-checkout,
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button {

    /* Animación fluida */
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease !important;
    will-change: transform;

    /* Protección UI */
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;

    /* Layout Fixes */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    cursor: pointer;
}

/* HOVER COMPARTIDO: Crecer */
.is-style-woo-general .wc-block-components-product-button__button:hover,
.is-style-woo-glow .wc-block-components-product-button__button:hover,
.is-style-woo-glow-inverse .wc-block-components-product-button__button:hover,
.wc-block-components-button.is-style-woo-glow-inverse:hover,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow-inverse:hover,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow:hover,
.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover {
    transform: scale(1.05) !important;
}

/* ACTIVE COMPARTIDO: Encoger */
.is-style-woo-general .wc-block-components-product-button__button:active,
.is-style-woo-glow .wc-block-components-product-button__button:active,
.is-style-woo-glow-inverse .wc-block-components-product-button__button:active,
.wc-block-components-button.is-style-woo-glow-inverse:active,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow-inverse:active,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow:active,
.wc-block-cart__submit-button:active,
.wc-block-components-checkout-place-order-button:active {
    transform: scale(0.95) !important;
}

/* FOCUS COMPARTIDO: Limpiar */
.is-style-woo-general .wc-block-components-product-button__button:focus,
.is-style-woo-glow .wc-block-components-product-button__button:focus,
.is-style-woo-glow-inverse .wc-block-components-product-button__button:focus {
    outline: none !important;
    box-shadow: none !important;
}


/* =========================================================
   2. ESTILOS ESPECÍFICOS (COLORES)
   ========================================================= */

/* --- ESTILO: GENERAL --- */
.is-style-woo-general .wc-block-components-product-button__button:hover,
.wc-block-components-button.is-style-woo-general:hover {
    color: var(--wp--preset--color--custom-blanco-suave, #f0f0f0) !important;
}


/* --- ESTILO: GLOW --- */
/* Reposo */
.is-style-woo-glow .wc-block-components-product-button__button,
.is-style-woo-glow .wc-block-components-button,
.wc-block-components-product-button__button.is-style-woo-glow,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow,
.wc-block-mini-cart__shopping-button.is-style-woo-glow {
    border-radius: 15px !important;
    background-color: transparent !important;
    color: var(--wp--preset--color--accent-5) !important;
    border: 2px solid var(--wp--preset--color--accent-5) !important;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1) !important;
}

/* Hover */
.is-style-woo-glow .wc-block-components-product-button__button:hover,
.is-style-woo-glow .wc-block-components-button:hover,
.wc-block-components-button.is-style-woo-glow:hover,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow:hover,
.wc-block-mini-cart__shopping-button.is-style-woo-glow:hover {
    border-radius: 15px !important;
    background-color: transparent !important;
    border-color: var(--wp--preset--color--accent-5) !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px var(--wp--preset--color--accent-5) !important;
}

/* Active */
.is-style-woo-glow .wc-block-components-product-button__button:active,
.wc-block-components-button.is-style-woo-glow:active,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow:active {
    border-radius: 15px !important;
    background-color: transparent !important;
    border-color: var(--wp--preset--color--accent-5) !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px var(--wp--preset--color--accent-5) !important;
}


/* --- ESTILO: GLOW INVERSE --- */
/* Reposo */
.is-style-woo-glow-inverse .wc-block-components-product-button__button,
.wc-block-components-button.is-style-woo-glow-inverse,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow-inverse {
    border-radius: 15px !important;
    color: var(--wp--preset--color--accent-3) !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
}

/* Hover */
.is-style-woo-glow-inverse .wc-block-components-product-button__button:hover,
.wc-block-components-button.is-style-woo-glow-inverse:hover,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow-inverse:hover {
    border-radius: 15px !important;
    color: var(--wp--preset--color--accent-7) !important;
    box-shadow: 0 0 15px var(--wp--preset--color--accent-5) !important;
    border-color: var(--wp--preset--color--accent-3) !important;
}

/* Active */
.is-style-woo-glow-inverse .wc-block-components-product-button__button:active,
.wc-block-components-button.is-style-woo-glow-inverse:active,
.wc-block-mini-cart__footer-checkout.is-style-woo-glow-inverse:active {
    border-radius: 15px !important;
    color: var(--wp--preset--color--accent-7) !important;
    box-shadow: 0 0 15px var(--wp--preset--color--accent-5) !important;
    border-color: var(--wp--preset--color--accent-3) !important;
}


/* ... [Keep all existing CSS above] ... */

/* =========================================================
   3. NEW EXTENSION: ANIMATED BUTTON (.is-style-woo-animated)
   ========================================================= */

/* 
   CRITICAL FIX: Hide the dynamic "X in cart" text.
   WooCommerce injects a <span> with the quantity. We must hide it 
   so it doesn't break the layout or overlap our animations.
*/
.is-style-woo-animated .wc-block-components-product-button__button>span {
    display: none !important;
}

/* 
   BASE LAYOUT
   - Flexbox to center the Icon (::before) and Text (::after).
   - Fixed height to prevent jumping.
*/
.is-style-woo-animated .wc-block-components-product-button__button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    /* Space between Icon and Text */
    /* --- CAMBIOS AQUÍ --- */

    /* 1. Eliminamos las medidas forzadas para que "enrolle" */
    min-height: auto !important;
    min-width: auto !important;

    /* 2. AQUÍ DECIDES EL TAMAÑO MEDIANTE PADDING */
    /* Formato: padding: [arriba/abajo] [izquierda/derecha] */
    padding: 10px 25px !important;

    /* Visual Style */
    background-color: transparent !important;
    border: 2px solid var(--wp--preset--color--accent-5, #8770ff) !important;
    color: var(--wp--preset--color--accent-5, #8770ff) !important;
    border-radius: 15px !important;
    transition: all 0.3s ease !important;
    position: relative;
}

/* 
   DEFAULT TEXT (Pseudo-element)
   Since we hid the span, we must inject "Add to Cart" manually.
*/
.is-style-woo-animated .wc-block-components-product-button__button::after {
    content: "Add to Cart";
    font-weight: 600;
    line-height: 1;
}

/* 
   DEFAULT ICON (Cart Icon)
   Uses a mask to allow color changes on hover.
*/
.is-style-woo-animated .wc-block-components-product-button__button::before {
    content: "";
    width: 26px;
    height: 26px;
    background-color: currentColor;
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' version='1.1' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='black' stroke-width='12' stroke-linejoin='round' d='M148.34 270.8c-6.62-1.09-13.01-5.85-15.95-11.88-5.93-12.16-.46-25.89 12.26-30.78 5.62-2.16 14.27-1.24 19.05 2.03 2.4 1.64 5.73 4.9 6.95 6.82 4.61 7.21 4.55 17.37-.14 24.19-3.37 4.89-8.4 8.24-14.26 9.48-3.64.77-4.09.78-7.92.15z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' version='1.1' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='black' stroke-width='12' stroke-linejoin='round' d='M148.34 270.8c-6.62-1.09-13.01-5.85-15.95-11.88-5.93-12.16-.46-25.89 12.26-30.78 5.62-2.16 14.27-1.24 19.05 2.03 2.4 1.64 5.73 4.9 6.95 6.82 4.61 7.21 4.55 17.37-.14 24.19-3.37 4.89-8.4 8.24-14.26 9.48-3.64.77-4.09.78-7.92.15zm10.07-9.13c4.8-2.51 7.59-7.15 7.6-12.65.01-8.11-5.86-13.99-13.98-13.99-8.07 0-13.97 5.9-13.98 13.99-.01 5.74 3.08 10.56 8.33 13.01 2.94 1.37 9.08 1.18 12.03-.36zm70.97 8.5c-6.45-1.81-11.85-6.31-14.77-12.31-1.63-3.33-2.25-6.29-2.23-9.56.02-3.13.6-5.78 2.24-9.11 3.69-7.51 10.68-12.4 18.44-12.88 6.67-.42 12.04 1.35 16.78 5.52 4.35 3.83 7.54 10.89 7.54 16.7 0 3.24-1.44 8.35-3.2 11.35-4.88 8.33-15.72 12.83-24.79 10.28zm11.25-8.48c3.2-1.47 5.35-3.54 6.89-6.62 1.28-2.55 1.5-3.56 1.5-6.7 0-5.66-2.48-9.89-7.37-12.55-5.7-3.1-11.9-2.12-16.73 2.65-3.1 3.06-4.38 6.01-4.38 10.07 0 6.56 4.9 12.66 11.3 14.05 2.37.52 6.68.08 8.79-.9zm-84.99-44.83c-71.46-.23-75.01-.29-75.95-1.13-2.08-1.88-1.34-5.9 1.2-6.54.75-.19 41.49-.2 90.52-.04 70.33.24 89.41.18 90.38-.3.67-.33 1.66-1.42 2.19-2.41.87-1.62.91-2.03.34-4.16-.34-1.3-1.06-2.81-1.6-3.35-.96-.97-1.79-.99-57.08-1.23 0 0-52.74 1.41-56.11-.25l-3.37-1.66c-5.86-2.89-10.51-8.6-13.08-16.09-1.28-3.71-1.25-6.15.07-7.35 1-.91 2.93-.94 62.74-1.18 69.63-.28 63.49.1 67.24-4.17 1.62-1.84 2.8-4.87 10.38-26.58 4.7-13.48 8.98-25.72 9.51-27.2 5.79-16.35 6.74-19.42 6.74-21.82 0-3.19-1.83-7.06-4.19-8.86-3.78-2.89 1.48-2.72-87.19-2.72-59.74 0-81.77-.15-82.66-.56-1.57-.71-1.92-1.65-6.17-16.29-1.94-6.7-3.87-13-4.29-14-2.11-5.08-7.3-9.69-12.82-11.4-2.82-.87-4.58-.97-16.59-.97H62.43l-1.67 1.47c-2.74 2.41-2.68 6.08.15 8.6 1 .9 1.99 1 11.24 1.23 10.12.25 10.15.25 12.78 1.7 2.68 1.48 5.18 4.13 6.65 7.01.45.88 1.67 4.74 2.71 8.59 1.05 3.85 2.81 10.26 3.92 14.24 2.18 7.83 2.44 10.35 1.25 12.05l-.76 1.09H66.86c-29.6 0-31.91-.06-32.88-.86-1.68-1.39-1.84-3.63-.39-5.32l1.23-1.43 28.31-.13c26.55-.13 28.3-.19 28.06-.98-.14-.47-1.26-4.49-2.5-8.95-3.61-12.99-4.22-14.89-5.29-16.38-1.73-2.43-3.35-2.77-13.24-2.78-8.38 0-9.14-.08-11.45-1.16-6.63-3.09-9.69-11.03-6.87-17.8 1.06-2.54 4.46-5.87 7.18-7.04 2.41-1.04 2.97-1.06 18.04-.91 14.67.15 15.72.22 18.47 1.25 7.11 2.67 13.08 7.84 16.17 13.99.98 1.96 3.02 7.87 4.53 13.14 1.51 5.27 3.11 10.68 3.56 12.03l.82 2.46 81.29.25 81.29.25 3.19 1.57c5.97 2.94 10.09 8.34 11.25 14.77.9 4.98 1.68 2.33-13.34 45.29-2.98 8.51-6.71 19.18-8.29 23.72-1.59 4.54-3.31 9.21-3.82 10.37-1.88 4.26-6.66 8.4-11.69 10.13-2.68.92-4.64.95-60.61.95-32.48 0-57.96.19-58.11.43-.44.71 3.34 6.1 5.35 7.64 3.7 2.82.98 2.69 59.83 2.72 39.98.02 55.03.17 56.71.6 3.02.76 6.51 4.19 7.64 7.51.92 2.7 1.07 7.93 .31 10.69-.76 2.74-3.35 5.8-6.12 7.22l-2.46 1.26H147.2c-8.91 0-49.94-.11-91.17-.25zM23.85 216.28c-2.41-1.32-2.91-3.82-1.19-6l1.02-1.29h20.01 20.01l1.07 1.14c1.46 1.56 1.4 3.97-.14 5.52l-1.21 1.2-19.3-.01c-13.02-.01-19.62-.19-20.28-.55zM3.06 184.77c-1.46-1.56-1.4-3.97.14-5.52l1.21-1.2h15.69 15.69l1.27 1.51c1.6 1.9 1.62 3.59.07 5.14l-1.21 1.2H20.02 4.13zm45.32-.07c-1.85-1.85-1.51-4.5.75-5.83 1.16-.68 2.84-.82 10.06-.82 8.54 0 8.68.02 9.87 1.21 1.58 1.58 1.64 4.25.13 5.65-1 .93-1.69 1-10.34 1-9.18 0-9.27-.01-10.47-1.21zm31.3.2c-1.6-1.49-1.48-4.5.22-5.84 1.25-.98 1.84-1.02 17.96-1.02H114.53l1.44 1.44c.79.79 1.44 1.8 1.44 2.23 0 1.21-1.34 3.54-2.23 3.88-.44.17-8.36.31-17.61.31-16.24 0-16.85-.03-17.89-1zm-45.54-31.63c-.76-.76-1.21-1.77-1.21-2.72 0-.96.45-1.96 1.21-2.72l1.21-1.21H56.19 77.04l1.27 1.51c1.41 1.68 1.55 2.46.7 4.05-1.22 2.29-1.02 2.27-22.9 2.28l-20.77.02zm57.35.88c-1.06-.43-2.12-3.01-1.79-4.34.17-.68.87-1.68 1.55-2.21 1.13-.89 2.01-.97 10.17-.97 8.29 0 9 .07 9.99 1 .59.55 1.2 1.52 1.36 2.16.34 1.35-.86 3.95-2.02 4.4-.94.36-18.36.34-19.26-.02zM14.98 121.84c-.76-.76-1.21-1.77-1.21-2.72 0-.96.45-1.96 1.21-2.72l1.21-1.21h14.04 14.04l1.21 1.21c.76.76 1.21 1.77 1.21 2.72 0 .96-.45 1.96-1.21 2.72l-1.21 1.21H30.23 16.19zm43.14.62c-1.23-.59-2.22-2.95-1.77-4.21.16-.47.75-1.34 1.29-1.95l1-1.1h22.53 22.53l1.21 1.2c.76.76 1.21 1.77 1.21 2.72 0 .96-.45 1.96-1.21 2.72l-1.21 1.21-22.25-.03c-14.62-.02-22.62-.21-23.32-.55z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

/* HOVER STATE (Only when idle) */
.is-style-woo-animated .wc-block-components-product-button__button:not(.vortex-state-loading):not(.vortex-state-success):hover {
    box-shadow: 0 0 15px var(--wp--preset--color--accent-5, #8770ff) !important;
    color: #ffffff !important;
    background-color: rgba(135, 112, 255, 0.1) !important;
}

/* 
   =========================================================
   STATE: LOADING (.vortex-state-loading)
   =========================================================
*/
.is-style-woo-animated .wc-block-components-product-button__button.vortex-state-loading {
    cursor: wait !important;
    pointer-events: none !important;
    opacity: 0.9;
}

/* Override Text */
.is-style-woo-animated .wc-block-components-product-button__button.vortex-state-loading::after {
    content: "Adding..." !important;
}

/* Override Icon (Spinner) */
.is-style-woo-animated .wc-block-components-product-button__button.vortex-state-loading::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-6.219-8.56'%3E%3C/path%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-6.219-8.56'%3E%3C/path%3E%3C/svg%3E") !important;
    animation: vortex-spin 1s linear infinite;
}

/* 
   =========================================================
   STATE: SUCCESS (.vortex-state-success)
   =========================================================
*/
.is-style-woo-animated .wc-block-components-product-button__button.vortex-state-success {
    border-color: var(--wp--preset--color--accent-4) !important;
    color: var(--wp--preset--color--accent-4) !important;
    cursor: default !important;
    pointer-events: none !important;
}

/* Override Text */
.is-style-woo-animated .wc-block-components-product-button__button.vortex-state-success::after {
    content: "Added!" !important;
}

/* Override Icon (Checkmark) */
.is-style-woo-animated .wc-block-components-product-button__button.vortex-state-success::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") !important;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-color: var(--wp--preset--color--accent-4) !important;
    animation: none !important;
}

/* Animation Keyframes */
@keyframes vortex-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* =========================================================
   4. NEW EXTENSION: FULL WIDTH (.is-style-woo-full-width)
   ========================================================= */

/* 
   1. OUTER CONTAINER 
   Target both the generic class and the specific block wrapper.
*/
.is-style-woo-full-width,
.wp-block-woocommerce-add-to-cart-with-options.is-style-woo-full-width,
.wp-block-woocommerce-product-button.is-style-woo-full-width {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}

/* 
   2. INNER FORM / WRAPPERS (Critical for "Add to Cart + Options")
   The "Options" block wraps the button in a <form>. We must stretch that too.
*/
.is-style-woo-full-width form,
.is-style-woo-full-width .wc-block-components-product-button {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* 
   3. THE BUTTON ITSELF
   Finally, force the button to fill the stretched parent.
*/
.is-style-woo-full-width .wc-block-components-product-button__button,
.is-style-woo-full-width .wp-block-button__link,
.is-style-woo-full-width button[type="submit"] {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
    flex: 1 !important;
    /* Grow to fill flex container */
}