/**
 * PW Variations Manager - Frontend Styles
 *
 * @package PW_Variations_Manager
 */

/* ==========================================================================
   Variation Intro & Labels
   ========================================================================== */

.pwvm-variation-intro {
    color: #606706;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

/* Variation attribute labels in dark gray */
table.variations th.label label,
.variations th.label label {
    color: #3a3a3a;
    font-weight: 500;
    font-size: 14px;
}

/* ==========================================================================
   Measurements Form
   ========================================================================== */

.pwvm-medidas-form {
    margin: 20px 0;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
}

.pwvm-medidas-form--table {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    width: 100%;
}

.pwvm-medidas-form--table .pwvm-form-row {
    gap: 10px;
    width: 100%;
}

.pwvm-medidas-form--table .pwvm-field {
    min-width: 120px;
}

.pwvm-medidas-form--table .pwvm-input-number {
    max-width: 100%;
    width: 100%;
}

.pwvm-measurements-row .value {
    width: 100%;
}

/* Keep dependent row visually attached to its controller */
tr.pwvm-merge-top th,
tr.pwvm-merge-top td {
    border-top: 0 !important;
    padding-top: 0 !important;
}

tr.pwvm-merge-top {
    border-top: 0 !important;
}

tr.pwvm-merge-top::before,
tr.pwvm-merge-top::after {
    border-top: 0 !important;
}

form.cart table.variations tr.pwvm-merge-top,
form.woocommerce-cart-form table.variations tr.pwvm-merge-top {
    border-top: 0 !important;
    border-top-style: none !important;
    border-top-width: 0 !important;
}

tr.pwvm-merge-bottom th,
tr.pwvm-merge-bottom td {
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
}

tr.pwvm-merge-bottom {
    border-bottom: 0 !important;
}

tr.pwvm-merge-bottom::before,
tr.pwvm-merge-bottom::after {
    border-bottom: 0 !important;
}

form.cart table.variations tr.pwvm-merge-bottom,
form.woocommerce-cart-form table.variations tr.pwvm-merge-bottom {
    border-bottom: 0 !important;
    border-bottom-style: none !important;
    border-bottom-width: 0 !important;
}

.pwvm-form-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.pwvm-variation-intro {
    margin: 0 0 10px;
    padding: 0;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 700;
    color: var(--bricks-color-pzwtad);
}

.single-product .summary .price ~ .pwvm-variation-intro,
.single-product .summary .pw-dynamic-price ~ .pwvm-variation-intro {
    margin-top: 18px;
}

.single-product form.variations_form table.variations th.label,
.single-product form.variations_form table.variations th.label label {
    color: #374151 !important;
}

.pwvm-form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.pwvm-field {
    flex: 1;
    min-width: 140px;
}

.pwvm-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #1d2327;
}

