/* Hệ thống biến toàn cục đã được gộp vào base.css */

/* =========================================
   1. NAVBAR & HERO SECTION
   ========================================= */
.navbar {
  display: flex;
  align-items: center;
  padding: 0 5%;
  height: 80px;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: all 0.4s ease;
  background: transparent;
  box-sizing: border-box;
}
.navbar.scrolled {
  background-color: rgba(15, 15, 18, 0.95); /* Đổi sang nền đen mờ chuẩn Xianxia */
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}
.logo {
  flex: 0 0 auto;
  font-family: "Quicksand", sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: white;
  z-index: 1001;
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
  transition: color 0.3s ease;
}
.logo span {
  /* [v7.56 FIX] Pacifico không hỗ trợ tiếng Việt → thêm Quicksand + system-ui làm fallback */
  font-family: "Pacifico", "Quicksand", system-ui, cursive;
  color: var(--accent-gold);
  font-size: 32px;
  margin-left: 5px;
  display: flex;
  align-items: center;
}
.navbar.scrolled .logo {
  color: var(--primary-red) !important;
}

.nav-logo-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}
.logo:hover .nav-logo-img {
  transform: rotate(15deg) scale(1.1);
}
.nav-links {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  height: 100%;
}
.nav-links li {
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
}
.nav-links a {
  display: flex;
  align-items: center;
  height: 100%;
  color: white;
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  text-decoration: none;
  transition: color 0.3s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 3px;
  bottom: 25px;
  left: 0;
  background-color: var(--accent-gold);
  transition: width 0.3s;
}
.nav-links a:hover::after {
  width: 100%;
}
.navbar.scrolled .nav-links a {
  color: #fff; /* Giữ chữ màu trắng trên nền đen */
}
.nav-links a.highlight-nav {
  color: #ff5722 !important; /* Màu cam nổi bật cho mục khóa học/lịch khai giảng */
  font-weight: 700;
}
.navbar .dropdown-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}
.dropdown-menu {
  display: none;
  position: absolute;
  background-color: #fff;
  min-width: 230px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  top: 70px;
  left: 0;
  z-index: var(--z-dropdown);
  border-top: 4px solid var(--primary-red);
  animation: fadeIn 0.3s ease;
  padding: 10px 0;
}
.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 20px;
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent var(--primary-red) transparent;
}
.dropdown-menu a {
  color: #333 !important;
  padding: 12px 20px;
  text-decoration: none;
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  border-bottom: 1px dashed #eee;
  height: auto;
}
.dropdown-menu a:last-child {
  border-bottom: none;
}
.dropdown-menu a:hover {
  background-color: #fff5f5;
  color: var(--primary-red) !important;
  padding-left: 25px;
}
.dropdown-item:hover .dropdown-menu {
  display: block;
}

/* Fix menu con & nút đăng nhập */
.dropdown-menu a::after {
  content: none !important;
  display: none !important;
}
.nav-links .btn::after {
  display: none !important;
  content: none !important;
}
.nav-links .btn {
  height: auto !important;
  padding: 8px 20px !important;
  font-size: 0.85rem !important;
  border-radius: 30px !important;
  margin-left: 10px;
  background: linear-gradient(135deg, var(--primary-red), var(--dark-red)) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) !important;
}
.nav-links .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(211, 47, 47, 0.5) !important;
  background: linear-gradient(135deg, var(--dark-red), #880e4f) !important;
}

.user-nav {
  display: flex;
  align-items: center;
  height: 100%;
  /* Ẩn khu vực chưa xác thực lúc mới load */
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}

/* Class kích hoạt hiện mượt mà sau khi check Firebase xong */
.user-nav.auth-resolved,
#user-account.auth-resolved {
  opacity: 1;
  visibility: visible;
}

#user-account {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}
.menu-toggle {
  display: none;
  cursor: pointer;
  z-index: 1001;
  align-items: center;
  height: 100%;
}
.menu-toggle i {
  font-size: 24px;
  color: white;
  transition: color 0.3s;
}
.navbar.scrolled .menu-toggle i {
  color: var(--text-dark);
}

/* === CSS SLIDER ẢNH NỀN === */
.hero-slider-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.hero-slider {
  display: flex;
  width: 300%;
  height: 100%;
  transition: transform 1.2s ease-in-out;
}

.slide-item {
  width: 33.3333%; /* Sửa lỗi trôi slide để chữ giữ đúng trọng tâm */
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center; /* Đổi tử flex-end thành center để căn giữa theo chiều dọc */
  align-items: center; /* Thêm align-items center để căn giữa theo chiều ngang */
}

