/* ============================================================
   CineZone - Main Stylesheet
   Phong cách: Dark Mode + Glassmorphism chuyên nghiệp
   ============================================================ */

/* --- 1. RESET & BIẾN CSS TOÀN CỤC --- */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  /* Màu sắc chủ đạo */
  --bg-primary: #080c14;
  --bg-secondary: #0f1623;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(15, 22, 35, 0.75);

  /* Accent — đỏ điện ảnh */
  --accent: #e50914;
  --accent-glow: rgba(229, 9, 20, 0.35);
  --accent-soft: rgba(229, 9, 20, 0.12);

  /* Text */
  --text-primary: #f0f4ff;
  --text-secondary: #8a9ab5;
  --text-muted: #4a5568;

  /* Border */
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(229, 9, 20, 0.5);

  /* Gradient */
  --grad-hero: linear-gradient(135deg, #0a0e1a 0%, #12182b 50%, #0a0e1a 100%);
  --grad-card-overlay: linear-gradient(to top, rgba(8, 12, 20, 0.98) 0%, rgba(8, 12, 20, 0.6) 50%, transparent 100%);
  --grad-accent: linear-gradient(135deg, #e50914, #ff4d4d);

  /* Typography */
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Spacing */
  --radius: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Navbar — desktop mặc định */
  --navbar-height: 68px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Lớp nền hạt grain để thêm chiều sâu */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

/* --- SEO: Visually Hidden Class --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.visually-hidden:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.seo-heading-footer {
  margin-top: 1rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* --- 2. SCROLLBAR TÙY CHỈNH --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 99px; }

/* --- 3. HEADER & NAVBAR --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.5rem 5%;
  min-height: var(--navbar-height);
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "logo center actions";
  align-items: center;
  gap: 0.65rem 1rem;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.nav-logo {
  grid-area: logo;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  line-height: 1.1;
  min-width: 0;
}

.nav-logo__icon {
  width: clamp(32px, 8vw, 40px);
  height: clamp(32px, 8vw, 40px);
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  border-radius: 8px;
}

.nav-logo__text {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.5vw, 2rem);
  letter-spacing: 2px;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.nav-center {
  grid-area: center;
  justify-self: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.65rem, 1.4vw, 1.5rem);
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.navbar-actions,
.navbar-end {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-self: end;
  min-width: 0;
  flex-shrink: 0;
}

.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: var(--transition);
  flex-shrink: 0;
}

.nav-icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.nav-search--mobile {
  display: none;
}

.page-main {
  padding-top: calc(var(--navbar-height) + 0.5rem);
}

.navbar.scrolled {
  background: rgba(8, 12, 20, 0.95);
  box-shadow: 0 4px 30px rgba(0,0,0,0.4);
}

.nav-logo__text > span {
  -webkit-text-fill-color: var(--text-primary);
}

.nav-links a {
  font-size: clamp(0.78rem, 1.1vw, 0.88rem);
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  transition: var(--transition);
  position: relative;
  padding-bottom: 4px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Search bar trong navbar — dùng chung mọi trang */
.nav-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  max-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.4rem 0.85rem;
  transition: var(--transition);
}

.nav-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.nav-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 100%;
  min-width: 0;
  flex: 1;
  caret-color: var(--accent);
}

/* Galaxy search cũ — ẩn (đã thay bằng .nav-search) */
#search-container {
  display: none !important;
}

.nav-search input::placeholder {
  color: var(--text-muted);
}

.nav-search button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.nav-search button:hover {
  color: var(--accent);
}

/* Hamburger mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border: none;
  background: transparent;
  flex-shrink: 0;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 99px;
  transition: var(--transition);
}

/* --- 4. HERO SLIDER --- */
.hero-slider {
  position: relative;
  width: 100%;
  height: 90vh;
  min-height: 550px;
  max-height: 750px;
  overflow: hidden;
  margin-top: var(--navbar-height);
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.hero-slide.active {
  opacity: 1;
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: brightness(0.5);
}

/* Lớp gradient che poster */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(8, 12, 20, 0.95) 0%,
    rgba(8, 12, 20, 0.7) 40%,
    rgba(8, 12, 20, 0.1) 70%,
    transparent 100%
  ),
  linear-gradient(
    to top,
    var(--bg-primary) 0%,
    transparent 30%
  );
}

