/* ========================================
   BLUVIA Web — Design System
   ======================================== */

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

/* ── Tokens ── */
:root {
  /* Colors */
  --bg-primary: #080c18;
  --bg-secondary: #0d1225;
  --bg-card: #111833;
  --bg-card-hover: #161e3d;
  --bg-sidebar: #0a0f22;
  --bg-input: #111833;
  --bg-nav: rgba(8, 12, 24, 0.85);

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
  --accent-glow: rgba(59, 130, 246, 0.25);

  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #60a5fa;

  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fs-hero: 3rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-elevated: 0 8px 40px rgba(0,0,0,0.4);

  /* Sidebar */
  --sidebar-width: 200px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: 90px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; font-family: inherit; }
input { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: var(--radius-full); }

/* ── Utility ── */
.container { width: 100%; margin: 0 auto; padding: 0 var(--space-2xl); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600; font-size: var(--fs-sm);
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent-gradient); color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-outline {
  background: transparent; color: var(--text-primary);
  border: 1.5px solid var(--border-light);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); }
.btn-lg { padding: 0.75rem 2rem; font-size: var(--fs-base); }
.btn-sm { padding: 0.4rem 1rem; font-size: var(--fs-xs); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.3s var(--ease);
}
.card:hover { border-color: var(--border-light); background: var(--bg-card-hover); }

/* ── Section Headers ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.section-title {
  font-size: var(--fs-lg); font-weight: 700;
  display: flex; align-items: center; gap: var(--space-sm);
}
.section-link {
  color: var(--text-accent); font-size: var(--fs-sm); font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}
.section-link:hover { text-decoration: underline; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: 600;
  background: var(--accent); color: #fff;
}
.badge-new { background: #22c55e; }
.badge-ongoing { background: var(--accent); }
.badge-premium { background: linear-gradient(135deg, #f59e0b, #f97316); }

/* ── Inputs ── */
.input-group { display: flex; flex-direction: column; gap: var(--space-xs); }
.input-label { font-size: var(--fs-sm); color: var(--text-secondary); font-weight: 500; }
.input-wrapper {
  position: relative; display: flex; align-items: center;
}
.input-icon {
  position: absolute; left: 12px; color: var(--text-muted);
  pointer-events: none; display: flex;
}
.input-wrapper input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  transition: border-color 0.2s;
}
.input-wrapper input::placeholder { color: var(--text-muted); }
.input-wrapper input:focus { outline: none; border-color: var(--accent); }
.input-toggle {
  position: absolute; right: 12px;
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  display: flex; padding: 4px;
}
.input-toggle:hover { color: var(--text-secondary); }

/* ── Search Bar ── */
.search-bar {
  display: flex; align-items: center; gap: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  width: 220px;
}
.search-bar input {
  background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: var(--fs-sm);
  width: 100%;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

/* ── Avatar ── */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-sm); color: #fff;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Poster Card ── */
.poster-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  transition: transform 0.3s var(--ease);
  cursor: pointer;
  aspect-ratio: 2/3;
}
.poster-card:hover { transform: translateY(-4px); }
.poster-card .poster-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--bg-secondary);
}
.poster-card .poster-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.poster-card .poster-title {
  font-size: var(--fs-sm); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.poster-card .poster-meta {
  font-size: var(--fs-xs); color: var(--text-secondary);
  margin-top: 2px;
}
.poster-card .poster-badge {
  position: absolute; top: 8px; right: 8px;
  z-index: 2;
}
.poster-card .poster-rank {
  position: absolute; top: 0; left: 0;
  width: 32px; height: 32px;
  background: var(--accent-gradient);
  border-radius: 0 0 var(--radius-md) 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: var(--fs-sm);
  z-index: 2;
}
.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;
}
.poster-card:hover .poster-play { opacity: 1; }
.poster-card .poster-play svg {
  width: 48px; height: 48px;
  background: var(--accent);
  border-radius: var(--radius-full);
  padding: 12px;
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ── Continue Watching Card ── */
.continue-card {
  display: flex; gap: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}
.continue-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.continue-card .cc-poster {
  width: 140px; flex-shrink: 0;
  object-fit: cover; aspect-ratio: 16/10;
  background: var(--bg-secondary);
}
.continue-card .cc-info {
  flex: 1; padding: var(--space-md) var(--space-md) var(--space-md) 0;
  display: flex; flex-direction: column; justify-content: center;
}
.continue-card .cc-title { font-weight: 600; font-size: var(--fs-sm); }
.continue-card .cc-episode { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; }
.continue-card .cc-progress-wrap {
  display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm);
}
.continue-card .cc-progress {
  flex: 1; height: 4px; background: var(--border-light);
  border-radius: var(--radius-full); overflow: hidden;
}
.continue-card .cc-progress-fill {
  height: 100%; background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.5s var(--ease);
}
.continue-card .cc-progress-pct {
  font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 600; min-width: 32px;
}

/* ── Genre Card ── */
.genre-card {
  display: flex; align-items: center; gap: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  transition: all 0.3s var(--ease);
  min-width: 160px;
}
.genre-card:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.genre-card .genre-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  background: rgba(59, 130, 246, 0.12);
}
.genre-card .genre-name { font-weight: 600; font-size: var(--fs-sm); }

