/**
 * Easy Product Videos - Burbuja de vídeo flotante configurable
 * Posición horizontal: izquierda / centrada / derecha
 * Posición vertical:   inferior / centrada
 * Separaciones y tamaño se inyectan como variables CSS desde el back office.
 */

.epv-bubble {
    --epv-bubble-size: 120px;
    --epv-bubble-x: 25px;
    --epv-bubble-y: 25px;
    --epv-bubble-lift: 0px;
    --epv-bubble-z: 999;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

/* ---------- Acoplada junto al título del producto ---------- */

/*
 * El hueco va en linea con el titulo (el JS pone el h1 en display:inline) y
 * reserva siempre el tamano del circulo, de modo que al anclarse la burbuja
 * no se recoloca nada de la ficha.
 */
.epv-bubble-slot {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 15px;
    width: var(--epv-bubble-size, 120px);
    height: var(--epv-bubble-size, 120px);
    flex-shrink: 0;
}

.epv-bubble--docked {
    position: relative;
    width: 100%;
    height: 100%;
    gap: 0;
}

/* Acoplada se muestra solo el circulo, como el resto de la ficha */
.epv-bubble--docked .epv-bubble__label {
    display: none;
}

/* ---------- Anclada sobre la página ---------- */

.epv-bubble--pinned {
    position: fixed;
    z-index: var(--epv-bubble-z);
}

.epv-bubble--pinned .epv-bubble__label {
    animation: epv-bubble-label-in .35s ease both;
    animation-delay: .28s;
}

@keyframes epv-bubble-label-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* Durante el vuelo el círculo va por encima de todo y sin efectos de hover */
.epv-bubble--flying {
    z-index: 100001;
}

.epv-bubble--flying .epv-bubble__circle {
    pointer-events: none;
}

.epv-bubble--flying .epv-bubble__circle:hover {
    transform: none;
}

.epv-bubble > * {
    pointer-events: auto;
}

/* ---------- Eje horizontal ---------- */

.epv-bubble--pinned.epv-bubble--right {
    right: var(--epv-bubble-x);
}

.epv-bubble--pinned.epv-bubble--left {
    left: var(--epv-bubble-x);
}

.epv-bubble--pinned.epv-bubble--hcenter {
    left: 50%;
    margin-left: calc(var(--epv-bubble-size) / -2);
}

/* ---------- Eje vertical ---------- */

.epv-bubble--pinned.epv-bubble--bottom {
    bottom: calc(var(--epv-bubble-y) + var(--epv-bubble-lift));
}

.epv-bubble--pinned.epv-bubble--middle {
    top: 50%;
    margin-top: calc(var(--epv-bubble-size) / -2);
}

/* ---------- Círculo ---------- */

.epv-bubble__circle {
    position: relative;
    width: var(--epv-bubble-size);
    height: var(--epv-bubble-size);
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid #fff;
    background: #000;
    box-shadow: 0 6px 30px rgba(0, 0, 0, .35);
    transition: transform .25s ease, box-shadow .25s ease;
    padding: 0;
    display: block;
}

.epv-bubble__circle:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 35px rgba(0, 0, 0, .45);
}

.epv-bubble__circle:active {
    transform: scale(.96);
}

.epv-bubble__circle:focus-visible {
    outline: 3px solid #2fb5d2;
    outline-offset: 3px;
}

.epv-bubble__player,
.epv-bubble__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 0;
    pointer-events: none;
}

/* El iframe de YouTube/Vimeo se amplía para tapar los bordes negros del 16:9 */
.epv-bubble__player--iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 178%;
    height: 178%;
    transform: translate(-50%, -50%);
}

.epv-bubble__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background .25s ease;
}

.epv-bubble__circle:hover .epv-bubble__play {
    background: rgba(0, 0, 0, .72);
}

.epv-bubble__play svg {
    width: 16px;
    height: 16px;
    fill: #fff;
    margin-left: 2px;
}

/* ---------- Etiqueta ---------- */

.epv-bubble__label {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    text-align: center;
    background: rgba(255, 255, 255, .92);
    padding: 5px 14px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    letter-spacing: .5px;
    text-transform: uppercase;
    max-width: calc(var(--epv-bubble-size) + 40px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Botón de cierre ---------- */

.epv-bubble__dismiss {
    position: absolute;
    top: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #333;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

.epv-bubble--right .epv-bubble__dismiss,
.epv-bubble--hcenter .epv-bubble__dismiss,
.epv-bubble--docked .epv-bubble__dismiss {
    right: -6px;
}

.epv-bubble--left .epv-bubble__dismiss {
    left: -6px;
}

.epv-bubble__dismiss:focus-visible {
    outline: 2px solid #2fb5d2;
    outline-offset: 2px;
}

/* ---------- Modal ---------- */

.epv-bubble-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, .9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.epv-bubble-modal__box {
    position: relative;
    width: 100%;
    max-width: 900px;
}

.epv-bubble-modal__ratio {
    position: relative;
    padding-top: 56.25%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.epv-bubble-modal--vertical .epv-bubble-modal__box {
    max-width: 420px;
}

.epv-bubble-modal--vertical .epv-bubble-modal__ratio {
    padding-top: 177.78%;
}

.epv-bubble-modal__ratio > iframe,
.epv-bubble-modal__ratio > video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.epv-bubble-modal__close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.epv-bubble-modal__close:hover {
    background: rgba(255, 255, 255, .3);
}

/* ---------- Responsive ---------- */

@media (max-width: 767px) {
    .epv-bubble {
        --epv-bubble-size: var(--epv-bubble-size-mobile, 80px);
        --epv-bubble-x: var(--epv-bubble-x-mobile, 15px);
        --epv-bubble-y: var(--epv-bubble-y-mobile, 20px);
    }

    .epv-bubble__label {
        font-size: 11px;
        padding: 4px 10px;
    }

    .epv-bubble__play {
        width: 30px;
        height: 30px;
    }

    .epv-bubble__play svg {
        width: 13px;
        height: 13px;
    }

    .epv-bubble-modal__close {
        top: 0;
        right: 0;
        transform: translate(8px, -44px);
    }
}

.epv-bubble--hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .epv-bubble--hide-mobile {
        display: flex;
    }
}

@media (prefers-reduced-motion: reduce) {
    .epv-bubble__circle,
    .epv-bubble__play {
        transition: none;
    }

    .epv-bubble__circle:hover {
        transform: none;
    }
}


@media (max-width: 767px) {
    .epv-bubble-slot {
        margin-left: 10px;
        width: var(--epv-bubble-size-mobile, 80px);
        height: var(--epv-bubble-size-mobile, 80px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .epv-bubble--pinned .epv-bubble__label {
        animation: none;
    }
}
