/* ==========================================================================
   1. CORE STYLES & THEME (KIẾM HIỆP DARK MODE)
   ========================================================================== */
   :root {
    --bg-dark: #0a0a0e;
    --bg-card: rgba(20, 20, 28, 0.85);
    --gold-primary: #f39c12;
    --gold-light: #f1c40f;
    --red-accent: #c0392b;
    --blue-accent: #2980b9;
    --border-color: rgba(243, 156, 18, 0.3);
    --text-color: #dcdde1;
  }

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: all 0.25s ease-in-out;
  }

  body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    background-image:
      radial-gradient(circle at 50% 0%, rgba(192, 57, 43, 0.15), transparent 70%),
      radial-gradient(circle at 80% 50%, rgba(243, 156, 18, 0.08), transparent 50%);
    background-attachment: fixed;
  }

  h1, h2, h3, .font-title {
    font-family: 'UVN Ban Mai', serif;
    letter-spacing: 1px;
  }

  a { color: inherit; text-decoration: none; }
  ul { list-style: none; }

  /* Custom Scrollbar Kiếm Hiệp */
  ::-webkit-scrollbar { width: 8px; }
  ::-webkit-scrollbar-track { background: #050508; }
  ::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--gold-primary), var(--red-accent));
    border-radius: 4px;
  }

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

  /* ==========================================================================
     2. HEADER & FOOTER
     ========================================================================== */
  .header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(10, 10, 14, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  }

  .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 75px;
  }

  .logo {
    font-size: 26px;
    font-weight: 800;
    color: var(--gold-primary);
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
  }

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

  .nav-link {
    font-family: 'UVN Ban Mai', serif;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 4px;
    color: #e1b12c;
    position: relative;
  }

  .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%; width: 0; height: 2px;
    background: var(--gold-light);
    transition: 0.3s;
    transform: translateX(-50%);
  }

  .nav-link:hover::after, .nav-link.active::after { width: 80%; }
  .nav-link:hover { color: #fff; text-shadow: 0 0 8px var(--gold-primary); }

  footer {
    border-top: 1px solid var(--border-color);
    background: #050508;
    padding: 30px 0;
    text-align: center;
    font-size: 14px;
    color: #777;
    margin-top: 40px;
  }

  /* ==========================================================================
     3. COMPONENTS DÙNG CHUNG
     ========================================================================== */
  /* Nút bấm Kiếm hiệp */
  .btn-kiemhiep {
    padding: 16px;
    text-align: center;
    font-family: 'UVN Ban Mai', serif;
    font-weight: 800;
    font-size: 18px;
    text-transform: uppercase;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    border: 1px solid var(--gold-primary);
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    display: block;
  }

  /* Styling chuẩn cho thẻ <a> làm Nút Bấm */
a.btn-kiemhiep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Khoảng cách giữa icon và chữ */
    text-decoration: none; /* Xóa gạch chân mặc định của thẻ a */
    cursor: pointer;

    /* Giữ nguyên màu sắc & khung style kiếm hiệp của bạn */
    background: #1a1a1a;
    color: #c5a059;
    border: 1px solid #8c2424;
    padding: 10px 20px;
    font-family: 'Playfair Display', serif, sans-serif;
    font-weight: bold;
    transition: all 0.3s ease;
  }

  /* 1. Xử lý Icon dạng Ảnh (Cách 1) */
  a.btn-kiemhiep .btn-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    transition: transform 0.3s ease;
  }

  a.btn-kiemhiep:hover .btn-icon {
    transform: scale(1.15) rotate(-5deg);
  }

  /* 2. Xử lý Icon dạng SVG (Cách 2) */
  a.btn-kiemhiep .btn-icon-svg {
    width: 20px;
    height: 20px;
    fill: #c5a059;
    transition: all 0.3s ease;
  }

  a.btn-kiemhiep:hover .btn-icon-svg {
    fill: #ffffff;
    transform: scale(1.1);
  }

  /* 3. Xử lý Icon bằng CSS Background (Cách 3) */
  a.btn-kiemhiep::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url('assets/images/icon-dragon.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.3s ease;
  }

  a.btn-kiemhiep:hover::before {
    transform: scale(1.2);
  }

  /* Hiệu ứng Hover chung cho Thẻ <a> */
  a.btn-kiemhiep:hover {
    background: #8c2424;
    color: #ffffff;
  }

  .btn-register { background: linear-gradient(135deg, #b71540, #c0392b); color: #fff; }
  .btn-login { background: linear-gradient(135deg, #f39c12, #e67e22); color: #000; }
  .btn-kiemhiep:hover { transform: translateY(-3px); box-shadow: 0 0 20px var(--gold-primary); }

  /* Badges */
  .badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    margin-right: 10px;
    font-weight: bold;
  }
  .badge-tintuc { background: var(--blue-accent); color: #fff; }
  .badge-sukien { background: var(--red-accent); color: #fff; }
  .badge-thongbao { background: var(--gold-primary); color: #000; }

  /* Custom Modal */
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; z-index: 2000;
  }
  .modal-overlay.show { opacity: 1; pointer-events: auto; }
  .modal-card {
    background: #14141c; border: 2px solid var(--gold-primary);
    border-radius: 10px; padding: 30px; max-width: 400px; width: 90%;
    text-align: center; transform: scale(0.8);
    box-shadow: 0 0 30px rgba(243, 156, 18, 0.4);
  }
  .modal-overlay.show .modal-card { transform: scale(1); }
  .modal-icon { font-size: 45px; margin-bottom: 15px; }
  .modal-card.success .modal-icon { color: var(--gold-primary); }
  .modal-card.error .modal-icon { color: var(--red-accent); }
  .modal-btn {
    margin-top: 20px; padding: 8px 25px; background: var(--gold-primary);
    border: none; font-weight: bold; border-radius: 4px; cursor: pointer;
  }

  /* ==========================================================================
     4. STYLES TRANG CHỦ (INDEX)
     ========================================================================== */
  .banner-slider {
    position: relative; height: 420px; margin: 20px 0;
    border-radius: 12px; overflow: hidden; border: 1px solid var(--border-color);
  }
  .slide {
    position: absolute; inset: 0; opacity: 0; background-size: cover;
    background-position: center; display: flex; align-items: flex-end; padding: 40px;
  }
  .slide.active { opacity: 1; }
  .slide-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,10,14,0.9) 10%, transparent 70%); }
  .slide-caption { position: relative; z-index: 2; border-left: 4px solid var(--gold-primary); padding-left: 15px; }

  .auth-cta-group { display: flex; gap: 20px; margin-bottom: 25px; }
  .auth-cta-group .btn-kiemhiep { flex: 1; }

  /* Layout tổng cho Section News */
.news-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
  }

  /* Chia 2 cột: Cột Video (40%) - Cột Tin Tức (60%) */
  .news-media-grid {
    display: grid;
    grid-template-columns: 42% 1fr;
    gap: 20px;
    align-items: flex-start;
  }

  /* KHUNG VIDEO RESPONSIVE (Tỷ lệ 16:9) */
  .video-box {
    background: rgba(10, 10, 14, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
  }

  .video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Tỷ lệ khung hình 16:9 chuẩn */
    height: 0;
  }

  .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  .video-caption {
    padding: 10px 12px;
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--gold-primary);
    background: rgba(0, 0, 0, 0.6);
    border-top: 1px solid rgba(243, 156, 18, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* KHUNG TABS TIN TỨC */
  .news-tabs-container {
    width: 100%;
    box-sizing: border-box; /* Bắt buộc để padding/border không làm tăng width */
    margin: 0; /* Đảm bảo không bị dính margin âm hoặc dương đẩy lệch layout */
    overflow: hidden; /* Cắt bỏ phần thừa nếu có thuộc tính con thò ra ngoài */
  }

  .tab-headers {
    display: flex;
    border-bottom: 2px solid rgba(243, 156, 18, 0.2);
    margin-bottom: 12px;
  }

  .tab-item {
    padding: 8px 18px;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    cursor: pointer;
    color: #aaa;
  }

  .tab-item.active {
    color: var(--gold-primary);
    border-bottom: 3px solid var(--gold-primary);
  }

  .news-list { display: none; }
  .news-list.active { display: block; }

  .news-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
    font-size: 14px;
  }

  .news-row:hover {
    background: rgba(243, 156, 18, 0.05);
  }

  .news-row a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
  }

  /* RESPONSIVE CHO MOBILE */
  @media (max-width: 868px) {
    .news-media-grid {
      grid-template-columns: 1fr; /* Tự động xếp video lên trên, tin tức xuống dưới */
    }
  }

  .tab-headers { display: flex; border-bottom: 2px solid rgba(243, 156, 18, 0.2); margin-bottom: 15px; }
  .tab-item { padding: 10px 25px; font-family: 'UVN Ban Mai', serif; font-weight: 700; cursor: pointer; color: #aaa; }
  .tab-item.active { color: var(--gold-primary); border-bottom: 3px solid var(--gold-primary); }
  .news-list { display: none; }
  .news-list.active { display: block; }
  .news-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed rgba(255,255,255,0.08); }

  .feature-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; margin-bottom: 30px; }
  .btn-column { display: flex; flex-direction: column; gap: 10px; }
  /* Tối ưu thẻ <a> đóng vai trò Nút Bấm */
