.video-gallery {
    display: grid;
    gap: 20px;
}

.video-gallery.columns-1 { grid-template-columns: repeat(1, 1fr); }
.video-gallery.columns-2 { grid-template-columns: repeat(2, 1fr); }
.video-gallery.columns-3 { grid-template-columns: repeat(3, 1fr); }
.video-gallery.columns-4 { grid-template-columns: repeat(4, 1fr); }

.video-item {
    position: relative;
    border: 1px solid #eee;
    border-radius: 5px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.video-item:hover {
    transform: translateY(-5px);
}

.video-thumbnail {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.video-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-item:hover .video-thumbnail img {
    transform: scale(1.05);
}

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: background 0.3s ease;
}

.video-play-button:hover {
    background: rgba(255, 0, 0, 0.8);
}

.video-title {
    margin: 15px 15px 10px;
    font-size: 1.1em;
}

.video-excerpt {
    margin: 0 15px 15px;
    font-size: 0.9em;
    color: #666;
}

/* Lightbox Styles */
.video-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 10px;
    padding: 20px;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #333;
    z-index: 10;
}

.lightbox-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    margin-bottom: 20px;
}

.lightbox-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lightbox-info {
    padding: 0 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .video-gallery.columns-3,
    .video-gallery.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .video-gallery.columns-2,
    .video-gallery.columns-3,
    .video-gallery.columns-4 {
        grid-template-columns: 1fr;
    }
}




/* Lightbox open state */
body.vg-lightbox-open {
    overflow: hidden;
}

/* Lightbox Styles */
.video-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
}

.lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    width: 95%;
    max-width: 1000px;
    max-height: 95vh;
    overflow-y: auto;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #333;
    z-index: 10;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: #f7f7f7;
    color: #ff0000;
}

.lightbox-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    margin-bottom: 25px;
    background: #000;
    border-radius: 5px;
    overflow: hidden;
}

.lightbox-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.lightbox-info {
    padding: 0 10px;
}

.lightbox-info h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #333;
}

.lightbox-info .lightbox-description {
    color: #666;
    line-height: 1.6;
    font-size: 16px;
}

/* Lightbox navigation arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: none; /* Hidden by default, show when multiple videos */
}

.lightbox-prev {
    left: -25px;
}

.lightbox-next {
    right: -25px;
}

.lightbox-nav:hover {
    background: #fff;
}

/* Responsive lightbox */
@media (max-width: 1100px) {
    .lightbox-content {
        width: 98%;
        padding: 20px;
    }
    
    .lightbox-nav {
        display: none !important; /* Hide navigation on mobile */
    }
}

@media (max-width: 768px) {
    .lightbox-content {
        padding: 15px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 24px;
        width: 35px;
        height: 35px;
        line-height: 35px;
    }
    
    .lightbox-info h3 {
        font-size: 20px;
    }
}




/* Playlist Layout */
.video-playlist-wrapper {
    display: flex;
    gap: 30px;
    margin: 20px 0;
}

.video-playlist-main {
    flex: 3;
}

.video-playlist-sidebar {
    flex: 1;
    min-width: 300px;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    background: #f9f9f9;
}

.video-player-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin-bottom: 20px;
    background: #000;
    border-radius: 5px;
    overflow: hidden;
}

.video-player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.playlist-info {
    padding: 15px;
    background: #fff;
    border-radius: 5px;
    border: 1px solid #eee;
}

.playlist-info h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.playlist-title {
    padding: 15px;
    margin: 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1;
}

.playlist-videos {
    padding: 10px;
}

.playlist-video-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.playlist-video-item:hover {
    background: #f5f5f5;
    border-color: #0073aa;
}

.playlist-video-item.active {
    background: #e6f2ff;
    border-color: #0073aa;
    border-left: 4px solid #0073aa;
}

.playlist-video-number {
    width: 30px;
    height: 30px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    margin-right: 10px;
    flex-shrink: 0;
}

.playlist-video-thumb {
    width: 60px;
    height: 40px;
    overflow: hidden;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
}

.playlist-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-video-thumb.default {
    background: #0073aa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.playlist-video-thumb.default .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.playlist-video-info {
    flex: 1;
    min-width: 0;
}

