/**
 * Tiger Video Pro — front-end styles.
 *
 * Scoped under .tg-vp so nothing leaks into the theme. The facade is a pure-CSS
 * thumbnail + play button (no player JS until clicked). Layout supports a side
 * playlist (--right) or a stacked one (--bottom), plus a single-video mode.
 */

.tg-vp {
    --tg-vp-list-width: 300px;
    display: grid;
    width: 100%;
    gap: 14px;
}

.tg-vp--single,
.tg-vp--bottom {
    grid-template-columns: 1fr;
}

.tg-vp--right {
    grid-template-columns: 1fr var(--tg-vp-list-width);
    align-items: start;
}

@media (max-width: 767px) {
    .tg-vp--right {
        grid-template-columns: 1fr;
    }
}

/* ---------- Player stage (16:9 by default via inline padding-top) ---------- */
.tg-vp-main {
    min-width: 0;
}

.tg-vp-stage {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.tg-vp-stage > .tg-vp-player,
.tg-vp-stage > .plyr,
.tg-vp-stage > iframe,
.tg-vp-stage > .tg-vp-facade {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.tg-vp-fallback {
    border: 0;
}

/* ---------- Facade (static thumbnail + play button) ---------- */
.tg-vp-facade {
    display: block;
    padding: 0;
    margin: 0;
    border: none;
    background: #000;
    cursor: pointer;
    overflow: hidden;
}

.tg-vp-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.tg-vp-facade:hover .tg-vp-thumb {
    transform: scale(1.05);
}

/* Vimeo / self-hosted without a custom thumbnail: a clean gradient placeholder
   keeps the facade attractive instead of showing a broken image. */
.tg-vp-facade--noimg {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.tg-vp-item-thumb--noimg {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Soft top-to-bottom scrim for legible play button + title over any thumbnail. */
.tg-vp-facade::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.28) 100%);
    transition: background 0.25s ease;
}

.tg-vp-facade:hover::after {
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.18) 100%);
}

.tg-vp-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    /* Glassy, provider-neutral button with a red core glow — premium + universal. */
    background: rgba(20, 20, 24, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease, box-shadow 0.2s ease;
}

.tg-vp-play svg {
    margin-left: 4px; /* optically centre the triangle */
    width: 34px;
    height: 34px;
    fill: #fff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.tg-vp-facade:hover .tg-vp-play {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(255, 0, 0, 0.92);
    border-color: #fff;
    box-shadow: 0 10px 34px rgba(255, 0, 0, 0.35), 0 8px 28px rgba(0, 0, 0, 0.45);
}

.tg-vp-facade:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -3px;
}


/* ---------- Title overlay ---------- */
.tg-vp-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 28px 16px 14px;
    color: #fff;
    font-size: 1.05em;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}

/* ---------- Playlist ---------- */
.tg-vp-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 480px;
    overflow-y: auto;
    background: #0f172a;
    border-radius: 12px;
    scrollbar-width: thin;
}

.tg-vp--bottom .tg-vp-list {
    display: flex;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
}

.tg-vp--bottom .tg-vp-list > li {
    flex: 0 0 220px;
}

.tg-vp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tg-vp--bottom .tg-vp-item {
    flex-direction: column;
    align-items: stretch;
}

.tg-vp-item:hover,
.tg-vp-item.is-active {
    background: rgba(255, 255, 255, 0.10);
}

.tg-vp-item.is-active {
    box-shadow: inset 3px 0 0 #ff0000;
}

.tg-vp-item-thumb {
    position: relative;
    flex: 0 0 96px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.tg-vp--bottom .tg-vp-item-thumb {
    flex-basis: auto;
    width: 100%;
}

.tg-vp-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tg-vp-item-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    opacity: 0;
    background: rgba(0, 0, 0, 0.35);
    transition: opacity 0.15s ease;
}

.tg-vp-item:hover .tg-vp-item-badge,
.tg-vp-item.is-active .tg-vp-item-badge {
    opacity: 1;
}

