/* --- Main Container --- */
.youtube-gallery {
    max-width: 100%;
    margin: 0 auto;
}

/* --- Search Form (If used) --- */
.youtube-gallery form {
    text-align: center;
    margin-bottom: 20px;
}

/* --- Custom Gallery Grid (Responsive) --- */
.ytvg-custom-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
}

.ytvg-video-item {
    /* Desktop: 3 Columns */
    width: calc((100% - 40px) / 3); 
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.ytvg-video-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.ytvg-video-item a {
    text-decoration: none;
    color: inherit;
}

/* Thumbnail Area */
.ytvg-thumb {
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #000;
}

/* Play Icon Overlay */
.play-icon {
    position: absolute;
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 50px;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: color 0.3s;
}

.ytvg-video-item:hover .play-icon {
    color: #ff0000;
}

/* Video Title in Grid */
.ytvg-video-item h3 {
    padding: 12px 15px;
    font-size: 16px;
    line-height: 1.4;
    margin: 0;
    color: #333;
    font-weight: 600;
}

/* --- Single Video Player Styling --- */
.ytvg-single-player {
    width: 100%;
    margin-bottom: 20px;
}

/* The Wrapper for 16:9 Aspect Ratio */
.video-wrapper, .plyr__video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background-color: #000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 100%; /* Ensure full width */
}

.video-wrapper iframe, .plyr__video-embed iframe {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
}

/* Facebook Wrapper */
.facebook-wrapper {
    width: 100%;
    overflow: hidden;
    background: #000;
    display: flex;
    justify-content: center;
    border-radius: 8px;
    margin-bottom: 20px;
}
.fb-video, .fb-video span, .fb-video iframe {
    max-width: 100% !important;
    width: 100% !important;
}

/* --- Social Actions (Like/Share) --- */
.ytvg-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
    flex-wrap: wrap; 
    gap: 15px;
}

/* Like Button */
.ytvg-like-btn {
    background: #f2f2f2;
    color: #0f0f0f;
    border: none;
    padding: 8px 16px;
    border-radius: 18px; 
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.ytvg-like-btn:hover {
    background: #e5e5e5;
}

.ytvg-like-btn.liked {
    background: #0f0f0f;
    color: #fff;
}

/* Share Section */
.ytvg-share {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-label {
    font-size: 14px;
    color: #606060;
    font-weight: 500;
}

/* Social Icons */
.ytvg-share a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f2f2f2;
    color: #606060;
    transition: all 0.3s ease;
    text-decoration: none;
}

.ytvg-share a svg {
    fill: currentColor;
    width: 20px;
    height: 20px;
}

.ytvg-share a.ytvg-icon-fb:hover { background: #1877F2; color: white; }
.ytvg-share a.ytvg-icon-x:hover { background: #000000; color: white; }
.ytvg-share a.ytvg-icon-wa:hover { background: #25D366; color: white; }


/* --- Single Video Layout (Columns) --- */
.ytvg-single-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 20px;
}
.ytvg-main-content {
    flex: 2;
    min-width: 300px;
}
.ytvg-sidebar {
    flex: 1;
    min-width: 300px; 
}

/* Description Area */
.ytvg-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    line-height: 1.6;
}

/* New Title Injection */
.ytvg-video-title {
    font-size: 24px;
    margin: 20px 0 10px 0;
    line-height: 1.3;
    font-weight: 700;
    color: #222;
    display: block !important;
}

/* Sidebar & Widget Items Styling */
.ytvg-sidebar h3, .widget_ytvg_video_widget h2 {
    font-size: 18px;
    margin-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

/* Professional Related Video Item */
.ytvg-related-item {
    margin-bottom: 15px;
}

.ytvg-related-item a {
    display: flex;       
    gap: 12px;           
    text-decoration: none;
    color: inherit;
    align-items: flex-start;
}

/* Thumbnail Styling */
.ytvg-thumb-wrapper {
    flex-shrink: 0;      
    width: 140px;        
    height: 79px;        
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.ytvg-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;   
    display: block;
}

/* Text Info Styling */
.ytvg-related-info {
    display: flex;
    flex-direction: column;
}

.ytvg-related-info h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #0f0f0f;      
    font-weight: 600;
    max-height: 40px;    
    overflow: hidden;
}

.ytvg-related-item:hover h4 {
    color: #065fd4;      
}

.related-date {
    font-size: 12px;
    color: #606060;
}

/* --- NEW: Sidebar Tabs (Chips) --- */
.ytvg-sidebar-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 20px;
    white-space: nowrap;
    border-bottom: 1px solid #f0f0f0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.ytvg-sidebar-tabs::-webkit-scrollbar {
    display: none;
}

.ytvg-tab-btn {
    background: #f2f2f2;
    border: 1px solid #e5e5e5;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #0f0f0f;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-family: inherit;
}

.ytvg-tab-btn:hover {
    background: #e5e5e5;
}

.ytvg-tab-btn.active {
    background: #0f0f0f;
    color: #fff;
    border-color: #0f0f0f;
}

.ytvg-tab-content {
    animation: fadeEffect 0.4s;
}

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


/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 900px) {
    .ytvg-video-item {
        width: calc((100% - 20px) / 2); 
    }
}

@media (max-width: 800px) {
    .ytvg-single-layout {
        flex-direction: column; 
    }
    
    .ytvg-sidebar {
        width: 100%;
        margin-top: 30px;
    }
    
    .ytvg-thumb-wrapper {
        width: 160px;
        height: 90px;
    }
    
    /* Removed sticky video code to fix mobile playback issues */
}

@media (max-width: 600px) {
    .ytvg-video-item {
        width: 100%; 
        margin-bottom: 10px;
    }
    .ytvg-custom-gallery {
        gap: 15px;
    }
    .ytvg-thumb {
        height: 200px; 
    }
    .ytvg-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    .ytvg-like-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .plyr__video-embed, .video-wrapper, .facebook-wrapper {
        border-radius: 0; 
    }
}

/* --- HIDE THEME HEADER ELEMENTS --- */
body.single-ytvg_video .entry-header, 
body.single-ytvg_video .post-header,
body.single-ytvg_video .page-header,
body.single-ytvg_video .entry-meta,
body.single-ytvg_video .post-meta,
body.single-ytvg_video .breadcrumbs, 
body.single-ytvg_video .breadcrumb,
body.single-ytvg_video .site-breadcrumb,
body.single-ytvg_video .rank-math-breadcrumb,
body.single-ytvg_video .yoast-breadcrumb,
body.single-ytvg_video #breadcrumbs {
    display: none !important;
}

body.single-ytvg_video h1.entry-title,
body.single-ytvg_video h1.post-title {
    display: none !important;
}
/* --- Widget Styling --- */
.ytvg-widget-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ytvg-widget-link {
    display: flex;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    align-items: flex-start;
}

.ytvg-widget-thumb {
    width: 100px;        /* Fixed width for thumb */
    height: 56px;        /* Fixed height (approx 16:9 ratio) */
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    flex-shrink: 0;      /* Prevent shrinking */
    background-color: #000;
}

.ytvg-widget-info {
    display: flex;
    flex-direction: column;
}

.ytvg-widget-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
    color: #333;
}

.ytvg-widget-info .meta-date, 
.ytvg-widget-info .meta-likes {
    font-size: 12px;
    color: #888;
}