/* =========================================================
   0. VARIABLES
   Gaps y padding de la grilla (se redefinen por breakpoint).
   Se usan en grilla, skeleton y product tabs.
========================================================= */

:root {
    --rvx-gap-x: 12px;
    --rvx-gap-y: 28px;
    --rvx-grid-pad: 12px;
}

@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --rvx-gap-x: 20px;
        --rvx-gap-y: 40px;
        --rvx-grid-pad: 20px;
    }
}

@media (min-width: 1025px) {
    :root {
        --rvx-gap-x: 24px;
        --rvx-gap-y: 45px;
        --rvx-grid-pad: 0px;
    }
}


/* =========================================================
   1. GRID DE PRODUCTOS (base)
========================================================= */

.custom-product-grid {
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.rvx-ptabs,
.rvx-ptabs-panels,
.rvx-ptabs-panel {
    min-width: 0;
    max-width: 100%;
}


/* =========================================================
   2. CARD
========================================================= */

.custom-product-card {
    position: relative;
    width: 100%;
    padding: 0;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
    overflow: visible;

    /* Variables del hover (solo se usan en escritorio con mouse) */
    --rvx-zoom: 1.10;          /* 1.05 suave · 1.10 medio · 1.20 fuerte */
    --rvx-zoom-time: .9s;      /* duración del zoom */
    --rvx-fade: .9s;           /* duración del fundido de la 2.ª foto */
    --rvx-ease: cubic-bezier(.4, 0, .2, 1);
    --rvx-ease-out: cubic-bezier(.22, .61, .36, 1);
}

.custom-product-card .product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    padding: 0;
    overflow: hidden;
    border-radius: 7px;
    background: #f3f3f3;
}

.product-media {
    position: absolute;
    inset: 0;
    z-index: 1;
    will-change: opacity, transform;
}

/* Link que cubre toda la imagen */
.product-link,
.product-link:focus,
.product-link:active {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: block;
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Sin resaltado al tocar */
.custom-product-card a,
.custom-product-card button,
.custom-product-card .product-image,
.custom-product-card .product-link {
    -webkit-tap-highlight-color: transparent;
}


/* =========================================================
   3. IMÁGENES (principal + segunda al hover/touch)
========================================================= */

.custom-product-card .product-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transition:
        opacity .45s ease,
        transform .85s cubic-bezier(.4, 0, .2, 1);
    will-change: opacity, transform;
}

.img-main {
    z-index: 1;
}

.img-hover {
    z-index: 2;
    opacity: 0;
    transform: scale(1.08);
}

/* Hover / touch (por defecto: la segunda foto reemplaza a la principal) */
.custom-product-card.has-hover.is-hover .img-main {
    opacity: 0;
    transform: scale(1);
}

.custom-product-card.has-hover.is-hover .img-hover {
    opacity: 1;
    transform: scale(1);
}

/* Cuando se selecciona una variación: vuelve a la foto principal */
.custom-product-card.variation-selected .img-hover {
    opacity: 0 !important;
    transform: scale(1.08) !important;
}

