/**
 * Shop Single — Producto individual (ymk-woo-extra)
 *
 * Índice:
 *   1.  Tabla de variaciones: reset + layout
 *   2.  Select nativo: oculto (WC lo necesita para su JS)
 *   3.  Radio buttons: contenedor
 *   4.  Radio inputs: ocultos
 *   5.  Labels — swatches: base compartida con tarjeta
 *   6.  Swatches: pastilla texto
 *   7.  Swatches: color (círculo)
 *   8.  Swatches: icono con mask
 *   9.  Estado seleccionado
 *   10. Estado deshabilitado
 *   11. Reset variaciones
 *   12. Precio variación + ATC en fila
 *   15. Diálogo de disponibilidad
 */

/* ── 1. Tabla de variaciones: reset + layout ─────────────────────────────── */

form.variations_form.cart {
    display: flex;
    flex-direction: column;
}

table.variations {
    border: 0;
    margin: 1.5rem 0;
    font-size: inherit;
    width: 100%;
}

table.variations * {
    border: 0;
}

table.variations tbody {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

table.variations tr {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

table.variations th.label,
table.variations td.value {
    display: block;
    padding: 0;
}

table.variations th.label label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    padding: 0;
    margin: 0;
}

/* ── 2. Select nativo: oculto ────────────────────────────────────────────── */

table.variations select {
    display: none;
}

/* ── 3. Radio buttons: contenedor ───────────────────────────────────────── */

.ymk-variation-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

/* ── 4. Radio inputs: ocultos ────────────────────────────────────────────── */

.ymk-variation-radios input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
    margin: 0;
}

/* ── 5. Labels como swatches ─────────────────────────────────────────────── */
/*
 * Reutiliza .ymk-swatch de shop-card-style.css.
 * Añadimos cursor: pointer y tamaños propios para single.
 */

.ymk-variation-radios .ymk-swatch {
    cursor: pointer;
    font-size: 13px;
    transition: opacity 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

/* ── 6. Pastilla texto ───────────────────────────────────────────────────── */

.ymk-variation-radios .ymk-swatch:not(.ymk-swatch--color):not(.has-image) {
    padding: 0.3rem 0.65rem;
    border: 1px solid currentColor;
    border-radius: var(--button--border-radius, 4px);
    opacity: 0.65;
}

/* ── 7. Color (círculo) ──────────────────────────────────────────────────── */
/*
 * No requiere body.ymk-colored-filters — los swatches de single siempre
 * muestran el círculo de color si la variación tiene .ymk-swatch--color.
 */

.ymk-variation-radios .ymk-swatch.ymk-swatch--color {
    font-size: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    overflow: hidden;
}

.ymk-variation-radios .ymk-swatch.ymk-swatch--color::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    /* colores.css define background para .slug::before — no sobreescribir aquí */
}

.ymk-variation-radios .ymk-swatch.ymk-swatch--color.has-image::before {
    background-image: var(--ymk-swatch, none);
    background-size: cover;
    background-position: center;
}

/* ── 8. Icono con mask ───────────────────────────────────────────────────── */

.ymk-variation-radios .ymk-swatch.has-image:not(.ymk-swatch--color) {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    font-size: 0;
    opacity: 1;
}

.ymk-variation-radios .ymk-swatch.has-image:not(.ymk-swatch--color)::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    mask: var(--ymk-swatch, none) no-repeat center / contain;
    -webkit-mask: var(--ymk-swatch, none) no-repeat center / contain;
    background-color: currentColor;
}

/* ── 9. Estado seleccionado ──────────────────────────────────────────────── */

