/**
 * Product Video Gallery — Front CSS
 * Hummingbird (Bootstrap Carousel) + Classic (Swiper) themes.
 *
 * @author    Woohoo.pl
 * @copyright 2025 Woohoo.pl
 * @license   AFL-3.0
 */

/* ======================================================
   TOKENY MODULU
   ------------------------------------------------------
   Kazdy fallback = DOTYCHCZASOWA wartosc, wiec migracja niczego nie zmienia
   wizualnie, dopoki branza nie nadpisze tokenu. Standard: CLAUDE.md 5a.

   ⚠️ Czesc tokenow CELOWO nie bierze z globalnych — powody przy kazdym.
   ====================================================== */

:root {
    /* Tlo playera i iframe'a. NIE podpinamy pod --wh-color-bg-inverse (#1a1a1a),
       bo to celowa prawie-czern pod materialem wideo: jasniejsze tlo daje widoczna
       ramke wokol filmu w formacie innym niz kontener. Branza moze nadpisac. */
    --wh-pv-player-bg: var(--wh-color-bg-inverse, #0a0a0a);
    --wh-pv-iframe-bg: var(--wh-color-bg-inverse, #000);

    /* Placeholder, gdy film nie ma plakatu — gradient „nocnego nieba". */
    --wh-pv-placeholder-from: color-mix(in srgb, var(--wh-color-bg-inverse, #1a1a2e) 92%, var(--wh-color-primary, #0049FF));
    --wh-pv-placeholder-to: color-mix(in srgb, var(--wh-color-bg-inverse, #16213e) 84%, var(--wh-color-primary, #0049FF));

    /* Przycisk odtwarzania: kolo na materiale, wiec przyciemnienie, nie kolor brandu. */
    --wh-pv-play-bg: color-mix(in srgb, var(--wh-color-bg-inverse, #000) 55%, transparent);
    --wh-pv-arrow-bg: color-mix(in srgb, var(--wh-color-bg-inverse, #000) 50%, transparent);

    /* ⚠️ KOLORY MAREK — nie podpinac pod --wh-color-primary ani --wh-color-sale.
       Czerwien YouTube i blekit Vimeo identyfikuja serwis; brandowy przycisk
       odtwarzania na filmie z YouTube wyglada jak bledny element obcy.
       Ten sam wzorzec co --wh-sl-fb-* / --wh-sl-apple-* w wh_sociallogin. */
    --wh-pv-youtube: 229, 57, 53;
    --wh-pv-vimeo: 26, 183, 234;

    /* Rozmiar przycisku odtwarzania (desktop / mobile).
       ⚠️ CELOWO w px, nie w rem. `html { font-size: 62.5% }` (1rem = 10px) siedzi
       w CHILD THEME (theme-tokens.css), a nie w hummingbirdzie — na motywie bez
       childa 7.2rem to 115 px, nie 72 px. Modul ma dzialac na dowolnym motywie,
       wiec fallback nie moze zakladac skali rem. Branza moze nadpisac na rem. */
    --wh-pv-play-size: 72px;
    --wh-pv-play-size-mobile: 52px;

    /* Powiekszenie kola pod kursorem. */
    --wh-pv-play-scale-hover: 1.08;
}

/* ======================================================
   CAROUSEL SLIDES (page gallery + product modal)
   ====================================================== */

.wh-pv-slide__inner {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wh-pv-player-bg, #0a0a0a);
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

/* In product modal: don't force 1:1, match modal size */
#product-modal .wh-pv-slide__inner {
    aspect-ratio: auto;
    min-height: 50vh;
    max-height: 80vh;
}

.wh-pv-slide__poster {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wh-pv-slide__poster-empty {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--wh-pv-placeholder-from, #1a1a2e) 0%, var(--wh-pv-placeholder-to, #16213e) 100%);
}

/* Play button overlay */
.wh-pv-slide__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 2;
}

.wh-pv-slide__play-circle {
    width: var(--wh-pv-play-size, 72px);
    height: var(--wh-pv-play-size, 72px);
    border-radius: 50%;
    background: var(--wh-pv-play-bg, rgba(0, 0, 0, 0.55));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 16px 18px 22px;
    transition: background var(--wh-duration-fast, .2s), transform var(--wh-duration-fast, .2s);
}

.wh-pv-slide__play:hover .wh-pv-slide__play-circle {
    background: rgba(var(--wh-pv-youtube, 229, 57, 53), 0.85);
    transform: scale(var(--wh-pv-play-scale-hover, 1.08));
}

/* Iframe wrapper (after clicking play) */
.wh-pv-slide__iframe-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: var(--wh-pv-iframe-bg, #000);
}

.wh-pv-slide__iframe-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ======================================================
   THUMBNAIL BUTTONS (page + modal)
   ====================================================== */

.wh-pv-thumb-btn {
    position: relative;
}

.wh-pv-thumb-btn__picture {
    display: block;
    width: 100%;
    height: 100%;
}

.wh-pv-thumb-btn__empty {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--wh-pv-placeholder-from, #1a1a2e), var(--wh-pv-placeholder-to, #16213e));
    border-radius: inherit;
}

.wh-pv-thumb-btn__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: var(--wh-pv-play-bg, rgba(0, 0, 0, 0.55));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 5px 6px 8px;
    pointer-events: none;
    z-index: 2;
    transition: background var(--wh-duration-fast, .2s);
}

.wh-pv-thumb-btn:hover .wh-pv-thumb-btn__play {
    background: rgba(var(--wh-pv-youtube, 229, 57, 53), 0.85);
}

.wh-pv-thumb-btn__badge {
    display: none;
}

.wh-pv-thumb-btn__badge--youtube { background: rgba(var(--wh-pv-youtube, 229, 57, 53), 0.9); }
.wh-pv-thumb-btn__badge--vimeo { background: rgba(var(--wh-pv-vimeo, 26, 183, 234), 0.9); }

/* ======================================================
   CAROUSEL ARROWS (injected when missing)
   ====================================================== */

/* Only style arrows we inject — don't override theme's existing arrows */
#product-modal .carousel-control-prev,
#product-modal .carousel-control-next {
    width: 44px;
    opacity: 0.7;
    transition: opacity var(--wh-duration-fast, .2s);
    z-index: 10;
}

#product-modal .carousel-control-prev:hover,
#product-modal .carousel-control-next:hover {
    opacity: 1;
}

#product-modal .carousel-control-prev-icon,
#product-modal .carousel-control-next-icon {
    width: 32px;
    height: 32px;
    background-color: var(--wh-pv-arrow-bg, rgba(0, 0, 0, 0.5));
    border-radius: 50%;
    background-size: 50%;
    padding: 8px;
}

/* ======================================================
   CLASSIC THEME — Thumbnails
   ====================================================== */

.wh-pv-classic-thumb {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.wh-pv-classic-thumb__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wh-pv-classic-thumb__empty {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--wh-pv-placeholder-from, #1a1a2e), var(--wh-pv-placeholder-to, #16213e));
}

.wh-pv-classic-thumb__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: var(--wh-pv-play-bg, rgba(0, 0, 0, 0.55));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 6px 7px 9px;
    pointer-events: none;
    z-index: 2;
    transition: background var(--wh-duration-fast, .2s);
}

.wh-pv-classic-thumb:hover .wh-pv-classic-thumb__play {
    background: rgba(var(--wh-pv-youtube, 229, 57, 53), 0.85);
}

.wh-pv-classic-thumb__badge {
    display: none;
}

.wh-pv-classic-thumb__badge--youtube { background: rgba(var(--wh-pv-youtube, 229, 57, 53), 0.9); }
.wh-pv-classic-thumb__badge--vimeo { background: rgba(var(--wh-pv-vimeo, 26, 183, 234), 0.9); }

/* Inline player (Classic cover replacement) */
.wh-pv-inline-player {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: var(--wh-pv-iframe-bg, #000);
}

.wh-pv-inline-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ======================================================
   RESPONSIVE
   ====================================================== */

@media (max-width: 767px) {
    .wh-pv-slide__play-circle {
        width: var(--wh-pv-play-size-mobile, 52px);
        height: var(--wh-pv-play-size-mobile, 52px);
        padding: 14px 12px 14px 16px;
    }

    #product-modal .wh-pv-slide__inner {
        min-height: 40vh;
    }
}
