/* =========================================================
   Video Grid Gallery – Frontend Styles
   ========================================================= */

/* ── Grid ──────────────────────────────────────────────── */
.vgg-grid-wrapper {
    position: relative;
}

.vgg-grid {
    display: grid;
    width: 100%;
    box-sizing: border-box;
}

/* ── Card ───────────────────────────────────────────────── */
.vgg-item {
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    box-sizing: border-box;
}

.vgg-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* ── Thumbnail ──────────────────────────────────────────── */
.vgg-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #111;
}

.vgg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.vgg-item:hover .vgg-thumb img {
    transform: scale(1.04);
}

/* ── Play button ────────────────────────────────────────── */
.vgg-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s;
}

.vgg-play-btn svg {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
    transition: transform 0.2s ease;
}

.vgg-item:hover .vgg-play-btn svg {
    transform: scale(1.1);
}

/* ── Title ──────────────────────────────────────────────── */
.vgg-title {
    padding: 10px 12px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
    text-align: center;
    background: inherit;
}

/* ── No videos ──────────────────────────────────────────── */
.vgg-no-videos {
    color: #666;
    font-style: italic;
}

/* =========================================================
   Popup / Lightbox
   ========================================================= */
.vgg-popup {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vgg-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
}

/* Fade-in animation */
.vgg-popup.vgg-popup-active {
    animation: vggFadeIn 0.22s ease forwards;
}

@keyframes vggFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.vgg-popup-inner {
    position: relative;
    z-index: 1;
    width: 95vw;
    max-width: 1100px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7);
    animation: vggSlideUp 0.25s ease forwards;
}

@keyframes vggSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Popup header ───────────────────────────────────────── */
.vgg-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #111;
    flex-shrink: 0;
}

.vgg-popup-title {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 48px);
}

.vgg-popup-close {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    padding: 0;
}

.vgg-popup-close:hover {
    background: rgba(255,255,255,0.22);
}

.vgg-popup-close svg {
    width: 18px;
    height: 18px;
    color: #fff;
    stroke: #fff;
}

/* ── Popup video ────────────────────────────────────────── */
.vgg-popup-video-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
    min-height: 0;
}

.vgg-popup-video {
    width: 100%;
    height: 100%;
    max-height: calc(95vh - 64px); /* subtract header height */
    object-fit: contain;
    display: block;
    outline: none;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 767px) {
    .vgg-popup-inner {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .vgg-play-btn svg {
        width: 48px;
        height: 48px;
    }
}

/* ── Body lock when popup open ──────────────────────────── */
body.vgg-popup-open {
    overflow: hidden;
}