a.feature-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Khoảng cách giữa Icon và Tên Môn Phái */
    text-decoration: none;
    cursor: pointer;
    user-select: none;

    /* Giữ nguyên các style kích thước, màu sắc nền, border của feature-btn cũ */
    padding: 10px 18px;
    background: rgba(20, 20, 20, 0.8);
    color: #c5a059;
    border: 1px solid #8c2424;
    border-radius: 4px;
    font-family: 'Playfair Display', serif, sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
  }

  /* Style cho Icon SVG (Cách 1) */
  a.feature-btn .feature-btn-icon {
    width: 18px;
    height: 18px;
    fill: currentColor; /* Tự động ăn theo màu chữ của nút */
    transition: transform 0.3s ease;
  }

  /* Style cho Icon Ảnh (Cách 2) */
  a.feature-btn .feature-btn-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    transition: transform 0.3s ease;
  }

  /* Hiệu ứng khi Active hoặc Hover */
  a.feature-btn.active,
  a.feature-btn:hover {
    background: #8c2424;
    color: #ffffff;
    border-color: #f39c12;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.3);
  }

  /* Hiệu ứng phóng nhẹ Icon khi Hover */
  a.feature-btn:hover .feature-btn-icon,
  a.feature-btn:hover .feature-btn-img {
    transform: scale(1.15);
  }
  .preview-box { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; min-height: 350px; display: flex; align-items: center; }
  .preview-img { width: 100%; height: 100%; object-fit: cover; }
  .preview-img.changing { opacity: 0; transform: scale(0.96); }

  /* Layout chung cho BXH */
