/* ══════════════════════════════════════════════
   Video Gallery Pro — Frontend Styles
   ══════════════════════════════════════════════ */

/* ── Grid wrap ── */
.vgp-gallery-wrap { width: 100%; }

.vgp-grid {
    display: grid;
    grid-template-columns: repeat(var(--vgp-cols, 3), 1fr);
    gap: var(--vgp-gap, 14px);
}

/* ── Card ── */
.vgp-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    cursor: default;
}
.vgp-card.vgp-has-lightbox { cursor: pointer; }

.vgp-card-inner {
    position: relative;
    width: 100%;
    aspect-ratio: var(--vgp-aspect, 16/9);
    overflow: hidden;
    background: #0d0d0d;
}

/* Thumbnail image */
.vgp-thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}
.vgp-card:hover .vgp-thumb-img { transform: scale(1.04); }

/* Native video preview */
.vgp-preview-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* iFrame preview (YouTube/Vimeo muted background) */
.vgp-preview-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Scale up to hide letterbox bars */
    width: 175%;
    height: 175%;
    transform: translate(-50%, -50%);
    border: none;
    pointer-events: none;  /* grid only — click goes to lightbox */
}

/* ── Overlay ── */
.vgp-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    transition: background 0.3s ease;
}
.vgp-card:hover .vgp-overlay { background: rgba(0,0,0,0.35); }

/* Play button */
.vgp-play-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.vgp-play-btn svg { width: 60px; height: 60px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.5)); }
.vgp-card:hover .vgp-play-btn { opacity: 1; transform: scale(1); }
.vgp-play-btn:hover svg circle { fill: rgba(0,0,0,.75); }

/* Card title */
.vgp-card-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 14px 12px;
    background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 100%);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s, transform 0.25s;
}
.vgp-card:hover .vgp-card-meta { opacity: 1; transform: translateY(0); }
.vgp-card-title {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Load More ── */
.vgp-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}
.vgp-load-more {
    background: #111;
    color: #fff;
    border: 1.5px solid rgba(255,255,255,.15);
    border-radius: 50px;
    padding: 13px 32px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: background .2s, border-color .2s, transform .15s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.vgp-load-more:hover { background: #222; border-color: rgba(255,255,255,.3); transform: translateY(-1px); }
.vgp-load-more.loading { opacity: .6; pointer-events: none; }
.vgp-lm-count { font-size: 12px; color: #888; font-weight: 400; }
.vgp-no-results { color: #888; font-style: italic; }

/* ── LIGHTBOX ── */
.vgp-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.vgp-lightbox.active { display: flex; }

.vgp-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.vgp-lb-container {
    position: relative;
    z-index: 1;
    width: min(92vw, 1100px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: vgp-lb-in .22s ease;
}
@keyframes vgp-lb-in { from { opacity:0; transform:scale(.95); } to { opacity:1; transform:scale(1); } }

.vgp-lb-media {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,.7);
}
.vgp-lb-media iframe,
.vgp-lb-media video {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.vgp-lb-info {
    width: 100%;
    padding: 16px 4px 0;
    text-align: left;
}
.vgp-lb-title {
    color: #f0f0f0;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.vgp-lb-desc {
    color: #888;
    font-size: 14px;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Lightbox buttons */
.vgp-lb-close,
.vgp-lb-prev,
.vgp-lb-next {
    position: absolute;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    transition: background .2s, transform .15s;
    line-height: 1;
    font-family: inherit;
    z-index: 2;
}
.vgp-lb-close {
    top: -14px;
    right: -14px;
    width: 40px;
    height: 40px;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vgp-lb-prev,
.vgp-lb-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vgp-lb-prev { left: -58px; }
.vgp-lb-next { right: -58px; }
.vgp-lb-close:hover { background: rgba(255,255,255,.2); transform: scale(1.05); }
.vgp-lb-prev:hover  { background: rgba(255,255,255,.2); transform: translateY(-50%) scale(1.05); }
.vgp-lb-next:hover  { background: rgba(255,255,255,.2); transform: translateY(-50%) scale(1.05); }

/* Hide prev/next when only 1 video */
.vgp-lb-prev.hidden,
.vgp-lb-next.hidden { display: none; }

/* Card entrance animation */
.vgp-card {
    animation: vgp-card-in .35s ease both;
}
@keyframes vgp-card-in { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
    .vgp-grid { grid-template-columns: repeat(min(var(--vgp-cols, 3), 2), 1fr) !important; }
    .vgp-lb-prev { left: -10px; }
    .vgp-lb-next { right: -10px; }
    .vgp-lb-close { top: -10px; right: -10px; }
}
@media (max-width: 480px) {
    .vgp-grid { grid-template-columns: 1fr !important; }
}
