/* Thiết lập chung */
:root {
    --primary-color: #e50914; /* Màu đỏ của Netflix */
    --secondary-color: #ff9800; /* Màu cam */
    --text-color: #333;
    --light-text-color: #f0f0f0;
    --bg-color: #f4f4f4;
    --dark-bg-color: #1a1a1a;
    --card-bg-color: #fff;
    --border-color: #ddd;
    --gray-text-color: #555;
    --light-gray-bg: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1300px; /* Tăng chiều rộng tối đa cho container */
    margin: 0 auto;
    padding: 0 20px; /* Tăng padding để có khoảng trống tốt hơn */
    width: 100%;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: #c10811; /* Màu đỏ đậm hơn khi hover */
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Header */
.main-header {
    background: var(--dark-bg-color);
    color: var(--light-text-color);
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px; /* Khoảng cách giữa các item trong header */
}

.main-header .logo a {
    color: var(--primary-color);
    font-size: 2rem; /* Kích thước logo lớn hơn */
    font-weight: bold;
    text-decoration: none;
    letter-spacing: -1px; /* Thêm hiệu ứng cho logo */
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap; /* Cho phép menu xuống dòng */
}

.main-nav ul li {
    margin-left: 25px;
}

.main-nav ul li a {
    color: var(--light-text-color);
    font-weight: 500; /* Độ đậm font */
    padding: 8px 0;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

.main-nav ul li a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.search-bar {
    display: flex;
    align-items: center;
}

.search-bar input[type="text"] {
    padding: 10px 15px;
    border: 1px solid #555;
    border-radius: 25px; /* Bo tròn thanh tìm kiếm */
    font-size: 1rem;
    background: #333;
    color: var(--light-text-color);
    outline: none;
    width: 220px;
    transition: width 0.3s ease, border-color 0.3s ease;
}

.search-bar input[type="text"]::placeholder {
    color: #aaa;
}

.search-bar input[type="text"]:focus {
    width: 240px;
    border-color: var(--primary-color);
}

.search-bar button {
    background: var(--primary-color);
    color: var(--light-text-color);
    border: none;
    padding: 10px 20px;
    margin-left: 10px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.3s ease;
}

.search-bar button:hover {
    background: #c10811;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1000;
    position: relative; /* Dùng cho hiệu ứng cross */
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--light-text-color);
    margin: 5px 0;
    transition: 0.4s;
}
/* Hiệu ứng X cho nút toggle */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}
.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 3rem 0; /* Tăng padding trên/dưới */
}

.section-title {
    font-size: 2rem; /* Kích thước tiêu đề lớn hơn */
    color: var(--text-color);
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px; /* Độ rộng gạch chân */
    height: 5px; /* Độ dày gạch chân */
    background: var(--primary-color);
    border-radius: 3px;
}

/* Video Grid (Áp dụng cho trang chủ và video liên quan) */
.video-grid {
    display: grid;
    /* Thiết lập cột với chiều rộng tối thiểu 320px.
       Auto-fill sẽ tạo ra các cột 320px nếu có đủ không gian,
       và các video card sẽ fill vào các cột đó. */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px; /* Giảm khoảng cách giữa các video card */
    margin-top: 2rem;
    justify-content: center; /* Căn giữa các item trong grid nếu có khoảng trống */
}


.video-card {
    background: var(--card-bg-color);
    border-radius: 10px; /* Bo tròn nhiều hơn */
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); /* Shadow rõ hơn */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-color);
}

.video-card:hover {
    transform: translateY(-8px); /* Nhấc lên rõ hơn */
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2); /* Shadow rõ hơn khi hover */
}

.video-thumbnail {
    position: relative;
    width: 100%; /* Sẽ chiếm hết chiều rộng của .video-card */
    padding-bottom: 56.25%; /* Tỷ lệ 16:9 (9 / 16 * 100%) */
    background-color: #000;
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; /* Sẽ co giãn theo .video-thumbnail */
    height: 100%; /* Sẽ co giãn theo .video-thumbnail */
    object-fit: cover;
    transition: transform 0.4s ease;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.1); /* Zoom ảnh thumbnail khi hover */
}