/* Pastilla texto seleccionada */
.ymk-variation-radios input[type="radio"]:checked + .ymk-swatch:not(.ymk-swatch--color):not(.has-image) {
    opacity: 1;
    background: var(--ymk-btn-bg, var(--button--color-background, #111));
    color: var(--ymk-btn-text, var(--button--color-text, #fff));
    border-color: transparent;
}

/* Color seleccionado: anillo exterior */
.ymk-variation-radios input[type="radio"]:checked + .ymk-swatch.ymk-swatch--color {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}

/* Icono seleccionado */
.ymk-variation-radios input[type="radio"]:checked + .ymk-swatch.has-image {
    opacity: 1;
}

/* ── 10. Estado deshabilitado ─────────────────────────────────────────────── */

.ymk-variation-radios .ymk-swatch.disabled,
.ymk-variation-radios input[type="radio"]:disabled + .ymk-swatch {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── 11. Reset variaciones ───────────────────────────────────────────────── */

a.reset_variations {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    opacity: 0.5;
    margin-top: 0.5rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

a.reset_variations:hover {
    opacity: 1;
}

/* ── 12. Inline ATC: precio + botón en fila (todos los tipos) ────────────── */
/*
 * .ymk-single-atc-wrap envuelve p.price (p.10) + form.cart / single_variation_wrap (p.30).
 * Mismo patrón que inline ATC en tarjeta — flex row, precio ocupa espacio disponible.
 *
 * Variable: .ymk-single-atc-wrap > p.price + .single_variation_wrap
 *           .single_variation_wrap tiene su propio flex row (precio variación + ATC)
 * Simple:   .ymk-single-atc-wrap > p.price + form.cart
 */

body.ymk-single-atc-inline .ymk-single-atc-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem 1rem;
    flex-wrap: nowrap;
    justify-content: space-evenly;
}

/* Precio genérico (simple) y precio variación (variable): mismo flex */
body.ymk-single-atc-inline .ymk-single-atc-wrap > p.price,
body.ymk-single-atc-inline .ymk-single-atc-wrap .woocommerce-variation-price {
   flex: none;
   margin: 0 !important;
}

/* form.cart y botones de disponibilidad: flex row inline */
body.ymk-single-atc-inline .ymk-single-atc-wrap > form.cart,
body.ymk-single-atc-inline .ymk-single-atc-wrap > .ymk-availability-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    width: 100%;
    justify-content: flex-end;
}

body.ymk-single-atc-inline .ymk-single-atc-wrap > form.cart .quantity {
    margin: 0;
}

body.ymk-single-atc-inline .ymk-single-atc-wrap > form.cart .single_add_to_cart_button,
body.ymk-single-atc-inline .ymk-single-atc-wrap > .ymk-availability-actions .button {
    margin: 0;
    white-space: nowrap;
}

.single-product .single_variation_wrap {
    order: -1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    width: 100%;
}

.single-product .woocommerce-variation.single_variation {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    min-height: 44px;
    flex-direction: column;
    gap: 0;
}

.single-product .woocommerce-variation-price {
    margin: 0 !important;
}

.single-product .woocommerce-variation-description {
    display: none;
}

/* Precio genérico: visible solo cuando no hay variación seleccionada.
 * WC añade .woocommerce-variation-price cuando hay selección activa —
 * usamos ese selector como señal para ocultar p.price sin JS. */
.single-product .single_variation_wrap:has(.woocommerce-variation-price:not(:empty)) > p.price {
    display: none;
}

.single-product .woocommerce-variation-add-to-cart {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

/* Quitar margin-top que WC añade al form quantity en algunos temas */
.single-product .woocommerce-variation-add-to-cart .quantity {
    margin: 0;
}

.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button {
    margin: 0;
    white-space: nowrap;
}

/* ── 13. Documentos: lista y tarjetas ───────────────────────────────────── */

ul.woocommerce_documents {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

ul.woocommerce_documents li {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-basis: calc( 50% - 1rem );
    padding: var(--button--padding-vertical) var(--button--padding-horizontal);
    border-radius: var(--button--border-radius, 4px);
    background: var(--wp--preset--color--light, #f5f5f5);
    transition: background 0.15s, color 0.15s;
}

ul.woocommerce_documents li:hover {
    background: var(--wp--preset--color--buttonback, var(--global--color-primary));
    color: var(--wp--preset--color--buttontext, #fff);
}

ul.woocommerce_documents li a {
    padding: 0;
    text-decoration: none;
    color: inherit;
}

ul.woocommerce_documents li a::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* ── 13.6 Documentos: iconos por tipo de archivo ─────────────────────────── */

[class^="ymk-doc-type-"] a::before,
[class^="ymk-doc-type-"] h4::before {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: normal;
    font-size: 1.25em;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.25em;
}

.ymk-doc-type-mp3 a::before  { content: "\e405"; } /* audio */
.ymk-doc-type-mp4 a::before  { content: "\e04b"; } /* videocam */
.ymk-doc-type-pdf a::before,
.ymk-doc-type-zip a::before  { content: "\e2c4"; } /* download */
.ymk-doc-type-doc a::before,
.ymk-doc-type-docx a::before { content: "\e873"; } /* description */
.ymk-doc-type-xls a::before,
.ymk-doc-type-xlsx a::before { content: "\e8ef"; } /* table_chart */

.ymk-doc-type-mp3 h4::before,
.ymk-doc-type-mp4 h4::before { content: "\e037"; } /* play_circle */
.ymk-doc-type-pdf h4::before,
.ymk-doc-type-zip h4::before { content: "\e2c4"; } /* download */

/* ── 14. Galería: layouts ────────────────────────────────────────────────────
 *
 *   default   → WC estándar (Flexslider + thumbnails)
 *   swipe     → WC slider sin thumbnails, ancho completo
 *   grid-auto → todas las imágenes en grid 2 col con alturas libres
 *   grid-1col → todas las imágenes apiladas en 1 col
 */

/* ── 14.1 Swipe ──────────────────────────────────────────────────────────── */

/* Mini nav: thumbnails como círculos */
body.ymk-gallery-swipe .flex-control-thumbs {
    display: flex !important;
    justify-content: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

body.ymk-gallery-swipe .flex-control-thumbs li {
    flex: 0 0 36px !important;
    width: 36px !important;
    max-width: 36px !important;
    margin: 0 !important;
}

body.ymk-gallery-swipe .flex-control-thumbs img {
    display: block;
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
    opacity: 0.45;
    cursor: pointer;
    transition: opacity 0.2s;
}

body.ymk-gallery-swipe .flex-control-thumbs img.flex-active,
body.ymk-gallery-swipe .flex-control-thumbs img:hover {
    opacity: 1;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px currentColor;
}

/* Flechas prev/next */
body.ymk-gallery-swipe .flex-direction-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

body.ymk-gallery-swipe .flex-direction-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    text-indent: -9999px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

body.ymk-gallery-swipe .woocommerce-product-gallery:hover .flex-direction-nav a {
    opacity: 1;
}

body.ymk-gallery-swipe .flex-direction-nav .flex-prev { left: 0.5rem; }
body.ymk-gallery-swipe .flex-direction-nav .flex-next { right: 0.5rem; }

body.ymk-gallery-swipe .flex-direction-nav a::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    position: absolute;
}

body.ymk-gallery-swipe .flex-direction-nav .flex-prev::before {
    transform: rotate(-135deg) translate(-1px, 1px);
}

body.ymk-gallery-swipe .flex-direction-nav .flex-next::before {
    transform: rotate(45deg) translate(-1px, 1px);
}

/* ── 14.2 Grid: contenedor ───────────────────────────────────────────────── */


.ymk-gallery-grid {
    display: grid !important;
    gap: 0.5rem;
}

.ymk-gallery-grid .woocommerce-product-gallery__image {
    width: auto !important;
    display: block !important;
    margin: 0 !important;
    overflow: hidden;
}

.ymk-gallery-grid .woocommerce-product-gallery__image img {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 100%;
    object-fit: cover;
}

/* ── 14.3 Grid auto: 2 columnas, primera imagen ocupa fila entera ─────────── */

.ymk-gallery-grid--grid-auto {
    grid-template-columns: repeat(2, 1fr);
}

.ymk-gallery-grid--grid-auto .woocommerce-product-gallery__image:first-child {
    grid-column: 1 / -1;
}

/* ── 14.4 Grid 1 col: apilado ────────────────────────────────────────────── */

.ymk-gallery-grid--grid-1col {
    grid-template-columns: 1fr;
}
/* ── 15. Diálogo de disponibilidad ──────────────────────────────────────── */

#ymk-availability-dialog {
    border: none;
    border-radius: 0.5rem;
    padding: 0 2rem 2rem;
    max-width: min(560px, 92vw);
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    position: relative;
    animation: ymk-dialog-in .2s ease;
}

#ymk-availability-dialog::backdrop {
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
    animation: ymk-backdrop-in .2s ease;
}

@keyframes ymk-dialog-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1);   }
}

@keyframes ymk-backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ymk-content-title {
    margin: 0 0 1rem;
}

#ymk-availability-dialog .ymk-dialog__close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 100%;
    margin-bottom: 1.3rem;
    padding: 0;
    background-color: transparent;
    border: none;
    color: var(--primary-nav--color-link);
    font-size: var(--primary-nav--font-size-button);
    font-weight: var(--primary-nav--font-weight-button);
    flex-wrap: nowrap;
    cursor: pointer;
}

#ymk-availability-dialog .ymk-dialog__close .dropdown-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: var(--primary-nav--font-size-button);
}

#ymk-availability-dialog .ymk-dialog__close::after {
    content: "";
    display: block;
    width: 100%;
    border-top: 1px solid;
    opacity: .15;
    margin: 1.3rem 0 0;
}

