/* --- GLOBAL RESET & BASE STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

a {
    text-decoration: none;
    transition: color .3s ease;
}

a:hover {
    text-decoration: underline;
}

/* --- DARK/LIGHT MODE VARIABLES --- */
:root {
    /* MÀU CỐ ĐỊNH (Primary/Accent) */
    --accent-color: #d45e5e;      
    --accent-hover: #d3a61f;
    --success-color: #28a745;
    --error-color: #dc3545;

    /* LIGHT MODE (Mặc định) */
    --bg-primary: #f4f4f4;          
    --bg-secondary: #ffffff;        
    --text-primary: #333333;        
    --text-secondary: #555555;      
    --border-color: #dddddd;        
    --shadow-color: rgba(0, 0, 0, 0.15);
    --link-color: var(--accent-color);
    --hover-color: var(--accent-hover);
    --header-bg: #1a1a1a;           
    --header-text: #f0f0f0;
}

/* DARK MODE */
body.dark-mode {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --link-color: #f0c367; 
    --hover-color: #f7d598;
    --header-bg: #1e1e1e;           
    --header-text: #e0e0e0;
}

/* --- ÁP DỤNG BIẾN MÀU --- */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

a {
    color: var(--link-color);
}

a:hover {
    color: var(--hover-color);
}