.video-views {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75); /* Đậm hơn */
    color: var(--light-text-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: bold;
}

.video-title {
    font-size: 0.8rem; /* Giảm kích thước font, ví dụ từ 1.4rem xuống 1.2rem */
    margin: 10px 15px 3px; /* Giảm khoảng cách trên, dưới, và hai bên */
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Giới hạn 2 dòng */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em; /* Chiều cao tối thiểu cho 2 dòng */
    font-weight: 600;
    line-height: 1.2; /* Điều chỉnh line-height để kiểm soát chiều cao dòng */
}


/* Footer */
.main-footer {
    background: var(--dark-bg-color);
    color: var(--light-text-color);
    text-align: center;
    padding: 2rem 0; /* Tăng padding */
    margin-top: 3rem; /* Tăng margin top */
    box-shadow: 0 -2px 8px rgba(0,0,0,0.3);
}

.main-footer p {
    margin-bottom: 0.7rem;
    font-size: 0.95rem;
}

.main-footer a {
    color: var(--primary-color);
    margin: 0 8px;
    transition: color 0.3s ease;
}

.main-footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Thông báo lỗi & nút quay lại */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 30px auto;
    max-width: 700px;
    font-size: 1.1rem;
    line-height: 1.8;
}

.text-center {
    text-align: center;
}

.back-home-btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background 0.3s ease, transform 0.3s ease;
}

.back-home-btn:hover {
    background: #c10811;
    transform: translateY(-2px);
    text-decoration: none;
}


/* Video Play Page Styles */
.video-play-page {
    display: flex;
    flex-direction: column; /* Đổi thành column để xếp chồng lên nhau */
    gap: 40px; /* Khoảng cách giữa các phần tử chính (player, details, related) */
    padding-top: 30px;
}

.main-video-player {
    width: 100%; /* Chiếm toàn bộ chiều rộng có thể */
    background: #000;
    border-radius: 12px; /* Bo tròn nhiều hơn */
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3); /* Shadow rõ hơn */
}

.video-embed-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Tỷ lệ khung hình 16:9 */
    height: 0;
    overflow: hidden;
    background-color: #000;
}

.video-embed-container iframe,
.video-embed-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background-color: #000;
}

.video-details {
    width: 100%; /* Chiếm toàn bộ chiều rộng có thể */
    background: var(--card-bg-color);
    padding: 30px; /* Tăng padding */
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.video-details-title {
    font-size: 1.8rem; /* Kích thước tiêu đề lớn hơn */
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-color);
    line-height: 1.3;
    font-weight: 700;
}

.video-meta {
    font-size: 1rem;
    color: #777;
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Khoảng cách giữa các meta item */
    align-items: center;
}

.video-meta span i {
    margin-right: 8px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.video-meta .category a {
    color: var(--primary-color);
    font-weight: bold;
}

.video-meta .category .badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: bold;
    vertical-align: middle;
}

.video-description-full {
    font-size: 1rem; /* Kích thước mô tả lớn hơn */
    line-height: 1.8;
    margin-bottom: 30px;
    color: #444;
}

.video-keywords {
    margin-bottom: 30px;
}

.video-keywords strong {
    margin-right: 12px;
    color: var(--text-color);
    font-size: 1.05rem;
}

.keyword-tag {
    display: inline-block;
    background: var(--light-gray-bg); /* Màu xám nhạt */
    color: #555;
    padding: 8px 15px;
    border-radius: 25px; /* Bo tròn hơn */
    font-size: 0.95rem;
    margin: 5px 8px 5px 0;
    transition: background 0.3s ease, color 0.3s ease;
    white-space: nowrap; /* Ngăn từ khóa xuống dòng giữa chừng */
}