.pwvm-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pwvm-optional-tag {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.pwvm-label-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.pwvm-label-wrap .pwvm-label {
    margin-bottom: 0;
}

.pwvm-label-wrap--inline {
    display: inline-flex;
    margin-bottom: 0;
}

.pwvm-measure-guide {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
}

.pwvm-measure-guide-link {
    border: 0;
    background: transparent;
    color: #374151;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
}

.pwvm-measure-guide-link:hover,
.pwvm-measure-guide-link:focus {
    color: #111827;
}

.pwvm-measure-guide--extra {
    margin-top: 6px;
}

.pwvm-predefined-guide {
    margin: 0 0 12px;
}

.pwvm-measurements-label-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.pwvm-measurements-label-trigger {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.pwvm-measurements-label-trigger:hover,
.pwvm-measurements-label-trigger:focus {
    text-decoration: underline;
}

.pwvm-measurements-label-trigger:focus-visible {
    outline: 2px solid #1f6feb;
    outline-offset: 2px;
}

.pwvm-unit {
    font-weight: 400;
    color: #757575;
    font-size: 0.85em;
}

.pwvm-range-hint {
    display: block;
    font-weight: 400;
    color: #757575;
    font-size: 11px;
    margin-top: 4px;
}

.pwvm-input-number {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.2;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.pwvm-input-text {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.2;
    box-sizing: border-box;
}

.pwvm-input-text:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.15);
}

.pwvm-info-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    background: #6e7419;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.pwvm-info-trigger:hover,
.pwvm-info-trigger:focus {
    background: #5b6014;
}

.pwvm-info-trigger:focus-visible {
    outline: 2px solid #1f6feb;
    outline-offset: 2px;
}

.pwvm-info-trigger--round {
    border-radius: 50%;
}

.pwvm-extra-fields {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e3e6eb;
}

.pwvm-extra-note {
    margin: 8px 0 0;
    color: #4b5563;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
}

.pwvm-extra-help-text {
    margin: 6px 0 0;
    color: #4b5563;
    font-size: 12px;
}

.pwvm-force-hidden,
tr.pwvm-force-hidden,
table.variations tr.pwvm-force-hidden,
.variations tr.pwvm-force-hidden,
.variations tr.pwvm-force-hidden > th,
.variations tr.pwvm-force-hidden > td,
.variations tr.pwvm-force-hidden .bricks-variation-swatches {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    max-height: 0 !important;
    opacity: 0 !important;
}

/* Hide measurement attribute rows by data-pwvm-attribute.
   Scoped: only when the custom measurements form is present on the page
   (productos "a tu medida"). KITS with predefined sizes use these same
   attributes as real selectors and must keep them visible. */
body:has(.pwvm-measurements-row) .variations tr.pwvm-attr-row[data-pwvm-attribute="pa_seleccionarancholinea"],
body:has(.pwvm-measurements-row) .variations tr.pwvm-attr-row[data-pwvm-attribute="pa_seleccionarlargosalida"],
body:has(.pwvm-measurements-form) .variations tr.pwvm-attr-row[data-pwvm-attribute="pa_seleccionarancholinea"],
body:has(.pwvm-measurements-form) .variations tr.pwvm-attr-row[data-pwvm-attribute="pa_seleccionarlargosalida"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    max-height: 0 !important;
    opacity: 0 !important;
}

/* Fila de atributo dependiente oculta por el módulo ConditionalAttrs
   (ej. Color Lasur cuando el tratamiento lo hace el cliente). Necesita
   !important para ganar al reflow responsive de la tabla de variaciones,
   que fuerza display:block !important en tr/th/td en <=768px. */
.variations tr.pwvm-cond-hidden,
.variations tr.pwvm-cond-hidden th.label,
.variations tr.pwvm-cond-hidden td.value,
.single-product form.variations_form table.variations tr.pwvm-cond-hidden,
.single-product form.variations_form table.variations tr.pwvm-cond-hidden th.label,
.single-product form.variations_form table.variations tr.pwvm-cond-hidden td.value {
    display: none !important;
}

.pwvm-info-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.pwvm-info-modal.is-open {
    display: block;
}

.pwvm-info-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
}

.pwvm-info-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(94vw, 980px);
    max-height: 92vh;
    margin: 4vh auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
    padding: 14px;
}

.pwvm-info-modal__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.pwvm-info-modal__content img {
    display: block;
    width: 100%;
    max-height: calc(92vh - 56px);
    object-fit: contain;
    margin: 0 auto;
}

.pwvm-info-modal__text {
    margin: 12px 4px 4px;
    color: #111827;
    font-size: 14px;
    line-height: 1.45;
}

body.pwvm-info-modal-open {
    overflow: hidden;
}

/* ==========================================================================
   Info Modal – Mobile Overflow Fix
   ========================================================================== */

/* Prevent horizontal overflow from the modal on any viewport */
.pwvm-info-modal {
    overflow: hidden;
}

.pwvm-info-modal__dialog {
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

.pwvm-info-modal__content {
    overflow: hidden;
    max-width: 100%;
}

.pwvm-info-modal__content img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 767px) {
    .pwvm-info-modal__dialog {
        width: calc(100vw - 16px) !important;
        max-width: 100vw !important;
        margin: 2vh auto;
        padding: 10px;
        border-radius: 8px;
    }

    .pwvm-info-modal__content img {
        max-height: calc(88vh - 40px);
    }
}

.pwvm-input-number:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.15);
}

.pwvm-input-number.pwvm-valid {
    border-color: #46b450;
}

.pwvm-input-number.pwvm-invalid {
    border-color: #dc3232;
}

.pwvm-input-feedback {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    min-height: 14px;
}

.pwvm-input-feedback.error {
    color: #dc3232;
}

form.variations_form.pwvm-variation-selecting table.variations,
.pwvm-medidas-form.pwvm-selection-syncing {
    /* Sin desplazamiento: el saltito de 1px se lee como "se esta recargando". */
    transition: opacity 0.18s ease;
    opacity: 0.94;
}

form.variations_form tr.pwvm-attr-updating {
    background: rgba(110, 116, 25, 0.08);
    transition: background-color 0.28s ease;
}

form.variations_form tr.pwvm-attr-updated {
    animation: pwvm-row-flash 0.55s ease;
}