.custom-product-card.variation-selected .img-main {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* Feedback al tocar (solo táctil) */
@media (hover: none) and (pointer: coarse) {

    .custom-product-card .product-image {
        transition: transform .18s cubic-bezier(.4, 0, .2, 1);
    }

    .custom-product-card:not(.variation-selected) .product-image:active {
        transform: scale(.985);
    }
}


/* =========================================================
   4. HOVER CON ZOOM (solo escritorio con mouse)
   - La foto principal NO desaparece (evita el "bache gris").
   - La 2.ª foto se funde encima y también hace zoom.
   - Sin 2.ª foto: zoom solo a la principal.
========================================================= */

@media (hover: hover) and (pointer: fine) {

    /* Reposo y salida (al quitar el cursor): el zoom regresa hacia
       adentro con la misma duración y curva que la entrada */
    .custom-product-card .product-image img {
        transition:
            opacity var(--rvx-fade) var(--rvx-ease),
            transform var(--rvx-zoom-time) var(--rvx-ease-out);
    }

    .custom-product-card .img-main,
    .custom-product-card .img-hover {
        transform: scale(1);
    }

    /* Entrada: zoom en la foto principal (con o sin 2.ª foto) */
    .custom-product-card.is-hover .img-main {
        opacity: 1;
        transform: scale(var(--rvx-zoom));
        transition:
            opacity .3s var(--rvx-ease),
            transform var(--rvx-zoom-time) var(--rvx-ease-out);
    }

    /* Entrada: la 2.ª foto aparece y también hace zoom */
    .custom-product-card.has-hover.is-hover .img-hover {
        opacity: 1;
        transform: scale(var(--rvx-zoom));
        transition:
            opacity var(--rvx-fade) var(--rvx-ease),
            transform var(--rvx-zoom-time) var(--rvx-ease-out);
    }
}


/* =========================================================
   5. INFORMACIÓN DEL PRODUCTO
========================================================= */

.product-info {
    padding: 8px 0 0;
    margin: 0;
}

.product-category {
    margin: 0 0 3px;
    font-size: 10px;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #888;
}

.product-title {
    margin: 0 0 4px;
    font-family: 'Varela Round', sans-serif;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 400;
    text-transform: none;
}

.product-title a {
    color: #222 !important;
    text-decoration: none !important;
}

.product-price {
    display: block;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 400;
    color: #111;
    text-decoration: none !important;
}

.product-price del {
    margin-right: 5px;
    font-size: 12px;
    font-weight: 400;
    opacity: .45;
}

.product-price ins {
    color: #ff3d00;
    font-weight: 400;
    text-decoration: none !important;
}


/* =========================================================
   6. ETIQUETAS (descuento, agotado, nuevo, sale)
========================================================= */

.rvx-labels {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

.rvx-labels__top {
    position: absolute;
    top: 12px;
    left: 12px;
}

.rvx-labels__bottom {
    position: absolute;
    bottom: 12px;
    left: 12px;
}

.rvx-label {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 4px;
    font-family: 'Varela Round', sans-serif;
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: .02em;
    white-space: nowrap;
}

/* Descuento: pegado al borde izquierdo, bajado del borde superior
   (escritorio y móvil comparten el mismo valor) */
.rvx-labels__top:has(.rvx-label--discount) {
    top: 14px;
    left: 0;
}

.rvx-labels .rvx-label--discount {
    padding: 7px 14px 7px 12px;
    background: #FF595E;
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 1;
    border: none;
    border-radius: 0 6px 6px 0;
}

.rvx-label--soldout {
    background: #EEF0F7;
    border: 1px solid #C9CDE0;
    color: #5A6178;
}

.rvx-label--new,
.rvx-label--sale {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 4px 8px;
}

.rvx-label--new {
    background: #111;
    color: #fff;
}

.rvx-label--sale {
    background: #fff;
    color: #000;
    border: 1px solid #000;
}


/* =========================================================
   7. BOTONES ANTIGUOS (ocultos)
   Ya no se usa "Comprar"; se agrega desde el quick add.
========================================================= */

.product-actions,
.archive-add-to-cart,
.archive-add-variable,
.custom-product-card .spinner {
    display: none !important;
}


/* =========================================================
   8. VARIACIONES (tallas)
   Fuera de escritorio con hover están ocultas: las tallas se
   eligen en el modal. En escritorio se muestran en el panel
   de la sección 12.
========================================================= */

.archive-variation-buttons {
    display: none !important;
}

.variation-option {
    min-width: 30px !important;
    margin: 0 !important;
    padding: 5px 8px !important;
    border: 1px solid #ddd !important;
    border-radius: 50px !important;
    background: #fff !important;
    color: #333 !important;
    font-size: 11px !important;
    line-height: 1;
    text-align: center !important;
    cursor: pointer !important;
    transition:
        background .2s ease,
        color .2s ease,
        border-color .2s ease;
    box-shadow: none !important;
    white-space: nowrap !important;
}

.variation-option:hover {
    border-color: #111 !important;
}

.variation-option.active {
    background: #111 !important;
    border-color: #111 !important;
    color: #fff !important;
}


/* =========================================================
   9. QUICK ADD — botón "+"
   Clases prefijadas "qkadd-" para no chocar con otros CSS
   del sitio (Elementor, popups, plugins).
========================================================= */

.quick-add-btn {
    appearance: none !important;
    -webkit-appearance: none !important;
    position: absolute !important;
    top: auto !important;
    left: auto !important;
    bottom: 10px !important;
    right: 10px !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: #fff !important;
    background-image: none !important;
    border: 1px solid #ddd !important;
    outline: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #111 !important;
    z-index: 25 !important;
    box-sizing: border-box !important;
    line-height: 0 !important;
    font-size: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-decoration: none !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
    transition:
        transform .15s ease,
        background .15s ease,
        color .15s ease,
        opacity .2s ease;
}

.quick-add-btn svg {
    width: 15px !important;
    height: 15px !important;
    min-width: 15px !important;
    min-height: 15px !important;
    flex-shrink: 0 !important;
    display: block !important;
}

.quick-add-btn:active {
    transform: scale(.9);
}

.quick-add-btn.qkadd-done {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
}


/* =========================================================
   10. QUICK ADD — modal de tallas (bottom sheet, móvil/tablet)
========================================================= */

.qkadd-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, .45) !important;
    z-index: 999998 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

.qkadd-modal-overlay.qkadd-visible {
    opacity: 1;
    pointer-events: auto;
}

.qkadd-modal {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    background: #fff !important;
    border-radius: 16px 16px 0 0 !important;
    z-index: 999999 !important;
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.32, .72, 0, 1);
    max-height: 90vh;
    overflow-y: auto;
    padding: 18px 18px 26px !important;
    margin: 0 !important;
    font-family: 'Varela Round', sans-serif;
    box-sizing: border-box;
}

