/* YOUTUBE RELATED VIDEOS - UNIFIED STYLES */

.ytrv-related-videos {
    margin: 40px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    max-width: 100%;
    overflow: hidden;
}

.ytrv-title {
    margin-top: 0;
    margin-bottom: 25px;
    color: #333;
    font-size: 1.5em;
    font-weight: 600;
    border-bottom: 2px solid #ff0000;
    padding-bottom: 12px;
}

/* Videos Grid - CRITICAL FIX */
.ytrv-videos-container {
    gap: 25px;
    margin: 20px 0;
    width: 100%;
}

/* Video Item Base */
.ytrv-video-item {
    width: 100%;
}

/* Reel Format (9:16) */
.ytrv-reel-format {
    width: 100%;
}

/* Landscape Format (16:9) */
.ytrv-landscape-format {
    width: 100%;
}

/* Common Wrapper for both formats */
.ytrv-reel-wrapper {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header - Same for both */
.ytrv-reel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.ytrv-reel-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ytrv-reel-duration {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Video Container Base */
.ytrv-reel-video,
.ytrv-landscape-video {
    width: 100%;
    position: relative;
    background: #000;
}

/* CRITICAL FIX: Separate aspect ratios with proper container targeting */
.ytrv-reel-video .ytrv-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 177.78%; /* 9:16 aspect ratio for reels */
    height: 0;
    overflow: hidden;
}

.ytrv-landscape-video .ytrv-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio for landscape */
    height: 0;
    overflow: hidden;
}

/* Iframe positioning - Fixed positioning for both formats */
.ytrv-reel-video .ytrv-video-container iframe,
.ytrv-landscape-video .ytrv-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Info Section - Same for both */
.ytrv-reel-info {
    padding: 15px;
    background: white;
}

.ytrv-reel-title {
    margin: 0 0 10px 0;
    font-size: 15px;
    line-height: 1.4;
    color: #333;
    font-weight: 500;
}

.ytrv-reel-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.ytrv-reel-stats .ytrv-views {
    font-weight: 500;
}

/* Landscape specific description */
.ytrv-landscape-desc {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

/* Hide old normal format styles */
.ytrv-normal-format,
.ytrv-normal-wrapper,
.ytrv-normal-thumbnail,
.ytrv-thumbnail-overlay,
.ytrv-thumbnail-img,
.ytrv-play-button,
.ytrv-normal-info,
.ytrv-normal-title,
.ytrv-normal-meta,
.ytrv-normal-channel,
.ytrv-normal-stats,
.ytrv-normal-desc,
.ytrv-watch-full {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ytrv-videos-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .ytrv-related-videos {
        margin: 30px 0;
        padding: 15px;
    }

    .ytrv-title {
        font-size: 1.3em;
    }

    .ytrv-reel-header {
        padding: 10px 12px;
    }
}

/* Admin badges */
.ytrv-permanent-badge {
    font-size: 11px;
    background: #46b450;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

/* Loading animation */
.ytrv-video-container iframe {
    transition: opacity 0.3s;
}

/* Debug helper - remove after testing */
.ytrv-reel-video,
.ytrv-landscape-video {
    min-height: 50px;
}

/* Ensure videos fill container properly */
.ytrv-video-container {
    position: relative;
    width: 100%;
    background: #000;
}

/* Additional safety for iframe display */
iframe {
    max-width: 100%;
    display: block;
}

/* Main player container */
.ytrv-main-player-container {
    margin-bottom: 30px;
}

.ytrv-player-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.ytrv-player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.ytrv-close-player {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 10px;
}

.ytrv-close-player:hover {
    color: #ff0000;
}

.ytrv-player-title {
    margin: 0;
    font-size: 16px;
    flex-grow: 1;
    padding: 0 15px;
}

.ytrv-player {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
}

.ytrv-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Suggestions Panel */
.ytrv-suggestions-panel {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.ytrv-suggestions-title {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    color: #333;
}

.ytrv-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.ytrv-suggestion-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.ytrv-suggestion-item:hover {
    background: #e9ecef;
}

.ytrv-suggestion-thumb {
    width: 80px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.ytrv-suggestion-info {
    flex: 1;
}

.ytrv-suggestion-info h5 {
    margin: 0 0 5px 0;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
}

.ytrv-suggestion-channel {
    font-size: 11px;
    color: #666;
}

/* Next up section */
.ytrv-next-up {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.ytrv-next-up h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #495057;
}

.ytrv-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}