body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f0f0f0;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header Top */
.header-top {
    background-color: #000;
    color: #fff;
    padding: 10px 0;
    border-bottom: 3px solid #f00;
}

.header-top .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Cho phép các item xuống dòng */
}

.header-top .logo {
    font-size: 24px;
    font-weight: bold;
    color: #f00;
    margin-bottom: 5px; /* Thêm khoảng cách */
}

.header-top .search-bar {
    display: flex;
    align-items: center;
    flex-grow: 1; /* Cho phép thanh tìm kiếm mở rộng */
    margin-bottom: 5px; /* Thêm khoảng cách */
}

.header-top .search-bar input {
    padding: 5px 10px;
    border: 1px solid #555;
    background-color: #333;
    color: #fff;
    border-radius: 3px;
    margin-right: 5px;
    width: 100%; /* Chiếm toàn bộ chiều rộng có thể */
}

.header-top .search-bar button {
    background-color: #f00;
    color: #fff;
    border: none;
    padding: 5px 15px;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap; /* Ngăn nút bị xuống dòng */
}

.header-top .header-promo {
    font-size: 14px;
    color: #ccc;
    text-align: right;
    width: 100%; /* Chiếm toàn bộ chiều rộng */
}

/* Main Navigation */
.main-nav {
    background-color: #f00;
    padding: 10px 0;
    color: #fff;
}

.main-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Cho phép các item xuống dòng */
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap; /* Cho phép các mục menu xuống dòng */
}

.main-nav ul li {
    margin-right: 20px;
    margin-bottom: 5px; /* Thêm khoảng cách */
}

.main-nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
}

.main-nav .auth-links {
    margin-top: 5px; /* Thêm khoảng cách */
}

.main-nav .auth-links a {
    color: #fff;
    text-decoration: none;
    margin-left: 10px;
}

/* Content Wrapper */
.content-wrapper {
    padding: 20px 0;
}

.new-videos-bar {
    background-color: #f00;
    color: #fff;
    padding: 10px 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    flex-wrap: wrap; /* Cho phép xuống dòng */
}

.new-videos-bar .more-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    margin-top: 5px; /* Thêm khoảng cách */
}

.main-content {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    /* Loại bỏ flex-shrink cho video-grid nếu nó được đặt ở đây */
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    flex-grow: 1;
    width: 100%; /* Đảm bảo video-grid chiếm toàn bộ chiều rộng */
}

.video-item {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

.video-item .thumbnail {
    position: relative;
    width: 100%;
    height: 150px; /* Fixed height for thumbnails */
    overflow: hidden;
}

.video-item .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures image covers the area without distortion */
    display: block;
}

.video-item .vevo-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background-color: #f00;
    color: #fff;
    padding: 2px 5px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
}

.video-item .title {
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.3;
    height: 40px; /* Limit title height */
    overflow: hidden;
}

.video-item .views {
    padding: 0 10px 10px;
    font-size: 12px;
    color: #777;
}

/* --- Responsive Adjustments --- */

/* For screens smaller than 1024px (e.g., tablets in landscape) */
@media (max-width: 1024px) {
    .container {
        padding: 0 10px;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 10px;
        width: 100%; /* Đảm bảo chiếm 100% */
    }

    /* Xóa hoặc comment các quy tắc sidebar trong media query */
    /*
    .sidebar {
        width: 250px;
    }
    */
}

/* For screens smaller than 768px (e.g., tablets in portrait, larger phones) */
@media (max-width: 768px) {
    .header-top .container,
    .main-nav .container,
    .new-videos-bar {
        flex-direction: column;
        align-items: flex-start; /* Căn trái các mục */
    }

    .header-top .logo {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .header-top .search-bar {
        width: 100%;
        margin-bottom: 10px;
    }

    .header-top .header-promo {
        width: 100%;
        text-align: center;
        margin-top: 5px;
    }

    .main-nav ul {
        width: 100%;
        justify-content: center; /* Căn giữa các mục menu */
        margin-bottom: 10px;
    }

    .main-nav ul li {
        margin: 0 10px 5px; /* Giảm khoảng cách giữa các mục menu */
    }

    .main-nav .auth-links {
        width: 100%;
        text-align: center;
        margin-top: 0;
    }

    .new-videos-bar {
        text-align: center;
    }
    .new-videos-bar .more-link {
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }

    .main-content {
        flex-direction: column; /* Sidebar xuống dưới video grid */
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Giảm số cột video */
        width: 100%; /* Chiếm toàn bộ chiều rộng */
    }

    /* Xóa hoặc comment các quy tắc sidebar trong media query */
    /*
    .sidebar {
        width: 100%; /* Sidebar chiếm toàn bộ chiều rộng */
        margin-top: 20px;
    }
    */
}

/* For screens smaller than 480px (e.g., mobile phones) */
@media (max-width: 480px) {
    .container {
        padding: 0 5px;
    }

    .header-top .logo {
        font-size: 20px;
    }

    .header-top .search-bar input,
    .header-top .search-bar button {
        padding: 8px;
    }

    .main-nav ul li {
        margin: 0 5px 5px;
        font-size: 14px;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); /* Giảm số cột video hơn nữa */
        gap: 8px;
    }

    .video-item .thumbnail {
        height: 100px; /* Giảm chiều cao thumbnail */
    }

    .video-item .title {
        font-size: 12px;
        height: 36px;
    }

    .video-item .views {
        font-size: 10px;
    }

    .sidebar .ad-block {
        padding: 5px;
    }
}

/* --- Video Detail Page Styles --- */
.video-detail-page {
    margin-top: 20px;
}

.main-video-player {
    width: 100%;
    margin-bottom: 30px;
    background-color: #000; /* Nền đen cho khu vực video */
}

.main-video-player iframe {
    display: block; /* Loại bỏ khoảng trắng dưới iframe */
    max-width: 100%;
    height: 500px; /* Chiều cao mặc định */
}

.related-videos-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.related-videos-grid {
    /* Sử dụng lại các style từ .video-grid */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Có thể điều chỉnh số cột */
}

/* Responsive Adjustments for Video Detail Page */
@media (max-width: 1024px) {
    .main-video-player iframe {
        height: 400px; /* Giảm chiều cao video trên tablet */
    }
    .related-videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-video-player iframe {
        height: 300px; /* Giảm chiều cao video trên điện thoại */
    }
    .related-videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .related-videos-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .main-video-player iframe {
        height: 220px; /* Giảm chiều cao video trên điện thoại nhỏ */
    }
    .related-videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    .related-videos-title {
        font-size: 18px;
    }
}

/* Style cho tiêu đề trang listing */
.page-listing-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #f00;
}

@media (max-width: 768px) {
    .page-listing-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
}

/* Ẩn dòng "Showing X to Y of Z results" trong phân trang */
.pagination-links nav > div:first-child p {
    display: none;
}
.pagination-links{
    margin-top: 30px;
}

.tag-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.tag-item {
    background-color: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.tag-item a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

/* Responsive for mobile */
@media (max-width: 768px) {
    .tag-list {
        grid-template-columns: 1fr;
    }
}