.tg-vp-list-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9em;
    line-height: 1.35;
    color: #e2e8f0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Editor / error notices ---------- */
.tg-vp-error {
    padding: 16px 18px;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.95em;
    text-align: center;
}

.tg-vp-note {
    text-align: left;
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    .tg-vp-play,
    .tg-vp-facade::after,
    .tg-vp-item {
        transition: none;
    }
}

/* ============================================================
   Lightbox (Advanced → Lightbox Mode)
   ============================================================ */
.tg-vp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 4vmin;
    background: rgba(0, 0, 0, 0.85);
}

.tg-vp-lightbox.is-open {
    display: flex;
}

.tg-vp-lightbox-inner {
    position: relative;
    width: min(1100px, 100%);
}

.tg-vp-lightbox-body {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.tg-vp-lightbox-body .tg-vp-player,
.tg-vp-lightbox-body .plyr {
    width: 100%;
    height: 100%;
}

.tg-vp-lightbox-close {
    position: absolute;
    top: -2.6em;
    right: 0;
    width: 2.2em;
    height: 2.2em;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.4em;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tg-vp-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   Sticky mini-player (Advanced → Sticky Mini-Player)
   ============================================================ */
/* `!important` is required here: the aspect-ratio control emits
   `{{WRAPPER}} .tg-vp-stage { padding-top: 56.25% }` at the SAME specificity,
   and its padding would inflate the fixed mini-player into a tall, letter-boxed
   box. Sticky is a transient JS-toggled state, so a hard override is correct. */
.tg-vp--sticky .tg-vp-stage {
    position: fixed !important;
    z-index: 99998;
    width: 340px !important;
    max-width: 80vw;
    height: auto !important;
    aspect-ratio: 16 / 9;
    padding-top: 0 !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    overflow: hidden;
    animation: tg-vp-pop 0.25s ease;
}

.tg-vp--sticky-bottom-right .tg-vp-stage { inset: auto 20px 20px auto !important; }
.tg-vp--sticky-bottom-left  .tg-vp-stage { inset: auto auto 20px 20px !important; }
.tg-vp--sticky-top-right    .tg-vp-stage { inset: 20px 20px auto auto !important; }
.tg-vp--sticky-top-left     .tg-vp-stage { inset: 20px auto auto 20px !important; }

@keyframes tg-vp-pop {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Drag bar + close: a slim chrome strip, shown only while docked. The bar is
   the drag handle (cursor: move) so dragging never fights the video controls. */
.tg-vp-sticky-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: space-between;
    height: 26px;
    padding: 0 4px 0 8px;
    background: linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
    cursor: move;
    touch-action: none; /* let pointer drag own the gesture, not the page scroll */
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tg-vp--sticky .tg-vp-sticky-bar {
    display: flex;
}

/* Reveal on hover/focus; always visible on touch (no hover) via coarse pointer. */
.tg-vp--sticky .tg-vp-stage:hover .tg-vp-sticky-bar,
.tg-vp--sticky .tg-vp-stage:focus-within .tg-vp-sticky-bar,
.tg-vp-stage.is-dragging .tg-vp-sticky-bar {
    opacity: 1;
}

@media (hover: none) {
    .tg-vp--sticky .tg-vp-sticky-bar { opacity: 1; }
}

.tg-vp-sticky-grip {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    line-height: 1;
    user-select: none;
}

.tg-vp-sticky-close {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tg-vp-sticky-close:hover {
    background: rgba(255, 0, 0, 0.85);
}

/* During a drag, stop the iframe/video from swallowing pointer moves and kill
   text selection so the drag stays smooth. */
.tg-vp-stage.is-dragging {
    user-select: none;
}

.tg-vp-stage.is-dragging .plyr,
.tg-vp-stage.is-dragging iframe,
.tg-vp-stage.is-dragging video {
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .tg-vp--sticky .tg-vp-stage {
        animation: none;
    }
}