.slide-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1;
}

.cultivation-bible-content {
  position: relative; /* Đổi từ absolute sang relative */
  z-index: 10;
  text-align: center;
  width: 90%;
  max-width: 1000px;
  pointer-events: none;
  margin-top: -8%; /* Bù lại khoảng padding-bottom: 8% trước đây trên hero-content-slider-overlay nếu cần, hoặc để nó tự nhiên ở giữa */
}

.cultivation-bible-glow {
  color: #ffffff !important;
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  font-size: 2.5rem;
  margin-bottom: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.8),
    0 0 20px var(--accent-gold),
    0 0 40px #ff8c00,
    0 0 60px #ff0000;
  animation: biblePulse 2s ease-in-out infinite alternate;
}

.cultivation-spirit-desc {
  color: #ffffff;
  font-size: 1.2rem;
  font-family: "Quicksand", sans-serif;
  letter-spacing: 1px;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
  text-align: center; /* Đảm bảo an toàn luôn căn giữa */
}

@keyframes biblePulse {
  from {
    text-shadow:
      0 0 10px rgba(255, 255, 255, 0.8),
      0 0 20px var(--accent-gold),
      0 0 40px #ff8c00;
  }
  to {
    text-shadow:
      0 0 5px rgba(255, 255, 255, 0.5),
      0 0 10px var(--accent-gold);
  }
}

.hero-content-slider-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 8%;
}

.hero-action-buttons {
  display: flex;
  gap: 20px;
}

.btn-tu-tien {
  display: inline-block;
  padding: 10px 15px;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  border-radius: 50px;
  transition: all 0.3s ease-in-out;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn-tu-tien-red {
  background-color: var(--primary-red);
  box-shadow: 0 0 15px rgba(211, 47, 47, 0.6);
}
.btn-tu-tien-red:hover {
  background-color: transparent;
  color: var(--primary-red);
  border-color: var(--primary-red);
  box-shadow: 0 0 25px rgba(211, 47, 47, 0.9);
  transform: translateY(-3px);
}

.btn-tu-tien-gold {
  background-color: transparent;
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}
.btn-tu-tien-gold:hover {
  background-color: var(--accent-gold);
  color: #000;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
  transform: translateY(-3px);
}

/* =========================================
   2. FORM ĐĂNG KÝ & FOOTER
   ========================================= */

footer {
  background: linear-gradient(135deg, var(--dark-red) 0%, #880e4f 100%);
  color: white;
  padding-top: 50px !important;
  padding-bottom: 30px !important;
  margin-top: 0 !important;
  clip-path: none !important;
  transform: none !important;
  border-top: 4px solid var(--accent-gold);
}
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 30px;
}
.footer-col {
  flex: 1;
  min-width: 250px;
  margin-bottom: 20px;
}
.footer-col h3 {
  font-size: 1.1rem;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 10px;
  display: inline-block;
}
/* Vá lỗi Logo Footer phình to đẩy văng chữ xuống dưới */
.footer-col .logo {
  height: auto !important;
  display: inline-block;
}
.footer-col h3::after {
  display: none;
}
.footer-desc,
.contact-row,
.footer-col p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
}
.contact-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
}
.contact-icon {
  width: 25px;
  height: 25px;
  background: transparent;
  color: var(--accent-gold);
  border: none;
  font-size: 1rem;
  padding: 0;
  justify-content: flex-start;
  /* Thêm linh hồn để icon xoay và đổi màu mượt mà */
  transition:
    transform 0.4s ease,
    color 0.3s ease;
  display: flex;
  align-items: center;
}

/* Bổ sung hiệu ứng xoay 360 độ bị thất lạc */
.contact-row:hover .contact-icon {
  color: #fff; /* Đổi màu icon cho nổi bật khi hover */
  transform: rotate(360deg);
}
.social-links {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}
.social-btn {
  width: 35px;
  height: 35px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1rem;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.3s;
}
.social-btn:hover {
  background: var(--accent-gold);
  color: var(--dark-red);
  border-color: var(--accent-gold);
}
.copyright {
  text-align: center;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.85rem;
  background: transparent;
}

/* =========================================
   KHU VỰC BÀI TEST ĐẦU VÀO (ENTRANCE TEST)
   ========================================= */
