/* ======================================================
   Video Popup Widget — front-end styles
   ====================================================== */

/* Grid */
.vpw-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Card — the entire card is the positioning context */
.vpw-card {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    outline: none;
    display: block;
    width: 100%;
}

.vpw-card:focus-visible {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2271b1;
}

/* Thumbnail wrapper — aspect ratio box, is the positioning parent for play btn */
.vpw-thumb-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 default */
    overflow: hidden;
    display: block;
}

/* Thumbnail image fills the padded box */
.vpw-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.35s ease;
}

.vpw-card:hover .vpw-thumb {
    transform: scale(1.04);
}

/* Hover overlay — inside thumb-wrap */
.vpw-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.vpw-card:hover .vpw-overlay {
    background: rgba(0, 0, 0, 0.3);
}

/* Play button — centred inside .vpw-thumb-wrap */
.vpw-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #4a7c8e;
    border-style: none;
    border-width: 2px;
    border-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor: pointer;
    padding: 0;
    box-sizing: border-box;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.30);
    transition: transform 0.22s ease, background 0.22s ease,
                box-shadow 0.22s ease, border-color 0.22s ease;
}

.vpw-card:hover .vpw-play-btn {
    transform: translate(-50%, -50%) scale(1.1);
    background: #3d6b7c;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.40);
}

.vpw-play-btn svg {
    width: 40%;
    height: 40%;
    margin-left: 3px;
    display: block;
}

.vpw-play-btn svg path {
    fill: #fff;
}

/* Duration badge */
.vpw-duration {
    position: absolute;
    bottom: 8px;
    left: 10px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.03em;
    z-index: 3;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    pointer-events: none;
}

/* Optional title below card */
.vpw-title {
    margin: 8px 0 0;
    padding: 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

/* ======================================================
   Lightbox
   ====================================================== */
.vpw-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.90);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: max(56px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
}

.vpw-lightbox.vpw-active {
    display: flex;
    animation: vpwFadeIn 0.2s ease;
}

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

.vpw-lightbox-inner {
    position: relative;
    width: 100%;
    max-width: 960px;
    animation: vpwSlideUp 0.25s ease;
}

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

.vpw-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.85;
    transition: opacity 0.2s;
    z-index: 10;
}
.vpw-close:hover { opacity: 1; }

/* Video wrapper */
.vpw-media-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.vpw-media-wrap iframe,
.vpw-media-wrap video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ======================================================
   Responsive
   ====================================================== */

@media (max-width: 1024px) {
    .vpw-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .vpw-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .vpw-card {
        width: 100% !important;
        max-width: 100% !important;
    }

    .vpw-thumb-wrap {
        padding-bottom: 56.25% !important;
    }

    .vpw-play-btn {
        width: 50px !important;
        height: 50px !important;
    }

    .vpw-lightbox-inner {
        width: 100%;
        max-width: 100%;
    }

    .vpw-close {
        top: -40px;
        font-size: 30px;
    }
}

@media (max-width: 400px) {
    .vpw-play-btn {
        width: 44px !important;
        height: 44px !important;
    }
}