.qkadd-modal.qkadd-visible {
    transform: translateY(0);
}

.qkadd-modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 4px;
}

.qkadd-modal-header h3 {
    margin: 0;
    width: 100%;
    font-family: 'Varela Round', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #222;
    text-align: center;
}

.qkadd-modal-sub {
    font-size: 11.5px;
    color: #888;
    margin: 0 0 14px;
}

.qkadd-modal-close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: #f3f3f3;
    color: #888;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.qkadd-options-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.qkadd-option-row {
    min-width: 44px;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 9px 14px !important;
    border: 0 solid #ddd !important;
    border-radius: 50px !important;
    background: #fff !important;
    color: #333 !important;
    font-family: 'Varela Round', sans-serif;
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.qkadd-option-row:hover {
    border-color: #111 !important;
}

.qkadd-option-row.qkadd-active {
    background: #111 !important;
    border-color: #111 !important;
    color: #fff !important;
}


/* =========================================================
   11. QUICK ADD — toast "Item agregado al carrito"
========================================================= */

.qkadd-toast {
    position: fixed !important;
    left: 16px !important;
    right: auto !important;
    bottom: 16px !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: calc(100% - 32px);
    margin: 0 !important;
    padding: 13px 16px !important;
    border: none !important;
    border-radius: 8px !important;
    background: #111 !important;
    color: #fff !important;
    display: flex !important;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    font-family: 'Varela Round', sans-serif;
    font-size: 12.5px;
    white-space: nowrap;
    transform: translateY(140%);
    opacity: 0;
    transition: all .35s cubic-bezier(.32, .72, 0, 1);
    z-index: 999997 !important;
    box-sizing: border-box;
}

.qkadd-toast.qkadd-visible {
    transform: translateY(0);
    opacity: 1;
}

.qkadd-toast span {
    color: #fff !important;
    font-size: 12.5px !important;
}

.qkadd-toast-close {
    width: auto !important;
    height: auto !important;
    margin: 0 0 0 10px !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    color: #fff !important;
    font-size: 16px;
    cursor: pointer;
    opacity: .7;
}


