/* ===============================================================
   K360 Wootools gallery — clases k360-wtg (no compartir con otros maquetadores)
   =============================================================== */

/* ── Wrapper general ─────────────────────────────────────────── */
/* Oxygen deja el shortcode como ítem flex (align-items: flex-start).
   La foto va en absolute, así que el shortcode medía 0 y la galería no se veía. */
.ct-shortcode:has(.k360-wtg) {
    align-self: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
}
.k360-wtg {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100%;
    font-family: inherit;
    box-sizing: border-box;
}
.k360-wtg-slot {
    display: block;
    width: 100%;
    container-type: inline-size;
}
.k360-wtg *,
.k360-wtg *::before,
.k360-wtg *::after {
    box-sizing: border-box;
}

/* Cuando el tema envuelve nuestra galería en .woocommerce-product-gallery
   para el layout de 2 columnas, solo prevenimos que WC la oculte
   (WC JS setea opacity:0 hasta inicializar; nosotros no usamos su JS) */
.woocommerce-product-gallery.kps-gallery-override {
    opacity: 1 !important;
    transition: none !important;
}

/* ── Layouts por posición de galería ─────────────────────────── */
/* Abajo (default): columna, imagen arriba, galería abajo */
.k360-wtg[data-position="bottom"] {
    flex-direction: column;
}
/* Arriba: columna inversa, galería arriba, imagen abajo */
.k360-wtg[data-position="top"] {
    flex-direction: column-reverse;
}
/* Derecha: fila, imagen a la izquierda, galería a la derecha */
.k360-wtg[data-position="right"] {
    flex-direction: row !important;
    align-items: flex-start;
}
/* Izquierda: fila inversa, galería a la izquierda, imagen a la derecha */
.k360-wtg[data-position="left"] {
    flex-direction: row-reverse !important;
    align-items: flex-start;
}

/* ── Imagen principal ────────────────────────────────────────── */
.k360-wtg__main {
    position: relative;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
}
.k360-wtg__frame {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    overflow: hidden !important;
    background: #f4f5f7;
}
/* El alto no depende de la foto (va en absolute). En el celular aspect-ratio
   se perdía y solo quedaban las miniaturas. */
