@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  --bg-deep: #0a0a0f; --bg-card: #13131a; --bg-card-hover: #1a1a24;
  --accent: #e63946; --accent-glow: #ff6b6b; --gold: #f4a261; --vip-gold: #ffd700;
  --text-primary: #e8e8ec; --text-secondary: #8888a0; --text-muted: #55556a;
  --border: #1e1e2e; --radius: 12px; --radius-sm: 8px;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4); --shadow-glow: 0 0 40px rgba(230,57,70,0.15);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg-deep); color: var(--text-primary); line-height: 1.6;
  min-height: 100vh; overflow-x: hidden;
}

body::before {
  content: ''; position: fixed; inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0;
}

/* ===== HEADER ===== */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.85); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border); padding: 0 2rem;
}
.header-inner {
  max-width: 1400px; margin: 0 auto; display: flex;
  align-items: center; justify-content: space-between; height: 64px;
}
.logo {
  font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 900;
  letter-spacing: -0.5px; color: var(--text-primary); text-decoration: none;
  display: flex; align-items: center; gap: 10px;
}
.logo span { color: var(--accent); }
.logo-icon {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent), #c1121f);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; box-shadow: var(--shadow-glow);
}
nav { display: flex; gap: 2rem; }
nav a {
  color: var(--text-secondary); text-decoration: none; font-size: 0.9rem;
  font-weight: 500; transition: var(--transition);
}
nav a:hover, nav a.active { color: var(--text-primary); }
.header-right { display: flex; align-items: center; gap: 1rem; }
.search-box {
  display: flex; align-items: center; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 50px; padding: 8px 16px; gap: 8px;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.search-box input {
  background: none; border: none; outline: none; color: var(--text-primary);
  font-size: 0.85rem; width: 160px; font-family: inherit;
}
.search-box input::placeholder { color: var(--text-muted); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 24px;
  border-radius: 50px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); border: none; font-family: inherit; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 20px rgba(230,57,70,0.3); }
.btn-primary:hover { background: #c1121f; transform: translateY(-2px); box-shadow: 0 8px 30px rgba(230,57,70,0.4); }
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--text-secondary); background: rgba(255,255,255,0.03); }
.btn-vip { background: linear-gradient(135deg, #f4a261, #e76f51); color: #fff; box-shadow: 0 4px 20px rgba(244,162,97,0.3); }
.btn-vip:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(244,162,97,0.4); }
.btn-sm { padding: 6px 16px; font-size: 0.78rem; }

.user-badge {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  border-radius: 50px; background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; font-size: 0.85rem; transition: var(--transition);
}
.user-badge:hover { border-color: var(--text-secondary); }
.user-badge.vip { border-color: var(--vip-gold); }
.vip-tag {
  font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 50px;
  background: linear-gradient(135deg, #f4a261, #e76f51); color: #000;
}

/* ===== HERO ===== */
.hero {
  position: relative; height: 520px; display: flex; align-items: center;
  padding: 3rem 2rem; max-width: 1400px; margin: 1.5rem auto 0;
  border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  background-repeat: no-repeat; opacity: 0.3;
}
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10,10,15,0.95) 0%, rgba(10,10,15,0.7) 50%, rgba(10,10,15,0.4) 100%);
}
.hero-content { position: relative; z-index: 2; max-width: 55%; }
.hero-poster {
  position: absolute; right: 4rem; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 220px; height: 330px; border-radius: 12px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(230,57,70,0.15);
  background: var(--bg-deep);
}
.hero-poster img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.hero-badge {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: 0.75rem; font-weight: 700; padding: 4px 12px; border-radius: 50px;
  letter-spacing: 1px; text-transform: uppercase; margin-bottom: 1rem;
}
.hero h1 {
  font-family: 'Playfair Display', serif; font-size: 3rem; font-weight: 900;
  line-height: 1.1; margin-bottom: 0.75rem;
  background: linear-gradient(to right, #fff 0%, #c0c0d0 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-meta { display: flex; gap: 1.5rem; margin-bottom: 1rem; font-size: 0.85rem; color: var(--text-secondary); }
.hero-meta .rating { color: var(--gold); font-weight: 700; font-size: 1rem; }
.hero p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.7; margin-bottom: 1.5rem; max-width: 480px; }
.hero-actions { display: flex; gap: 1rem; }

/* ===== SECTIONS ===== */
.section { max-width: 1400px; margin: 3rem auto; padding: 0 2rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.section-header h2 { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 700; }

/* ===== GENRE TAGS ===== */
.genre-tags { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 2rem; }
.genre-tag {
  padding: 6px 18px; border-radius: 50px; font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary);
}
.genre-tag:hover, .genre-tag.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== MOVIE GRID ===== */
.movie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem; }
.movie-card {
  background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: var(--transition); border: 1px solid transparent; position: relative;
}
.movie-card:hover { transform: translateY(-6px); border-color: var(--border); box-shadow: var(--shadow-card), 0 0 30px rgba(230,57,70,0.08); }
.movie-poster {
  position: relative; aspect-ratio: 2/3;
  background: linear-gradient(135deg, #1a1a2e, #16213e); overflow: hidden;
}
.movie-poster img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.3s;
}
.movie-card:hover .movie-poster img {
  transform: scale(1.05);
}
.movie-poster .placeholder-poster {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--text-muted);
}
.movie-rating-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
  color: var(--gold); font-size: 0.75rem; font-weight: 700;
  padding: 4px 10px; border-radius: 50px;
}
.movie-year-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
  color: var(--text-secondary); font-size: 0.7rem; padding: 4px 10px; border-radius: 50px;
}
.movie-vip-badge {
  position: absolute; bottom: 10px; right: 10px;
  background: linear-gradient(135deg, #f4a261, #e76f51);
  color: #000; font-size: 0.65rem; font-weight: 700;
  padding: 3px 8px; border-radius: 50px;
}
.movie-info { padding: 1rem; }
.movie-info h3 { font-size: 0.95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.35rem; }
.movie-info .movie-genres { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.movie-info .movie-meta-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--text-secondary); }

