/* video.css - Styles for the single video page */

/* Container adjustment for video page */
.video-page-container {
    display: grid;
    grid-template-columns: 1fr 350px; /* Main video area + sidebar for related */
    gap: 30px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Video player section */
.video-player-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.video-player-container {
    position: relative;
    width: 100%;
    height: 600px;
    background-color: #000;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    z-index: 1;
}

/* Mobile responsive video container */
@media (max-width: 768px) {
    .video-player-container {
        height: 0;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
    }
}

/* Style for the actual video element */
.video-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none; /* Hidden by default until placeholder is clicked */
}

/* Video placeholder and play button overlay */
.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 2;
}

.video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    display: block;
}

.video-placeholder:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

.video-placeholder:hover img {
    opacity: 0.8;
}

.play-button-overlay {
    position: absolute;
    width: 80px;
    height: 60px;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.play-button-overlay svg {
    fill: white;
    transition: transform 0.2s ease;
}

.video-placeholder:hover .play-button-overlay svg {
    transform: scale(1.1);
}

.video-placeholder .ytp-large-play-button-bg {
    fill: #e52d27;
    fill-opacity: 0.9;
}

/* Duration overlay */
.duration-overlay {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    z-index: 2;
    font-weight: bold;
}

/* Video details */
#video-title {
    font-size: 1.3rem;
    line-height: 2.8rem;
    font-weight: 700;
    overflow: hidden;
    display: block;
    max-height: 5.6rem;
    -webkit-line-clamp: 2;
    margin: 0 0 10px 0;
    color: #333;
    width: 100%;
}

.video-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9em;
    color: #666;
}

.video-meta .tags {
    margin-top: 5px;
}

.video-meta .tags a {
    color: #666;
    text-decoration: none;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    margin-right: 8px;
    transition: background-color 0.2s ease;
}

.video-meta .tags a:hover {
    background: #e0e0e0;
    color: #333;
}

/* Related videos section */
.related-videos-section {
    background-color: white;
    padding: 10px;
    border-radius: 4px;
}

.related-videos-section h3 {
    margin-top: 0;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 10px;
}

.related-video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

@media (min-width: 1201px) {
    .related-video-grid {
        max-height: calc(10 * (90px + 8px)); /* Height for 10 items including gap */
        overflow-y: auto;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }

    .related-video-grid::-webkit-scrollbar {
        display: none; /* Chrome, Safari and Opera */
    }
}

.related-video {
    display: flex;
    gap: 8px;
    text-decoration: none;
    height: 90px;
    background: white;
}

.related-video:hover {
    background: #f5f5f5;
}

.related-video .thumbnail-container {
    position: relative;
    width: 160px;
    height: 90px;
    flex-shrink: 0;
    overflow: hidden;
}

.related-video .thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-video .video-info {
    flex: 1;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
}

.related-video h4 {
    font-size: 0.85em;
    margin: 0;
    color: #333;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.related-video .views {
    font-size: 0.75em;
    color: #666;
    margin-top: 4px;
}

.related-video .duration-overlay {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 0.75em;
}

/* Bottom related videos section */
.bottom-related-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.bottom-related-section h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 20px;
}

.bottom-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.bottom-related-video {
    text-decoration: none;
    color: inherit;
    display: block;
}

.bottom-related-video .thumbnail-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    margin-bottom: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #f0f0f0;
}

.bottom-related-video .thumbnail-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.bottom-related-video h4 {
    font-size: 0.9em;
    margin: 0;
    color: #333;
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.bottom-related-video:hover img {
    transform: scale(1.05);
}

.bottom-related-video .duration-overlay {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.8em;
}

@media (max-width: 1400px) {
    .bottom-related-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

@media (max-width: 1200px) {
    .video-page-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .related-videos-section {
        margin-top: 30px;
        padding: 20px;
        border-top: 1px solid #eee;
    }
    
    .related-video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .related-video {
        flex-direction: row;
        height: auto;
        background: transparent;
        align-items: flex-start;
    }
    
    .related-video .thumbnail-container {
        width: 120px;
        height: 68px;
        flex-shrink: 0;
    }
    
    .related-video .video-info {
        padding: 0 0 0 10px;
        flex: 1;
    }
    
    .related-video:hover {
        background: transparent;
    }
    
    .related-video h4 {
        font-size: 0.9em;
    }
}

@media (max-width: 768px) {
    .bottom-related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .related-video-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .bottom-related-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .video-player-section {
        padding: 10px;
    }
    
    #video-title {
        font-size: 1.4em;
    }
    
    .related-videos-section {
        padding: 15px;
        margin-top: 20px;
    }
    
    .related-video .video-info {
        padding: 8px 0;
    }
    
    .related-video h4 {
        font-size: 1em;
        -webkit-line-clamp: 2;
        max-height: 2.6em;
    }
    
    .related-video .thumbnail-container {
        margin-bottom: 0;
    }
}