/* --- HEADER --- */
.main-header {
    background-color: var(--header-bg);
    box-shadow: 0 2px 8px var(--shadow-color);
    padding: 1rem 0;
    margin-bottom: 20px;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo a {
    color: var(--accent-color);
    font-size: 2rem;
    font-weight: 700;
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
}

.main-nav ul li a {
    color: var(--header-text); 
    font-weight: 500;
    padding: 8px 0;
}

.main-nav ul li a:hover {
    color: var(--accent-color);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-bar input[type="text"] {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    background-color: var(--bg-secondary); 
    color: var(--text-primary);
    outline: none;
    width: 220px;
    transition: width .3s ease, border-color .3s ease;
}

.search-bar button {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    margin-left: 10px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    padding: 0;
    margin-right: 15px; 
    color: var(--header-text); 
    transition: transform 0.2s;
}

.mobile-menu-toggle {
    display: none; 
    background:none;
    border:none;
    cursor:pointer;
    padding:10px;
    z-index:1000;
    position:relative
}
.mobile-menu-toggle span{
    display:block;
    width:25px;
    height:3px;
    background:var(--header-text);
    margin:5px 0;
    transition:.4s
}

/* --- VIDEO GRID & SECTIONS --- */
.main-content {
    flex: 1;
    padding: 3rem 0;
}

.section-title {
    font-size: 1.8rem; /* Kích thước tiêu đề ngoài trang chủ */
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 15px;
    font-weight: 700;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px; 
    background: var(--accent-color);
    border-radius: 3px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px; 
    margin-top: 1rem;
}

.video-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform .3s ease, box-shadow .3s ease;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}

.video-views {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: .85rem;
    font-weight: 700;
}

/* TIÊU ĐỀ VIDEO TRONG CARD (Trang chủ/Danh mục) */
.video-card .video-title {
    font-size: 0.8rem;
    margin: 10px 15px 15px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.4em; 
    font-weight: 600;
    line-height: 1.2;
    padding: 0; 
}

/* --- PLAY PAGE LAYOUT TWEAKS --- */

/* 1. Breadcrumb - Thân thiện SEO & Điều hướng */
.breadcrumb {
    padding: 15px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    align-items: center;
}
.breadcrumb a {
    color: var(--text-secondary);
    transition: color 0.3s;
}
.breadcrumb a:hover {
    color: var(--accent-color);
}
.breadcrumb span {
    color: var(--accent-color);
    font-weight: 600;
}

/* 2. Tiêu đề Video (H1 - Rất quan trọng cho SEO) */
h1.video-title {
    font-size: 1.8rem;
    line-height: 1.4;
    font-weight: 800;
    margin: 10px 0 20px 0;
    color: var(--text-primary);
    display: block;
}

/* 3. Khung trình phát Video (Hiện đại) */
.video-player-container {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px var(--shadow-color);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}
.video-embed-box {
    position: relative;
    padding-bottom: 56.25%; /* Tỷ lệ 16:9 */
    height: 0;
}
.video-embed-box iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 4. Server Switcher (Nút chọn Server) */
.server-selector-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}
.server-selector-buttons span {
    font-weight: 700;
    font-size: 0.9rem;
    margin-right: 5px;
}
.server-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.server-btn.active {
    background: var(--accent-color);
    color: #000 !important;
    border-color: var(--accent-color);
}
.server-btn:hover:not(.active) {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* 5. Khối Mô tả Video (Description) */
.video-description {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}
.video-description h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 6. Tags Danh mục dưới mô tả */
.video-category-tags {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}
.category-tag {
    display: inline-block;
    background: var(--bg-primary);
    color: var(--text-secondary) !important;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-right: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    font-weight: 600;
}
.category-tag:hover {
    background: var(--accent-color);
    color: #000 !important;
    border-color: var(--accent-color);
}

/* 7. Related Videos (Video liên quan) */
.related-videos-section h3 {
    font-size: 0.8rem;
    margin-bottom: 20px;
    padding-left: 10px;
    border-left: 4px solid var(--accent-color);
}

/* --- RESPONSIVE CHO TRANG PLAY --- */
@media (max-width: 768px) {
    h1.video-title {
        font-size: 1.4rem;
    }
    .video-description {
        padding: 15px;
    }
    .server-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* --- FOOTER & KEYWORDS (Khắc phục lỗi Ghi đè) --- */
footer {
    margin-top: auto;
    padding: 2rem 0;
    background: var(--header-bg);
    color: var(--header-text);
    text-align: center;
    box-shadow: 0 -2px 8px var(--shadow-color);
}

.footer-keywords {
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
}

.footer-keywords h3 {
    color: var(--text-primary);
    font-size: 1.2em;
    margin-bottom: 15px;
}

/* Thẻ từ khóa */
.keyword-tag {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px 6px 4px 0;
    background: var(--bg-secondary); 
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: .85rem;
    transition: background .3s ease, color .3s ease, border-color .3s ease;
    white-space: nowrap;
}

.keyword-tag:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}


/* --- ADMIN DASHBOARD & TABLES (Trang index.php & manage_videos.php) --- */

.admin-panel {
    border-top: 4px solid var(--accent-color); /* Tạo điểm nhấn phía trên khối admin */
}

/* Tối ưu hóa Table Admin */
.admin-table {
    margin-top: 15px;
    border: 1px solid var(--border-color);
}

.admin-table th {
    padding: 15px 20px;
    text-align: left;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    background-color: var(--accent-color);
}

.admin-table td {
    padding: 12px 20px;
    font-size: 0.95rem;
    vertical-align: middle;
}

/* Link tiêu đề video trong admin */
.admin-table td a {
    font-weight: 600;
    color: var(--link-color);
}

.admin-table td a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Các nút hành động trong bảng */
.actions {
    display: flex;
    gap: 8px;
}

.btn-edit, .btn-delete {
    padding: 6px 14px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    color: #fff !important;
    text-transform: none !important;
}

.btn-edit {
    background-color: var(--success-color) !important;
    border: 1px solid rgba(0,0,0,0.1);
}

.btn-delete {
    background-color: var(--error-color) !important;
    border: 1px solid rgba(0,0,0,0.1);
}

.btn-edit:hover, .btn-delete:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px var(--shadow-color);
}


/* --- ADMIN FORM ENHANCEMENTS (Trang edit_video.php & index.php admin) --- */

.add-video-form, .add-category-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
    font-weight: 600;
}

/* Các ô input và textarea */
.add-video-form input, 
.add-video-form textarea, 
.add-video-form select {
    background-color: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    padding: 12px !important;
    border-radius: 6px !important;
    transition: all 0.3s ease !important;
}

.add-video-form input:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(228, 183, 48, 0.15) !important;
}

/* Tối ưu cho khung đa chọn danh mục (Multiple Select) */
select[multiple] {
    height: 120px;
    padding: 10px !important;
}