.k360-wtg__frame::before {
    content: "";
    display: block;
    box-sizing: content-box !important;
    width: 100%;
    height: 0;
    padding-top: var(--kps-pad, 100%);
}
.k360-wtg__stage {
    position: absolute !important;
    inset: 0;
    overflow: hidden !important;
    transition: transform .45s ease;
}
.k360-wtg__photo {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block;
    cursor: default;
    background: transparent;
}
.k360-wtg__open {
    position: absolute;
    z-index: 5;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.k360-wtg__open:hover {
    background: #fff;
}
.k360-wtg[data-zoom]:not([data-zoom="100"]) .k360-wtg__frame:hover .k360-wtg__stage {
    transform: scale(var(--kps-zoom, 1));
}
.k360-wtg__flyer {
    position: fixed;
    z-index: 100000;
    object-fit: contain;
    pointer-events: none;
    background: transparent;
    opacity: 0;
}
body.k360-wtg-fly-under .k360-wtg__flyer {
    z-index: 1;
}
body.k360-wtg-fly-under .ct-section,
body.k360-wtg-fly-under .oxy-header,
body.k360-wtg-fly-under header,
body.k360-wtg-fly-under .site-header,
body.k360-wtg-fly-under #content,
body.k360-wtg-fly-under .site-content {
    position: relative;
    z-index: 2;
}

/* Miniaturas sobre la foto, como tarjetas dentro del marco */
.k360-wtg.k360-wtg--over {
    display: block;
}
.k360-wtg.k360-wtg--over .k360-wtg__main {
    width: 100%;
}
.k360-wtg__frame > .k360-wtg__thumbs {
    position: absolute !important;
    z-index: 4;
    width: auto !important;
    max-width: calc(100% - 16px);
    max-height: calc(100% - 16px);
    margin: 0;
    padding: 0;
    background: none !important;
    pointer-events: none;
    align-self: auto;
}
.k360-wtg__frame > .k360-wtg__thumbs .k360-wtg__thumb,
.k360-wtg__frame > .k360-wtg__thumbs .k360-wtg__nav {
    pointer-events: auto;
}
.k360-wtg[data-position="left"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-position="right"] .k360-wtg__frame > .k360-wtg__thumbs {
    flex-direction: column;
}
.k360-wtg[data-position="left"] .k360-wtg__frame > .k360-wtg__thumbs {
    left: 12px;
    right: auto;
}
.k360-wtg[data-position="right"] .k360-wtg__frame > .k360-wtg__thumbs {
    right: 12px;
    left: auto;
}
.k360-wtg[data-position="left"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-position="right"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-align="center"][data-position="left"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-align="center"][data-position="right"] .k360-wtg__frame > .k360-wtg__thumbs {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}
.k360-wtg[data-align="start"][data-position="left"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-align="start"][data-position="right"] .k360-wtg__frame > .k360-wtg__thumbs {
    top: 12px;
    bottom: auto;
    transform: none;
}
.k360-wtg[data-align="end"][data-position="left"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-align="end"][data-position="right"] .k360-wtg__frame > .k360-wtg__thumbs {
    top: auto;
    bottom: 12px;
    transform: none;
}
.k360-wtg[data-position="bottom"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-position="top"] .k360-wtg__frame > .k360-wtg__thumbs {
    flex-direction: row;
}
.k360-wtg[data-position="bottom"] .k360-wtg__frame > .k360-wtg__thumbs {
    bottom: 12px;
    top: auto;
}
.k360-wtg[data-position="top"] .k360-wtg__frame > .k360-wtg__thumbs {
    top: 12px;
    bottom: auto;
}
.k360-wtg[data-position="bottom"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-position="top"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-align="center"][data-position="bottom"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-align="center"][data-position="top"] .k360-wtg__frame > .k360-wtg__thumbs {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}
.k360-wtg[data-align="start"][data-position="bottom"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-align="start"][data-position="top"] .k360-wtg__frame > .k360-wtg__thumbs {
    left: 12px;
    right: auto;
    transform: none;
}
.k360-wtg[data-align="end"][data-position="bottom"] .k360-wtg__frame > .k360-wtg__thumbs,
.k360-wtg[data-align="end"][data-position="top"] .k360-wtg__frame > .k360-wtg__thumbs {
    left: auto;
    right: 12px;
    transform: none;
}
.k360-wtg__frame .k360-wtg__thumb {
    opacity: 1;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 0 2px #fff, 0 6px 16px rgba(15, 23, 42, .22);
}
.k360-wtg__frame .k360-wtg__thumb img {
    border-radius: 6px;
}
.k360-wtg__frame .k360-wtg__thumb.k360-wtg--on {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(15, 23, 42, .35), 0 8px 18px rgba(15, 23, 42, .2);
}

/* ── Área de galería ─────────────────────────────────────────── */
.k360-wtg__thumbs {
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

/* Galería horizontal (top/bottom) */
.k360-wtg[data-position="top"] .k360-wtg__thumbs,
.k360-wtg[data-position="bottom"] .k360-wtg__thumbs {
    flex-direction: row;
    width: 100%;
}
/* Galería vertical (left/right) */
.k360-wtg[data-position="left"] > .k360-wtg__thumbs,
.k360-wtg[data-position="right"] > .k360-wtg__thumbs {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 0 auto !important;
    align-self: center;
    width: calc(var(--kps-thumb, 80px) + 16px) !important;
    max-width: none !important;
}
.k360-wtg[data-align="start"][data-position="left"] > .k360-wtg__thumbs,
.k360-wtg[data-align="start"][data-position="right"] > .k360-wtg__thumbs {
    align-self: flex-start;
}
.k360-wtg[data-align="end"][data-position="left"] > .k360-wtg__thumbs,
.k360-wtg[data-align="end"][data-position="right"] > .k360-wtg__thumbs {
    align-self: flex-end;
}
.k360-wtg[data-position="top"] > .k360-wtg__thumbs,
.k360-wtg[data-position="bottom"] > .k360-wtg__thumbs {
    justify-content: center;
}
.k360-wtg[data-align="start"][data-position="top"] > .k360-wtg__thumbs,
.k360-wtg[data-align="start"][data-position="bottom"] > .k360-wtg__thumbs {
    justify-content: flex-start;
}
.k360-wtg[data-align="end"][data-position="top"] > .k360-wtg__thumbs,
.k360-wtg[data-align="end"][data-position="bottom"] > .k360-wtg__thumbs {
    justify-content: flex-end;
}
.k360-wtg[data-position="left"] > .k360-wtg__thumbs .k360-wtg__track,
.k360-wtg[data-position="right"] > .k360-wtg__thumbs .k360-wtg__track {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}
.k360-wtg[data-position="left"] > .k360-wtg__thumbs .k360-wtg__thumb,
.k360-wtg[data-position="right"] > .k360-wtg__thumbs .k360-wtg__thumb {
    flex: 0 0 var(--kps-thumb, 80px) !important;
    width: var(--kps-thumb, 80px) !important;
    height: var(--kps-thumb, 80px) !important;
    max-width: none !important;
}

/* ── Track de miniaturas ─────────────────────────────────────── */
.k360-wtg__track {
    overflow: hidden;
    display: flex;
    flex: 1;
    /* Ocultar scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.k360-wtg__track::-webkit-scrollbar {
    display: none;
}
/* Horizontal */
.k360-wtg[data-position="top"] .k360-wtg__track,
.k360-wtg[data-position="bottom"] .k360-wtg__track {
    flex-direction: row;
}
/* Vertical */
.k360-wtg[data-position="left"] .k360-wtg__track,
.k360-wtg[data-position="right"] .k360-wtg__track {
    flex-direction: column;
    align-items: stretch;
}

/* ── Miniatura ───────────────────────────────────────────────── */
.k360-wtg__thumb {
    cursor: pointer;
    flex-shrink: 0;
    opacity: .55;
    transition: opacity .2s ease, transform .2s ease;
    overflow: hidden;
    position: relative;
}
.k360-wtg__thumb:hover {
    opacity: .8;
    transform: scale(1.03);
}
.k360-wtg__thumb.k360-wtg--on {
    opacity: 1;
}
.k360-wtg__thumb.k360-wtg--on::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid currentColor;
    pointer-events: none;
}
.k360-wtg__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Flechas de navegación en galería ───────────────────────── */
.k360-wtg__nav {
    background: rgba(255, 255, 255, .92);
    border: 1px solid #dde1e7;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #333;
    flex-shrink: 0;
    z-index: 2;
    transition: background .2s, box-shadow .2s;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.k360-wtg__nav:hover {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
}

/* ── Lightbox ────────────────────────────────────────────────── */
.k360-wtg__lightbox {
    position: fixed !important;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}
.k360-wtg__lightbox.k360-wtg--open {
    display: flex !important;
}
.k360-wtg__shade {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .88);
    cursor: pointer;
}
.k360-wtg__lb {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 92vw;
    max-height: 92vh;
}
.k360-wtg__full {
    max-width: 80vw;
    max-height: 86vh;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
    user-select: none;
}
/* Close button */
.k360-wtg__close {
    position: absolute;
    top: -44px;
    right: -6px;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: 22px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    padding: 0;
    line-height: 1;
}
.k360-wtg__close:hover {
    background: rgba(255, 255, 255, .3);
}
/* Prev / Next */
.k360-wtg__lbprev,
.k360-wtg__lbnext {
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.k360-wtg__lbprev:hover,
.k360-wtg__lbnext:hover {
    background: rgba(255, 255, 255, .3);
}
/* Counter */
.k360-wtg__count {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .75);
    font-size: 13px;
    white-space: nowrap;
    letter-spacing: .3px;
    pointer-events: none;
}

/* ── Prevenir scroll del body con lightbox abierto ───────────── */
body.k360-wtg-lock {
    overflow: hidden;
}

/* ── Responsive ──────────────────────────────────────────────── */
@container (max-width: 460px) {
    .k360-wtg[data-position="left"]:not(.k360-wtg--over),
    .k360-wtg[data-position="right"]:not(.k360-wtg--over) {
        flex-direction: column !important;
    }
    .k360-wtg[data-position="left"]:not(.k360-wtg--over) > .k360-wtg__main,
    .k360-wtg[data-position="right"]:not(.k360-wtg--over) > .k360-wtg__main {
        width: 100% !important;
        flex: 1 1 auto !important;
    }
    .k360-wtg[data-position="left"]:not(.k360-wtg--over) > .k360-wtg__thumbs,
    .k360-wtg[data-position="right"]:not(.k360-wtg--over) > .k360-wtg__thumbs {
        width: 100% !important;
        flex-direction: row !important;
        align-self: stretch !important;
    }
    .k360-wtg[data-position="left"]:not(.k360-wtg--over) > .k360-wtg__thumbs .k360-wtg__track,
    .k360-wtg[data-position="right"]:not(.k360-wtg--over) > .k360-wtg__thumbs .k360-wtg__track {
        flex-direction: row !important;
    }
    .k360-wtg[data-position="left"]:not(.k360-wtg--over) > .k360-wtg__thumbs .k360-wtg__thumb,
    .k360-wtg[data-position="right"]:not(.k360-wtg--over) > .k360-wtg__thumbs .k360-wtg__thumb {
        flex: 0 0 72px !important;
        width: 72px !important;
        height: 72px !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   KPS PRODUCT SUMMARY — [kps_product_summary]
   ═══════════════════════════════════════════════════════════ */

/* Wrapper general */
.kps-sum-wrapper {
    font-family: inherit;
    color: inherit;
}

/* Separadores entre secciones */
.kps-sum-section {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.kps-sum-section:first-child { padding-top: 0; }
.kps-sum-section:last-child  { border-bottom: none; }

/* Título */
.kps-sum-titulo .kps-sum-title {
    margin: 0;
    line-height: 1.3;
}

/* Zona de acción — producto de pago */
.kps-sum-action-flex {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Stack layout — cada elemento en su propia fila */
.kps-sum-action-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.kps-sum-action-stack .kps-sum-price-col,
.kps-sum-action-stack .kps-sum-cart-col { width: 100%; }
.kps-sum-price-col .price {
    font-weight: 700;
    line-height: 1;
}
.kps-sum-cart-col { flex: 1 1 auto; }

/* Overrides WooCommerce dentro del wrapper */
.kps-sum-wrapper .cart {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
}
.kps-sum-wrapper .qty {
    width: 64px !important;
    padding: 6px 8px !important;
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    font-size: var(--kps-qty-size, 15px) !important;
}
.kps-sum-wrapper .single_add_to_cart_button {
    margin: 0 !important;
    line-height: 1.5 !important;
    padding: 10px 20px !important;
    font-size: var(--kps-btn-size, 15px) !important;
    transition: opacity .2s, background-color .2s !important;
}
.kps-sum-wrapper .single_add_to_cart_button:hover {
    opacity: .85 !important;
}

/* Botón descarga directa (logueado + producto gratis) */
.kps-sum-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity .2s;
    line-height: 1.5;
}
.kps-sum-dl-btn:hover { opacity: .85; text-decoration: none; }

/* Botón abrir modal (no logueado + producto gratis) */
.kps-sum-free-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: opacity .2s;
    line-height: 1.5;
}
.kps-sum-free-trigger:hover { opacity: .85; }

/* ─── Modal ─── */
.kps-sum-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.kps-sum-modal.is-open {
    display: flex;
}
.kps-sum-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    cursor: pointer;
}
.kps-sum-modal-box {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 36px 32px 28px;
    max-width: 440px;
    width: calc(100% - 32px);
    box-shadow: 0 8px 40px rgba(0,0,0,.22);
    z-index: 1;
}
.kps-sum-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    color: #888;
    padding: 4px;
}
.kps-sum-modal-close:hover { color: #333; }
.kps-sum-modal-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}
.kps-sum-modal-desc {
    margin: 0 0 20px;
    color: #555;
    font-size: 14px;
    line-height: 1.55;
}
.kps-sum-field {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color .2s;
}
.kps-sum-field:focus {
    outline: none;
    border-color: #0f7c4c;
}
.kps-sum-submit-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #0f7c4c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    margin-top: 4px;
}
.kps-sum-submit-btn:hover { background: #0a5c38; }
.kps-sum-submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.kps-sum-error-msg {
    color: #c00;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

/* Estado éxito */
.kps-sum-lead-form { display: block; }
.kps-sum-success   { display: none; text-align: center; padding: 10px 0; }
.kps-sum-success-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 8px;
}
.kps-sum-success-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px;
}
.kps-sum-success-text {
    color: #555;
    font-size: 14px;
    margin: 0;
}

/* No scroll cuando modal está abierto */
body.k360-wtg-lock { overflow: hidden; }
    .k360-wtg__full {
        max-width: 90vw;
        max-height: 70vh;
    }
    .k360-wtg__lbprev,
    .k360-wtg__lbnext {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }
}

/* ── Contención Oxygen / builders (evita escape del marco) ── */
.k360-wtg {
    max-width: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}
.ct-shortcode .k360-wtg,
.oxy-inner-content .k360-wtg,
.elementor-widget-shortcode .k360-wtg {
    max-width: 100%;
}
.k360-wtg__main,
.k360-wtg__thumbs {
    max-width: 100%;
}
.k360-wtg__lightbox[style*="display: none"],
.k360-wtg__lightbox[hidden] {
    pointer-events: none !important;
}
/* Alias futuro */
.k360-wootools-gallery {
    max-width: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}