.keyword-tag:hover {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* Social Share */
.social-share {
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.social-share h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-color);
    font-weight: 600;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px;
    margin-right: 15px; /* Tăng khoảng cách */
    margin-bottom: 15px;
    border-radius: 8px; /* Bo tròn hơn */
    color: white;
    font-weight: bold;
    font-size: 1rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.share-btn i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.share-btn.facebook {
    background: #3b5998;
}

.share-btn.twitter {
    background: #00acee;
}

.share-btn.email {
    background: #bb001b;
}

.share-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px); /* Hiệu ứng nhấc lên */
    text-decoration: none;
}

/* Related Videos Section (Sử dụng lại video-grid) */
.related-videos-section {
    width: 100%;
    margin-top: 50px; /* Tăng margin top */
}

.related-videos-section .section-title {
    margin-bottom: 30px; /* Tăng margin bottom */
}


/* Admin Page Styles */
.admin-page {
    background: var(--bg-color);
    padding: 30px 0;
}

.admin-panel {
    background: var(--card-bg-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
}

.admin-panel .panel-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.add-video-form .form-group,
.add-category-form .form-group { /* Áp dụng cho cả form category */
    margin-bottom: 20px;
}

.add-video-form label,
.add-category-form label { /* Áp dụng cho cả form category */
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-color);
    font-size: 1.05rem;
}

.add-video-form label .required,
.add-category-form label .required { /* Áp dụng cho cả form category */
    color: var(--primary-color);
    font-size: 1.1em;
    margin-left: 5px;
}

.add-video-form input[type="text"],
.add-video-form textarea,
.add-video-form select,
.add-category-form input[type="text"] { /* Áp dụng cho cả form category */
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-color);
    background-color: #fcfcfc;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.add-video-form input[type="text"]:focus,
.add-video-form textarea:focus,
.add-video-form select:focus,
.add-category-form input[type="text"]:focus { /* Áp dụng cho cả form category */
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color), 0.2);
    outline: none;
}

.add-video-form textarea {
    resize: vertical; /* Cho phép resize theo chiều dọc */
    min-height: 100px;
}

.add-video-form .submit-btn,
.add-category-form .submit-btn { /* Áp dụng cho cả form category */
    display: block;
    width: 100%;
    padding: 15px 25px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    margin-top: 30px;
}

.add-video-form .submit-btn:hover,
.add-category-form .submit-btn:hover { /* Áp dụng cho cả form category */
    background: #c10811;
    transform: translateY(-2px);
}

.status-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1rem;
    text-align: center;
    font-weight: bold;
}

.status-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}


/* Admin Table Styles */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    background: white;
    border-radius: 8px;
    overflow: hidden; /* Để border-radius hoạt động với table */
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.admin-table th,
.admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.admin-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.admin-table tr:hover {
    background-color: #f1f1f1;
}

.admin-table .actions {
    white-space: nowrap; /* Giữ các nút hành động trên một dòng */
}

.admin-table .actions .btn {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9rem;
    text-align: center;
    text-decoration: none;
    margin-right: 8px;
    transition: background 0.3s ease, color 0.3s ease;
}

.admin-table .actions .btn-edit {
    background-color: #28a745; /* Green */
    color: white;
}

.admin-table .actions .btn-edit:hover {
    background-color: #218838;
    text-decoration: none;
}

.admin-table .actions .btn-delete {
    background-color: #dc3545; /* Red */
    color: white;
}

.admin-table .actions .btn-delete:hover {
    background-color: #c82333;
    text-decoration: none;
}

.admin-action-link {
    text-align: center;
    margin-top: 30px;
}

.btn-primary-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-block; /* Để padding hoạt động */
}
.btn-primary-outline:hover {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
}
.btn-secondary-outline {
    background: transparent;
    border: 2px solid var(--gray-text-color);
    color: var(--gray-text-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-block; /* Để padding hoạt động */
}
.btn-secondary-outline:hover {
    background: var(--gray-text-color);
    color: white;
    text-decoration: none;
}

/* Admin Login Page Styles */
.admin-login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px); /* Đảm bảo có đủ không gian */
    padding: 50px 20px;
    background: linear-gradient(to right, #ece9e6, #ffffff); /* Nền nhẹ nhàng */
}