/* ── Horizontal Scroll ── */
.h-scroll {
  display: flex; gap: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-sm);
  scroll-behavior: smooth;
}
.h-scroll::-webkit-scrollbar { height: 4px; }
.h-scroll > * { flex-shrink: 0; }

/* ── Pagination Dots ── */
.dots { display: flex; gap: 6px; justify-content: center; margin-top: var(--space-lg); }
.dot {
  width: 8px; height: 8px; border-radius: var(--radius-full);
  background: var(--text-muted); border: none;
  transition: all 0.2s;
}
.dot.active { background: var(--accent); width: 24px; }

/* ── Divider ── */
.divider {
  display: flex; align-items: center; gap: var(--space-md);
  color: var(--text-muted); font-size: var(--fs-sm);
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-light);
}

/* ── Social Icons ── */
.social-icons { display: flex; gap: var(--space-sm); }
.social-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.social-icon:hover { color: var(--accent); border-color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 0px; }
}

@media (max-width: 768px) {
  :root { --fs-hero: 2rem; --fs-3xl: 1.75rem; --fs-2xl: 1.25rem; }
  .container { padding: 0 var(--space-md); }
  .search-bar { width: 200px; }
}

@media (max-width: 480px) {
  .search-bar { width: 150px; }
  .btn { padding: 0.5rem 1rem; }
}


/* ── Poster cards fill available space ── */
.h-scroll .poster-card { flex-shrink: 1; min-width: 0; }

/* ── Genre section poster grid ── */
.h-scroll.genre-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  overflow: hidden;
}
.h-scroll.genre-grid > * {
  flex-shrink: unset;
  min-width: 0;
}
.h-scroll.genre-grid .poster-card {
  aspect-ratio: 2/3;
}
.h-scroll.genre-grid .poster-card .poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ══════════════════════════════════════════════════════════════
   DRAKORID.CO STYLE ADDITIONS
   ══════════════════════════════════════════════════════════════ */

/* ── Episode Picker Badge ── */
.ep-count-badge {
  font-size: var(--fs-xs);
  background: rgba(255,255,255,0.2);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  margin-left: var(--space-sm);
}

/* ── Drama Schedule ── */
.drama-schedule {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--text-accent);
  margin-top: var(--space-md);
}

/* ── Drama Tabs ── */
.drama-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-2xl);
}
.drama-tab {
  padding: var(--space-md) var(--space-xl);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.drama-tab:hover {
  color: var(--text-primary);
}
.drama-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Tab Content ── */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ── Drama Stats ── */
.drama-stats {
  display: flex;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}
.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* ── Drama Synopsis Section ── */
.drama-synopsis-section {
  margin-bottom: var(--space-2xl);
}
.drama-synopsis-section h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}
.drama-synopsis-section p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ── Cast Section ── */
.cast-section {
  margin-bottom: var(--space-2xl);
}
.cast-section h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}
.cast-list {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
}
.cast-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  min-width: 100px;
}
.cast-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--bg-secondary);
}
.cast-name {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  text-align: center;
}

/* ── Details Section ── */
.drama-details-section {
  margin-bottom: var(--space-2xl);
}
.drama-details-section h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}
.details-content {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.8;
  white-space: pre-line;
}
.detail-row {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-label {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 120px;
  flex-shrink: 0;
}
.detail-value {
  color: var(--text-secondary);
}

/* ── Comments Section ── */
.comments-section {
  margin-bottom: var(--space-2xl);
}
.comment-input-wrap {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}
.comment-input-wrap textarea {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  resize: none;
}
.comment-input-wrap textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.comment-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}
.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--bg-secondary);
}
.comment-content {
  flex: 1;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}
.comment-author {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.comment-date {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.comment-text {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Episode Picker Modal (drakorid.co style) ── */
.episode-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.episode-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}
.episode-picker-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.episode-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.episode-picker-header h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.episode-picker-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}
.episode-picker-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.episode-picker-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}
.episode-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: var(--space-sm);
}
.episode-pick-item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}
.episode-pick-item:hover {
  border-color: var(--accent);
  background: rgba(59,130,246,0.1);
}
.episode-pick-item.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.episode-pick-item.is-premium {
  position: relative;
}
.episode-pick-item.is-premium::after {
  content: '👑';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
}

/* ── Favorited Button State ── */
.btn-favorited, .btn.favorited {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #ef4444;
}
.btn-favorited:hover, .btn.favorited:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.5);
}

/* ── Kategori Grid (drakorid.co style) ── */
.kategori-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-md);
}
.kategori-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: all 0.25s var(--ease);
}
.kategori-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.kategori-icon {
  font-size: 2rem;
}
.kategori-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

/* ── Responsive Poster Grids ── */
@media (max-width: 1024px) {
  .genre-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .kategori-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

@media (max-width: 768px) {
  .genre-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .kategori-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
  .poster-card { border-radius: var(--radius-sm); }
  .poster-title { font-size: var(--fs-xs); }
  .poster-meta { font-size: 0.65rem; }
  .section-header { gap: var(--space-sm); }
  .section-title { font-size: var(--fs-md); }
}

@media (max-width: 480px) {
  .genre-grid { grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); gap: 6px; }
  .kategori-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
  .kategori-icon { font-size: 1.5rem; }
  .poster-info { padding: 4px 6px; }
}