@keyframes pwvm-row-flash {
    0% { background: rgba(110, 116, 25, 0.22); }
    100% { background: transparent; }
}

.woocommerce-product-gallery.pwvm-gallery-syncing .flex-viewport,
.woocommerce-product-gallery.pwvm-gallery-syncing .woocommerce-product-gallery__wrapper {
    /* Atenuado discreto. Con 0.35 la foto casi desaparecia y parecia que cargaba. */
    transition: opacity 0.18s ease;
    opacity: 0.88;
}

.woocommerce-product-gallery.pwvm-gallery-syncing .woocommerce-product-gallery__wrapper {
    transition-duration: 0s !important;
}

.woocommerce-product-gallery.pwvm-gallery-updated .flex-viewport,
.woocommerce-product-gallery.pwvm-gallery-updated .woocommerce-product-gallery__wrapper {
    animation: pwvm-gallery-fade 0.30s ease;
}

@keyframes pwvm-gallery-fade {
    0% { opacity: 0.15; }
    100% { opacity: 1; }
}

.pwvm-swatch-pulse {
    animation: pwvm-swatch-pulse 0.42s ease;
}

@keyframes pwvm-swatch-pulse {
    0% { transform: scale(1); }
    45% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* Ocultar el enlace «Limpiar» (reset_variations) de WooCommerce en las fichas
   con variaciones. El cliente cambia la selección directamente; el enlace suelto
   confunde. */
.woocommerce-variation-add-to-cart .reset_variations,
form.variations_form .reset_variations,
a.reset_variations {
    display: none !important;
}

/* ==========================================================================
   Gallery Simplification
   ========================================================================== */

/* P41: la tira de miniaturas propia de Bricks duplica las flex-control-thumbs
   de WooCommerce (que son las que usamos y estilamos). Se oculta siempre. */
.brx-product-gallery-thumbnail-slider,
.brxe-product-gallery.thumbnail-slider .woocommerce-product-gallery > .flex-direction-nav {
    display: none !important;
}

/* P16: Miniaturas de galería siempre visibles aunque haya variación activa */
.woocommerce-product-gallery .flex-control-nav.flex-control-thumbs {
    display: flex !important;
    gap: 8px;
    flex-wrap: wrap;
}

/* 14J-12: en MÓVIL las miniaturas complementarias salían a la derecha de la
   imagen principal y se pisaban con el sello rojo/verde. WooCommerce no genera
   flechas en la imagen principal (la navegación es por swipe), así que se
   ocultan las miniaturas en móvil; la imagen principal sigue siendo deslizable
   y el zoom (lightbox) muestra el resto. */
@media (max-width: 768px) {
    .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs {
        display: none !important;
    }
}

/* P-kits: en kits (3+ atributos de variación) la galería son renders por medida.
   La tira de miniaturas confunde (son las 15 medidas), así que se oculta y la
   imagen grande cambia con la variación seleccionada (módulo GallerySelection).
   Solo se oculta la tira; el viewport del carrusel sigue recortando a 1 imagen. */
body.pwvm-gallery-medidas .woocommerce-product-gallery .flex-control-nav.flex-control-thumbs,
body.pwvm-gallery-medidas .brx-product-gallery-thumbnail-slider,
body.pwvm-gallery-medidas .brxe-product-gallery.thumbnail-slider .flex-control-thumbs {
    display: none !important;
}

/* P-kits (rev. 14-jul): en el lightbox de kits, una medida = una imagen.
   El cliente pide que al ampliar NO aparezcan flechas para navegar a otras
   imágenes. PhotoSwipe abre con todas las medidas; ocultamos su navegación
   (flechas + contador) en páginas de kit. La imagen mostrada es siempre la de
   la medida seleccionada (módulo GallerySelection actualiza el slide activo). */
body.pwvm-gallery-medidas .pswp__button--arrow--left,
body.pwvm-gallery-medidas .pswp__button--arrow--right,
body.pwvm-gallery-medidas .pswp__counter {
    display: none !important;
}

/* Desistimiento (rev. 14-jul): el aviso es obligatorio (deber legal de informar,
   art. 97 RDL 1/2007), pero el cliente lo quiere mucho mas sutil. El plugin lo
   pinta como una caja azul con borde y margen 1em que empuja la ficha. Lo
   reducimos a una linea gris pequena, sin caja ni borde. Los estilos del plugin
   son inline, por eso se sobrescriben con !important. */
.desist-ficha-aviso,
.desist-excluido-aviso {
    background: transparent !important;
    border: 0 !important;
    border-left: 0 !important;
    padding: 0 !important;
    margin: .35em 0 .2em !important;
    font-size: .75em !important;
    line-height: 1.35 !important;
    color: #9a9a9a !important;
    opacity: .95;
}
.desist-ficha-aviso strong,
.desist-excluido-aviso strong {
    font-weight: 600 !important;
    color: #8f8f8f !important;
}
.desist-ficha-aviso a,
.desist-excluido-aviso a {
    color: #7a7a7a !important;
    text-decoration: underline !important;
}
.desist-ficha-aviso a:hover,
.desist-excluido-aviso a:hover {
    color: #606706 !important;
}

/* P41b: galerías largas (5+ miniaturas, ej. kits) — columna acotada con
   scroll propio y fade inferior, en vez de estirarse hasta abajo. */
.brxe-product-gallery.thumbnail-slider ol.flex-control-thumbs:has(li:nth-child(5)) {
    flex-direction: column;
    flex-wrap: nowrap;
    max-height: 480px;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent 100%);
    padding-bottom: 40px;
}