/* Tối ưu cho phần Server Link */
.server-entry {
    background-color: var(--bg-primary);
    border: 1px dashed var(--accent-color) !important; /* Tạo viền nét đứt để phân biệt các server */
    padding: 20px !important;
    margin-bottom: 15px !important;
    position: relative;
    border-radius: 8px;
}

.server-entry h4 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: var(--accent-color);
}

.remove-server-btn {
    background: #ff4d4d;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: bold;
}


/* --- MANAGE CATEGORIES SPECIFIC (Trang manage_categories.php) --- */

.add-category-form {
    max-width: 500px;
    margin: 0 auto 30px;
    padding: 20px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.add-category-form .submit-btn {
    padding: 10px 20px;
    font-size: 1rem;
}


/* --- STATUS MESSAGES --- */

.status-message {
    border-left: 5px solid transparent;
}

.status-message.success {
    background-color: rgba(40, 167, 69, 0.15) !important;
    color: var(--success-color) !important;
    border-left-color: var(--success-color);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.status-message.error {
    background-color: rgba(220, 53, 69, 0.15) !important;
    color: var(--error-color) !important;
    border-left-color: var(--error-color);
    border: 1px solid rgba(220, 53, 69, 0.2);
}


/* --- RESPONSIVE ADMIN --- */

@media (max-width: 768px) {
    .admin-panel {
        padding: 15px;
    }
    .admin-table th, .admin-table td {
        padding: 10px;
    }
    .actions {
        flex-direction: column;
    }
}
/* --- TỐI ƯU HÓA NÚT ADMIN CHO 2 CHẾ ĐỘ --- */

/* 1. Nút Thêm Video / Lưu (Nút chính - Primary) */
.submit-btn, .btn-primary {
    background: var(--accent-color);
    color: #1a1a1a !important; /* Chế độ sáng thường để chữ tối cho rõ */
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(228, 183, 48, 0.3);
}

/* Tối ưu nút chính cho Dark Mode */
body.dark-mode .submit-btn, 
body.dark-mode .btn-primary {
    background: var(--accent-color);
    color: #000 !important; /* Chữ đen trên nền vàng rất nổi trong tối */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* 2. Nút Thêm Server / Nút Phụ (Secondary) */
button[onclick="addServer()"], .btn-secondary {
    background-color: #e0e0e0; /* Nền xám nhạt ở chế độ sáng */
    color: #333 !important;
    border: 1px solid #ccc;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 10px;
}

/* Tối ưu nút phụ cho Dark Mode */
body.dark-mode button[onclick="addServer()"], 
body.dark-mode .btn-secondary {
    background-color: #2d324d; /* Nền xanh đen tối */
    color: #e1e1e1 !important;
    border: 1px solid var(--border-color);
}
body.dark-mode button[onclick="addServer()"]:hover {
    background-color: #3d4466;
}

/* 3. Các nút Menu Quản lý (Xem Video, Quản lý danh mục...) */
.admin-action-link {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
}

/* Tối ưu Menu Quản lý cho Dark Mode */
body.dark-mode .admin-action-link {
    background: #1a1d2e;
    color: #ffffff;
    border-color: #3d4466;
}
body.dark-mode .admin-action-link a:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* 4. Nút Đăng xuất (Logout) */
.btn-logout, a[href*="logout"] {
    background: transparent;
    border: 2px solid var(--error-color);
    color: var(--error-color) !important;
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 700;
}

/* Tối ưu Đăng xuất cho Dark Mode */
body.dark-mode .btn-logout, 
body.dark-mode a[href*="logout"] {
    border-color: #ff5e5e; /* Màu đỏ sáng hơn một chút để không bị chìm */
    color: #ff5e5e !important;
}
body.dark-mode .btn-logout:hover, 
body.dark-mode a[href*="logout"]:hover {
    background: #ff5e5e;
    color: #fff !important;
}

/* 5. Nút Sửa/Xóa trong bảng Admin */
.btn-edit { background: #27ae60; color: #fff !important; }
.btn-delete { background: #c0392b; color: #fff !important; }

body.dark-mode .btn-edit { background: #2ecc71; } /* Sáng hơn trong nền tối */
body.dark-mode .btn-delete { background: #e74c3c; } /* Sáng hơn trong nền tối */

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 992px) {
    .main-nav { display: none; }
    h1.video-title { font-size: 1.6em; }
    .section-title { font-size: 1.5em; text-align: center; }
    .video-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

@media (max-width: 576px) {
    .search-bar input[type="text"] { max-width: 130px; }
    .mobile-menu-toggle { display: block; }
    h1.video-title { font-size: 1.4em; }
    .video-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .video-card .video-title { font-size: 0.9em; margin: 5px; }
    .related-video-grid { grid-template-columns: repeat(2, 1fr); }
}
/* --- CATEGORY LIST PAGE STYLES --- */

.category-list-section {
    padding: 30px 0;
    /* Sử dụng lại .section-title chung cho tiêu đề trang */
}

/* Khối Lưới Danh mục */
.category-list {
    list-style: none;
    display: grid;
    /* Hiển thị 4 cột trên desktop, minwidth 250px */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 30px;
    justify-content: center;
}

.category-list li {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform .3s ease, box-shadow .3s ease;
    overflow: hidden;
    
    /* Căn giữa nội dung trong mỗi card */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 150px;
    padding: 20px;
}

.category-list li:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow-color);
}

/* Liên kết Danh mục */
.category-item {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: var(--text-primary);
    
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.3;
    
    /* Đảm bảo link chiếm toàn bộ không gian li */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.category-item:hover {
    background-color: var(--accent-color);
    color: #fff; /* Màu chữ trắng khi hover */
    text-decoration: none;
}

/* --- RESPONSIVE CHO DANH MỤC --- */

@media (max-width: 992px) {
    .category-list {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    .category-list li {
        min-height: 130px;
    }
    .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 {
        /* Chuyển sang bố cục danh sách 1 cột trên điện thoại nhỏ */
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0 10px;
    }
    .category-list li {
        min-height: 100px;
        border-radius: 8px;
        padding: 15px;
    }
    .category-item {
        font-size: 1.2rem;
    }
}
/* --- ADMIN LOGIN PAGE STYLES (Khôi phục) --- */

.admin-login-page {
    /* Đảm bảo trang đăng nhập hiển thị ở giữa màn hình */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Chiếm toàn bộ chiều cao màn hình */
    padding: 50px 20px;
    background-color: var(--bg-primary); /* Sử dụng nền chính */
}

.admin-login-page .admin-panel {
    /* Khối panel đăng nhập */
    max-width: 450px;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 10px 30px var(--shadow-color);
    text-align: center;
}

.admin-login-page .panel-title {
    /* Tiêu đề "Admin Login" */
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 15px;
    font-weight: 700;
}

.admin-login-page .panel-title::after {
    /* Thanh gạch ngang dưới tiêu đề */
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

.login-form .form-group {
    margin-bottom: 25px;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text-primary);
    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-primary);
    background-color: var(--bg-primary); /* Nền input đồng nhất */
    transition: border-color .3s ease, box-shadow .3s ease;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(228, 183, 48, 0.2);
    outline: none;
}

.login-form .submit-btn {
    display: block;
    width: 100%;
    padding: 15px 25px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .3s ease, transform .3s ease;
    margin-top: 25px;
}

/* --- ADMIN COMMON STYLES (Forms & Tables) --- */

.admin-page {
    background-color: var(--bg-primary);
    padding: 30px 0;
}

.admin-panel {
    background-color: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 20px var(--shadow-color);
    max-width: 900px;
    margin: 30px auto; /* Điều chỉnh margin */
}

.admin-panel .panel-title {
    color: var(--accent-color);
    font-weight: 700;
}

/* Form Inputs (Dùng chung cho Add/Edit Video & Category) */
.add-video-form input[type="text"],
.add-video-form textarea,
.add-video-form select,
.add-category-form input[type="text"],
.add-video-form input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
    background-color: var(--bg-primary); /* Nền input đồng nhất */
    transition: border-color .3s ease;
}
.add-video-form input:focus, .add-video-form textarea:focus, .add-video-form select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(228, 183, 48, 0.2);
    outline: none;
}

/* Form Buttons */
.add-video-form .submit-btn,
.add-category-form .submit-btn,
.login-form .submit-btn {
    background: var(--accent-color);
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
}
.add-video-form .submit-btn:hover,
.add-category-form .submit-btn:hover,
.login-form .submit-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* --- TỐI ƯU MÔ TẢ XEM THÊM/RÚT GỌN --- */
/* --- CSS MÔ TẢ TỐI ƯU --- */
.description-content {
    position: relative;
    max-height: 150px; /* Chiều cao cố định ban đầu */
    overflow: hidden;
    transition: max-height 0.4s ease-in-out; /* Chỉ giữ transition cho max-height */
    color: var(--text-secondary);
}

/* Lớp phủ mờ khi đang đóng */
.description-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--bg-secondary));
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
}

/* Khi mở rộng, chúng ta sẽ điều khiển bằng Style trực tiếp từ JS để mượt hơn */
/* --- CATEGORY TAGS UNDER DESCRIPTION --- */
.video-category-tags {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color); /* Đường phân cách */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.video-category-tags strong {
    font-size: 1em;
    color: var(--text-primary);
    margin-right: 15px;
    font-weight: 700;
}

.category-tag {
    display: inline-block;
    padding: 6px 12px;
    margin: 5px 8px 5px 0;
    background: var(--bg-primary); /* Nền thẻ */
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    text-decoration: none !important; /* Loại bỏ gạch chân mặc định */
}

.category-tag:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    text-decoration: none !important;
}