.hero-content {
  position: absolute;
  bottom: 12%;
  left: 5%;
  max-width: 560px;
  animation: slideUp 0.6s ease forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.hero-meta span {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.hero-meta .separator {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
}

.hero-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffd700 !important;
  font-weight: 600;
}

.hero-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.8rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Nút chính (xem phim) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grad-accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.8rem;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

/* Nút phụ (thông tin) */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.75rem 1.8rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

/* Dots điều hướng slider */
.hero-dots {
  position: absolute;
  bottom: 5%;
  right: 5%;
  display: flex;
  gap: 8px;
  z-index: 12;
}

.page-home .hero-content {
  bottom: 14%;
}

.page-home .hero-dots {
  bottom: calc(52px + 4%);
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.hero-dot.active {
  width: 24px;
  background: var(--accent);
}

/* --- 5. SECTION PHIM --- */
.section {
  padding: 3rem 5%;
  position: relative;
  z-index: 1;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title::before {
  content: '';
  display: block;
  width: 5px;
  height: 28px;
  background: var(--grad-accent);
  border-radius: 99px;
}

.section-link {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}

.section-link:hover {
  gap: 8px;
}

/* --- 6. LƯỚI CARD PHIM --- */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.6rem;
}

/* Card phim */
.movie-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  transform-origin: center;
}

.movie-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--border-hover);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-hover);
}

