/**
 * RkAiMagicCatalogSuite - Frontoffice Video & Gallery Styles
 */

/* ============================================================
   1. GALERÍA PREMIUM (ficha de producto - Swiper + Fancybox)
   ============================================================ */

.easyseo-pro-gallery {
    width: 100%;
    margin-bottom: 30px;
    animation: esms-fadeIn 0.5s ease-out;
}

/* Swiper principal */
.easyseo-main-swiper {
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #f0f0f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.easyseo-main-swiper .swiper-button-next,
.easyseo-main-swiper .swiper-button-prev {
    color: #2c3e50;
    background: rgba(255, 255, 255, 0.8);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.easyseo-main-swiper .swiper-button-next::after,
.easyseo-main-swiper .swiper-button-prev::after {
    font-size: 16px;
    font-weight: bold;
}

/* Zoom link sobre imagen */
.easyseo-zoom-link {
    display: block;
    position: relative;
    cursor: zoom-in;
    width: 100%;
    height: 100%;
}

.easyseo-zoom-icon {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    color: #2c3e50;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.easyseo-zoom-link:hover .easyseo-zoom-icon {
    opacity: 1;
    transform: scale(1);
}

/* Swiper miniaturas */
.easyseo-thumbs-swiper .swiper-slide {
    opacity: 0.5;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    transition: opacity 0.3s ease, border-color 0.3s ease;
}

.easyseo-thumbs-swiper .swiper-slide-thumb-active {
    opacity: 1;
    border-color: #e74c3c;
}

/* Icono de play en miniatura de vídeo */
.easyseo-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.easyseo-video-play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 10px solid #fff;
    margin-left: 3px;
}

/* Galería legacy */
.easyseo-video-thumb-container {
    position: relative;
    cursor: pointer;
    display: inline-block;
}

.easyseo-video-thumb-container:hover .easyseo-video-play-icon {
    background: #e74c3c;
    transform: translate(-50%, -50%) scale(1.15);
}

.easyseo-video-thumb-container.selected .thumb {
    border: 2px solid #e74c3c;
}

.easyseo-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: #000;
}


/* ============================================================
   2. MODO DIRECTO (vídeo siempre visible en listados)
   ============================================================ */

.easyseo-direct-video-wrapper {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    min-height: 150px;
    transition: all 0.3s ease;
    pointer-events: none; /* El ratón traspasa el vídeo → el quick-view siempre es accesible */
}

.easyseo-direct-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    transition: transform 0.3s ease;
}

.easyseo-direct-video-wrapper:hover .easyseo-direct-video {
    transform: scale(1.05);
}


/* ============================================================
   3. STICKER "PLAY" en listados
   ============================================================ */

.easyseo-listing-sticker {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3);
    backdrop-filter: blur(4px);
    animation: esms-pulse 2s infinite;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.easyseo-listing-sticker:hover {
    transform: scale(1.1);
    background: #c0392b;
    box-shadow: 0 6px 15px rgba(192, 57, 43, 0.4);
    animation: none;
}

.easyseo-listing-sticker i {
    font-size: 20px;
    color: #fff;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.easyseo-listing-sticker .badge {
    background: #fff;
    color: #e74c3c;
    border-radius: 30px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease, color 0.3s ease;
}

.easyseo-listing-sticker:hover .badge {
    background: #e74c3c;
    color: #fff;
}

/* ============================================================
   4. POPOVER de vídeos en listados
   ============================================================ */

