/* =========================================================
   Video Playlist for Elementor – CSS v3
   All layout driven by CSS variables set per-breakpoint
   by Elementor's responsive controls.
   ========================================================= */

.vpe-playlist-wrapper,
.vpe-playlist-wrapper *,
.vpe-playlist-wrapper *::before,
.vpe-playlist-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
}

/* ── Wrapper ─────────────────────────────────── */
.vpe-playlist-wrapper {
    display: flex;
    overflow: hidden;
    border-radius: 8px;
    width: 100%;
    position: relative;

    /* ── These are set by the responsive video_position control ── */
    flex-direction: var(--vpe-dir, row);
    height:         var(--vpe-h-act, auto);
}

/* ============================================================
   VIDEO AREA
   ============================================================ */
.vpe-video-area {
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    flex-shrink: 0;

    width: var(--vpe-vw-act, 65%);
}

/* ── Video container ── */
.vpe-video-container {
    position: relative;
    width: 100%;
    overflow: hidden;

    /* In side mode (left/right): flex:1 1 auto, height:0 → fills wrapper height.
       In stack mode (top/bottom): flex:0 0 auto, height:auto, padding-top:AR → aspect-ratio box. */
    flex:        var(--vpe-vc-flex, 0 0 auto);
    height:      var(--vpe-vc-h, auto);
    padding-top: var(--vpe-vc-pt, 56.25%);
}

/* Video / iframe absolutely positioned inside container */
.vpe-video-container video,
.vpe-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 0;
}

/* ── Now Playing bar ── */
.vpe-now-playing {
    padding: 10px 16px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* ============================================================
   PLAYLIST SIDEBAR
   ============================================================ */
.vpe-playlist-sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;

    width:      var(--vpe-pl-w-act, 35%);
    max-height: var(--vpe-pl-mh-act, none);
}

/* ── Playlist header ── */
.vpe-playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.vpe-playlist-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.vpe-video-count {
    font-size: 13px;
    white-space: nowrap;
    margin-left: 12px;
    flex-shrink: 0;
}

/* ── Scrollable items ── */
.vpe-playlist-items {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.vpe-playlist-items::-webkit-scrollbar       { width: 5px; }
.vpe-playlist-items::-webkit-scrollbar-track  { background: transparent; }
.vpe-playlist-items::-webkit-scrollbar-thumb  { background: #555; border-radius: 3px; }
.vpe-playlist-items { scrollbar-width: thin; scrollbar-color: #555 transparent; }

/* ============================================================
   PLAYLIST ITEMS
   ============================================================ */
.vpe-playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    transition: background-color 0.2s;
    position: relative;
    user-select: none;
}

/* Active left-bar */
.vpe-active-bar {
    display: none;
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
}
.vpe-playlist-item.is-active .vpe-active-bar { display: block; }

/* ── Thumbnail ── */
.vpe-item-thumb {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #222;
}
.vpe-item-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.vpe-thumb-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.3);
    background: #1e1e2e;
}

/* Play overlay */
.vpe-play-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.45);
    color: #fff;
    transition: opacity 0.2s;
}
.vpe-play-overlay.hover-only { opacity: 0; }
.vpe-playlist-item:hover .vpe-play-overlay.hover-only { opacity: 1; }

/* Duration badge */
.vpe-duration-badge {
    position: absolute; bottom: 4px; right: 4px;
    background: rgba(0,0,0,0.78);
    color: #fff; font-size: 11px;
    padding: 1px 5px; border-radius: 3px;
    line-height: 1.4; pointer-events: none;
}

/* ── Item info ── */
.vpe-item-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.vpe-item-title {
    font-size: 14px; font-weight: 500; line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.vpe-item-duration {
    font-size: 12px;
}

/* ── Watched icon ── */
.vpe-watched-icon {
    flex-shrink: 0;
    display: none;
    align-items: center; justify-content: center;
    margin-left: auto;
    padding-right: 4px;
}
.vpe-playlist-item.is-watched .vpe-watched-icon { display: flex; }
.vpe-watched-icon.hover-only { display: none !important; }
.vpe-playlist-item.is-watched:hover .vpe-watched-icon.hover-only { display: flex !important; }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.vpe-video-area.is-loading .vpe-video-container::after {
    content: '';
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 5;
}
.vpe-video-area.is-loading .vpe-video-container::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 36px; height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vpe-spin 0.7s linear infinite;
    z-index: 6;
}
@keyframes vpe-spin { to { transform: rotate(360deg); } }

/* ============================================================
   FADE-IN
   ============================================================ */
.vpe-playlist-item {
    animation: vpe-fade 0.25s ease both;
}
@keyframes vpe-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
