/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Layout Container */
.main-container {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Ad Banners - General */
.ad-banner {
    background-color: #333;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #555;
    font-size: 0.8rem;
    overflow: hidden;
    text-align: center;
}

.ad-banner span {
    padding: 10px;
}

/* Specific Ad Placements */
.ad-top {
    width: 100%;
    height: 90px;
    margin-bottom: 10px;
}

.ad-bottom {
    width: 100%;
    height: 90px;
    margin-top: 20px;
}

.ad-side {
    width: 160px;
    min-width: 160px;
    height: 600px;
    /* Or 100% of viewport height if sticky */
    position: sticky;
    top: 10px;
    margin: 0 10px;
}

/* Header */
header {
    background-color: #b71c1c;
    /* Dark Red */
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.video-card {
    background-color: #2a2a2a;
    border-radius: 5px;
    overflow: hidden;
    transition: transform 0.2s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.thumbnail {
    width: 100%;
    height: 280px;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    position: relative;
}

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

.video-info {
    padding: 10px;
}

.video-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.page-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}

.page-btn:hover {
    background-color: #555;
}

.page-btn.active {
    background-color: #b71c1c;
}

/* Footer */
footer {
    background-color: #000;
    color: #777;
    padding: 20px;
    text-align: center;
    margin-top: auto;
}

/* Popup Ad */
.popup-ad {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    height: 250px;
    background-color: #fff;
    color: #000;
    border: 2px solid #b71c1c;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.popup-header {
    background-color: #b71c1c;
    color: white;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.close-popup {
    cursor: pointer;
    font-weight: bold;
}

.popup-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
}

/* Video Player Page */
.video-player-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: #000;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-title-large {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* Responsive Design */

/* Tablet and smaller desktops (< 1024px) */
@media (max-width: 1024px) {
    .ad-side {
        display: none;
        /* Hide sidebars to prioritize content */
    }

    .main-container {
        padding: 0 10px;
    }
}

/* Mobile Devices (< 768px) */
@media (max-width: 768px) {
    header {
        font-size: 1.5rem;
        padding: 15px;
    }

    .ad-top,
    .ad-bottom {
        height: auto;
        min-height: 50px;
        overflow: hidden;
    }

    /* Ensure iframes in ads don't break layout */
    .ad-top iframe,
    .ad-bottom iframe {
        max-width: 100%;
        height: auto;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        /* Smaller cards */
        gap: 10px;
    }

    .thumbnail {
        height: 180px;
        /* Smaller thumbnails */
    }

    .video-title {
        font-size: 0.9rem;
    }

    .popup-ad {
        width: 90%;
        right: 5%;
        bottom: 10px;
    }

    .video-player-container {
        width: 100%;
    }
}

/* Video Duration Badge */
.duration-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 5px;
    font-size: 0.8rem;
    border-radius: 3px;
    pointer-events: none;
    z-index: 3;
}

/* Video Preview Overlay */
.video-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    display: none;
    /* Hidden by default */
    background-color: black;
}