.brxe-product-gallery.thumbnail-slider ol.flex-control-thumbs:has(li:nth-child(5))::-webkit-scrollbar {
    display: none;
}

body.pwvm-gallery-no-slide .woocommerce-product-gallery .woocommerce-product-gallery__wrapper {
    transition-property: none !important;
}

body.pwvm-gallery-no-slide .woocommerce-product-gallery.pwvm-gallery-fading .flex-viewport,
body.pwvm-gallery-no-slide .woocommerce-product-gallery.pwvm-gallery-fading .woocommerce-product-gallery__image {
    animation: pwvm-gallery-fade-forced 0.34s ease;
}

@keyframes pwvm-gallery-fade-forced {
    0% { opacity: 0.15; }
    100% { opacity: 1; }
}

/* ==========================================================================
   Swatches (Image)
   ========================================================================== */

.cfvsw-swatches-option img,
.cfvsw-swatch-inner img,
.cfvsw-swatches-option span {
    filter: none !important;
    opacity: 1 !important;
}

body.single-product.single-product .bricks-variation-swatches.bricks-swatch-image li img {
    filter: none !important;
    opacity: 1 !important;
}

.cfvsw-swatches-option.cfvsw-swatchtype-image,
.cfvsw-swatches-option.cfvsw-image-swatch,
.cfvsw-swatches-option[data-type="image"],
.cfvsw-swatches-option.pwvm-image-swatch,
body.single-product.single-product .bricks-variation-swatches.bricks-swatch-image li {
    position: relative;
}

.cfvsw-swatches-option.cfvsw-swatchtype-image.cfvsw-selected-swatch::after,
.cfvsw-swatches-option.cfvsw-image-swatch.cfvsw-selected-swatch::after,
.cfvsw-swatches-option[data-type="image"].cfvsw-selected-swatch::after,
.cfvsw-swatches-option.pwvm-image-swatch.pwvm-image-selected::after,
body.single-product.single-product .bricks-variation-swatches.bricks-swatch-image li.bricks-swatch-selected::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--bricks-color-pzwtad);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 3;
    pointer-events: none;
}

.cfvsw-swatches-option.cfvsw-swatchtype-image.cfvsw-selected-swatch::before,
.cfvsw-swatches-option.cfvsw-image-swatch.cfvsw-selected-swatch::before,
.cfvsw-swatches-option[data-type="image"].cfvsw-selected-swatch::before,
.cfvsw-swatches-option.pwvm-image-swatch.pwvm-image-selected::before,
body.single-product.single-product .bricks-variation-swatches.bricks-swatch-image li.bricks-swatch-selected::before {
    content: "";
    position: absolute;
    top: 6px;
    right: 7px;
    width: 3px;
    height: 6px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
    z-index: 4;
    pointer-events: none;
}

/* ==========================================================================
   Add To Cart Layout
   ========================================================================== */

.single-product div.product form.cart:not(.variations_form):not(.grouped_form) {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
}

body.single-product form.cart:not(.variations_form):not(.grouped_form) {
    display: inline-flex !important;
    align-items: center !important;
    gap: 14px !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    max-width: 100%;
}

body.single-product .summary form.cart:not(.variations_form):not(.grouped_form),
body.single-product div.product .summary form.cart:not(.variations_form):not(.grouped_form) {
    display: inline-flex !important;
    align-items: center !important;
    gap: 14px !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    max-width: 100% !important;
}

.single-product div.product form.variations_form .single_variation_wrap .woocommerce-variation-add-to-cart {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
}

.single-product div.product form.cart .quantity {
    margin: 0 !important;
    flex: 0 0 auto;
}

