/* ══════════════════════════════════════
   BLUVIA — Premium Mobile UI v2
   ══════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg: #0e0e14;
  --bg2: #14141e;
  --bg3: #1c1c2a;
  --surface: #1e1e2e;
  --surface2: #282840;
  --accent: #5b6ef5;
  --accent2: #4a5ae0;
  --accent-glow: rgba(91,110,245,0.25);
  --purple: #7c6cfc;
  --pink: #f06292;
  --orange: #ff8a65;
  --green: #4caf80;
  --red: #ef5350;
  --text: #eeeef2;
  --text2: #9999aa;
  --text3: #66667a;
  --border: rgba(255,255,255,0.06);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 24px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 0; height: 0; }

/* ─── UTILITY ─── */
.section { padding: 0 16px; margin-bottom: 20px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 20px; font-weight: 700; }
.section-link { font-size: 13px; color: var(--accent); font-weight: 600; }

/* ─── ANIMATION ─── */
.fade-in {
  animation: fadeIn 0.4s ease-out both;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in-d1 { animation-delay: 0.05s; }
.fade-in-d2 { animation-delay: 0.1s; }
.fade-in-d3 { animation-delay: 0.15s; }
.fade-in-d4 { animation-delay: 0.2s; }
.fade-in-d5 { animation-delay: 0.25s; }

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--surface) 50%, var(--bg3) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.8s infinite linear;
  border-radius: var(--radius-sm);
}
.skeleton-card {
  width: 145px;
  aspect-ratio: 2/3;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}
.skeleton-trending {
  height: 80px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text3);
  font-size: 14px;
}

/* ─── HEADER ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}
.header-logo { display: flex; align-items: center; gap: 8px; }
.header-logo .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #7c6cfc);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.header-logo .logo-icon svg { width: 17px; height: 17px; fill: white; }
.header-logo .logo-text {
  font-size: 19px; font-weight: 800; letter-spacing: 1.5px;
  background: linear-gradient(135deg, #fff, #ccc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header-right { display: flex; align-items: center; gap: 8px; }
.header-right .search-btn, .header-right .bell-btn {
  width: 38px; height: 38px; border-radius: var(--radius-pill);
  background: var(--surface); border: none; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.header-right .search-btn:active, .header-right .bell-btn:active {
  background: var(--surface2); transform: scale(0.94);
}

/* ─── FEATURED HERO CAROUSEL ─── */
.featured-carousel {
  position: relative;
  margin: 0 16px 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg2);
  box-shadow: 0 4px 30px rgba(0,0,0,0.4);
}
.carousel-slide {
  display: none;
  position: relative;
  overflow: hidden;
}
.carousel-slide.active { display: block; }
.carousel-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transition: background-image 0.5s ease;
}
.carousel-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(0deg, var(--bg) 15%, transparent 60%);
}
.carousel-inner {
  position: relative; z-index: 2;
  padding: 12px; display: flex; gap: 12px; min-height: 200px;
}
.carousel-poster-wrap {
  width: 42%; max-width: 140px;
  aspect-ratio: 2/3; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.carousel-poster-wrap img {
  width: 100%; height: 100%; object-fit: cover;
}
.carousel-info {
  flex: 1; display: flex; flex-direction: column;
  justify-content: flex-end; padding-bottom: 2px;
}
.carousel-badge {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 8px; align-self: flex-start;
}
.carousel-badge.action { background: var(--pink); color: white; }
.carousel-badge.new { background: var(--green); color: white; }
.carousel-badge.hot { background: var(--orange); color: white; }

.carousel-info h1 { font-size: 16px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.carousel-meta {
  font-size: 12px; color: var(--text2); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.carousel-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text3); }
.carousel-desc {
  font-size: 12px; color: var(--text2); line-height: 1.5; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.carousel-actions { display: flex; gap: 8px; }

.btn {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 700; border: none; cursor: pointer;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.95); }
.btn-primary {
  background: var(--accent); color: white;
  box-shadow: 0 2px 16px var(--accent-glow);
}
.btn-primary svg { fill: white; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-full { flex: 1; }

/* Hero Dots */
.carousel-dots {
  display: flex; justify-content: center; gap: 6px;
  padding: 8px 0 10px; position: relative; z-index: 3;
}
.carousel-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text3); border: none; cursor: pointer;
  transition: all 0.3s; padding: 0;
}
.carousel-dot.active {
  width: 20px; border-radius: 3px;
  background: var(--accent);
}

