/* =========================
   1. ROOT & THEME VARIABLES
   ========================= */
:root {
  --white: #ffffff;
  --text: #222222;
  --text-muted: #666666;
  --blue: #0b3c5d;
  --red: #c4161c;
  --yellow: #ffcc00;
  --gray: #f4f7f6;
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --border: #eeeeee;
  --shadow: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --white: #121212;
  --text: #e0e0e0;
  --text-muted: #aaaaaa;
  --blue: #3498db;
  --header-bg: #1a1a1a;
  --gray: #242424;
  --card-bg: #1e1e1e;
  --border: #333333;
  --shadow: rgba(0, 0, 0, 0.3);
}

/* =========================
   2. RESET & BASE
   ========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Be Vietnam Pro", sans-serif;
  background: var(--white);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* =========================
   3. HEADER & LOGO
   ========================= */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  box-shadow: 0 2px 10px var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: auto;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.logo img {
  width: clamp(36px, 8vw, 46px);
  border-radius: 4px;
}

.logo-text-group {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo-sub {
  font-size: 9px;
  font-weight: 700;
  color: var(--blue);
  opacity: 0.85;
}

.logo-main {
  font-size: clamp(16px, 4.5vw, 24px);
  font-weight: 700;
  background: linear-gradient(to right, var(--red), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}
.theme-btn {
  background: var(--gray);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--text);
}

/* =========================
   4. HERO & TYPEWRITER
   ========================= */
.hero {
  height: 40vh;
  min-height: 280px;
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("bìa.jpg") center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}

#typewriter-text {
  font-size: clamp(20px, 5vw, 32px);
  font-weight: 700;
  min-height: 1.2em;
}

/* Hiệu ứng con trỏ cho đánh chữ */
#typewriter-text::after {
  content: "|";
  animation: blink 0.7s infinite;
  margin-left: 5px;
  color: var(--red);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.sub-slogan {
  margin-top: 10px;
  font-size: clamp(14px, 3vw, 18px);
  opacity: 0.9;
}

/* =========================
   5. MENU & QUICK ACCESS
   ========================= */
.quick-access {
  margin-top: -40px;
  position: relative;
  z-index: 100;
}
.menu-grid {
  max-width: 1000px;
  margin: auto;
  padding: 0 15px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.menu-item {
  background: var(--card-bg);
  border-radius: 15px;
  padding: 20px 10px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: 0 8px 15px var(--shadow);
  transition: 0.3s;
}

.menu-item:hover {
  transform: translateY(-5px);
  border-color: var(--blue);
}
.active-item {
  border: 2px solid var(--red) !important;
  box-shadow: 0 10px 20px rgba(196, 22, 28, 0.15) !important;
}

/* =========================
   6. GALLERY & LOADING (CẢI TIẾN)
   ========================= */
/* Lưới ảnh hoạt động */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 15px;
  max-width: 1200px;
  margin: auto;
}

.gallery-item {
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 15px var(--shadow);
  position: relative;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.15);
}

/* Vòng xoay Thái Cực (Mục 4) */
.taichi {
  width: 60px;
  height: 60px;
  margin: 30px auto;
  border-radius: 50%;
  position: relative;
  background: linear-gradient(to bottom, #222 50%, #fff 50%);
  border: 2px solid var(--red);
  animation: spin 2s linear infinite;
  box-shadow: 0 0 15px var(--shadow);
}

.taichi::before,
.taichi::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  left: 50%;
  transform: translateX(-50%);
}

.taichi::before {
  top: 0;
  background: #222;
  border: 8px solid #fff;
  box-sizing: border-box;
}

.taichi::after {
  bottom: 0;
  background: #fff;
  border: 8px solid #222;
  box-sizing: border-box;
}

/* =========================
   7. SECTIONS & CARDS
   ========================= */
.section {
  padding: 50px 15px;
  width: 100%;
}
.section-title {
  text-align: center;
  font-size: 24px;
  margin-bottom: 35px;
  text-transform: uppercase;
  font-weight: 700;
}
.section-title span {
  color: var(--red);
}
.bg-light {
  background: var(--gray);
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  max-width: 1200px;
  margin: auto;
}

.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px var(--shadow);
  border-top: 4px solid var(--red);
  transition: 0.3s;
}

/* Tìm kiếm */
.member-search-container {
  max-width: 600px;
  margin: 0 auto 30px;
}
.search-box {
  display: flex;
  gap: 10px;
}
.search-box input {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  outline: none;
}
.btn-search {
  padding: 12px 25px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}
.btn-search:hover {
  background: #a01216;
}