/* ===== FEATURED ===== */
.featured-row { display: flex; gap: 1.5rem; overflow-x: auto; padding-bottom: 1rem; scroll-snap-type: x mandatory; }
.featured-row::-webkit-scrollbar { height: 4px; }
.featured-row::-webkit-scrollbar-track { background: transparent; }
.featured-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.featured-card {
  flex: 0 0 320px; scroll-snap-align: start; background: var(--bg-card);
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  transition: var(--transition); cursor: pointer;
}
.featured-card:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.featured-card .fc-poster { height: 180px; background: linear-gradient(135deg, #1a1a2e, #16213e); position: relative; }
.featured-card .fc-poster .fc-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-card) 0%, transparent 60%);
}
.featured-card .fc-info { padding: 1rem 1.25rem 1.25rem; }
.featured-card .fc-info h4 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.featured-card .fc-info p { font-size: 0.8rem; color: var(--text-secondary); }

/* ===== FOOTER ===== */
footer { border-top: 1px solid var(--border); padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.8rem; margin-top: 4rem; }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 800px; width: 90%; max-height: 90vh; overflow-y: auto;
  transform: translateY(20px); transition: transform 0.3s; position: relative;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-close {
  position: absolute; top: 1rem; right: 1rem; z-index: 10;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.modal-close:hover { background: var(--accent); border-color: var(--accent); }

.auth-modal { max-width: 420px; padding: 2.5rem; }
.auth-modal h2 { font-family: 'Playfair Display', serif; font-size: 1.8rem; margin-bottom: 1.5rem; text-align: center; }
.auth-modal .form-group { margin-bottom: 1rem; }
.auth-modal label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.auth-modal input {
  width: 100%; padding: 10px 14px; background: var(--bg-deep); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.9rem; font-family: inherit;
}
.auth-modal input:focus { outline: none; border-color: var(--accent); }
.auth-modal .btn { width: 100%; justify-content: center; margin-top: 0.5rem; }
.auth-modal .switch-link { text-align: center; margin-top: 1rem; font-size: 0.85rem; color: var(--text-secondary); }
.auth-modal .switch-link a { color: var(--accent); cursor: pointer; text-decoration: none; }
.auth-modal .error-msg { color: var(--accent); font-size: 0.8rem; margin-top: 0.5rem; text-align: center; }

/* ===== DETAIL MODAL ===== */
.modal-body { display: flex; gap: 2rem; padding: 2rem; }
.modal-poster { flex: 0 0 250px; aspect-ratio: 2/3; border-radius: var(--radius-sm); overflow: hidden; background: linear-gradient(135deg, #1a1a2e, #16213e); }
.modal-details { flex: 1; }
.modal-details h2 { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; margin-bottom: 0.75rem; }
.modal-details .detail-meta { display: flex; gap: 1.5rem; margin-bottom: 1rem; font-size: 0.85rem; color: var(--text-secondary); flex-wrap: wrap; }
.modal-details .detail-rating { color: var(--gold); font-weight: 700; font-size: 1.1rem; }
.modal-details .detail-overview { color: var(--text-secondary); line-height: 1.8; margin-bottom: 1.5rem; }
.modal-details .detail-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; font-size: 0.85rem; }
.modal-details .detail-info-grid dt { color: var(--text-muted); }
.modal-details .detail-info-grid dd { color: var(--text-primary); font-weight: 500; }
.modal-details .vip-lock {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: rgba(244,162,97,0.1); border: 1px solid rgba(244,162,97,0.3);
  border-radius: var(--radius-sm); margin-top: 1rem;
}
.modal-details .vip-lock span { color: var(--vip-gold); font-size: 0.85rem; }

/* ===== VIDEO PLAYER ===== */
.player-overlay {
  position: fixed; inset: 0; background: #000; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.player-overlay.active { opacity: 1; pointer-events: auto; }
.player-overlay video { max-width: 100%; max-height: 100%; }
.player-close {
  position: absolute; top: 1.5rem; right: 1.5rem; z-index: 10;
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  font-size: 1.5rem; display: flex; align-items: center; justify-content: center;
}
.player-close:hover { background: rgba(255,255,255,0.2); }

/* ===== VIP PLANS ===== */
.vip-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.5rem 0; }
.vip-plan {
  padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-align: center; cursor: pointer; transition: var(--transition); background: var(--bg-deep);
}
.vip-plan:hover { border-color: var(--vip-gold); }
.vip-plan.selected { border-color: var(--vip-gold); background: rgba(244,162,97,0.08); }
.vip-plan h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.vip-plan .price { font-size: 2rem; font-weight: 700; color: var(--vip-gold); font-family: 'Playfair Display', serif; }
.vip-plan .price small { font-size: 0.9rem; color: var(--text-secondary); }
.vip-plan .desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.5rem; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 400;
  padding: 12px 24px; border-radius: 50px; font-size: 0.9rem; font-weight: 500;
  transform: translateY(100px); opacity: 0; transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: #2d6a4f; color: #d8f3dc; }
.toast.error { background: var(--accent); color: #fff; }

/* ===== CATEGORY TABS ===== */
.category-tabs { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 2rem; }
.cat-tab {
  padding: 8px 20px; border-radius: 50px; font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary); user-select: none;
}
.cat-tab:hover, .cat-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== PAGINATION ===== */
.pagination { display: flex; justify-content: center; margin-top: 2rem; }
.pagination-inner { display: flex; align-items: center; gap: 0.35rem; }
.page-btn {
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary); font-family: inherit;
}
.page-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-dots { color: var(--text-muted); padding: 0 4px; font-size: 0.85rem; }

/* ===== EPISODE BADGE ON CARDS ===== */
.movie-episode-badge {
  position: absolute; bottom: 10px; left: 10px;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
  color: #4ecdc4; font-size: 0.65rem; font-weight: 700;
  padding: 3px 8px; border-radius: 50px;
}

/* ===== SERIES GRID ===== */
.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.series-card {
  background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: var(--transition); border: 1px solid var(--border);
  display: flex; gap: 1rem; padding: 0;
}
.series-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); border-color: var(--accent); }
.series-poster {
  width: 120px; min-height: 160px; flex-shrink: 0;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  position: relative; overflow: hidden;
}
.series-poster .placeholder-poster {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: var(--text-muted);
}
.series-info { padding: 1rem 1rem 1rem 0; flex: 1; }
.series-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.35rem; }
.series-meta { display: flex; gap: 0.75rem; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; flex-wrap: wrap; }
.series-info p { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; }