/* Layout tổng full 100% theo parent div */
.bxh-section,
.bxh-container {
  width: 100%;
  box-sizing: border-box;
}

/* THANH TAB NÚT BẤM: Kéo dài full 100% width */
.bxh-tabs {
  display: flex;
  width: 100%;
  margin-bottom: 0;
  gap: 0; /* Liền mạch full width */
}

/* Mỗi nút chiếm đều % chiều rộng (4 nút = 25% mỗi nút) */
.bxh-tabs .tab-btn {
  flex: 1;
  text-align: center;
  background: rgba(15, 15, 20, 0.9);
  color: #c5a059; /* Màu vàng kim */
  border: 1px solid var(--border-color, #8c2424);
  border-bottom: 2px solid var(--border-color, #8c2424);
  padding: 12px 5px;
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
}

.bxh-tabs .tab-btn:hover,
.bxh-tabs .tab-btn.active {
  background: var(--border-color, #8c2424);
  color: #ffffff;
  border-bottom: 2px solid #f39c12; /* Điểm nhấn vàng */
}

/* Khung chứa bảng bên dưới */
.bxh-content {
  width: 100%;
  background: rgba(10, 10, 14, 0.95);
  border: 1px solid var(--border-color, #8c2424);
  border-top: none; /* Liền với thanh tab nút bấm */
  padding: 15px;
  box-sizing: border-box;
}

.bxh-pane {
  display: none;
  width: 100%;
}

.bxh-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* BẢNG XẾP HẠNG: Full 100% Width, 3 cột */
.bxh-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 14px;
  color: #e0e0e0;
}

.bxh-table th {
  background: rgba(140, 36, 36, 0.3);
  color: #f39c12;
  padding: 10px;
  font-family: 'Playfair Display', serif;
  border-bottom: 1px solid rgba(243, 156, 18, 0.3);
}

.bxh-table td {
  padding: 9px 5px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.bxh-table tbody tr:hover {
  background: rgba(243, 156, 18, 0.08);
}

/* Huy hiệu xếp hạng Top 1, 2, 3 */
.rank {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #aaa;
}

.rank-1 { background: #f1c40f; color: #000; box-shadow: 0 0 6px #f1c40f; }
.rank-2 { background: #bdc3c7; color: #000; box-shadow: 0 0 6px #bdc3c7; }
.rank-3 { background: #e67e22; color: #fff; box-shadow: 0 0 6px #e67e22; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive cho màn hình nhỏ/mobile */
@media (max-width: 600px) {
  .bxh-tabs .tab-btn {
    font-size: 12px;
    padding: 8px 2px;
  }
  .bxh-table th, .bxh-table td {
    padding: 6px 2px;
    font-size: 12px;
  }
}

  /* Mặc định ẩn tất cả Pane, chỉ hiện Pane có class active */
  .tab-pane {
    display: none;
  }

  .tab-pane.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
  }

  /* Hiệu ứng mượt khi đổi Tab */
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* ==========================================================================
     5. STYLES TRANG ĐĂNG KÝ / ĐĂNG NHẬP
     ========================================================================== */
  .form-container {
    max-width: 500px; margin: 40px auto; background: var(--bg-card);
    border: 1px solid var(--border-color); border-radius: 10px; padding: 30px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
  }
  .form-title { text-align: center; color: var(--gold-primary); font-size: 26px; margin-bottom: 25px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
  .form-group { margin-bottom: 20px; }
  .form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #aaa; }
  .form-control {
    width: 100%; padding: 12px 15px; background: rgba(10, 10, 14, 0.8);
    border: 1px solid rgba(243, 156, 18, 0.2); border-radius: 4px; color: #fff; font-size: 15px;
  }
  .form-control:focus { outline: none; border-color: var(--gold-primary); box-shadow: 0 0 8px rgba(243, 156, 18, 0.4); }

  /* ==========================================================================
     6. STYLES TRANG TIN TỨC (STICKY & SCROLLABLE)
     ========================================================================== */
  .news-page-layout { display: flex; gap: 25px; margin: 30px 0; position: relative; }
  .sticky-tabs-sidebar {
    position: sticky; top: 90px; width: 220px; height: fit-content;
    display: flex; flex-direction: column; gap: 10px; z-index: 100;
  }
  .sticky-tab-btn {
    padding: 14px 18px; background: var(--bg-card); border: 1px solid var(--border-color);
    color: #bbb; border-radius: 6px; cursor: pointer; font-family: 'UVN Ban Mai', serif; font-weight: 600;
    display: flex; align-items: center; gap: 10px;
  }
  .sticky-tab-btn.active, .sticky-tab-btn:hover {
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
    color: #000; box-shadow: 0 0 12px var(--gold-primary);
  }
  .news-content-area { flex: 1; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 25px; }
  .scrollable-article { max-height: 60vh; overflow-y: auto; padding-right: 15px; text-align: justify; }

  /* Responsive Mobile */
  @media (max-width: 768px) {
    .nav-menu { display: none; }
    .feature-grid { grid-template-columns: 1fr; }
    .news-page-layout { flex-direction: column; }
    .sticky-tabs-sidebar {
      position: sticky; top: 75px; width: 100%; flex-direction: row;
      overflow-x: auto; background: var(--bg-dark); padding: 10px 0;
    }
    .sticky-tab-btn { white-space: nowrap; }
  }