.admin-login-page .admin-panel {
    max-width: 450px;
    padding: 40px;
    background: var(--card-bg-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.admin-login-page .panel-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    padding-bottom: 15px;
}

.admin-login-page .panel-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

.login-form .form-group {
    margin-bottom: 25px;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--text-color);
    font-size: 1.1rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.05rem;
    color: var(--text-color);
    background-color: #fcfcfc;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(var(--primary-color), 0.2);
    outline: none;
}

.login-form .submit-btn {
    display: block;
    width: 100%;
    padding: 15px 25px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    margin-top: 25px;
}

.login-form .submit-btn:hover {
    background: #c10811;
    transform: translateY(-2px);
}

/* Static Page Content */
.static-page-content {
    background: var(--card-bg-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin: 30px auto;
    line-height: 1.7;
    font-size: 1.05rem;
    color: #444;
}

.static-page-content h1.section-title {
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 2.2rem;
    color: var(--primary-color);
    text-align: left;
}

/* Ghi đè gạch chân cho section-title trong static-page-content nếu muốn khác */
.static-page-content h1.section-title::after {
    left: 0;
    transform: translateX(0);
}

.static-page-content h2 {
    font-size: 1.6rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.static-page-content p,
.static-page-content ul {
    margin-bottom: 15px;
}

.static-page-content ul {
    list-style-type: disc;
    margin-left: 25px;
    padding-left: 0;
}

.static-page-content ul li {
    margin-bottom: 8px;
}

.static-page-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.static-page-content a:hover {
    color: #c10811;
}

/* Small text alignment for footer links in static pages */
.static-page-content .text-center {
    margin-top: 25px;
}

/* Filter and Sort Section */
.filter-sort-section {
    background: var(--card-bg-color);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    /* Đảm bảo nó không quá rộng trên màn hình nhỏ */
    max-width: 900px; /* Thêm max-width để form không quá dài */
    margin-left: auto;
    margin-right: auto;
}

.filter-sort-form {
    display: flex; /* Đảm bảo là flex container */
    flex-wrap: wrap; /* Cho phép các mục xuống dòng nếu không đủ chỗ */
    gap: 25px; /* Tăng khoảng cách giữa các nhóm lọc */
    align-items: center; /* Căn giữa các mục theo chiều dọc */
    justify-content: center; /* Căn giữa các mục theo chiều ngang trong container */
}

.filter-sort-form .form-group {
    display: flex; /* Đảm bảo label và select nằm trên cùng một hàng */
    align-items: center; /* Căn giữa label và select */
    margin-bottom: 0; /* Bỏ margin-bottom nếu có để tránh khoảng trống thừa */
}

.filter-sort-form .form-group label {
    font-weight: bold;
    color: var(--text-color);
    margin-right: 10px; /* Tăng khoảng cách giữa label và select */
    white-space: nowrap; /* Ngăn label xuống dòng */
}

.filter-sort-form select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.8rem;
    background-color: #fcfcfc;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease;
    min-width: 120px; /* Đảm bảo chiều rộng tối thiểu cho select box */
}

.filter-sort-form select:focus {
    border-color: var(--primary-color);
}

/* Responsive cho Filter/Sort */
@media (max-width: 768px) {
    .filter-sort-form {
        flex-direction: column; /* Trở lại xếp chồng trên màn hình nhỏ */
        align-items: stretch; /* Để các mục giãn ra toàn bộ chiều rộng */
    }
    .filter-sort-form .form-group {
        width: 100%;
        text-align: center; /* Căn giữa nội dung trong nhóm trên mobile */
        justify-content: center; /* Căn giữa label và select trên mobile */
    }
    .filter-sort-form select {
        width: 100%;
        max-width: 300px; /* Giới hạn để không quá rộng */
        margin: 0 auto; /* Căn giữa select box */
        display: block; /* Để căn giữa */
        margin-top: 5px; /* Khoảng cách giữa label và select trên mobile */
    }
    .filter-sort-form .form-group label {
        margin-right: 0; /* Bỏ margin phải của label trên mobile */
        margin-bottom: 5px; /* Thêm margin dưới cho label */
    }
}
/* Các media query khác giữ nguyên */

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    min-width: 40px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.pagination-link:hover:not(.active):not(.disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    text-decoration: none;
}

.pagination-link.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    cursor: default;
}