/* =========================
   8. POPUP & MODAL (CẢI TIẾN)
   ========================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  backdrop-filter: blur(3px);
}

.modal-box {
  background: var(--card-bg);
  width: 100%;
  max-width: 500px;
  padding: 30px;
  border-radius: 15px;
  position: relative;
  color: var(--text);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Style riêng cho popup thông báo võ thuật */
.popup-martial {
  border-top: 6px solid var(--red);
}

.popup-martial h2 {
  margin-bottom: 15px;
  font-size: 1.5rem;
}

/* =========================
   9. FOOTER & UTILS
   ========================= */
.footer {
  background: var(--blue);
  color: #fff;
  padding: 40px 20px;
  text-align: center;
  margin-top: 50px;
}
.footer-divider {
  width: 50px;
  height: 3px;
  background: var(--red);
  margin: 15px auto;
}
.social-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
  flex-wrap: wrap;
}
.social-item {
  color: #fff;
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
  transition: 0.3s;
}
.social-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

#back-to-top {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: 0.3s;
  z-index: 999;
}
#back-to-top.show {
  opacity: 1;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Mobile Optimization */
@media (min-width: 768px) {
  .menu-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
  }
  .gallery-item {
    height: 140px;
  }
  .section {
    padding: 30px 15px;
  }
}
/* Đồng nhất khung hình cho Giá trị cốt lõi */
.value-card {
  display: flex;
  flex-direction: column;
  height: 100%; /* Đảm bảo 2 thẻ cao bằng nhau */
}

.value-img-container {
  width: 100%;
  height: 250px; /* Cố định chiều cao ảnh */
  overflow: hidden;
  background: #fdfdfd;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px 8px 0 0;
}

.value-img-container img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Giữ nguyên hình dáng ảnh không bị méo, hiện đầy đủ ảnh */
  padding: 10px;
}

.value-content {
  padding: 20px;
  text-align: left;
}

.value-content h4 {
  color: var(--red);
  margin-bottom: 10px;
}
/* Đẩy mục Giá trị cốt lõi xuống thấp hơn để cân đối */
#values {
  margin-top: 50px !important; /* Bạn có thể tăng lên 60px hoặc 70px nếu muốn xuống thấp nữa */
}
/* Khung bài báo chuyên nghiệp */
.detail-content {
  max-width: 850px;
  margin: 0 auto;
  padding: 20px;
  font-family: "Be Vietnam Pro", sans-serif;
}

.news-date {
  color: #888;
  font-size: 0.9em;
  margin-bottom: 10px;
  display: block;
}
.news-title {
  font-size: 1.8em;
  font-weight: 700;
  color: #d32f2f;
  line-height: 1.3;
  margin-bottom: 15px;
}
.news-sapo {
  font-size: 1.1em;
  font-weight: 600;
  font-style: italic;
  color: #444;
  line-height: 1.6;
  border-left: 4px solid #d32f2f;
  padding-left: 15px;
  margin-bottom: 25px;
}
.news-text {
  font-size: 1.05em;
  line-height: 1.8;
  text-align: justify;
  color: #333;
  white-space: pre-line;
}

/* Ảnh và chú thích */
.news-img {
  width: 100%;
  border-radius: 8px;
  margin-top: 20px;
  display: block;
}
.news-caption {
  text-align: center;
  font-size: 0.9em;
  color: #666;
  font-style: italic;
  margin: 10px 0 25px 0;
  display: block;
}

/* Khung Video & PDF (Tự thích nghi mọi màn hình) */
.media-box {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin-top: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.media-box iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
/* 1. Chữ chạy màu luân chuyển (Đỏ - Vàng - Xanh dương - Trắng) */
.logo-sub-custom {
  font-size: clamp(8px, 2.3vw, 11px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  /* Hiệu ứng chạy màu */
  background: linear-gradient(
    to right,
    #ff0000,
    #ffeb3b,
    #2196f3,
    #ffffff,
    #ff0000
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: colorFlow 4s linear infinite;
}

@keyframes colorFlow {
  to {
    background-position: 200% center;
  }
}

/* 2. Làm nút đóng (X) to và dễ bấm hơn */
.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 35px; /* Tăng kích thước */
  font-weight: bold;
  color: var(--red); /* Đổi sang màu đỏ cho nổi bật */
  cursor: pointer;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1001;
}

/* 3. CSS cho nút xem PDF bên ngoài */
.pdf-link-btn {
  display: inline-block;
  margin-top: 15px;
  padding: 10px 20px;
  background: #c4161c;
  color: white !important;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 14px;
  transition: 0.3s;
}
.pdf-link-btn:hover {
  background: #1a237e;
}