.easyseo-listing-popover {
    display: none;
    opacity: 0;
    visibility: hidden;
    flex-direction: column;
    position: absolute;
    top: 50px;
    right: 10px;
    z-index: 999999 !important; /* Z-index muy alto para estar por encima de todo */
    width: 280px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transform-origin: top right;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Cuando está visible */
.easyseo-listing-popover[style*="display: flex"] {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.easyseo-listing-popover .popover-header {
    padding: 12px 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    font-size: 13px;
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: 0.3px;
}

.easyseo-listing-popover .popover-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 15px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
}

.easyseo-listing-popover .popover-grid::-webkit-scrollbar { width: 6px; }
.easyseo-listing-popover .popover-grid::-webkit-scrollbar-track { background: #f1f1f1; }
.easyseo-listing-popover .popover-grid::-webkit-scrollbar-thumb { background: #e74c3c; border-radius: 3px; }

/* Items del popover */
.easyseo-list-popover-item {
    position: relative;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    border: 2px solid transparent;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.easyseo-list-popover-item:hover {
    border-color: #e74c3c;
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(231, 76, 60, 0.3);
}

.easyseo-list-popover-item img,
.easyseo-list-popover-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.easyseo-list-popover-item:hover img,
.easyseo-list-popover-item:hover video {
    transform: scale(1.1);
}

.easyseo-list-popover-item .overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 10;
    transition: background 0.3s ease;
}

.easyseo-list-popover-item:hover .overlay {
    background: rgba(231, 76, 60, 0.8);
}

.easyseo-list-popover-item i {
    color: #fff;
    font-size: 32px;
    opacity: 0.9;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.easyseo-list-popover-item:hover i {
    transform: scale(1.2);
    opacity: 1;
}

/* Posicionamiento relativo SOLO en productos con vídeo asignado */
.thumbnail-container:has(.easyseo-listing-sticker),
.product-miniature:has(.easyseo-listing-sticker),
.js-product-miniature:has(.easyseo-listing-sticker) {
    position: relative;
    z-index: 1;
}

.easyseo-listing-popover {
    z-index: 999999 !important;
}

.easyseo-listing-sticker {
    z-index: 99999 !important;
}


/* ============================================================
   5. OVERLAY DE HOVER (vídeo preview al pasar el ratón)
   ============================================================ */

.easyseo-hover-modal-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
    animation: esms-fadeIn 0.3s ease-out;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.easyseo-hover-modal-overlay video,
.easyseo-hover-modal-overlay iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}


/* ============================================================
   6. WIDGET FLOTANTE (ficha de producto)
   ============================================================ */

.easyseo-floating-wrapper:hover .easyseo-floating-widget {
    transform: scale(1.05);
}

.easyseo-popover-item:hover > div {
    background: rgba(0, 0, 0, 0.5) !important;
}

.easyseo-popover-item:hover .easyseo-popover-icon {
    transform: scale(1.2);
    color: #e74c3c !important;
}

.easyseo-modal-close:hover {
    color: #e74c3c !important;
}


/* ============================================================
   7. MODAL DE VÍDEO A PANTALLA COMPLETA
   ============================================================ */

.easyseo-video-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
}

.easyseo-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    aspect-ratio: 16 / 9;
}

.easyseo-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.easyseo-modal-close:hover {
    color: #e74c3c;
}

.easyseo-modal-video-container {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.easyseo-modal-video-container iframe,
.easyseo-modal-video-container video {
    width: 100%;
    height: 100%;
    border: none;
}


/* ============================================================
   8. ANIMACIONES
   ============================================================ */

@keyframes esms-fadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes esms-pulse {
    0%,  100% { transform: scale(1); }
    50%        { transform: scale(1.05); }
}


/* ============================================================
   9. RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .easyseo-direct-video-wrapper {
        position: relative;
        height: 200px;
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .easyseo-listing-sticker {
        padding: 4px 10px;
        font-size: 11px;
    }

    .easyseo-listing-sticker i { font-size: 18px; }

    .easyseo-listing-popover {
        width: 240px;
        right: 5px;
    }

    .easyseo-listing-popover .popover-grid {
        gap: 8px;
        padding: 10px;
    }

    .easyseo-list-popover-item i { font-size: 24px; }
}


/* ============================================================
   10. MODO OSCURO
   ============================================================ */

@media (prefers-color-scheme: dark) {
    .easyseo-listing-popover {
        background: #2c3e50;
        border-color: #34495e;
    }

    .easyseo-listing-popover .popover-header {
        background: linear-gradient(135deg, #34495e, #2c3e50);
        color: #ecf0f1;
        border-bottom-color: #7f8c8d;
    }

    .easyseo-listing-popover .popover-grid {
        background: #2c3e50;
    }
}

/* ============================================================
   11. MINIATURAS DEL SWIPER (ficha de producto)
   ============================================================ */

/* Imagen dentro de miniatura — opacidad reducida por defecto para
   indicar que no está activa, se aclara al hacer hover o al activarse */
.easyseo-thumbs-swiper .swiper-slide img,
.easyseo-thumbs-swiper .swiper-slide .easyseo-thumb-img {
    opacity: 0.55;
    transition: opacity 0.25s ease;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.easyseo-thumbs-swiper .swiper-slide:hover img,
.easyseo-thumbs-swiper .swiper-slide:hover .easyseo-thumb-img {
    opacity: 0.85;
}

.easyseo-thumbs-swiper .swiper-slide-thumb-active img,
.easyseo-thumbs-swiper .swiper-slide-thumb-active .easyseo-thumb-img {
    opacity: 1;
}


/* overflow: visible solo en productos con vídeo activo */
.easyseo-list-video-container {
    overflow: visible !important;
}

.thumbnail-container:has(.easyseo-listing-sticker),
.product-miniature:has(.easyseo-listing-sticker),
.js-product-miniature:has(.easyseo-listing-sticker) {
    overflow: visible !important;
}

.thumbnail-top:has(.easyseo-listing-sticker),
.product-thumbnail:has(.easyseo-listing-sticker),
.thumbnail:has(.easyseo-listing-sticker) {
    overflow: visible !important;
}