/* ========================================
   DRACIN STREAM — Premium Streaming UI
   ======================================== */

/* Tokens */
:root {
  --bg-body: #0b0e14;
  --bg-surface: #131720;
  --bg-card: #181d28;
  --bg-elevated: #1e2430;
  --bg-hover: #242a38;

  --text-primary: #e8eaf0;
  --text-secondary: #8b93a7;
  --text-muted: #545d72;
  --text-accent: #c9a0ff;

  --accent: #a06aff;
  --accent-dim: rgba(160, 106, 255, 0.12);
  --accent-glow: rgba(160, 106, 255, 0.25);
  --accent-secondary: #ff6b9d;

  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(160, 106, 255, 0.4);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 100px;

  --header-h: 64px;
  --max-w: 1400px;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100dvh;
  overflow-x: hidden;
}

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

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

button {
  font-family: inherit;
}

/* ── HEADER ─────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(11, 14, 20, 0.82);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.header__container {
  max-width: var(--max-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

.header__logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}

/* Search */
.search-bar {
  flex: 1;
  max-width: 380px;
  margin-left: auto;
  position: relative;
}

.search-bar__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .85rem;
  pointer-events: none;
}

.search-bar__input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: .87rem;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}

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

.search-bar__input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-hover);
}

/* ── LAYOUT ─────────────────────────────── */
.main {
  padding: calc(var(--header-h) + 24px) 0 48px;
  min-height: 100dvh;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── PROVIDER FILTER ────────────────────── */
.provider-filter {
  margin-bottom: 20px;
}

.provider-filter__scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.provider-filter__scroll::-webkit-scrollbar {
  display: none;
}

.provider-chip {
  flex-shrink: 0;
  height: 32px;
  padding: 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s var(--ease);
  white-space: nowrap;
}

.provider-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, .1);
}

.provider-chip--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.provider-chip--active:hover {
  background: var(--accent);
  border-color: var(--accent);
  opacity: .9;
}

/* ── SECTION TITLE ──────────────────────── */
.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-title__icon {
  display: none;
  /* Remove emoji icons for cleaner look */
}

.section-title__count {
  font-size: .85rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ── DRAMA GRID ─────────────────────────── */
.drama-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* ── DRAMA CARD ─────────────────────────── */
.drama-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  border: 1px solid transparent;
}

.drama-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}

.drama-card__thumbnail {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg-surface);
}

.drama-card__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease);
}

.drama-card:hover .drama-card__thumbnail img {
  transform: scale(1.04);
}

/* Gradient overlay at bottom of thumbnail */
.drama-card__thumbnail::after {
  content: '';
  position: absolute;
  inset: 50% 0 0 0;
  background: linear-gradient(to top, var(--bg-card) 0%, transparent 100%);
  pointer-events: none;
}

.drama-card__episodes {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 3px 8px;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  font-size: .68rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: .02em;
}

.drama-card__play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .25s var(--ease);
  background: rgba(0, 0, 0, .2);
}

.drama-card:hover .drama-card__play {
  opacity: 1;
}

.drama-card__play::after {
  content: '▶';
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 50%;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.drama-card__info {
  padding: 10px 10px 12px;
}

.drama-card__title {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.drama-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .72rem;
  color: var(--text-muted);
}

.drama-card__views {
  display: flex;
  align-items: center;
  gap: 3px;
}

.drama-card__provider {
  padding: 2px 7px;
  background: var(--accent-dim);
  color: var(--text-accent);
  border-radius: 4px;
  font-size: .65rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ── DRAMA DETAIL ───────────────────────── */
.drama-detail {
  display: grid;
  gap: 32px;
}

.drama-detail__hero {
  display: grid;
  gap: 24px;
}

.drama-detail__poster {
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
}

.drama-detail__poster img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.drama-detail__info {
  text-align: center;
}

.drama-detail__title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.drama-detail__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: .88rem;
}

.drama-detail__meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.drama-detail__tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}

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

.drama-detail__description {
  color: var(--text-secondary);
  font-size: .9rem;
  line-height: 1.7;
  text-align: left;
  max-width: 640px;
}

/* Episode Grid */
.episode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.episode-btn {
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s var(--ease);
}

.episode-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

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

/* ── PLAYER ─────────────────────────────── */
.player-page {
  max-width: 960px;
  margin: 0 auto;
}

.player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.player-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-info {
  margin-bottom: 20px;
}

.player-info__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.player-info__episode {
  color: var(--accent);
  font-size: .9rem;
  font-weight: 500;
}

.episode-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.episode-nav__btn {
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: .88rem;
  cursor: pointer;
  transition: all .2s var(--ease);
}

.episode-nav__btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.episode-nav__btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* ── STATES ─────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 20px;
  gap: 14px;
}

.loading__spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--bg-elevated);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading__text {
  color: var(--text-muted);
  font-size: .88rem;
}

.empty-state,
.error-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}

.empty-state__icon,
.error-state__icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  opacity: .6;
}

.error-state {
  color: var(--accent-secondary);
}

/* Load More */
.load-more {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.load-more__btn {
  height: 42px;
  padding: 0 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s var(--ease);
}

.load-more__btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Back */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: .82rem;
  cursor: pointer;
  margin-bottom: 24px;
  transition: all .2s var(--ease);
}

.back-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── AUTO-NEXT BADGE ────────────────────── */
.auto-next {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-dim);
  border-radius: var(--radius-md);
  color: var(--text-accent);
  font-size: .8rem;
  font-weight: 500;
  margin-bottom: 16px;
}

/* ── RESPONSIVE ─────────────────────────── */
@media (min-width: 480px) {
  .drama-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 640px) {
  .drama-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .drama-card__title {
    font-size: .88rem;
  }
}

@media (min-width: 768px) {
  .drama-detail__hero {
    grid-template-columns: 220px 1fr;
    gap: 32px;
  }

  .drama-detail__poster {
    margin: 0;
  }

  .drama-detail__info {
    text-align: left;
  }

  .drama-detail__tags {
    justify-content: flex-start;
  }

  .drama-detail__meta {
    justify-content: flex-start;
  }
}

@media (min-width: 1024px) {
  .drama-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
  }

  .container {
    padding: 0 32px;
  }
}

@media (min-width: 1280px) {
  .drama-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ── UTILITY ────────────────────────────── */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}