body.single-product.product-type-simple form.cart .quantity {
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
}

.single-product div.product form.cart .quantity .qty {
    min-width: 76px;
    text-align: center;
}

.single-product div.product form.cart .single_add_to_cart_button {
    margin: 0 !important;
    white-space: nowrap;
}

.single-product div.product form.cart:not(.variations_form):not(.grouped_form) .single_add_to_cart_button,
.single-product div.product form.variations_form .single_variation_wrap .single_add_to_cart_button {
    flex: 1 1 auto;
    min-height: 46px;
}

body.single-product.product-type-simple form.cart .quantity .action.minus,
body.single-product.product-type-simple form.cart .quantity .action.plus,
body.single-product.product-type-simple form.cart .quantity .minus,
body.single-product.product-type-simple form.cart .quantity .plus,
body.single-product.product-type-simple form.cart #brxe-utdsdv .action.minus,
body.single-product.product-type-simple form.cart #brxe-utdsdv .action.plus,
body.single-product.product-type-simple form.cart #brxe-utdsdv .minus,
body.single-product.product-type-simple form.cart #brxe-utdsdv .plus {
    width: 25px !important;
    height: 25px !important;
    padding: 0 !important;
    border: 1px solid #885e45 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #885e45 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

body.single-product.product-type-simple form.cart .quantity .qty,
body.single-product.product-type-simple form.cart #brxe-utdsdv .qty {
    min-width: 64px;
    text-align: center;
    border: 0 !important;
    background: transparent !important;
}

body.single-product.product-type-simple form.cart #brxe-utdsdv {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

body.single-product form.cart:not(.variations_form):not(.grouped_form) #brxe-utdsdv,
body.single-product form.cart:not(.variations_form):not(.grouped_form) #brxe-udhaqx {
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    margin: 0 !important;
}

body.single-product form.cart:not(.variations_form):not(.grouped_form) > .quantity,
body.single-product form.cart:not(.variations_form):not(.grouped_form) > .single_add_to_cart_button,
body.single-product form.cart:not(.variations_form):not(.grouped_form) > .button,
body.single-product form.cart:not(.variations_form):not(.grouped_form) #brxe-utdsdv,
body.single-product form.cart:not(.variations_form):not(.grouped_form) #brxe-udhaqx {
    flex: 0 0 auto !important;
}

body.single-product .summary form.cart:not(.variations_form):not(.grouped_form) .quantity,
body.single-product .summary form.cart:not(.variations_form):not(.grouped_form) .single_add_to_cart_button {
    flex: 0 0 auto !important;
    margin: 0 !important;
}

body.single-product.product-type-simple form.cart .single_add_to_cart_button {
    width: auto !important;
    min-width: 220px;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
}

body.single-product form.cart:not(.variations_form):not(.grouped_form) #brxe-udhaqx .single_add_to_cart_button,
body.single-product form.cart:not(.variations_form):not(.grouped_form) .single_add_to_cart_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
}

body.single-product.product-type-simple form.cart > .quantity + .single_add_to_cart_button,
body.single-product.product-type-simple form.cart > .quantity + button.single_add_to_cart_button {
    margin-left: 12px !important;
}

/* ==========================================================================
   Mini-Cart / Off-Canvas
   ========================================================================== */

.wc-block-mini-cart__drawer.is-open,
.brxe-woocommerce-mini-cart.show-cart-details .cart-detail,
.brxe-woocommerce-mini-cart.show-cart-details .cart-detail-panel,
.brxe-woocommerce-mini-cart.show-cart-details .mini-cart-panel,
.brxe-woocommerce-mini-cart.cart-open .cart-detail,
.brxe-woocommerce-mini-cart.cart-open .cart-detail-panel,
.brxe-woocommerce-mini-cart.cart-open .mini-cart-panel {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateX(0) !important;
}

.wc-block-mini-cart__drawer.is-open + .wc-block-mini-cart__drawer-overlay,
.off-canvas-overlay.active,
.cart-overlay.active,
.overlay.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Loading state */
.pwvm-medidas-form.pwvm-loading {
    position: relative;
    pointer-events: none;
}

.pwvm-medidas-form.pwvm-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.pwvm-medidas-form.pwvm-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid #e1e4e8;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: pwvm-spin 0.8s linear infinite;
    z-index: 1;
}

@keyframes pwvm-spin {
    to { transform: rotate(360deg); }
}

/* No match message */
.pwvm-no-match-message {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fff8e5;
    border: 1px solid #ffb900;
    border-radius: 4px;
    color: #826200;
    font-size: 14px;
}

