/**
 * @package     J2Commerce
 * @subpackage  Plugin.J2Commerce.AppVideodisplay
 *
 * @copyright   (C)2024-2026 J2Commerce, LLC <https://www.j2commerce.com>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

/* ------------------------------------------------------------------ */
/* Video Display plugin — storefront styles                            */
/* ------------------------------------------------------------------ */

#j2commerce-videodisplay {
    container-type: inline-size;
}

/* Shared embed wrapper */
.j2c-videodisplay iframe,
.j2c-videodisplay video {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    border-radius: 4px;
}

/* ------------------------------------------------------------------ */
/* Grid mode                                                           */
/* ------------------------------------------------------------------ */

.j2c-videodisplay--grid .j2c-video-caption {
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 0.875rem;
}

/* ------------------------------------------------------------------ */
/* Scroller (Swiper) mode                                              */
/* ------------------------------------------------------------------ */

.j2c-videoswiper .swiper {
    width: 100%;
}

.j2c-videoswiper .swiper-slide {
    box-sizing: border-box;
}

/* Spotlight: big centered card with peeking neighbors */
.j2c-videoswiper--spotlight .swiper-slide {
    width: min(1152px, 80vw);
    height: auto;
}

.j2c-videoswiper .j2c-video-caption {
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 0.875rem;
    text-align: center;
}

/* Poster-thumbnail link (scroller mode) */
.j2c-video-poster {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 6px;
    text-decoration: none;
}

.j2c-video-poster img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.j2c-video-poster:hover img {
    transform: scale(1.02);
}

/* Play button overlay */
.j2c-video-playbtn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.j2c-video-poster:hover .j2c-video-playbtn {
    opacity: 0.75;
}

/* ------------------------------------------------------------------ */
/* Alternating mode                                                    */
/* ------------------------------------------------------------------ */

.j2c-videodisplay--alternating .j2c-videodisplay-row {
    margin-bottom: 2rem;
}

.j2c-videodisplay--alternating .j2c-video-text {
    /* Prevent stray margins from WYSIWYG output clipping flex container */
    overflow: hidden;
}

.j2c-videodisplay--alternating .j2c-video-text :first-child {
    margin-top: 0;
}

.j2c-videodisplay--alternating .j2c-video-text :last-child {
    margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* Admin: provider badge on URL field                                  */
/* ------------------------------------------------------------------ */

.j2c-video-provider-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 3px;
    background: #e9ecef;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-inline-start: 6px;
}

.j2c-video-provider-badge--youtube {
    background: #ff0000;
    color: #fff;
}

.j2c-video-provider-badge--vimeo {
    background: #1ab7ea;
    color: #fff;
}

.j2c-video-provider-badge--html5 {
    background: #e44d26;
    color: #fff;
}