#entrance-test {
  padding: 80px 10%;
  /* Bọc thép màu nền đỏ dự phòng nếu biến gradient bị lỗi */
  background: linear-gradient(135deg, var(--dark-red) 0%, #880e4f 100%);
  background: var(
    --primary-gradient,
    linear-gradient(135deg, var(--dark-red) 0%, #880e4f 100%)
  );
  color: white !important;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.entrance-test-circle-1 {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  top: -100px;
  left: -100px;
}

.entrance-test-circle-2 {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  bottom: -50px;
  right: -50px;
}

.entrance-test-title {
  font-size: 2.5rem;
  margin-bottom: 20px;
  position: relative;
  font-weight: 700;
  color: white !important;
}

.entrance-test-desc {
  font-size: 1.1rem;
  margin-bottom: 40px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0.9;
  color: white !important;
}

/* =========================================
   FIX LỖI CHẤM XANH ONLINE BAY LUNG TUNG (NAVBAR)
   ========================================= */
.user-avatar-container {
  position: relative !important; /* Lệnh quan trọng nhất: Cấp sổ đỏ cho thẻ cha */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px; /* Khóa cứng kích thước Avatar */
  height: 45px;
  cursor: pointer;
}

.nav-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Đóng đinh chấm xanh vào góc dưới bên phải */
.user-avatar-container span {
  position: absolute !important;
  bottom: 0px !important;
  right: 0px !important;
  width: 14px !important; /* Làm to ra một xíu nhìn cho rõ */
  height: 14px !important;
  background: #2ecc71 !important;
  border-radius: 50% !important;
  border: 2px solid #fff !important; /* Viền trắng bọc quanh để tách biệt với ảnh */
  z-index: 10 !important;
}

/* =========================================
   ANIMATION: BÀN TAY GÕ PHÍM (AI LOADING)
   ========================================= */
.🤚 {
  --skin-color: #E4C560;
  --tap-speed: 0.6s;
  --tap-stagger: 0.1s;
  position: relative;
  width: 80px;
  height: 60px;
}

.🤚:before {
  content: '';
  display: block;
  width: 180%;
  height: 75%;
  position: absolute;
  top: 70%;
  right: 20%;
  background-color: black;
  border-radius: 40px 10px;
  filter: blur(10px);
  opacity: 0.3;
}

.🌴 {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: var(--skin-color);
  border-radius: 10px 40px;
}

.👍 {
  position: absolute;
  width: 120%;
  height: 38px;
  background-color: var(--skin-color);
  bottom: -18%;
  right: 1%;
  transform-origin: calc(100% - 20px) 20px;
  transform: rotate(-20deg);
  border-radius: 30px 20px 20px 10px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  border-left: 2px solid rgba(0, 0, 0, 0.1);
}

.👍:after {
  width: 20%;
  height: 60%;
  content: '';
  background-color: rgba(255, 255, 255, 0.3);
  position: absolute;
  bottom: -8%;
  left: 5px;
  border-radius: 60% 10% 10% 30%;
  border-right: 2px solid rgba(0, 0, 0, 0.05);
}

.👉 {
  position: absolute;
  width: 80%;
  height: 35px;
  background-color: var(--skin-color);
  bottom: 32%;
  right: 64%;
  transform-origin: 100% 20px;
  animation-duration: calc(var(--tap-speed) * 2);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  transform: rotate(10deg);
}

.👉:before {
  content: '';
  position: absolute;
  width: 140%;
  height: 30px;
  background-color: var(--skin-color);
  bottom: 8%;
  right: 65%;
  transform-origin: calc(100% - 20px) 20px;
  transform: rotate(-60deg);
  border-radius: 20px;
}

.👉:nth-child(1) {
  animation-delay: 0;
  filter: brightness(70%);
  animation-name: tap-upper-1;
}

.👉:nth-child(2) {
  animation-delay: var(--tap-stagger);
  filter: brightness(80%);
  animation-name: tap-upper-2;
}

.👉:nth-child(3) {
  animation-delay: calc(var(--tap-stagger) * 2);
  filter: brightness(90%);
  animation-name: tap-upper-3;
}

.👉:nth-child(4) {
  animation-delay: calc(var(--tap-stagger) * 3);
  filter: brightness(100%);
  animation-name: tap-upper-4;
}

@keyframes tap-upper-1 {
  0%, 50%, 100% {
    transform: rotate(10deg) scale(0.4);
  }
  40% {
    transform: rotate(50deg) scale(0.4);
  }
}

@keyframes tap-upper-2 {
  0%, 50%, 100% {
    transform: rotate(10deg) scale(0.6);
  }
  40% {
    transform: rotate(50deg) scale(0.6);
  }
}

@keyframes tap-upper-3 {
  0%, 50%, 100% {
    transform: rotate(10deg) scale(0.8);
  }
  40% {
    transform: rotate(50deg) scale(0.8);
  }
}

@keyframes tap-upper-4 {
  0%, 50%, 100% {
    transform: rotate(10deg) scale(1);
  }
  40% {
    transform: rotate(50deg) scale(1);
  }
}

/* =========================================
   ẨN GIAO DIỆN GOOGLE TRANSLATE MẶC ĐỊNH
   ========================================= */
.goog-te-banner-frame {
  display: none !important;
}
iframe.goog-te-banner-frame {
  display: none !important;
}
/* Các class mới của Google Translate */
.VIpgJd-ZVi9od-ORHb-OEVmcd,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.skiptranslate > iframe.skiptranslate {
  display: none !important;
}
body {
  top: 0px !important;
  position: static !important;
}
html {
  height: 100% !important;
  margin-top: 0px !important;
}
#goog-gt-tt, .goog-te-balloon-frame {
  display: none !important;
}
.goog-tooltip, .goog-tooltip:hover {
  display: none !important;
}
.goog-text-highlight {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* =========================================
   HỆ THỐNG CHUÔNG THÔNG BÁO (NOTIFICATION BELL)
   ========================================= */
.notif-btn {
  width: 45px;
  height: 45px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(44, 44, 44, 0.6);
  border-radius: 50%;
  cursor: pointer;
  transition-duration: .3s;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 999; /* Đẩy chuông lên trên cùng */
}

.bell {
  width: 18px;
  transition: .3s;
}

.bell path {
  fill: #f5f5f5;
}

.notif-btn:hover {
  background-color: rgba(229, 57, 53, 0.8); /* Hover sang đỏ Yếu Tiếng Trung */
  border-color: rgba(229, 57, 53, 1);
}

.notif-btn:hover .bell {
  animation: bellRing 0.9s both;
  fill: white;
}

/* Dấu chấm đỏ báo hiệu có thông báo mới (Notification Badge) */
.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: var(--primary-red);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 6px;
  border: 2px solid #1a1a2e;
  box-shadow: 0 0 5px rgba(229, 57, 53, 0.5);
  animation: pulse-red 2s infinite;
}

/* Hiệu ứng rung chuông (Keyframes) */
@keyframes bellRing {
  0%, 100% { transform-origin: top; }
  15% { transform: rotateZ(10deg); }
  30% { transform: rotateZ(-10deg); }
  45% { transform: rotateZ(5deg); }
  60% { transform: rotateZ(-5deg); }
  75% { transform: rotateZ(2deg); }
}
.notif-btn.ringing .bell {
  animation: bellRing 0.9s infinite;
}

.notif-btn:active {
  transform: scale(0.8);
}

/* =========================================
   NÚT HỘP THƯ (INBOX ICON) — GLOBAL TRÊN NAVBAR
   Đồng bộ hoàn toàn với .notif-btn (chuông thông báo)
   ========================================= */
.inbox-btn {
  width: 45px;
  height: 45px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(44, 44, 44, 0.6);
  border-radius: 50%;
  cursor: pointer;
  transition-duration: .3s;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 999; /* Đồng bộ với chuông — không xung đột modal (9999+) */
}

.inbox-btn:hover {
  background-color: rgba(24, 119, 242, 0.8); /* Hover xanh dương — phân biệt với chuông đỏ */
  border-color: rgba(24, 119, 242, 1);
}

.inbox-btn:hover i {
  color: white;
  transform: scale(1.1);
}

.inbox-btn:active {
  transform: scale(0.8);
}

/* Nút Reply trong Inbox Drawer */
.btn-reply {
  background: none;
  border: 1px solid #444;
  color: #4fc3f7;
  padding: 4px 12px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 8px;
  transition: 0.3s;
}
.btn-reply:hover {
  background: rgba(79, 195, 247, 0.15);
  border-color: #4fc3f7;
}

/* KHUNG DROPDOWN BÊN DƯỚI CHUÔNG */

.notif-popup, .inbox-popup {
  position: absolute;
  top: 60px;
  right: -10px; /* Căn chỉnh lệch một chút qua trái */
  width: 380px;
  background: #1e1e24; /* Dark mode sâu theo chuẩn iQIYI */
  border: 1px solid #333;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-15px);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
}

/* Class kích hoạt hiển thị */
.notif-popup.show, .inbox-popup.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Mũi tên tam giác chỉ lên nút chuông */
.notif-popup::before, .inbox-popup::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 25px;
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent #1e1e24 transparent;
  z-index: 10;
}
.notif-popup::after,
  .inbox-popup::before,
  .inbox-popup::after {
  content: "";
  position: absolute;
  top: -11px;
  right: 25px;
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent #333 transparent;
  z-index: 9;
}