/* ─── CATEGORY TABS ─── */
.category-tabs {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 0 16px 4px; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; margin-bottom: 16px;
}
.category-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 16px; border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text2);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  flex-shrink: 0; transition: all 0.2s; border: 1px solid transparent;
}
.category-tab.active {
  background: rgba(91,110,245,0.15);
  color: var(--accent);
  border-color: rgba(91,110,245,0.3);
}
.category-tab .flag { font-size: 15px; }
.category-tab:active { transform: scale(0.95); }

/* ═══════ HERO SKELETON ═══════ */
.skeleton-hero-poster {
  width: 100%; height: 100%; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg3) 25%, var(--surface) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}
.skeleton-text {
  display: inline-block; border-radius: 6px;
  background: linear-gradient(90deg, var(--bg3) 25%, var(--surface) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}
.skeleton-title { width: 80%; height: 24px; }
.skeleton-meta { width: 120px; height: 14px; }
.skeleton-desc { width: 90%; height: 16px; margin: 8px 0; }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── PROMO BANNERS ─── */
.promo-banner {
  margin: 0 16px 10px; padding: 14px 16px;
  border-radius: var(--radius); display: flex; align-items: center;
  gap: 12px; overflow: hidden; position: relative;
}
.promo-banner .promo-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.promo-banner .promo-text { flex: 1; }
.promo-banner .promo-text h3 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.promo-banner .promo-text p { font-size: 12px; color: var(--text2); }
.promo-banner .promo-btn {
  padding: 8px 18px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700; border: none; cursor: pointer;
  white-space: nowrap; transition: all 0.15s;
}
.promo-banner .promo-btn:active { transform: scale(0.95); }
.promo-banner.login { background: linear-gradient(135deg, #1a1050, var(--bg3)); }
.promo-banner.login .promo-btn { background: var(--accent); color: white; }
.promo-banner.streak { background: linear-gradient(135deg, #3a1020, var(--bg3)); }
.promo-banner.streak .promo-btn { background: var(--orange); color: white; }

/* ─── TRENDING RANKING ─── */
.trending-list { display: flex; flex-direction: column; gap: 10px; }
.trending-item {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; -webkit-tap-highlight-color: transparent; padding: 4px 0;
  animation: fadeIn 0.3s ease-out both;
}
.trending-item:active { opacity: 0.7; }
.trending-rank {
  width: 36px; text-align: center;
  font-size: 16px; font-weight: 800; color: var(--text3); flex-shrink: 0;
}
.trending-rank.t1 { color: var(--orange); }
.trending-rank.t2 { color: var(--accent); }
.trending-rank.t3 { color: var(--pink); }
.trending-poster {
  width: 56px; height: 78px; border-radius: 6px;
  overflow: hidden; flex-shrink: 0; background: var(--bg3);
}
.trending-poster img { width: 100%; height: 100%; object-fit: cover; }
.trending-info { flex: 1; min-width: 0; }
.trending-info .trending-title {
  font-size: 14px; font-weight: 600; margin-bottom: 2px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trending-info .trending-meta { font-size: 12px; color: var(--text3); }
.trending-info .trending-tags { margin-top: 4px; }
.trending-info .trending-tags .tag { font-size: 10px; font-weight: 600; color: var(--text3); background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 4px; }

/* ─── POSTER SCROLL ─── */
.poster-scroll {
  display: flex !important; gap: 10px;
  overflow-x: auto !important; overflow-y: hidden !important;
  padding: 4px 0 8px; -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none; scroll-behavior: smooth;
  flex-wrap: nowrap !important; -ms-overflow-style: none;
}
.poster-card {
  text-decoration: none; color: inherit;
  position: relative; border-radius: var(--radius-lg);
  overflow: hidden; background: var(--bg3);
  flex-shrink: 0 !important; width: 145px;
  aspect-ratio: 2/3; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.3s, box-shadow 0.3s;
}
.poster-card:hover {
  transform: scale(1.04) translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}
.poster-card:active { transform: scale(0.98); }

/* Poster image — fills entire card */
.poster-card .poster-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: var(--bg3);
}

/* Info overlay — bottom gradient */
.poster-card .poster-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  z-index: 4;
}
.poster-card .poster-title {
  font-size: var(--fs-sm, 12px); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff;
}
.poster-card .poster-meta {
  font-size: var(--fs-xs, 11px); color: rgba(255,255,255,0.7);
  margin-top: 2px; font-weight: 400;
}

/* Dark overlay on hover */
.poster-card::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(0,0,0,0.4); opacity: 0;
  transition: opacity 0.3s; z-index: 1;
}
.poster-card:hover::after { opacity: 1; }

/* Play button triangle on hover */
.poster-card::before {
  content: ""; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 48px; height: 48px; border-radius: 50%;
  z-index: 3; opacity: 0; transition: opacity 0.3s;
  box-shadow: 0 4px 20px rgba(59,130,246,0.4);
  clip-path: polygon(38% 25%, 38% 75%, 75% 50%);
  background: #fff;
}
.poster-card:hover::before { opacity: 1; }

/* Play icon overlay (SVG version) */
.poster-card .poster-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4); opacity: 0;
  transition: opacity 0.3s; z-index: 2;
}
.poster-card:hover .poster-play { opacity: 1; }
.poster-card .poster-play svg {
  width: 48px; height: 48px;
  background: var(--accent); border-radius: 50%;
  padding: 12px; color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* Badge (top-right) */
.poster-card .pc-badge {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700;
}
.poster-card .pc-badge.populer { background: var(--red); color: white; }
.poster-card .pc-badge.baru { background: var(--green); color: white; }
.poster-card .pc-badge.hot { background: var(--orange); color: white; }
.poster-card .pc-badge.ep {
  background: rgba(0,0,0,0.8); color: white;
  top: auto; bottom: 8px; right: 8px; left: auto;
}

/* Favorite button */
.poster-card .pc-fav {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.7); display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: background 0.2s;
}
.poster-card .pc-fav:hover { background: rgba(0,0,0,0.9); }

/* Landscape posters for Film sections */
.poster-card.landscape { aspect-ratio: 3/2; }
.poster-card.landscape { width: 200px; }

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(14,14,20,0.98);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  padding: 4px 0 calc(4px + env(safe-area-inset-bottom, 0px));
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 6px 10px; font-size: 10px; font-weight: 600;
  color: var(--text3); transition: color 0.2s;
  position: relative; -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--accent); }
