/**
 * DataFirefly Product Video - Front Styles
 * @author DataFirefly
 */

/* ── Thumbnails Container ── */
.dfpv-thumbnails-container {
    display: contents; /* Integrates into the existing thumbnail flow */
}

/* ── Thumbnail item ── */
.dfpv-thumb-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
    transition: transform 0.2s, box-shadow 0.2s;
    outline: none;
}

.dfpv-thumb-item:hover,
.dfpv-thumb-item:focus-visible {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.dfpv-thumb-item:focus-visible {
    outline: 2px solid #25b9d7;
    outline-offset: 2px;
}

/* Poster */
.dfpv-thumb-poster {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f0f0f0;
}

.dfpv-poster-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dfpv-poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
    color: #999;
}

.dfpv-poster-placeholder svg {
    width: 40%;
    height: 40%;
}

/* Play overlay */
.dfpv-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.dfpv-thumb-item:hover .dfpv-play-overlay {
    opacity: 1;
}

.dfpv-play-icon {
    width: 36px;
    height: 36px;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s;
}

.dfpv-thumb-item:hover .dfpv-play-icon {
    transform: scale(1.1);
}

/* Type badge */
.dfpv-type-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 1;
}

.dfpv-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1;
    color: #fff;
}

.dfpv-badge-youtube {
    background: #ff0000;
}

.dfpv-badge-vimeo {
    background: #1ab7ea;
}

.dfpv-badge-mp4 {
    background: rgba(0, 0, 0, 0.6);
}

/* ── Main gallery video (injected via JS as cover) ── */
.dfpv-main-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #000;
    overflow: hidden;
    border-radius: 4px;
}

.dfpv-main-video-wrapper video,
.dfpv-main-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
}

/* Poster overlay for main */
.dfpv-main-poster-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    z-index: 2;
    transition: opacity 0.3s;
}

.dfpv-main-poster-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.dfpv-main-play-btn {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s;
}

.dfpv-main-poster-overlay:hover .dfpv-main-play-btn {
    transform: scale(1.1);
}

/* ── Lightbox ── */
.dfpv-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dfpv-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    animation: dfpvFadeIn 0.25s ease;
}

.dfpv-lightbox-content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 900px;
    animation: dfpvSlideIn 0.3s ease;
}

.dfpv-lightbox-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.dfpv-lightbox-player video,
.dfpv-lightbox-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.dfpv-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 2;
}

.dfpv-lightbox-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.dfpv-lightbox-title {
    text-align: center;
    color: #fff;
    margin-top: 12px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ── Animations ── */
@keyframes dfpvFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dfpvSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .dfpv-lightbox-content {
        width: 96%;
    }

    .dfpv-lightbox-close {
        top: -36px;
    }

    .dfpv-play-icon {
        width: 28px;
        height: 28px;
    }

    .dfpv-main-play-btn {
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 480px) {
    .dfpv-lightbox-content {
        width: 100%;
        border-radius: 0;
    }

    .dfpv-lightbox-player {
        border-radius: 0;
    }
}

/* ── Accessibility ── */
@media (prefers-reduced-motion: reduce) {
    .dfpv-thumb-item,
    .dfpv-play-icon,
    .dfpv-main-play-btn,
    .dfpv-lightbox-backdrop,
    .dfpv-lightbox-content {
        animation: none;
        transition: none;
    }
}

/* ──────────────────────────────────────────
 * Injected gallery thumbnails (Swiper & UL)
 * ────────────────────────────────────────── */

/* Ensure the thumb-container has a positioning context for our overlay */
.dfpv-gallery-thumb,
.dfpv-gallery-thumb .thumb-container,
.dfpv-gallery-thumb .dfpv-thumb-wrap {
    position: relative;
    cursor: pointer;
    outline: none;
}

.dfpv-gallery-thumb:focus-visible {
    outline: 2px solid #25b9d7;
    outline-offset: 2px;
}

.dfpv-gallery-thumb .dfpv-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hover effect on gallery thumbs */
.dfpv-gallery-thumb:hover .dfpv-play-icon {
    transform: scale(1.1);
}

.dfpv-gallery-thumb .dfpv-play-overlay {
    opacity: 0.9;
}

.dfpv-gallery-thumb:hover .dfpv-play-overlay {
    opacity: 1;
}

/* Close button on cover video overlay */
.dfpv-cover-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.dfpv-cover-close:hover,
.dfpv-cover-close:focus {
    background: rgba(0, 0, 0, 0.85);
    outline: none;
}

/* Make sure the video overlay covers the whole product-cover area */
.dfpv-cover-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    aspect-ratio: auto;
    border-radius: 0;
}