.pagination-link.disabled {
    color: #ccc;
    border-color: #eee;
    cursor: not-allowed;
    background-color: #f9f9f9;
}

.pagination-dots {
    padding: 10px 5px;
    color: #777;
}


/* Responsive Design */
@media (max-width: 992px) {
    /* ... (các style hiện có cho main-header, main-nav, mobile-menu-toggle) ... */

    .search-bar {
        width: 100%;
        order: 2;
        display: flex; /* Đảm bảo là flex container */
        justify-content: center; /* Căn giữa toàn bộ thanh tìm kiếm */
        flex-wrap: nowrap; /* Ngăn các item trong search bar xuống dòng */
        padding: 0 10px; /* Thêm padding nhẹ để tránh dính sát lề */
        /* Bỏ các thuộc tính liên quan đến width/max-width và margin auto nếu có từ trước */
    }
    .search-bar input[type="text"] {
        flex-grow: 1; /* Cho phép input chiếm phần lớn không gian */
        width: auto; /* Đặt lại width để flex-grow có tác dụng */
        max-width: 250px; /* Giới hạn chiều rộng tối đa cho input */
        margin-right: 5px; /* Khoảng cách giữa input và button */
        padding: 8px 12px; /* Điều chỉnh padding */
        font-size: 0.9rem; /* Điều chỉnh font size */
    }
    .search-bar input[type="text"]:focus {
        max-width: 280px; /* Tăng max-width khi focus */
    }
    .search-bar button {
        flex-shrink: 0; /* Ngăn nút bị co lại */
        padding: 8px 15px; /* Điều chỉnh padding cho nút */
        font-size: 0.9rem; /* Điều chỉnh font size cho nút */
    }
}

@media (max-width: 768px) {
    /* ... (các style hiện có) ... */
    .search-bar {
        padding: 0 5px; /* Giảm padding hơn nữa trên màn hình nhỏ hơn */
    }
    .search-bar input[type="text"] {
        max-width: 180px; /* Giảm max-width hơn nữa */
    }
}