/* ==========================================================================
   Dynamic Price Display
   ========================================================================== */

.pw-dynamic-price {
    transition: opacity 0.2s;
}

.pw-dynamic-price .pw-price-display {
    display: inline-block;
}

.pw-dynamic-price.pwvm-price-updated .pw-price-display {
    animation: pwvm-highlight 0.6s ease;
}

@keyframes pwvm-highlight {
    0% { background-color: rgba(0, 115, 170, 0.15); }
    100% { background-color: transparent; }
}

/* ==========================================================================
   Conditional Attribute Visibility
   ========================================================================== */

.pwvm-visible {
    display: table-row !important;
}

/* Smooth transition for hiding */
tr.pwvm-visible {
    opacity: 1;
    transition: opacity 0.2s;
}

/* ==========================================================================
   WooCommerce Variation Override
   ========================================================================== */

/* Hide default WooCommerce variation price when using our shortcode */
.product .pw-dynamic-price ~ .woocommerce-variation-price {
    display: none !important;
}

/* ==========================================================================
   Print Selection Shortcode
   ========================================================================== */

.pwvm-print-selection {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.pwvm-print-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    color: #111;
    font-size: 16px;
    line-height: 1.3;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-decoration: none;
}

.pwvm-print-button:hover,
.pwvm-print-button:focus {
    color: #000;
    text-decoration: underline;
}

.pwvm-print-button:focus-visible {
    outline: 2px solid #1f6feb;
    outline-offset: 2px;
}

.pwvm-print-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.pwvm-print-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