/* Head */
.notif-header, .inbox-header {
  padding: 15px 20px;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.2);
}
.notif-header h3, .inbox-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
  font-weight: 700;
}
.mark-all-read {
  font-size: 0.85rem;
  color: var(--primary-red);
  cursor: pointer;
  transition: 0.3s;
  font-weight: bold;
}
.mark-all-read:hover {
  text-decoration: underline;
  text-shadow: 0 0 5px rgba(229,57,53,0.5);
}

/* Body (Chứa List) */
.notif-body, .inbox-body {
  max-height: 400px;
  min-height: 250px;
  overflow-y: auto;
  padding: 10px 0;
}
/* Cuộn siêu mỏng */
.notif-body::-webkit-scrollbar { width: 4px; }
.notif-body::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; }

/* Item Thông Báo Từng Cái */
.notif-item {
  display: flex;
  align-items: flex-start;
  padding: 15px 20px;
  gap: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.3s;
  position: relative;
}
.notif-item:hover {
  background: rgba(255,255,255,0.08); /* Sáng lên khi hover */
}
.notif-item.unread {
  background: rgba(229, 57, 53, 0.08); /* Highlight đỏ nhạt nếu chưa đọc */
}

/* Avatar hoặc Icon riêng biệt cho từng loại thông báo */
.notif-icon-box {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Icon con ở góc (ví dụ: Logo Play, Icon Tiền) */
.notif-sub-icon {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  background: var(--primary-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: white;
  border: 1px solid #1e1e24;
}

.notif-content {
  flex: 1;
}
.notif-title {
  color: #eee;
  font-size: 0.95rem;
  font-weight: bold;
  margin-bottom: 4px;
  line-height: 1.3;
}
.notif-desc {
  color: #aaa;
  font-size: 0.85rem;
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-time {
  font-size: 0.75rem;
  color: #58a6ff; /* Màu xanh nước biển nhạt */
  font-style: italic;
}

/* Nút xóa */
.notif-del-btn {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 5px;
  font-size: 0.9rem;
  transition: 0.3s;
}
.notif-del-btn:hover {
  color: var(--primary-red);
}

/* Footer xem tất cả */
.notif-footer {
  padding: 12px;
  text-align: center;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid #333;
}
.notif-footer span {
  color: #888;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
}
.notif-footer span:hover {
  color: #eee;
}

/* =========================================
   NOTIFICATION POPUP — MOBILE FULL-SCREEN OVERLAY
   Trên mobile, popup biến thành trang thông báo riêng (chuẩn Instagram/Facebook)
   - Full-screen overlay với backdrop tối
   - Trượt từ phải vào (slide-in) giống trang riêng
   - Nút X đóng rõ ràng
   - Không che navbar, không che tabs khác
   ========================================= */
@media (max-width: 767px) {
  .notif-popup, .inbox-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: 100vh !important;
    height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    background: #121218 !important;
    transform: translateX(100%) !important;
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    opacity: 1 !important;
    z-index: 100000 !important;
    display: flex !important;
    flex-direction: column !important;
    pointer-events: none !important;
  }
  
  .inbox-popup {
    top: auto !important;
    max-height: 60vh !important;
    height: auto !important;
    border-radius: 12px 12px 0 0 !important;
    transform: translateY(100%) !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
  }

  .notif-popup.show {
    transform: translateX(0) !important;
    pointer-events: auto !important;
  }
  
  .inbox-popup.show {
    transform: translateY(0) !important;
    pointer-events: auto !important;
  }

  /* Ẩn mũi tên tam giác desktop */
  .notif-popup::before,
  .notif-popup::after,
  .inbox-popup::before,
  .inbox-popup::after {
    display: none !important;
  }

  /* Header giống thanh nav app */
  .notif-header, .inbox-header {
    padding: 16px 20px !important;
    background: linear-gradient(135deg, #1a1a24, #0d0d12) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0;
    min-height: 56px;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  /* Nút "Đọc tất cả" hiện rõ hơn */
  .notif-header .mark-all-read, .inbox-header .mark-all-read {
    background: rgba(229, 57, 53, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
  }
  .notif-header h3, .inbox-header h3 {
    font-size: 1.15rem !important;
  }

  /* Body list: chiếm toàn bộ không gian còn lại, scroll mượt */
  .notif-body, .inbox-body {
    flex: 1 !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0 !important;
    padding-bottom: 80px !important; /* Tránh bottom nav che */
  }

  /* Items: rộng hơn, dễ bấm hơn */
  .notif-item {
    padding: 14px 18px !important;
    gap: 12px !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  }
  .notif-item:active {
    background: rgba(255,255,255,0.12);
  }
  .notif-title { font-size: 0.92rem !important; }
  .notif-desc { font-size: 0.82rem !important; }
  .notif-icon-box { width: 42px !important; height: 42px !important; }

  /* Footer dính đáy */
  .notif-footer {
    position: sticky;
    bottom: 0;
    background: #121218;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* =========================================
   SEO INTERNAL LINKS — Mạng Lưới Bài Học
   ========================================= */
.seo-links-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 5% 50px;
  background: var(--bg-card, #fafafa);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.seo-links-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark, #333);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.seo-links-title i {
  color: var(--primary-red, #d32f2f);
  font-size: 1.1rem;
}

.seo-links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.seo-link-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-secondary, #fff);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  color: var(--text-color, #444);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s ease;
  cursor: pointer;
}

.seo-link-item:hover {
  background: var(--primary-red, #d32f2f);
  color: #fff;
  border-color: var(--primary-red, #d32f2f);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.25);
}

.seo-link-item:hover .seo-link-level {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.seo-link-text {
  white-space: nowrap;
}

.seo-link-level {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(211, 47, 47, 0.08);
  color: var(--primary-red, #d32f2f);
  white-space: nowrap;
  transition: all 0.25s ease;
}

@media (max-width: 768px) {
  .seo-links-container {
    padding: 30px 4% 40px;
  }
  .seo-link-item {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
}

/* =========================================
   UNIVERSAL VIEWER (Trình Đọc PDF / Video)
   ========================================= */
.viewer-overlay {
  display: none;
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.92);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.viewer-content {
  width: 95%;
  max-width: 1200px;
  height: 90vh;
  margin: 5vh auto;
  background: #1a1a2e;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 40px rgba(212, 175, 55, 0.15),
    0 20px 60px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.viewer-header {
  padding: 16px 24px;
  background: linear-gradient(135deg, #0d0d1a 0%, #1a1a2e 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(212, 175, 55, 0.25);
  flex-shrink: 0;
}

.viewer-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex: 1;
  background: linear-gradient(135deg, #fff 0%, #b0b0b0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.viewer-close-btn {
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(211, 47, 47, 0.3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.viewer-close-btn:hover {
  background: linear-gradient(135deg, #b71c1c, #880e0e);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.5);
}

.viewer-body {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-iframe {
  width: 100%;
  display: block;
  flex: 1;
  flex-grow: 1;
  height: 100%;
  min-height: 500px;
  border: none;
  background: white;
}

/* --- Thanh Audio Bar (Lấy Bí Âm) --- */
.viewer-audio-bar {
  padding: 14px 24px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-top: 2px solid #d4af37;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-shrink: 0;
  flex-wrap: wrap;
  width: 100%;
  text-align: center;
}
.viewer-audio-bar span {
  color: #ffd54f;
  font-size: 0.95rem;
  font-weight: 600;
}

.zalo-btn {
  display: inline-block;
  background: linear-gradient(135deg, #d4af37, #fbc02d);
  color: #1a1a2e;
  padding: 10px 28px;
  border-radius: 25px;
  font-weight: 800;
  text-decoration: none;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  transition: all 0.3s ease;
  white-space: nowrap;
}
.zalo-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

.download-btn {
  display: inline-block;
  background: linear-gradient(135deg, #4CAF50, #66BB6A);
  color: #fff;
  padding: 10px 24px;
  border-radius: 25px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.35);
  transition: all 0.3s ease;
  white-space: nowrap;
}
.download-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .viewer-content {
    width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  .viewer-header {
    padding: 12px 16px;
  }
  .viewer-title {
    font-size: 1.1rem;
  }
  .viewer-close-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
  .viewer-audio-bar {
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
  }
  .zalo-btn {
    width: 100%;
    text-align: center;
  }
}

/* =============================================
   CLICK-TO-ANIMATE WORD HEADER STROKES
   ============================================= */

/* Main word container — flexbox column for Simplified/Traditional rows */
.dict-main-word {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.dict-word-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.dict-word-trad-row {
  margin-top: 2px;
}

/* Clickable character spans in the main word header */
.dict-char-clickable {
  cursor: pointer !important;
  display: inline-block;
  min-width: 44px;
  min-height: 44px;
  text-align: center;
  transition: all 0.25s ease;
  border-radius: 8px;
  padding: 2px 4px;
  position: relative;
}
.dict-char-clickable:hover {
  background: rgba(211, 47, 47, 0.08);
  opacity: 0.8;
  transform: scale(1.05);
}
.dict-char-clickable:active {
  transform: scale(0.97);
}
.dict-char-clickable.dict-char-active {
  background: rgba(211, 47, 47, 0.12);
  box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.3);
}
/* Subtle underline hint that chars are clickable */
.dict-char-clickable::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  width: 60%;
  height: 2px;
  background: var(--primary-red);
  opacity: 0.25;
  border-radius: 2px;
  transition: opacity 0.3s;
}
.dict-char-clickable:hover::after {
  opacity: 0.6;
}

/* Traditional character color — WCAG AA (5.2:1 vs #1a1a1a) */
.dict-trad-char {
  color: #888;
  font-size: 0.7em;
}
body.dark-mode .dict-trad-char {
  color: #E57373 !important;
}

/* Floating stroke animation panel (dynamic inline injection) */
.dict-stroke-float {
  display: none; /* hidden by default */
  width: 100%;
  max-width: 320px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-top: 10px;
  position: relative;
  text-align: center;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-10px);
}
body.dark-mode .dict-stroke-float {
  background: rgba(30, 30, 38, 0.95);
  border-color: #444;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}
.dict-stroke-float.stroke-show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}
.dict-stroke-float-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
}
.dict-stroke-float-close:hover {
  color: #d32f2f;
}

/* =========================================
   CLICKABLE AVATAR cho Binh Luan & Bang Phong Than
   ========================================= */
.clickable-avatar {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.clickable-avatar:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════
   MINI-PROFILE CARD — Hiển thị khi click avatar user
   ═══════════════════════════════════════════════════════════ */
.mini-profile-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.mini-profile-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.mini-profile-card {
  background: #1a1a22;
  border: 1px solid #d4af37;
  border-radius: 16px;
  max-width: 340px;
  width: 90%;
  padding: 28px 24px 22px;
  text-align: center;
  position: relative;
  transform: scale(0.85) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
  opacity: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(212,175,55,0.08) inset;
}
.mini-profile-overlay.visible .mini-profile-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Nút đóng (góc phải trên) */
.mini-profile-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  color: #888; font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
  padding: 4px;
}
.mini-profile-close:hover { color: #fff; }

/* Avatar */
.mini-profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #d4af37;
  margin-bottom: 12px;
  background: #333;
}

/* Tên */
.mini-profile-name {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.3;
}

/* Cảnh giới */
.mini-profile-rank {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 2px;
}

/* Tu Vi + ID */
.mini-profile-meta {
  font-size: 0.78rem;
  color: #999;
  margin-bottom: 10px;
}

/* Bio */
.mini-profile-bio {
  font-size: 0.85rem;
  color: #bbb;
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 18px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Nhóm nút hành động */
.mini-profile-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.mini-profile-actions button {
  flex: 1;
  padding: 9px 0;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}
.mini-profile-btn-msg {
  background: linear-gradient(135deg, #4caf50, #66bb6a);
  color: #fff;
  box-shadow: 0 3px 10px rgba(76,175,80,0.25);
}
.mini-profile-btn-msg:hover {
  box-shadow: 0 5px 18px rgba(76,175,80,0.4);
  transform: translateY(-1px);
}
.mini-profile-btn-friend {
  background: transparent;
  color: #d4af37;
  border: 1.5px solid #d4af37 !important;
}
.mini-profile-btn-friend:hover {
  background: rgba(212,175,55,0.1);
}

/* Loading skeleton */
.mini-profile-skeleton {
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Mobile 320px — đảm bảo card không tràn */
@media (max-width: 360px) {
  .mini-profile-card {
    max-width: 300px;
    padding: 22px 18px 18px;
  }
  .mini-profile-avatar {
    width: 60px; height: 60px;
  }
  .mini-profile-actions button {
    font-size: 0.78rem;
    padding: 8px 0;
  }
}


/* -- Mini Profile: 3-Tab Nav (Sprint 3.6) -- */
.mp-tab-nav {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 12px 0 6px;
  border-bottom: 1px solid #2a2a34;
  padding-bottom: 8px;
}
.mp-tab-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  color: #999;
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  white-space: nowrap;
}
.mp-tab-btn:hover {
  color: #ddd;
  background: rgba(255,255,255,0.08);
}
.mp-tab-btn.active {
  background: rgba(212,175,55,0.15);
  border-color: #d4af37;
  color: #d4af37;
}
.mp-tab-pane {
  animation: mp-tab-fade-in 0.2s ease;
}
@keyframes mp-tab-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.mp-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.82rem;
}
.mp-info-row:last-child { border-bottom: none; }
.mp-info-label {
  color: #999;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
.mp-info-value {
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
}
.mp-items-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 4px;
  justify-items: center;
}
.mp-item-cell {
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid #2a2a34;
  border-radius: 10px;
  transition: transform 0.2s, border-color 0.2s;
}
.mp-item-cell:hover {
  transform: scale(1.15);
  border-color: #d4af37;
}

/* ==========================================
   REALTIME CHATBOX UI
   ========================================= */
.chatbox-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 340px;
  height: 480px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 999999;
  border: 1px solid var(--border-color);
  overflow: hidden;
  animation: slideUpChat 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUpChat {
  from { transform: translateY(50px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.chatbox-header {
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbox-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#chatbox-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-red);
}

.chatbox-name-status h4 {
  margin: 0;
  color: var(--text-light);
  font-size: 1rem;
}

.chatbox-status {
  font-size: 0.75rem;
  color: #888;
}

.chatbox-actions button {
  background: none;
  border: none;
  color: #888;
  font-size: 1.2rem;
  cursor: pointer;
  transition: 0.2s;
  padding: 5px;
}

.chatbox-actions button:hover {
  color: var(--primary-red);
}

.chatbox-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-dark); /* Same as app body if any */
}

/* Tin nhắn của mình (Bên phải) */
.chat-msg.me {
  align-self: flex-end;
  background: var(--primary-red);
  color: #fff;
  border-radius: 16px 16px 0 16px;
  padding: 10px 14px;
  max-width: 80%;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(211,47,47,0.3);
}

/* Tin nhắn của đôi phương (Bên trái) */
.chat-msg.them {
  align-self: flex-start;
  background: var(--bg-elevated);
  color: var(--text-light);
  border-radius: 16px 16px 16px 0;
  padding: 10px 14px;
  max-width: 80%;
  word-wrap: break-word;
  border: 1px solid var(--border-color);
}

.chat-msg .time {
  display: block;
  font-size: 0.65rem;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}

.chatbox-footer {
  padding: 10px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
}

.chatbox-footer input {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--text-light);
  border-radius: 20px;
  padding: 8px 14px;
  outline: none;
  font-size: 0.95rem;
}

.chatbox-footer input:focus {
  border-color: var(--primary-red);
}

.chatbox-footer button {
  background: var(--primary-red);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
}

.chatbox-footer button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(211,47,47,0.4);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .chatbox-container {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: calc(100vh - 60px); /* Leave room for nav if any */
    max-width: 100vw;
    max-height: calc(100vh - 60px);
    border-radius: 20px 20px 0 0;
  }
}

/* ═══════════════════════════════════════════
   [Sprint F1] TTS LOADING STATE
   ═══════════════════════════════════════════ */
.tts-loading {
  opacity: 0.6 !important;
  pointer-events: none !important;
  position: relative;
}
/* Thay icon loa bằng spinner khi đang load — selector rộng cho mọi icon variant */
.tts-loading .fa-volume-up::before,
.tts-loading .fa-volume-down::before,
.tts-loading .fa-headphones::before,
.tts-loading .fa-volume-off::before {
  content: "\f110" !important; /* fa-spinner */
  -webkit-animation: fa-spin 1s linear infinite;
  animation: fa-spin 1s linear infinite;
}

/* ═══════════════════════════════════════════
   [Sprint F1] VIP AUDIO TOOLTIP
   ═══════════════════════════════════════════ */
[data-vip-tooltip] {
  position: relative;
}
[data-vip-tooltip]::after {
  content: attr(data-vip-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
[data-vip-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
/* VIP tooltip — vàng gold */
[data-vip-tooltip="Giọng VIP \2728"]::after {
  background: linear-gradient(135deg, #bf8d2c, #f5d77a);
  color: #3e2700;
}

/* ══════════════════════════════════════════
   [v7.56 FIX LỖI 3] Dropdown menu trên dark-mode pages (tudien.html)
   Scoped vào body.dark-mode — KHÔNG override global light theme
   ══════════════════════════════════════════ */
body.dark-mode .dropdown-menu {
  background-color: #fff;
}
body.dark-mode .dropdown-menu a {
  color: #333 !important;
}
body.dark-mode .dropdown-menu a:hover {
  background-color: #fff5f5;
  color: var(--primary-red) !important;
}