@media (max-width: 576px) {
    /* ... (các style hiện có cho .video-grid, .video-card, v.v.) ... */
    
    /* Điều chỉnh lại cho header để logo và search bar nằm ngang */
    .main-header .container {
        flex-direction: row; /* Đảm bảo logo và search bar nằm ngang */
        justify-content: space-between; /* Đẩy logo và search bar ra 2 biên */
        align-items: center;
        padding: 0 10px; /* Giảm padding cho container header */
    }
    
    .main-header .logo {
        flex-shrink: 0; /* Ngăn logo bị co lại */
        margin-right: 10px; /* Khoảng cách giữa logo và search bar */
        order: 1;
    }
    .main-header .logo a {
        font-size: 1.6rem; /* Giảm kích thước logo trên mobile */
    }

    .search-bar {
        width: auto; /* Để flex container bên ngoài kiểm soát chiều rộng */
        flex-grow: 1; /* Cho phép search bar chiếm không gian còn lại */
        order: 2; /* Đặt search bar sau logo */
        justify-content: flex-end; /* Căn phải nội dung bên trong search bar */
        padding: 0; /* Bỏ padding để tối đa hóa không gian */
        margin-top: 0; /* Đảm bảo không có margin top dư thừa */
    }
    .search-bar input[type="text"] {
        max-width: 130px; /* Giảm max-width cho input trên màn hình rất nhỏ */
        padding: 6px 8px; /* Giảm padding */
        font-size: 0.8rem; /* Giảm font size */
    }
    .search-bar button {
        padding: 6px 10px; /* Giảm padding cho nút */
        font-size: 0.8rem; /* Giảm font size */
    }

    /* Đảm bảo menu mobile-toggle không bị ảnh hưởng */
    .mobile-menu-toggle {
        top: auto; /* Bỏ top cố định */
        right: auto; /* Bỏ right cố định */
        position: static; /* Hoặc relative, để nó nằm trong luồng flex */
        margin-left: 10px; /* Khoảng cách với search bar */
        order: 3; /* Đặt nút toggle sau search bar */
    }
    
    /* Điều chỉnh lại main-nav trên mobile nếu có class 'active' */
    .main-nav {
        width: 100%;
        order: 4; /* Đảm bảo menu nằm dưới cùng khi mở */
        /* Các quy tắc display: none/flex vẫn giữ nguyên */
    }

    /* Các điều chỉnh khác cho mobile */
    .section-title {
        font-size: 1.8rem; /* Giảm kích thước tiêu đề section */
    }
}

    /* Video Play Page - Stacking layout (đã là mặc định) */
    .video-play-page {
        gap: 30px;
    }
    .main-video-player,
    .video-details {
        flex: none; /* Bỏ flex grow */
        width: 100%; /* Chiếm toàn bộ chiều rộng */
        min-width: unset; /* Xóa min-width */
    }
    .video-details-title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    .section-title {
        font-size: 2rem;
    }
    .video-grid {
        /* Trên tablet nhỏ, 2 cột hoặc ít hơn */
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Ví dụ giảm xuống 220px */
        gap: 15px;
    }
    .video-details-title {
        font-size: 1.8rem;
    }
    .video-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .share-btn {
        display: flex; /* Mỗi nút share một hàng */
        margin-right: 0;
        width: 100%;
        justify-content: center;
    }
    /* Responsive Table */
    .admin-table, .admin-table thead, .admin-table tbody, .admin-table th, .admin-table td, .admin-table tr {
        display: block;
    }
    .admin-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .admin-table tr {
        border: 1px solid var(--border-color);
        margin-bottom: 10px;
        border-radius: 8px;
    }
    .admin-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }
    .admin-table td:before {
        position: absolute;
        top: 0;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--text-color);
    }
    .admin-table td:nth-of-type(1):before { content: "ID:"; }
    .admin-table td:nth-of-type(2):before { content: "Tiêu đề:"; }
    .admin-table td:nth-of-type(3):before { content: "Loại:"; }
    .admin-table td:nth-of-type(4):before { content: "Danh mục:"; }
    .admin-table td:nth-of-type(5):before { content: "Ngày đăng:"; }
    .admin-table td:nth-of-type(6):before { content: "Hành động:"; }
}

@media (max-width: 576px) {
    .video-grid {
        /* Trên điện thoại, 2 cột gần full màn hình */
        /* minmax(45%, 1fr) sẽ cố gắng tạo 2 cột mỗi cột ít nhất 45% chiều rộng của cha */
        grid-template-columns: repeat(auto-fit, minmax(45%, 1fr));
        gap: 10px; /* Giảm khoảng cách để tối ưu không gian */
        padding: 0 5px; /* Thêm padding nhỏ để cách lề màn hình */
    }
    .video-card {
        max-width: unset; /* Bỏ max-width để nó giãn theo cột grid */
        margin: 0; /* Bỏ margin auto để nó nằm sát nhau */
    }
    .video-title {
        font-size: 0.8rem; /* Có thể giảm thêm font-size để phù hợp */
        margin: 2px; /* Giảm margin cho tiêu đề */
        min-height: 2.6em; /* Điều chỉnh lại min-height cho font mới */
    }
    /* Các style khác cho mobile giữ nguyên */
    .main-header .container {
        padding: 0 10px; /* Giảm padding header trên mobile */
    }
    .main-content {
        padding: 1.5rem 0; /* Giảm padding cho nội dung chính */
    }
    .filter-sort-section {
        padding: 15px; /* Giảm padding cho bộ lọc */
    }
}
    .video-category, .video-description {
        margin: 0 15px 15px;
    }
    .main-video-player, .video-details {
        border-radius: 8px;
    }
    .video-details {
        padding: 20px;
    }
    .video-details-title {
        font-size: 1.5rem;
    }
    .share-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}
