@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --bg-primary: #09090b;
  --bg-secondary: #121217;
  --bg-card: rgba(24, 24, 27, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(245, 158, 11, 0.4);
  --accent-amber: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #f59e0b, #ef4444);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #09090b;
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

/* Glassmorphism */
.glass-header {
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.glass-card {
  background: rgba(20, 20, 25, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6), 0 0 20px -5px rgba(245, 158, 11, 0.15);
}

/* Glow Badges */
.badge-gold {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-cyan {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(8, 145, 178, 0.3));
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.badge-purple {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(126, 34, 206, 0.3));
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

/* Line clamps */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Video Player Container 16:9 */
.video-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.9);
}

/* #playerFrame luôn lấp đầy khung 16:9 để mọi nội dung (iframe hoặc card
   thông báo như "video bị chặn nhúng") đều hiển thị đúng, không bị tràn. */
.video-responsive > #playerFrame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

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

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #18181b 25%, #27272a 50%, #18181b 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.6s infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Pulse animation */
@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse-slow {
  animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Hide scrollbar for category list while keeping scrolling */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Active navigation indicators */
.nav-tab.active {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Modal animation */
.modal-enter {
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ===================== SYNC DIALOG: HẤP THU LINH KHÍ ===================== */
#syncOverlay.show { display: flex; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.qi-core {
  position: absolute;
  width: 72px; height: 72px;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(245,158,11,0.35), rgba(245,158,11,0.05));
  box-shadow: 0 0 40px 10px rgba(245,158,11,0.4), inset 0 0 20px rgba(245,158,11,0.3);
  animation: qiCorePulse 1.6s ease-in-out infinite;
}
@keyframes qiCorePulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 40px 10px rgba(245,158,11,0.4), inset 0 0 20px rgba(245,158,11,0.3); }
  50% { transform: scale(1.12); box-shadow: 0 0 60px 18px rgba(245,158,11,0.6), inset 0 0 28px rgba(245,158,11,0.5); }
}

.qi-ring {
  position: absolute;
  border-radius: 9999px;
  border: 2px solid rgba(245,158,11,0.5);
  animation: qiRingRotate 3s linear infinite;
}
.qi-ring-1 { width: 100px; height: 100px; border-top-color: rgba(251,191,36,0.9); border-right-color: transparent; }
.qi-ring-2 { width: 140px; height: 140px; border-color: rgba(168,85,247,0.4); border-bottom-color: rgba(168,85,247,0.9); animation-duration: 4s; animation-direction: reverse; }
.qi-ring-3 { width: 180px; height: 180px; border-color: rgba(245,158,11,0.2); border-left-color: rgba(251,191,36,0.6); animation-duration: 6s; }
@keyframes qiRingRotate { to { transform: rotate(360deg); } }

.qi-particle {
  position: absolute;
  left: 50%; top: 50%;
  width: 7px; height: 7px;
  border-radius: 9999px;
  background: radial-gradient(circle, #fde68a, #f59e0b);
  box-shadow: 0 0 8px 2px rgba(245,158,11,0.8);
  transform: rotate(var(--a)) translateX(90px);
  animation: qiAbsorb 1.8s ease-in infinite;
}
@keyframes qiAbsorb {
  0% { transform: rotate(var(--a)) translateX(100px) scale(1); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateX(0px) scale(0.2); opacity: 0; }
}

/* Lớp bùng nổ khi đồng bộ xong */
.qi-burst {
  position: fixed;
  left: 50%; top: 50%;
  width: 20px; height: 20px;
  border-radius: 9999px;
  background: radial-gradient(circle, #fff, #fde68a 40%, #f59e0b 70%, transparent 100%);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  z-index: 70;
}
.qi-burst.boom {
  display: block !important;
  animation: qiBoom .7s cubic-bezier(.22,.61,.36,1) forwards;
}
@keyframes qiBoom {
  0% { transform: translate(-50%,-50%) scale(0); opacity: 1; box-shadow: 0 0 0 0 rgba(245,158,11,0.8); }
  60% { opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(70); opacity: 0; box-shadow: 0 0 120px 60px rgba(245,158,11,0); }
}

/* Dialog thu nhỏ biến mất khi bùng nổ */
#syncDialog.collapse { animation: qiCollapse .5s ease-in forwards; }
@keyframes qiCollapse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.1); opacity: 0; filter: blur(4px); }
}

/* ===================== HEADER NAV FIX ===================== */
.nav-tab {
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-tab span { white-space: nowrap; }
.glass-header .nav-tab.active {
  background: rgba(39,39,42,0.8);
  color: #fbbf24;
}

/* ===================== HOME MAJOR TABS (ACTIVE STATES) ===================== */
#tabDrama.active #tabDramaIcon,
#tabDrama.active [data-lucide="clapperboard"],
#tabDrama.active svg {
  color: #000000 !important;
  stroke: #000000 !important;
}

#tabDrama.active #tabDramaBadge,
#tabDrama.active .tab-drama-badge {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}