/* Responsive */
@media (max-width: 576px) {
    .video-category-tags strong {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }
}
/* --- PAGINATION STYLES (Phân trang) --- */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px; /* Khoảng cách giữa các nút */
}

.pagination-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    
    /* Điều chỉnh Padding để nút có cảm giác to hơn */
    padding: 10px 18px; 
    
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary); /* Màu chữ mặc định */
    background-color: var(--bg-secondary); /* Nền nút */
    text-decoration: none;
    font-weight: 700;
    min-width: 40px;
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
    font-size: 0.95em;
}

.pagination-link:hover:not(.active):not(.disabled) {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    text-decoration: none;
    /* Thêm hiệu ứng nâng nhẹ */
    box-shadow: 0 2px 5px rgba(228, 183, 48, 0.3);
}

.pagination-link.active {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    cursor: default;
}

.pagination-link.disabled {
    color: var(--text-secondary);
    border-color: var(--border-color);
    cursor: not-allowed;
    background-color: var(--bg-primary); /* Nền hơi xám */
    opacity: 0.6;
}

/* TỐI ƯU CHO NÚT PREVIOUS/NEXT */

/* Làm nổi bật các nút điều hướng chính */
.pagination-link:first-child,
.pagination-link:last-child {
    background-color: var(--bg-secondary); /* Giữ nền để làm nổi bật border */
    border: 1px solid var(--text-secondary); /* Border nổi bật hơn */
    color: var(--text-primary);
    font-size: 1em; /* To hơn một chút */
    padding: 10px 20px;
}