.pwvm-print-text {
    display: inline-block;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .pwvm-form-row {
        flex-direction: column;
        gap: 15px;
    }

    .pwvm-field {
        width: 100%;
        min-width: 100%;
    }

    .pwvm-medidas-form {
        padding: 15px;
    }

    .single-product div.product form.cart:not(.variations_form):not(.grouped_form),
    .single-product div.product form.variations_form .single_variation_wrap .woocommerce-variation-add-to-cart {
        gap: 10px;
    }

    .single-product div.product form.cart .single_add_to_cart_button {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pwvm-swatch-pulse,
    form.variations_form tr.pwvm-attr-updated,
    .woocommerce-product-gallery.pwvm-gallery-updated .flex-viewport,
    .woocommerce-product-gallery.pwvm-gallery-updated .woocommerce-product-gallery__wrapper,
    body.pwvm-gallery-no-slide .woocommerce-product-gallery.pwvm-gallery-fading .flex-viewport,
    body.pwvm-gallery-no-slide .woocommerce-product-gallery.pwvm-gallery-fading .woocommerce-product-gallery__image {
        animation: none !important;
    }

    form.variations_form.pwvm-variation-selecting table.variations,
    .pwvm-medidas-form.pwvm-selection-syncing,
    .woocommerce-product-gallery.pwvm-gallery-syncing .flex-viewport,
    .woocommerce-product-gallery.pwvm-gallery-syncing .woocommerce-product-gallery__wrapper {
        transition: none !important;
    }
}

/* ==========================================================================
   Add to Cart - Consistent Horizontal Layout
   ========================================================================== */

/* Always horizontal: quantity + add to cart button in a row */
form.cart:not(.variations_form),
form.cart.variations_form .woocommerce-variation-add-to-cart {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    max-width: 420px;
}

form.cart:not(.variations_form) .quantity,
form.cart.variations_form .woocommerce-variation-add-to-cart .quantity {
    flex-shrink: 0;
}

form.cart:not(.variations_form) .single_add_to_cart_button,
form.cart.variations_form .woocommerce-variation-add-to-cart .single_add_to_cart_button {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0 30px !important;
    margin: 0 !important;
    height: 42px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Consistent quantity input styling across all products */
.brxe-product-add-to-cart .quantity,
form.cart .quantity {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    height: 42px;
    margin: 0;
    padding: 0;
}

/* Reset all quantity children: no borders, no shadows, stretch height */
.brxe-product-add-to-cart .quantity > *,
form.cart .quantity > * {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
    background: transparent !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    align-self: stretch;
    box-sizing: border-box;
}

/* Number input field */
.brxe-product-add-to-cart .quantity input.qty,
form.cart .quantity input.qty {
    width: 50px !important;
    text-align: center;
    border-left: 1px solid #d1d5db !important;
    border-right: 1px solid #d1d5db !important;
    -moz-appearance: textfield;
    font-size: 15px;
    font-weight: 500;
    background: #fff !important;
    order: 1;
}

.brxe-product-add-to-cart .quantity input.qty::-webkit-inner-spin-button,
.brxe-product-add-to-cart .quantity input.qty::-webkit-outer-spin-button,
form.cart .quantity input.qty::-webkit-inner-spin-button,
form.cart .quantity input.qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Minus/Plus buttons: Bricks span.action.minus/plus with SVG icons
   Bricks theme sets border-style:solid;border-width:1px on .quantity .minus/.plus
   We must override with higher specificity */
.brxe-product-add-to-cart .quantity .action,
.brxe-product-add-to-cart .quantity .action.minus,
.brxe-product-add-to-cart .quantity .action.plus,
form.cart .quantity .action,
form.cart .quantity .action.minus,
form.cart .quantity .action.plus,
form.cart .quantity .minus,
form.cart .quantity .plus,
.brxe-product-add-to-cart .quantity .minus,
.brxe-product-add-to-cart .quantity .plus {
    width: 36px !important;
    height: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    color: #4f4f4f;
    background: #fff !important;
    border: none !important;
    border-style: none !important;
    border-width: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    opacity: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

/* Force SVG icons centered */
.brxe-product-add-to-cart .quantity .action svg,
.brxe-product-add-to-cart .quantity .minus svg,
.brxe-product-add-to-cart .quantity .plus svg,
form.cart .quantity .action svg,
form.cart .quantity .minus svg,
form.cart .quantity .plus svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
    margin: auto !important;
}

/* Force input centered */
.brxe-product-add-to-cart .quantity input.qty,
form.cart .quantity input.qty {
    height: 100% !important;
    line-height: 42px !important;
}

.brxe-product-add-to-cart .quantity .action.minus,
form.cart .quantity .action.minus,
form.cart .quantity .minus {
    order: 0;
}

.brxe-product-add-to-cart .quantity .action.plus,
form.cart .quantity .action.plus,
form.cart .quantity .plus {
    order: 2;
}

.brxe-product-add-to-cart .quantity .action:hover,
form.cart .quantity .action:hover,
form.cart .quantity .minus:hover,
form.cart .quantity .plus:hover {
    background: #f2f2f2 !important;
}

.brxe-product-add-to-cart .quantity .action svg,
form.cart .quantity .action svg {
    width: 16px;
    height: 16px;
}

/* Mobile: compact quantity */
@media (max-width: 767px) {
    .brxe-product-add-to-cart .quantity,
    form.cart .quantity {
        height: 38px;
    }

    .brxe-product-add-to-cart .quantity input.qty,
    form.cart .quantity input.qty {
        width: 38px !important;
        font-size: 14px;
    }

    .brxe-product-add-to-cart .quantity .action,
    form.cart .quantity .action,
    form.cart .quantity .minus,
    form.cart .quantity .plus {
        width: 30px !important;
    }

    .brxe-product-add-to-cart .quantity .action svg,
    form.cart .quantity .action svg {
        width: 14px;
        height: 14px;
    }
}

/* ==========================================================================
   Product Gallery Lightbox - Show trigger
   ========================================================================== */

/* Re-enable the lightbox/zoom trigger button hidden by Bricks custom CSS */
.woocommerce-product-gallery__trigger {
    display: block !important;
    position: absolute !important;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    text-align: center;
    line-height: 36px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
}

.woocommerce-product-gallery__trigger:hover {
    background: rgba(255, 255, 255, 1);
}

/* ==========================================================================
   Mini Cart Off-Canvas (mobile)
   ========================================================================== */

/* CRITICAL: Kill transform on mini-cart parents — transform breaks position:fixed on children */
#brxe-ibmmdd,
#brxe-ibmmdd.brxe-woocommerce-mini-cart {
    transform: none !important;
}

/* Move cart-detail OUTSIDE the stacking context via CSS containment override */
#brxe-ibmmdd .cart-detail,
.cart-detail-ibmmdd {
    position: fixed !important;
    top: 0 !important;
    right: -100vw !important;
    bottom: 0 !important;
    left: auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 99999 !important;
    background: #fff !important;
    overflow-y: auto !important;
    transition: right 0.3s ease !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: hidden !important;
    padding: 20px 16px 30px !important;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15) !important;
}

/* Cart detail inner spacing */
#brxe-ibmmdd .cart-detail .woocommerce-mini-cart__buttons,
.cart-detail-ibmmdd .woocommerce-mini-cart__buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 15px;
    border-top: 1px solid #e5e5e5;
    margin-top: 15px;
}

