/* =========================================================
   BOTÓN DE AÑADIR AL CARRITO

   Solo se añade el icono delante del texto. El color, el fondo y
   el tamaño siguen siendo los del tema: el icono toma el color
   del propio texto del botón.
   ========================================================= */

/* Valor de partida: si el estilo que inyecta el plugin se perdiera (por un
   optimizador que combine CSS), el icono sigue apareciendo. */
:root {
    --superop-cart-icon: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCAyNCAyNCc+PHBhdGggZD0nTTMuOCA3LjRoMTYuNGwtMS4xIDEzLjJhMi4yIDIuMiAwIDAgMS0yLjIgMkg3LjFhMi4yIDIuMiAwIDAgMS0yLjItMkwzLjggNy40eicvPjxwYXRoIGQ9J004LjYgOC4zVjYuMWEzLjQgMy40IDAgMCAxIDYuOCAwdjIuMicgZmlsbD0nbm9uZScgc3Ryb2tlPSdibGFjaycgc3Ryb2tlLXdpZHRoPScyLjEnIHN0cm9rZS1saW5lY2FwPSdyb3VuZCcvPjwvc3ZnPg==");
    --superop-cart-size: 0.85em;
}

/* El icono y el texto se centran juntos dentro del botón, en vez de que el
   icono se coma el relleno de la izquierda. No se toca color ni fondo. */
.woocommerce a.button.add_to_cart_button,
.woocommerce a.add_to_cart_button,
.woocommerce button.single_add_to_cart_button,
.woocommerce .single_add_to_cart_button,
.woocommerce-page a.button.add_to_cart_button,
a.button.add_to_cart_button,
a.add_to_cart_button,
button.single_add_to_cart_button,
.single_add_to_cart_button,
.wc-block-components-product-button__button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.55em;
    max-width: 100%;
    vertical-align: middle;
    text-align: center;
}

.woocommerce a.button.add_to_cart_button::before,
.woocommerce a.add_to_cart_button::before,
.woocommerce button.single_add_to_cart_button::before,
.woocommerce .single_add_to_cart_button::before,
.woocommerce-page a.button.add_to_cart_button::before,
.woocommerce-page .single_add_to_cart_button::before,
a.button.add_to_cart_button::before,
a.add_to_cart_button::before,
button.single_add_to_cart_button::before,
.single_add_to_cart_button::before,
.wc-block-components-product-button__button::before {
    content: "" !important;
    display: inline-block !important;
    flex: 0 0 auto;
    /* Divi coloca en absoluto los pseudo-elementos de sus botones (la flecha
       del hover). Sin esto, el icono se hereda ese posicionamiento y se
       superpone al texto en lugar de ponerse delante. */
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    float: none !important;
    transform: none !important;
    line-height: 1 !important;
    width: var(--superop-cart-size, 0.85em);
    height: var(--superop-cart-size, 0.85em);
    /* La separación la pone el «gap» del botón, no un margen del icono. */
    margin: 0 !important;
    background-color: currentColor;
    -webkit-mask-image: var(--superop-cart-icon);
    mask-image: var(--superop-cart-icon);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    /* Neutraliza fuentes de iconos que el tema pudiera imponer aquí. */
    font-family: inherit !important;
    font-weight: inherit !important;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 1;
    transition: none;
}

/* «Ver carrito» y «Leer más» no llevan icono: son otro tipo de enlace. */
.woocommerce a.added_to_cart::before,
a.added_to_cart::before {
    content: none !important;
    display: none !important;
}

/* Mientras se añade por AJAX, WooCommerce dibuja su propio indicador. */
.woocommerce a.button.add_to_cart_button.loading::before,
a.button.add_to_cart_button.loading::before {
    opacity: 0.55;
}

/* =========================================================
   MODO FONT AWESOME

   Mismo icono que usa la cabecera («fa fa-shopping-bag fa-fw»),
   dibujado con la fuente en vez del SVG incrustado.
   ========================================================= */

body.superop-btn-fa .woocommerce a.button.add_to_cart_button::before,
body.superop-btn-fa .woocommerce a.add_to_cart_button::before,
body.superop-btn-fa .woocommerce button.single_add_to_cart_button::before,
body.superop-btn-fa .woocommerce .single_add_to_cart_button::before,
body.superop-btn-fa a.button.add_to_cart_button::before,
body.superop-btn-fa a.add_to_cart_button::before,
body.superop-btn-fa button.single_add_to_cart_button::before,
body.superop-btn-fa .single_add_to_cart_button::before,
body.superop-btn-fa .wc-block-components-product-button__button::before {
    content: var(--superop-cart-glyph, "\f290") !important;
    /* Las versiones 5 y 6 solo dibujan la variante maciza con el grosor 900;
       en la 4.7 «font-synthesis: none» evita que ese grosor la engorde. */
    font-family: FontAwesome, "Font Awesome 6 Free", "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    -webkit-font-synthesis: none;
    font-synthesis: none;
    /* Equivale a la clase «fa-fw»: todos los iconos ocupan lo mismo. */
    width: 1.28571429em;
    height: auto;
    font-size: var(--superop-cart-size, 0.85em);
    text-align: center;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    /* Sin máscara: aquí el color lo pone el propio glifo. */
    background-color: transparent !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    color: inherit;
}