.nav-item svg { width: 22px; height: 22px; }
/* Nav icon glow for active */
.nav-item.active svg {
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
body { padding-bottom: 68px; }

/* ─── DESKTOP: bottom-nav is mobile-only ─── */
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
  body { padding-bottom: 0 !important; }
  /* Center page content into a column like a real app shell */
  .page-header,
  .fav-count,
  .fav-grid,
  #fav-container {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
  .page-header { border-bottom: 1px solid var(--border); }
}

/* ─── SEARCH ─── */
.search-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg); display: none; padding: 16px;
}
.search-overlay.open { display: block; animation: fadeIn 0.2s ease-out; }
.search-overlay .search-top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.search-overlay .search-input {
  flex: 1; padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 15px; outline: none;
}
.search-overlay .search-input:focus { border-color: var(--accent); }
.search-overlay .search-close {
  width: 36px; height: 36px; display: flex;
  align-items: center; justify-content: center; cursor: pointer; color: var(--text2);
}
.search-results { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.search-card { border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; }
.search-card img {
  width: 100%; aspect-ratio: 2/3; object-fit: cover; background: var(--bg3);
}
.search-card .search-title { font-size: 12px; font-weight: 600; margin-top: 4px; }
.search-card .search-meta { font-size: 11px; color: var(--text3); }

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: white; padding: 10px 20px;
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
  z-index: 300; opacity: 0; transition: all 0.3s;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-8px); }

/* ── Login page variable aliases ── */
:root {
  --bg-primary: var(--bg);
  --bg-secondary: var(--bg2);
  --border-light: var(--border);
  --accent-gradient: linear-gradient(135deg, var(--accent), var(--purple));
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --text-primary: #fff;
  --text-secondary: rgba(196,181,253,0.7);
  --text-muted: rgba(196,181,253,0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Trending badge (small rank indicator) ── */
.trending-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  z-index: 10;
  border: 1px solid rgba(255,255,255,0.1);
}
.trending-badge.t1 { background: linear-gradient(135deg, #ff8a65, #ff6b35); }
.trending-badge.t2 { background: linear-gradient(135deg, #5b6ef5, #4a5ae0); }
.trending-badge.t3 { background: linear-gradient(135deg, #f06292, #e91e63); }