#brxe-ibmmdd .cart-detail .woocommerce-mini-cart__buttons .button,
.cart-detail-ibmmdd .woocommerce-mini-cart__buttons .button {
    width: 100% !important;
    text-align: center;
    padding: 12px 20px !important;
    border-radius: 6px !important;
}

/* Cart item images */
#brxe-ibmmdd .cart-detail .woocommerce-mini-cart-item img,
.cart-detail-ibmmdd .woocommerce-mini-cart-item img {
    width: 60px;
    border-radius: 6px;
}

/* When open: slide in from right */
.show-cart-details #brxe-ibmmdd .cart-detail,
.show-cart-details .cart-detail-ibmmdd,
#brxe-ibmmdd.show-cart-details .cart-detail,
#brxe-ibmmdd .cart-detail.active {
    right: 0 !important;
    visibility: visible !important;
}

/* Overlay */
#brxe-ibmmdd .off-canvas-overlay,
.cart-detail-ibmmdd + .off-canvas-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.4) !important;
    z-index: 99998 !important;
}

/* Desktop mini-carts: cap on mobile too */
@media (max-width: 991px) {
    .cart-detail.off-canvas.right:not(.cart-detail-ibmmdd) {
        max-width: 320px !important;
        width: 320px !important;
    }
}

/* ==========================================================================
   WooCommerce Notice Suppression (after add-to-cart)
   ========================================================================== */

/* Hide the green "product added to cart" notice on product pages
   when mini-cart auto-open is handling the feedback */
body.single-product .woocommerce-message,
body.single-product .wc-block-components-notice-banner.is-success {
    display: none !important;
}

/* ==========================================================================
   Action Button Border-Radius
   ========================================================================== */

/* Rounded corners on all action buttons */
.single_add_to_cart_button,
.button.wc-forward,
a.button.wc-forward,
.wc-block-cart__submit-button,
.wc-block-components-button,
.checkout-button,
.wc-proceed-to-checkout .button,
#place_order,
.woocommerce-mini-cart__buttons .button,
.woocommerce .button,
body.woocommerce-cart .wc-proceed-to-checkout a.button,
body.woocommerce-checkout #place_order {
    border-radius: 6px !important;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .pwvm-medidas-form {
        background: #fff;
        border: 1px solid #000;
        page-break-inside: avoid;
    }

    .pwvm-input-number {
        border: 1px solid #000;
    }

    .pwvm-print-selection,
    .pwvm-print-selection .pwvm-print-button {
        display: none !important;
    }

    .pwvm-info-trigger,
    .pwvm-info-modal {
        display: none !important;
    }
}


/* ==========================================================================
   Sin velo de carga en fichas de medidas (pwvm-sin-velo)
   Red de seguridad: si algun camino inserta el blockUI de WooCommerce pese al
   parche de JS, aqui no llega a verse. El precio ya se pinta al instante.
   ========================================================================== */
body:has(.pwvm-medidas-form) form.variations_form > .blockUI,
body:has(.pwvm-medidas-form) .pwvm-medidas-form > .blockUI,
body:has(.pwvm-medidas-form) form.variations_form > .blockUI.blockOverlay,
body:has(.pwvm-medidas-form) .pwvm-medidas-form > .blockUI.blockOverlay {
    display: none !important;
}


/* ==========================================================================
   Cierre del minicarrito
   El panel off-canvas de Bricks no trae boton de cierre. En movil ocupa todo el
   ancho y la capa oscura no es accesible: sin esto no se puede salir.
   ========================================================================== */
/* OJO: NO tocar el position del panel. Es off-canvas (fixed) y ponerle
   position:relative lo saca de su sitio y descuadra la cabecera entera.
   El boton se posiciona solo: un elemento fixed ya sirve de referencia
   para sus hijos absolutos. */

.pwvm-minicart-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    /* 44px: objetivo tactil minimo recomendado */
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 50%;
    background: #fff;
    color: #4a5260;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.pwvm-minicart-close:hover,
.pwvm-minicart-close:focus-visible {
    background: #f2f3f5;
    color: #15181d;
}

.pwvm-minicart-close:focus-visible {
    outline: 2px solid #6e7419;
    outline-offset: 2px;
}

/* Reservar sitio para el boton: sin esto se superpone con la X de eliminar del
   primer producto y no se puede quitar del carrito. El relleno va en el CONTENIDO,
   nunca en el panel, para no alterar su posicionado. */
.brxe-woocommerce-mini-cart .cart-detail.off-canvas .widget_shopping_cart_content {
    padding-top: 60px;
}

@media (max-width: 767px) {
    .pwvm-minicart-close {
        top: 8px;
        right: 8px;
    }
}
