/* --- CSS RESET & GLOBAL STYLES --- */
:root {
    --bg-primary: #141414;
    --bg-secondary: #1E1E1E;
    --bg-tertiary: #2C2C2C;
    --accent-primary: #E50914;
    --accent-hover: #F6121D;
    --text-primary: #F5F5F5;
    --text-secondary: #A3A3A3;
    --border-color: #3D3D3D;
    --font-family: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

a {
    color: var(--text-primary);
    text-decoration: none;
}

ul {
    list-style: none;
}

/* --- HEADER & NAVIGATION --- */
.header {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), 
                        url('/assets/img/header.jpeg');
            background-size: cover;
            background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-bottom: 40px;
}

.nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 40px;
    z-index: 1000;
}

.logo a {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-menu a {
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: var(--text-primary);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* --- SEARCH --- */
.search-container {
    position: relative;
    max-width: 500px;
    width: 90%;
    margin-top: 20px;
}

.search-box {
    width: 100%;
    padding: 15px 60px 15px 25px;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.search-box::placeholder {
    color: var(--text-secondary);
}

.search-box:focus {
    border-color: var(--accent-primary);
    background-color: #252525;
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.search-btn:hover {
    color: var(--accent-primary);
}

/* --- AD PLACEHOLDER --- */
.placeholder-section {
    display: flex;
    justify-content: center;
    padding: 0 20px 30px;
}

.ad-placeholder-large {
    width: 100%;
    max-width: 970px;
}

.ad-placeholder-large img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* --- VIDEO CONTENT --- */
.video-content {
    padding: 0 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ADD THIS NEW RULE */
.video-category {
    margin-bottom: 50px; /* Adds space between the Trending and Latest sections */
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 0 5px;
}

.video-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
}

.filter-container {
    position: relative;
   
}

.filter-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.filter-btn:hover {
    background-color: var(--bg-tertiary);
}

.filter-btn i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.filter-dropdown {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    list-style: none;
    padding: 8px 0;
    width: 180px;
    z-index: 100;
    overflow: hidden;
}

.filter-dropdown.active {
    display: block;
}

.filter-dropdown li a {
    display: block;
    padding: 10px 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s;
}

.filter-dropdown li a:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* --- VIDEO GRID --- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px 20px;
}

.video-card {
    display: block;
}

.video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.video-card:hover .video-thumbnail {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.video-title {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0 5px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.video-card:hover .video-title {
    color: var(--text-primary);
}

/* --- PAGINATION --- */
.pagination-container {
    display: flex;
    justify-content: center;
    margin: 60px 0 40px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.page-link {
    display: block;
    padding: 10px 15px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: #555;
}

.page-link.active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    cursor: default;
}

.page-item.disabled .page-link {
    color: #666;
    pointer-events: none;
    background-color: #222;
    border-color: #333;
}

/* --- PLAYER PAGE STYLES --- */

/* Main container for the player page */
.player-page-container {
    max-width: 1600px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap; /* Allows sidebar to wrap on smaller screens */
    gap: 40px;
    align-items: flex-start; /* Aligns items to the top */
}

/* Main video section wrapper */
.main-video-section {
    flex: 3; /* Takes up 3 parts of the available space */
    min-width: 65%; /* Ensures it doesn't get too small */
}

/* Wrapper for the video player */
.video-player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Maintains a 16:9 aspect ratio */
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); /* Adds depth */
}

/* Styling for the video element itself */
#video-id {
    width: 100%;
    height: 100%;
}

/* Container for video title, metadata, and actions */
.video-info {
    padding: 10px;
}

/* Video title styling */
h1.video-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.3;
}

/* Metadata (views and duration) */
.video-metadata {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 25px;
}

/* Video actions container (Download, Share buttons) */
.video-actions {
    display: flex;
    gap: 15px;
}

/* General styling for action buttons */
.action-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 50px; /* Pill-shaped buttons */
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-2px); /* Slight lift on hover */
}

/* Specific styling for the download button */
.download-btn {
    background-color: var(--accent-primary);
    color: var(--text-primary);
}

.download-btn:hover {
    background-color: var(--accent-hover);
}

/* Specific styling for the share button */
.share-btn {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.share-btn:hover {
    background-color: #3a3a3a;
}

/* --- RELATED VIDEOS SIDEBAR --- */

/* Sidebar section */
.related-videos-section {
    flex: 1; /* Takes up 1 part of the available space */
    min-width: 300px; /* Minimum width before wrapping */
    background-color: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
}

.related-videos-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

/* List of related videos */
.related-videos-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Individual related video item */
.related-video-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: var(--bg-primary); /* Slightly darker background */
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.related-video-item:hover {
    background-color: var(--bg-tertiary);
    transform: translateX(5px); /* Moves item slightly to the right on hover */
}

/* Thumbnail image for related videos */
.related-video-item img {
    width: 120px;
    height: 68px; /* 16:9 aspect ratio */
    object-fit: cover;
    border-radius: 6px;
}

/* Info container for related videos */
.related-video-info h3 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
    line-height: 1.4;
}

.related-video-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- FOOTER --- */
.site-footer {
    background-color: #0A0A0A;
    color: var(--text-secondary);
    padding: 50px 20px;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent-primary);
}

.footer-disclaimer, .footer-copyright {
    font-size: 0.8rem;
    max-width: 600px;
    margin: 10px auto 0;
    line-height: 1.6;
}

.footer-copyright {
    color: #666;
}

/* --- RESPONSIVE STYLES --- */
@media (max-width: 992px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .video-header h2 {
        font-size: 1.5rem;
    }
    
    .player-page-container {
        flex-direction: column; /* Stack video and sidebar vertically */
        gap: 30px;
    }

    .main-video-section,
    .related-videos-section {
        min-width: 100%; /* Both sections take full width */
    }

    h1.video-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .nav {
        padding: 20px;
    }

    .logo a {
        font-size: 2rem;
    }

    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 0;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background-color: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        width: 100%;
        height: 100vh;
        transition: left 0.3s ease;
        gap: 40px;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu a {
        font-size: 1.5rem;
        color: var(--text-primary);
    }

    .search-container {
        max-width: 90%;
    }
    
    .video-grid {
        gap: 20px 15px;
    }
}

@media (max-width: 480px) {
    .video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 0 5px;
}
    .video-header h2 {
        font-size: 1.25rem;
    }
    
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px 10px; /* Adjusted gap for mobile */
    }

    /* ADJUST THUMBNAIL AND TITLE FOR SMALLER SIZE */
    .video-thumbnail {
        border-radius: 8px;
        margin-bottom: 6px;
    }

    .video-title {
        font-size: 0.55rem; /* Make font smaller to fit */
        line-height: 1.3;
        padding: 0 2px;
        /* Truncate long titles to 2 lines */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .pagination {
        gap: 5px;
    }

    .page-link {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .player-page-container {
        padding: 0 10px;
        margin-top: 20px;
    }

    h1.video-title {
        font-size: 1.4rem;
    }

    .video-actions {
        flex-direction: column; /* Stack buttons vertically */
        align-items: stretch; /* Make buttons full width */
    }
    
    .action-btn {
        text-align: center;
    }

    .related-videos-section {
        padding: 15px;
    }

    .related-video-item img {
        width: 100px;
        height: 56px;
    }
    
    .related-video-info h3 {
        font-size: 0.9rem;
    }
}