/* Styles for categories.php (All Categories Page) */
.category-list-section {
    padding: 30px 0;
}

.category-list-section .section-title {
    /* Đảm bảo tiêu đề được căn giữa và có gạch chân như các section-title khác */
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 15px;
}

.category-list-section .section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 5px;
    background: var(--primary-color);
    border-radius: 3px;
}


.category-list {
    list-style: none;
    display: grid;
    /* Tự động tạo cột, mỗi cột min 250px, tối đa 1fr */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px; /* Khoảng cách giữa các card danh mục */
    margin-top: 30px;
    justify-content: center; /* Căn giữa lưới */
}

.category-list li {
    background: var(--card-bg-color);
    border-radius: 12px; /* Bo tròn nhiều hơn */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); /* Shadow rõ hơn */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden; /* Đảm bảo nội dung không tràn ra ngoài border-radius */
    display: flex; /* Dùng flex để căn giữa nội dung trong card */
    flex-direction: column;
    justify-content: center; /* Căn giữa theo chiều dọc */
    align-items: center; /* Căn giữa theo chiều ngang */
    text-align: center;
    min-height: 150px; /* Chiều cao tối thiểu cho card danh mục */
    padding: 20px; /* Padding bên trong card */
}

.category-list li:hover {
    transform: translateY(-8px); /* Hiệu ứng nhấc lên rõ hơn */
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2); /* Shadow rõ hơn khi hover */
}

.category-item {
    display: block; /* Đảm bảo link chiếm toàn bộ không gian */
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: var(--text-color); /* Màu chữ mặc định */
    font-size: 1.6rem; /* Kích thước chữ lớn hơn */
    font-weight: bold;
    line-height: 1.3;
    /* Dùng Flexbox để căn giữa nội dung bên trong link */
    display: flex;
    justify-content: center;
    align-items: center;
}

.category-item:hover {
    background-color: var(--primary-color); /* Nền đỏ khi hover */
    color: white; /* Chữ trắng khi hover */
    text-decoration: none;
}

/* Thêm icon nếu muốn (cần thêm i tag vào HTML) */
/*
.category-item i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    transition: color 0.3s ease;
}
.category-item:hover i {
    color: white;
}
*/

/* Responsive for category list */
@media (max-width: 992px) {
    .category-list {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    .category-list li {
        min-height: 130px;
        padding: 15px;
    }
    .category-item {
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) {
    .category-list {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
    }
    .category-list li {
        min-height: 120px;
    }
    .category-item {
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    .category-list {
        grid-template-columns: 1fr; /* Một cột trên màn hình rất nhỏ */
        gap: 10px;
        padding: 0 10px; /* Padding để cách lề màn hình */
    }
    .category-list li {
        min-height: 100px;
        border-radius: 8px;
        padding: 15px;
    }
    .category-item {
        font-size: 1.2rem;
    }
}
/* Footer Keywords Section */
.footer-keywords {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1); /* Đường kẻ phân chia nhẹ nhàng */
}

.footer-keywords h3 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-keywords .keyword-tag {
    /* Tái sử dụng style của keyword-tag từ trang play, nhưng điều chỉnh cho footer */
    background: #333; /* Màu nền tối hơn cho footer */
    color: #bbb; /* Màu chữ sáng hơn */
    border: 1px solid #555;
    margin: 4px 6px 4px 0; /* Khoảng cách nhỏ hơn */
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 20px;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.footer-keywords .keyword-tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    text-decoration: none;
}