.pagination-link:first-child:hover:not(.disabled),
.pagination-link:last-child:hover:not(.disabled) {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}
/* --- VIDEO SHARE BAR --- */
.video-share-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.share-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff !important;
    font-size: 1.1rem;
    transition: transform 0.3s, opacity 0.3s;
    border: none;
    cursor: pointer;
}

.share-btn:hover {
    transform: translateY(-3px);
    opacity: 0.9;
}

.share-btn.facebook { background-color: #1877f2; }
.share-btn.twitter { background-color: #000000; } /* X Color */
.share-btn.telegram { background-color: #0088cc; }

.share-btn.copy-link {
    width: auto;
    border-radius: 20px;
    padding: 0 15px;
    background-color: var(--bg-secondary);
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 600;
}

body.dark-mode .share-btn.twitter { background-color: #f1f1f1; color: #000 !important; }
body.dark-mode .share-btn.copy-link { background-color: #2d324d; }

/* Hiệu ứng khi copy thành công */
.copy-success {
    color: var(--success-color) !important;
    border-color: var(--success-color) !important;
}
.share-btn i {
    pointer-events: none; /* Tránh icon làm gián đoạn sự kiện click */
}
.text {
	font-size: small;
}
/* --- VIDEO KEYWORDS STYLES --- */
.video-keywords-tags {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tag-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-tag {
    font-size: 0.85rem;
    color: var(--accent-color) !important;
    background: transparent;
    border: 1px solid var(--accent-color);
    padding: 4px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.keyword-tag:hover {
    background: var(--accent-color);
    color: #000 !important;
    text-decoration: none !important;
    transform: translateY(-2px);
}

/* Tinh chỉnh cho Dark Mode */
body.dark-mode .keyword-tag {
    border-color: rgba(228, 183, 48, 0.4);
    color: var(--accent-color) !important;
}

body.dark-mode .keyword-tag:hover {
    background: var(--accent-color);
    color: #000 !important;
    border-color: var(--accent-color);
}
/* Container chính chứa cả 2 nhóm */
.video-action-bar {
    display: flex;
    justify-content: space-between; /* Đẩy 2 nhóm về 2 phía */
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
    flex-wrap: wrap; /* Cho phép xuống dòng trên mobile */
    gap: 15px;
}

/* Nhóm bên trái */
.action-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Nhóm bên phải */
.action-right {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-item i {
    color: var(--accent-color);
}

/* --- RESPONSIVE CHO MOBILE --- */
@media (max-width: 768px) {
    .video-action-bar {
        flex-direction: column; /* Chuyển thành hàng dọc */
        align-items: flex-start; /* Căn lề trái toàn bộ */
        gap: 12px;
    }

    .action-right {
        width: 100%;
        justify-content: flex-start; /* Để view/date nằm dưới share */
        padding-top: 5px;
        border-top: 1px dashed var(--border-color);
        padding-top: 12px;
    }
    
    .share-label {
        display: none; /* Ẩn chữ Share trên mobile để tiết kiệm diện tích */
    }
}
/* --- LAYOUT TRANG PLAY --- */
.video-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin: 15px 0;
    flex-wrap: wrap;
    gap: 15px;
}

.action-left, .action-right { display: flex; align-items: center; gap: 15px; }

.share-buttons { display: flex; gap: 8px; }
.share-btn {
    width: 35px; height: 35px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff !important; transition: 0.3s; border: none; cursor: pointer;
}
.share-btn.facebook { background: #1877f2; }
.share-btn.twitter { background: #000; }
.share-btn.telegram { background: #0088cc; }
.share-btn.copy-link { width: auto; border-radius: 20px; padding: 0 15px; background: var(--bg-secondary); color: var(--text-primary) !important; border: 1px solid var(--border-color); font-size: 0.8rem; }
.share-btn.copy-link.copy-success { border-color: #2ecc71; color: #2ecc71 !important; }

.meta-item { font-size: 0.9rem; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }
.meta-item i { color: var(--accent-color); }

/* --- DESCRIPTION & TAGS --- */
.video-details-box { background: var(--bg-secondary); padding: 20px; border-radius: 8px; margin-bottom: 30px; }

.description-content {
    position: relative; max-height: 150px; overflow: hidden;
    transition: max-height 0.4s ease-in-out; margin: 15px 0;
    line-height: 1.6; color: var(--text-secondary);
}
.description-fade {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 50px;
    background: linear-gradient(transparent, var(--bg-secondary));
}
.description-content.expanded .description-fade { display: none; }

.video-keywords-tags { margin-top: 20px; border-top: 1px dashed var(--border-color); padding-top: 15px; }
.keyword-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.keyword-tag { color: #3498db !important; font-size: 0.85rem; font-weight: 500; }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .video-action-bar { flex-direction: column; align-items: flex-start; }
    .action-right { width: 100%; justify-content: space-between; border-top: 1px solid var(--border-color); padding-top: 15px; }
    .share-label { display: none; }
}