/* Thumbnail phim */
.card-thumb {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.movie-card:hover .card-thumb img {
  transform: scale(1.08);
}

/* Overlay khi hover */
.card-thumb-overlay {
  position: absolute;
  inset: 0;
  background: var(--grad-card-overlay);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.movie-card:hover .card-thumb-overlay {
  opacity: 1;
}

/* Icon play */
.play-icon {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: scale(0.7);
  transition: transform 0.3s ease;
}

.movie-card:hover .play-icon {
  transform: scale(1);
}

/* Badge loại phim (TV/Movie) */
.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 2;
}

.card-badge.series {
  background: rgba(59, 130, 246, 0.85);
  color: #fff;
}

.card-badge.movie {
  background: rgba(229, 9, 20, 0.85);
  color: #fff;
}

/* Badge số tập */
.card-ep {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(0,0,0,0.7);
  color: #ffd700;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 2;
  backdrop-filter: blur(4px);
}

/* Thông tin card */
.card-info {
  padding: 0.75rem;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- 7. FILTER BAR (Trang Danh Mục) --- */
.filter-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 2rem;
  padding-bottom: 0.25rem;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-bar .filter-btn {
  flex-shrink: 0;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.45rem 1.1rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- 8. SEARCH PAGE --- */
.search-hero {
  padding: calc(var(--navbar-height) + 1.5rem) 5% 2rem;
  text-align: center;
}

.search-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 1.5rem;
}

.search-box {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: visible;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 1rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  caret-color: var(--accent);
}

.search-box button {
  background: var(--accent);
  border: none;
  padding: 0 1.5rem;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.search-box button:hover {
  background: #cc0812;
}

/* Autocomplete dùng chung cho navbar và trang tìm kiếm */
.autocomplete-host {
  position: relative;
}

.search-suggestions {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: min(360px, calc(100vw - 24px));
  max-height: min(430px, 65vh);
  overflow-y: auto;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(12, 17, 28, 0.98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.search-box .search-suggestions {
  top: calc(100% + 10px);
}

.search-box .search-suggestion,
.nav-search .search-suggestion {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem;
  border: 0;
  border-radius: 10px;
  color: var(--text-primary);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-box .search-suggestion:hover,
.search-box .search-suggestion.is-active,
.nav-search .search-suggestion:hover,
.nav-search .search-suggestion.is-active {
  background: var(--accent-soft);
}

.search-suggestion__poster {
  width: 44px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 7px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.search-suggestion__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.search-suggestion__info strong,
.search-suggestion__info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggestion__info strong {
  font-size: 0.9rem;
}

.search-suggestion__info small,
.search-suggestions__status {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.search-suggestions__status {
  padding: 0.9rem;
  text-align: center;
}

.search-suggestions__status.is-loading {
  color: var(--accent);
}

.light-theme .search-suggestions {
  background: rgba(255, 255, 255, 0.98);
}

.light-theme input[type="text"],
.light-theme .search-input,
.light-theme .nav-search input {
  color: #111827 !important;
  background: #ffffff;
}

.light-theme input::placeholder {
  color: #6b7280 !important;
  opacity: 1;
}

.light-theme .search-box .search-suggestion,
.light-theme .nav-search .search-suggestion {
  color: #111827;
}

.light-theme .search-box .search-suggestion:hover,
.light-theme .search-box .search-suggestion.is-active,
.light-theme .nav-search .search-suggestion:hover,
.light-theme .nav-search .search-suggestion.is-active {
  background: rgba(220, 38, 38, 0.12);
  color: #111827;
}

.light-theme .search-suggestion__info strong {
  color: #111827;
}

.light-theme .search-suggestion__info small,
.light-theme .search-suggestions__status {
  color: #4b5563;
}

.light-theme .search-suggestion:hover .search-suggestion__info strong,
.light-theme .search-suggestion.is-active .search-suggestion__info strong {
  color: #111827;
}

.light-theme .search-suggestion:hover .search-suggestion__info small,
.light-theme .search-suggestion.is-active .search-suggestion__info small {
  color: #374151;
}

/* --- 9. WATCH PAGE --- */
.watch-container {
  padding-top: var(--navbar-height);
}

/* Vùng player */
.player-section {
  background: #000;
  position: relative;
}

.player-wrapper {
  max-width: 1100px;
  margin: 0 auto;
}

.video-player {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}

.video-player iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Vùng thông tin + danh sách tập */
.watch-info-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 5%;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
}

/* Thông tin phim */
.movie-detail-info h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.movie-detail-info h2 {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tag {
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-card);
}

.tag.genre {
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.1);
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.detail-meta-item label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 4px;
}

.detail-meta-item span {
  font-size: 0.88rem;
  font-weight: 500;
}

.detail-description h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.detail-description p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Danh sách tập (Episode list) */
.episode-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: fit-content;
  position: sticky;
  top: 80px;
}

.episode-panel-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.episode-list {
  max-height: 420px;
  overflow-y: auto;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 0.5rem;
}

.ep-btn {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ep-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.ep-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* --- 10. LOADING SKELETON --- */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 0%,
    rgba(255,255,255,0.07) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

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

.skeleton-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.skeleton-thumb {
  aspect-ratio: 2/3;
}

.skeleton-info {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 12px;
  border-radius: 99px;
}

.skeleton-line.short { width: 60%; }

/* --- 11. ERROR / EMPTY STATE --- */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* --- 12. PAGINATION --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem;
}

.page-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover,
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* --- 13. FOOTER --- */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 2rem 5%;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

footer strong {
  color: var(--accent);
}

/* --- 14. RESPONSIVE --- */
@media (max-width: 1024px) {
  .nav-search {
    max-width: 220px;
  }

  .nav-links {
    gap: 0.75rem;
  }
}

@media (max-width: 900px) {
  .watch-info-section {
    grid-template-columns: 1fr;
  }

  .episode-panel {
    position: static;
  }

  .hero-content {
    max-width: 90%;
    left: 4%;
  }
}

@media (max-width: 768px) {
  :root {
    --navbar-height: 118px;
  }

  .navbar {
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
      "logo theme toggle"
      "search search search";
    padding: 0.5rem 4%;
    gap: 0.5rem;
  }

  .navbar:not(:has(.toggleWrapper)) {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "logo toggle"
      "search search";
  }

  /* Trang chủ: cyber portal cùng hàng logo */
  .page-home .navbar {
    grid-template-columns: 1fr auto auto auto;
    grid-template-areas:
      "logo cyber theme toggle"
      "search search search search";
  }

  .page-home .navbar-actions,
  .page-home .navbar-end {
    display: contents;
  }

  .page-home .nav-icon-btn--search {
    display: none;
  }

  .page-home .nav-search--mobile,
  .page-home .nav-search {
    display: flex !important;
    grid-area: search;
    width: 100%;
    max-width: none;
  }

  .page-home .navbar-cyber-slot {
    grid-area: cyber;
  }

  .page-home .toggleWrapper {
    grid-area: theme;
  }

  .nav-center {
    position: static;
    width: 0;
    height: 0;
    overflow: visible;
    justify-self: start;
  }

  .nav-icon-btn--search {
    display: none;
  }

  .nav-search--mobile {
    display: flex !important;
  }

  .nav-toggle {
    grid-area: toggle;
    display: flex;
  }

  .toggleWrapper {
    grid-area: theme;
    margin: 0;
  }

  .navbar-end {
    grid-area: search;
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }

  .nav-search {
    display: flex !important;
    max-width: none;
    width: 100%;
    padding: 0.45rem 0.9rem;
  }

  .nav-search input {
    font-size: 16px; /* tránh zoom tự động trên iOS */
  }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--navbar-height));
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0;
    background: rgba(8, 12, 20, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: 1rem;
    z-index: 2000;
    overflow-y: auto;
    transform: translateY(-8px);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    justify-self: stretch;
  }

  .nav-links li {
    width: 100%;
    border-bottom: 1px solid var(--border);
  }

  .nav-links a {
    display: block;
    padding: 1rem 1.25rem;
    font-size: 1.05rem;
  }

  #navLinks.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
  }

  #navToggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  #navToggle.active span:nth-child(2) {
    opacity: 0;
  }

  #navToggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
  }

  .hero-slider {
    height: min(75vh, 520px);
    min-height: 380px;
    margin-top: var(--navbar-height);
  }

  .hero-title {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  .hero-content {
    bottom: 8%;
    max-width: 92%;
  }

  .page-home .hero-content {
    bottom: 12%;
  }

  .page-home .hero-dots {
    bottom: calc(48px + 3%);
  }

  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .search-hero {
    padding-left: 4%;
    padding-right: 4%;
  }

  .search-box {
    max-width: 100%;
    border-radius: var(--radius);
  }

  .search-box input {
    font-size: 16px;
    padding: 0.85rem 1rem;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }
}

@media (max-width: 480px) {
  :root {
    --navbar-height: 112px;
  }

  .nav-logo__text {
    display: none;
  }

  .nav-logo__icon {
    width: 40px;
    height: 40px;
  }

  .movie-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .section {
    padding: 1.5rem 4%;
  }

  .seo-heading-footer {
    font-size: 0.9rem;
  }

  .filter-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.85rem;
  }

  .toggleWrapper .toggle {
    width: 44px;
    height: 26px;
  }
}