.ymk-dialog__body { margin-top: 0; }

.ymk-dialog__error {
    text-align: center;
    opacity: .6;
    padding: 1.5rem 0;
    font-size: .9rem;
}

/* ── Preloader: spinner coherente con infinite scroll ─────────────────────── */

.ymk-dialog__loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 0;
}

.ymk-dialog__loader span {
    display: block;
    width: 2rem;
    height: 2rem;
    border: 3px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    opacity: .35;
    animation: ymk-spin .7s linear infinite;
}

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

/* ── 15.1 Lateral izquierdo 2:3 ─────────────────────────────────────────── */

#ymk-availability-dialog.ymk-dialog--lateral-left {
    max-width: none;
    width: min(calc(100dvh * 2 / 3), 92vw);
    height: fit-content;
    max-height: 100dvh;
    border-radius: 0 0.5rem 0.5rem 0;
    margin: 0;
    inset: 0 auto 0 0;
    animation: ymk-dialog-left-in .25s ease;
    overflow-y: auto;
}

@keyframes ymk-dialog-left-in {
    from { opacity: 0; transform: translateX(-100%); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── 15.2 Lateral derecho 2:3 ───────────────────────────────────────────── */

#ymk-availability-dialog.ymk-dialog--lateral-right {
    max-width: none;
    width: min(calc(100dvh * 2 / 3), 92vw);
    height: fit-content;
    max-height: 100dvh;
    border-radius: 0.5rem 0 0 0.5rem;
    margin-block: 0;
    margin-inline-start: auto;
    margin-inline-end: 0;
    animation: ymk-dialog-right-in .25s ease;
    overflow-y: auto;
}

@keyframes ymk-dialog-right-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── 15.2 Bottom: hoja inferior ─────────────────────────────────────────── */

#ymk-availability-dialog.ymk-dialog--bottom {
    max-width: none;
    width: 100%;
    border-radius: 0.75rem 0.75rem 0 0;
    margin: auto auto 0 auto;
    inset: auto 0 0 0;
    animation: ymk-dialog-bottom-in .25s ease;
    max-height: 80dvh;
    overflow-y: auto;
}

@keyframes ymk-dialog-bottom-in {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
}