/* ===== EPISODES IN DETAIL MODAL ===== */
.episodes-section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.episodes-section h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; font-family: 'Playfair Display', serif; }
.season-group { margin-bottom: 1rem; }
.season-group h4 { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.5rem; font-weight: 600; }
.episode-list { display: flex; flex-direction: column; gap: 0.5rem; }
.episode-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
  background: var(--bg-deep); border: 1px solid transparent;
}
.episode-item:hover { border-color: var(--accent); background: rgba(230,57,70,0.05); }
.episode-item.current { border-color: var(--accent); background: rgba(230,57,70,0.08); }
.episode-item .episode-info { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.episode-item .episode-info strong { font-size: 0.85rem; }
.episode-current-tag {
  font-size: 0.65rem; background: var(--accent); color: #fff;
  padding: 2px 8px; border-radius: 50px; font-weight: 600;
}
.episode-play-tag {
  font-size: 0.8rem; color: #4ecdc4;
}
.episode-vip-tag {
  font-size: 0.9rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { display: none; }
  .search-box input { width: 100px; }
  .hero { height: auto; padding: 2rem 1.5rem; flex-direction: column; align-items: flex-start; gap: 1rem; }
  .hero-content { max-width: 100%; }
  .hero-poster { position: relative; right: auto; top: auto; transform: none; width: 150px; height: 225px; order: -1; }
  .hero h1 { font-size: 2rem; }
  .movie-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
  .modal-body { flex-direction: column; padding: 1.5rem; }
  .modal-poster { flex: 0 0 auto; aspect-ratio: 16/9; max-height: 200px; }
  .featured-card { flex: 0 0 260px; }
  .vip-plans { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .search-box { display: none; }
  .movie-grid { grid-template-columns: repeat(2, 1fr); }
}