.playlist-video-info h5 {
    margin: 0 0 5px 0;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-duration {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
}

.playlist-video-playing {
    position: absolute;
    top: 5px;
    right: 5px;
    color: #0073aa;
    font-size: 12px;
}

.playlist-navigation {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.playlist-navigation button {
    padding: 8px 15px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.playlist-navigation button:hover {
    background: #005a87;
}

.playlist-navigation button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Playlist player controls */
.playlist-player-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 10;
}

.playlist-player-controls button {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.playlist-player-controls button:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Responsive playlist */
@media (max-width: 768px) {
    .video-playlist-wrapper {
        flex-direction: column;
    }
    
    .video-playlist-sidebar {
        max-height: 400px;
        min-width: 100%;
    }
    
    .playlist-video-item {
        padding: 8px;
    }
    
    .playlist-video-thumb {
        width: 50px;
        height: 35px;
    }
}




/* Playlist Header */
.playlist-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.playlist-main-title {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

.playlist-description {
    color: #666;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
}

/* Playlist Search */
.playlist-search-container {
    position: relative;
    margin: 0 0 20px 0;
    max-width: 400px;
}

.playlist-search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.playlist-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0,115,170,0.1);
}

.search-clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    color: #999;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    border-radius: 50%;
}

.search-clear:hover {
    background: #f0f0f0;
    color: #333;
}

/* Playlist sidebar title */
.playlist-title {
    padding: 15px;
    margin: 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-count {
    font-size: 14px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: normal;
}

/* Grid layout search */
.video-gallery-wrapper .playlist-search-container {
    margin-bottom: 25px;
}

/* Search results highlight */
.playlist-video-item.highlighted {
    background: #fff9e6;
    border-color: #ffd700;
}

/* Responsive */
@media (max-width: 768px) {
    .playlist-main-title {
        font-size: 24px;
    }
    
    .playlist-description {
        font-size: 14px;
    }
    
    .playlist-search-container {
        max-width: 100%;
    }
}



/* Playlist sidebar header */
.playlist-sidebar-header {
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 2;
}

.playlist-sidebar-title {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.playlist-sidebar-description {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
    margin: 0 0 8px 0;
}

.playlist-count {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 10px;
    display: inline-block;
}

/* Search bar styling for sidebar */
.video-playlist-sidebar .playlist-search-container {
    padding: 10px 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 120px; /* Adjust based on header height */
    z-index: 1;
}

.video-playlist-sidebar .playlist-search-input {
    width: 100%;
    padding: 8px 35px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.video-playlist-sidebar .search-clear {
    right: 20px;
    font-size: 16px;
}

/* Grid layout (default) - no big header */
.video-gallery-wrapper .playlist-search-container {
    margin-bottom: 20px;
    max-width: 100%;
}

/* Remove the big header styles we don't need anymore */
.playlist-header,
.playlist-main-title,
.playlist-description {
    display: none;
}

/* FIXED: Make links inside clickable thumbnails not interfere with video playback */
.playlist-thumb.video-playable .playlist-link,
.gallery-thumb.video-playable .gallery-link,
.search-video-item.video-playable a:not(.video-play-button) {
    pointer-events: none;
}

/* FIXED: Ensure search result thumbnails are properly clickable */
.playlist-thumb.video-playable:not(.empty),
.gallery-thumb.video-playable:not(.empty) {
    cursor: pointer;
    position: relative;
}

.playlist-thumb.video-playable:not(.empty) .playlist-thumb-overlay,
.gallery-thumb.video-playable:not(.empty) .gallery-thumb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.playlist-thumb.video-playable:not(.empty):hover .playlist-thumb-overlay,
.gallery-thumb.video-playable:not(.empty):hover .gallery-thumb-overlay {
    opacity: 1;
}

.playlist-thumb.video-playable:not(.empty) .playlist-thumb-overlay .dashicons,
.gallery-thumb.video-playable:not(.empty) .gallery-thumb-overlay .dashicons {
    color: white;
    font-size: 24px;
    width: 24px;
    height: 24px;
}






/* Search result highlighting */
.search-highlight {
    animation: highlightPulse 2s ease;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
    border-radius: 5px;
}

@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 115, 170, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0, 115, 170, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 115, 170, 0); }
}

/* Make search playlist/gallery items clickable */
.search-playlist-item,
.search-gallery-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.search-playlist-item:hover,
.search-gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    border-color: #0073aa;
}

.search-playlist-item:hover .playlist-title,
.search-gallery-item:hover .gallery-title {
    color: #0073aa;
}

/* Remove old clickable thumbnail styles */
.playlist-thumb.video-playable,
.gallery-thumb.video-playable {
    cursor: default;
}

.playlist-thumb-overlay,
.gallery-thumb-overlay {
    display: none;
}