/* --- Light/Dark mode toggle (navbar) --- */
.toggleWrapper {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.toggleWrapper .input {
  position: absolute;
  left: -99em;
}
.toggle {
  cursor: pointer;
  display: inline-block;
  position: relative;
  width: 50px;
  height: 28px;
  background-color: #83d8ff;
  border-radius: 84px;
  transition: background-color 200ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
}
.toggle__handler {
  display: inline-block;
  position: relative;
  z-index: 1;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background-color: #ffcf96;
  border-radius: 50px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform: rotate(-45deg);
}
.toggle__handler .crater {
  position: absolute;
  background-color: #e8cda5;
  opacity: 0;
  transition: opacity 200ms ease-in-out;
  border-radius: 100%;
}
.toggle__handler .crater--1 { top: 10px; left: 5px; width: 2px; height: 2px; }
.toggle__handler .crater--2 { top: 15px; left: 12px; width: 3px; height: 3px; }
.toggle__handler .crater--3 { top: 5px; left: 14px; width: 4px; height: 4px; }
.star {
  position: absolute;
  background-color: #fff;
  transition: all 300ms cubic-bezier(0.445, 0.05, 0.55, 0.95);
  border-radius: 50%;
}
.star--1 { top: 6px; left: 20px; z-index: 0; width: 16px; height: 2px; }
.star--2 { top: 10px; left: 16px; z-index: 1; width: 16px; height: 2px; }
.star--3 { top: 15px; left: 22px; z-index: 0; width: 16px; height: 2px; }
.star--4, .star--5, .star--6 { opacity: 0; transition: all 300ms 0s cubic-bezier(0.445, 0.05, 0.55, 0.95); }
.star--4 { top: 9px; left: 6px; z-index: 0; width: 1px; height: 1px; transform: translate3d(2px, 0, 0); }
.star--5 { top: 18px; left: 9px; z-index: 0; width: 2px; height: 2px; transform: translate3d(2px, 0, 0); }
.star--6 { top: 20px; left: 15px; z-index: 0; width: 1px; height: 1px; transform: translate3d(2px, 0, 0); }
.input:checked + .toggle { background-color: #749dd6; }
.input:checked + .toggle .toggle__handler { background-color: #ffe5b5; transform: translate3d(22px, 0, 0) rotate(0); }
.input:checked + .toggle .toggle__handler .crater { opacity: 1; }
.input:checked + .toggle .star--1 { width: 1px; height: 1px; }
.input:checked + .toggle .star--2 { width: 2px; height: 2px; transform: translate3d(-3px, 0, 0); }
.input:checked + .toggle .star--3 { width: 1px; height: 1px; transform: translate3d(-4px, 0, 0); }
.input:checked + .toggle .star--4, .input:checked + .toggle .star--5, .input:checked + .toggle .star--6 { opacity: 1; transform: translate3d(0, 0, 0); }
.input:checked + .toggle .star--4 { transition: all 300ms 200ms cubic-bezier(0.445, 0.05, 0.55, 0.95); }
.input:checked + .toggle .star--5 { transition: all 300ms 300ms cubic-bezier(0.445, 0.05, 0.55, 0.95); }
.input:checked + .toggle .star--6 { transition: all 300ms 400ms cubic-bezier(0.445, 0.05, 0.55, 0.95); }

body.light-theme {
  background-color: #f5f7fa !important;
  color: #1a202c !important;
}
body.light-theme .navbar {
  background-color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
body.light-theme .nav-links a { color: #4a5568 !important; }
body.light-theme footer { background-color: #e2e8f0 !important; color: #4a5568 !important; }

/* --- PRELOADER --- */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #0a0e1a; /* Trùng với màu nền web */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader {
  display: block;
  width: 12em;
  height: 12em;
  overflow: visible;
}

.loader path.fill {
  fill: #2Af2;
  animation: fill 4s ease-in-out infinite;
}

.loader .dash path {
  stroke: #2AF;
  stroke-width: 1px;
  stroke-linecap: round;
  animation: dashArray var(--sped, 2s) ease-in-out infinite,
    dashOffset var(--sped, 2s) linear infinite;
}

.loader .dash path.aaa {
  stroke-width: 2px;
  stroke-linecap: butt;
  clip-path: path('M 20.4603 48.5493 L 16.6461 46.9584 C 17.3209 48.3794 18.4917 49.5682 20.0447 50.2206 C 23.4007 51.6328 27.2707 50.0262 28.6694 46.6367 C 29.3464 44.9966 29.3509 43.1867 28.6806 41.5422 C 28.0103 39.8977 26.7434 38.6151 25.119 37.9315 C 23.5035 37.2544 21.7741 37.279 20.2547 37.8576 L 24.1961 39.5022 C 26.6719 40.5434 27.8427 43.4124 26.8104 45.9105 C 25.7803 48.4085 22.936 49.5905 20.4603 48.5493 Z');
}

.loader .dash path.big {
  stroke-width: 2px;
  filter: drop-shadow(0 0 2px #2AF);
}

@keyframes dashArray {
  0% {
    stroke-dasharray: 0 1 359 0;
  }
  50% {
    stroke-dasharray: 0 359 1 0;
  }
  100% {
    stroke-dasharray: 359 1 0 0;
  }
}

@keyframes dashOffset {
  0% {
    stroke-dashoffset: -5;
  }
  100% {
    stroke-dashoffset: -365;
  }
}

@keyframes fill {
  30%,
  55% {
    fill: #2AF0;
  }
}

/* --- Galaxy Search (navbar) --- */
#search-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 36px;
  margin: 0 10px;
  z-index: 10;
}
#main-search {
  position: relative;
}
.galaxy-input {
  background-color: #0d0d13;
  border: none;
  width: 220px;
  height: 36px;
  border-radius: 6px;
  color: #fff;
  padding-left: 35px;
  padding-right: 40px;
  font-size: 14px;
  transition: all 0.3s;
}
.galaxy-input::placeholder {
  color: #ff4d4d88;
}
.galaxy-input:focus {
  outline: none;
}
#main-search:focus-within > #input-mask {
  display: none;
}
#input-mask {
  pointer-events: none;
  width: 60px;
  height: 20px;
  position: absolute;
  background: linear-gradient(90deg, transparent, #0d0d13);
  top: 8px;
  left: 120px;
}
#cosmic-glow {
  pointer-events: none;
  width: 20px;
  height: 15px;
  position: absolute;
  background: #ff4d4d;
  top: 10px;
  left: 5px;
  filter: blur(15px);
  opacity: 0.5;
  transition: all 1.5s;
}
#main-search:hover > #cosmic-glow {
  opacity: 0;
}
.stardust,
.cosmic-ring,
.starfield,
.nebula {
  max-height: 38px;
  width: 100%;
  position: absolute;
  overflow: hidden;
  z-index: -1;
  border-radius: 6px;
  filter: blur(2px);
  pointer-events: none;
}
.stardust::before {
  content: "";
  z-index: -2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(83deg);
  position: absolute;
  width: 400px;
  height: 400px;
  background-repeat: no-repeat;
  filter: brightness(1.2);
  background-image: conic-gradient(
    rgba(0, 0, 0, 0) 0%,
    #ff4d4d,
    rgba(0, 0, 0, 0) 8%,
    rgba(0, 0, 0, 0) 50%,
    #ff1a1a,
    rgba(0, 0, 0, 0) 58%
  );
  transition: all 1.5s;
}
.cosmic-ring::before {
  content: "";
  z-index: -2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(70deg);
  position: absolute;
  width: 400px;
  height: 400px;
  filter: brightness(1.1);
  background-image: conic-gradient(
    #0d0d13,
    #ff4d4d 5%,
    #0d0d13 14%,
    #0d0d13 50%,
    #ff1a1a 60%,
    #0d0d13 64%
  );
  transition: all 1.5s;
}
.starfield::before {
  content: "";
  z-index: -2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(82deg);
  position: absolute;
  width: 400px;
  height: 400px;
  background-image: conic-gradient(
    rgba(0, 0, 0, 0),
    #3a1414,
    rgba(0, 0, 0, 0) 10%,
    rgba(0, 0, 0, 0) 50%,
    #5c1e1e,
    rgba(0, 0, 0, 0) 60%
  );
  transition: all 1.5s;
}
#search-container:hover > .starfield::before {
  transform: translate(-50%, -50%) rotate(-98deg);
}
#search-container:hover > .nebula::before {
  transform: translate(-50%, -50%) rotate(-120deg);
}
#search-container:hover > .stardust::before {
  transform: translate(-50%, -50%) rotate(-97deg);
}
#search-container:hover > .cosmic-ring::before {
  transform: translate(-50%, -50%) rotate(-110deg);
}
#search-container:focus-within > .starfield::before {
  transform: translate(-50%, -50%) rotate(442deg);
  transition: all 3s;
}
#search-container:focus-within > .nebula::before {
  transform: translate(-50%, -50%) rotate(420deg);
  transition: all 3s;
}
#search-container:focus-within > .stardust::before {
  transform: translate(-50%, -50%) rotate(443deg);
  transition: all 3s;
}
#search-container:focus-within > .cosmic-ring::before {
  transform: translate(-50%, -50%) rotate(430deg);
  transition: all 3s;
}
.nebula {
  filter: blur(20px);
  opacity: 0.3;
  max-height: 50px;
}
.nebula:before {
  content: "";
  z-index: -2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(60deg);
  position: absolute;
  width: 500px;
  height: 500px;
  background-image: conic-gradient(
    #000,
    #ff4d4d 5%,
    #000 38%,
    #000 50%,
    #ff1a1a 60%,
    #000 87%
  );
  transition: all 1.5s;
}
.cosmic-dust {
  max-height: 38px;
  width: 100%;
  position: absolute;
  overflow: hidden;
  z-index: -1;
  border-radius: 6px;
  filter: blur(6px);
  pointer-events: none;
  opacity: 0.25;
}
.cosmic-dust::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 280px;
  height: 280px;
  transform: translate(-50%, -50%) rotate(0deg);
  background-image: radial-gradient(
    circle at center,
    rgba(255, 77, 77, 0.6) 0%,
    rgba(255, 26, 26, 0.1) 35%,
    rgba(0, 0, 0, 0) 70%
  );
}
.wormhole-border {
  height: 30px;
  width: 30px;
  position: absolute;
  top: 3px;
  right: 3px;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: none;
}
.wormhole-border::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  transform: translate(-50%, -50%) rotate(90deg);
  filter: brightness(1.2);
  background-image: conic-gradient(
    rgba(0, 0, 0, 0),
    #ff4d4d,
    rgba(0, 0, 0, 0) 50%,
    rgba(0, 0, 0, 0) 50%,
    #ff1a1a,
    rgba(0, 0, 0, 0) 100%
  );
  animation: rotateW 4s linear infinite;
}
#wormhole-icon {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  height: 28px;
  width: 28px;
  border-radius: 4px;
  background: linear-gradient(180deg, #3a1414, #0d0d13, #5c1e1e);
  cursor: pointer;
}
#search-icon {
  position: absolute;
  left: 10px;
  top: 10px;
  display: flex;
  align-items: center;
}
@keyframes rotateW {
  100% {
    transform: translate(-50%, -50%) rotate(450deg);
  }
}