/* =========================================================
   12. ESCRITORIO CON HOVER: panel de tallas dentro de la tarjeta
   Sube desde abajo; el título y las tallas entran escalonados.
========================================================= */

@keyframes rvxSizeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (min-width: 1025px) and (hover: hover) {

    /* Panel (cerrado) */
    .custom-product-card .archive-variation-buttons {
        display: flex !important;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        padding: 16px 12px 18px;
        margin: 0;
        gap: 8px;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        box-sizing: border-box;
        z-index: 30;
        background: rgba(255, 255, 255, .78);   /* velo blanco, sin blur */

        transform: translateY(100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition:
            transform .38s cubic-bezier(.32, .72, 0, 1),
            opacity .25s ease,
            visibility 0s linear .38s;
    }

    /* Panel (abierto) */
    .custom-product-card.qkadd-inline-open .archive-variation-buttons {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    /* Título del panel: entra un poco después */
    .custom-product-card .archive-variation-buttons::before {
        content: 'Selecciona tu talla';
        flex: 0 0 100%;
        margin-bottom: 6px;
        text-align: center;
        font-family: 'Varela Round', sans-serif;
        font-size: 13px;
        color: #222;
        opacity: 0;
        transform: translateY(8px);
        transition: opacity .25s ease, transform .3s cubic-bezier(.32, .72, 0, 1);
    }

    .custom-product-card.qkadd-inline-open .archive-variation-buttons::before {
        opacity: 1;
        transform: translateY(0);
        transition-delay: .08s;
    }

    /* Tallas dentro del panel */
    .custom-product-card .archive-variation-buttons .variation-option {
        min-width: 46px !important;
        padding: 7px 14px !important;
        border: 1px solid transparent !important;
        background: #fff !important;
        font-family: 'Varela Round', sans-serif;
        font-size: 13px !important;
        color: #222 !important;
    }

    .custom-product-card .archive-variation-buttons .variation-option:hover {
        border-color: #111 !important;
    }

    .custom-product-card .archive-variation-buttons .variation-option.active {
        background: #111 !important;
        color: #fff !important;
    }

    /* Tallas: entran una por una al abrir */
    .custom-product-card.qkadd-inline-open .archive-variation-buttons .variation-option {
        animation: rvxSizeIn .32s cubic-bezier(.22, .61, .36, 1) backwards;
    }
    .custom-product-card.qkadd-inline-open .variation-option:nth-child(1)    { animation-delay: .10s; }
    .custom-product-card.qkadd-inline-open .variation-option:nth-child(2)    { animation-delay: .14s; }
    .custom-product-card.qkadd-inline-open .variation-option:nth-child(3)    { animation-delay: .18s; }
    .custom-product-card.qkadd-inline-open .variation-option:nth-child(4)    { animation-delay: .22s; }
    .custom-product-card.qkadd-inline-open .variation-option:nth-child(5)    { animation-delay: .26s; }
    .custom-product-card.qkadd-inline-open .variation-option:nth-child(n+6)  { animation-delay: .30s; }

    /* Mientras el panel está abierto: se oculta el "+" y la etiqueta inferior */
    .custom-product-card.qkadd-inline-open .quick-add-btn {
        opacity: 0;
        transform: scale(.8);
        pointer-events: none;
    }

    .custom-product-card.qkadd-inline-open .rvx-labels__bottom {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .custom-product-card .archive-variation-buttons,
    .custom-product-card .archive-variation-buttons::before {
        transition: none !important;
    }
    .custom-product-card.qkadd-inline-open .archive-variation-buttons .variation-option {
        animation: none !important;
    }
}


/* =========================================================
   13. SKELETON (mismas medidas que la grilla real)
========================================================= */

.rvx-ptabs-skeleton {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--rvx-gap-x);
    row-gap: var(--rvx-gap-y);
    padding: 0 var(--rvx-grid-pad);
}

.rvx-ptabs-skeleton-item {
    aspect-ratio: 2 / 3;
}


/* =========================================================
   14. BREAKPOINTS (un solo bloque por tamaño)
========================================================= */

/* ---------- ESCRITORIO (≥ 1025px) ---------- */
@media (min-width: 1025px) {

    .custom-product-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        column-gap: var(--rvx-gap-x);
        row-gap: var(--rvx-gap-y);
        justify-content: center;
    }

    .rvx-ptabs-skeleton {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* Product tabs: centrar cuando hay menos productos que columnas
       (4 columnas, 3 gaps) */
    .rvx-ptabs .custom-product-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .rvx-ptabs .custom-product-grid .custom-product-card {
        flex: 0 0 calc((100% - 3 * var(--rvx-gap-x)) / 4);
        width: calc((100% - 3 * var(--rvx-gap-x)) / 4);
        max-width: calc((100% - 3 * var(--rvx-gap-x)) / 4);
    }
}


/* ---------- TABLET (769px – 1024px) ---------- */
@media (min-width: 769px) and (max-width: 1024px) {

    .custom-product-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: var(--rvx-gap-x);
        row-gap: var(--rvx-gap-y);
        padding: 0 var(--rvx-grid-pad);
    }

    .rvx-ptabs-skeleton {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Product tabs: centrar (3 columnas, 2 gaps) */
    .rvx-ptabs .custom-product-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .rvx-ptabs .custom-product-grid .custom-product-card {
        flex: 0 0 calc((100% - 2 * var(--rvx-gap-x)) / 3);
        width: calc((100% - 2 * var(--rvx-gap-x)) / 3);
        max-width: calc((100% - 2 * var(--rvx-gap-x)) / 3);
    }
}


/* ---------- MÓVIL (≤ 768px) ---------- */
@media (max-width: 768px) {

    /* Tienda: grilla de 2 columnas */
    .custom-product-grid:not(.is-carousel) {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: var(--rvx-gap-x);
        row-gap: var(--rvx-gap-y);
        padding: 0 var(--rvx-grid-pad);
    }

    /* Carrusel (solo con carousel="yes") */
    .custom-product-grid.is-carousel {
        display: flex;
        gap: 16px;
        overflow-x: auto;
        padding: 0 16px 24px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .custom-product-grid.is-carousel .custom-product-card {
        flex: 0 0 82%;
        width: 82%;
        max-width: 320px;
        height: auto;
        scroll-snap-align: start;
    }

    /* Solo 1 producto en el carrusel */
    .custom-product-grid.is-carousel:has(.custom-product-card:only-child) {
        justify-content: center;
        overflow-x: hidden;
    }

    .custom-product-grid.is-carousel:has(.custom-product-card:only-child) .custom-product-card {
        width: calc(100% - 34px);
        max-width: calc(100% - 34px);
        margin: 0 auto;
    }

    /* Skeleton en modo carrusel */
    .rvx-ptabs-skeleton.is-carousel {
        display: flex;
        gap: 16px;
        overflow: hidden;
        padding: 0 16px 24px;
    }

    .rvx-ptabs-skeleton.is-carousel .rvx-ptabs-skeleton-item {
        flex: 0 0 82%;
        width: 82%;
        max-width: 320px;
    }

    /* Tarjeta */
    .custom-product-card .product-image {
        border-radius: 6px;
    }

    .product-info {
        padding-top: 7px;
    }

    .product-category {
        font-size: 10px;
        letter-spacing: .07em;
        margin-bottom: 2px;
    }

    .product-title {
        font-size: 12px;
        margin-bottom: 3px;
    }

    /* Etiquetas */
    .rvx-labels__top {
        top: 10px;
        left: 10px;
    }

    .rvx-labels__bottom {
        bottom: 10px;
        left: 10px;
    }

    .rvx-label {
        font-size: 11px;
        padding: 3px 8px;
    }

    .rvx-labels .rvx-label--discount {
        padding: 6px 12px 6px 10px;
        font-size: 12px;
    }

    /* Botón "+" más pequeño */
    .quick-add-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        bottom: 8px !important;
        right: 8px !important;
    }

    .quick-add-btn svg {
        width: 13px !important;
        height: 13px !important;
    }
}