/* ===========================================================
   Vidking Family Movie Site — Global Styles
   Dark cinema theme
   =========================================================== */

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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --accent: #e50914;
  --text: #ffffff;
  --text-dim: #8a8a9a;
  --glow: 0 0 20px rgba(229, 9, 20, 0.3);
  --card-w-desktop: 160px;
  --card-w-mobile: 120px;
  --radius: 8px;
  --header-h: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: linear-gradient(180deg, rgba(10,10,15,0.98) 0%, rgba(10,10,15,0.85) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.9rem;
  letter-spacing: 2px;
  color: var(--text);
  white-space: nowrap;
}
.brand .brand-accent { color: var(--accent); }

.search-wrap {
  flex: 1;
  max-width: 520px;
  margin-left: auto;
  position: relative;
}
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229,9,20,0.15);
}
.search-input::placeholder { color: var(--text-dim); }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  stroke: var(--text-dim);
  pointer-events: none;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  padding: 48px 24px 56px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  z-index: 0;
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10,10,15,0.95) 0%, rgba(10,10,15,0.55) 50%, rgba(10,10,15,0.2) 100%),
    linear-gradient(0deg, var(--bg) 2%, rgba(10,10,15,0) 60%);
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
}
.hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 4rem;
  line-height: 0.95;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 14px;
}
.hero-rating { color: var(--accent); font-weight: 600; }
.hero-overview {
  font-size: 1rem;
  color: #d4d4dd;
  margin-bottom: 22px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-watch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn-watch:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow);
}
.btn-watch svg { width: 18px; height: 18px; fill: #fff; }

.btn-secondary {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.2); }

/* ---------- Rows ---------- */
.rows { padding: 8px 0 64px; }

.row { margin: 36px 0; }
.row-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 24px;
  margin-bottom: 14px;
}
.row-title {
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.row-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px 24px 14px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.row-scroll::-webkit-scrollbar { height: 8px; }
.row-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}
.row-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- Card ---------- */
.card {
  position: relative;
  flex: 0 0 auto;
  width: var(--card-w-desktop);
  scroll-snap-align: start;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: scale(1.05);
  box-shadow: var(--glow);
  z-index: 2;
}

/* Signature element: a 2px accent line that sweeps top->bottom on hover */
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 2px;
  height: 0;
  background: var(--accent);
  z-index: 3;
  transition: height 0.35s ease;
}
.card:hover::before { height: 100%; }

.card-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #1c1c26;
}
.card-fallback {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--text-dim);
  background: #1c1c26;
}
.card-body {
  padding: 10px 10px 12px;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}
.card-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.card-rating { color: var(--accent); font-weight: 600; }

/* Card hover overlay with rating + play icon */
.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(0deg, rgba(10,10,15,0.85), rgba(10,10,15,0.35));
  opacity: 0;
  transition: opacity 0.2s ease;
}
.card:hover .card-overlay { opacity: 1; }
.card-overlay .play-circle {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow);
}
.card-overlay .play-circle svg { width: 20px; height: 20px; fill: #fff; margin-left: 2px; }
.card-overlay .overlay-rating {
  font-weight: 600;
  font-size: 0.95rem;
}
.card-overlay .overlay-rating .star { color: var(--accent); }

/* Continue-watching progress bar */
.card-progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 4px;
  background: var(--accent);
  z-index: 3;
}

/* ---------- Genre filter ---------- */
.genre-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 24px 0;
}
.genre-chip {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-dim);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.genre-chip:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }
.genre-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Search results grid ---------- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
  padding: 24px;
}
.results-grid .card { width: 100%; }
.section-label {
  padding: 24px 24px 0;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

/* ---------- Player page ---------- */
.player-page {
  position: relative;
  min-height: 100vh;
}
.player-bg {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(30px) brightness(0.25);
  transform: scale(1.1);
  z-index: -1;
}

.player-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.iframe-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.iframe-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.resume-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid rgba(229,9,20,0.4);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
}
.resume-banner.show { display: flex; }
.resume-banner .resume-text { font-size: 0.95rem; }
.resume-banner .resume-text strong { color: var(--accent); }
.resume-actions { display: flex; gap: 10px; }

.detail {
  display: flex;
  gap: 28px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.detail-poster {
  flex: 0 0 200px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.detail-poster img { width: 100%; }
.detail-main { flex: 1; min-width: 280px; }
.detail-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: 1px;
}
.detail-tagline {
  color: var(--text-dim);
  font-style: italic;
  margin-top: 4px;
  margin-bottom: 16px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.detail-meta .rating { color: var(--accent); font-weight: 600; }
.genres { display: flex; gap: 8px; flex-wrap: wrap; }
.genre-tag {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #d4d4dd;
}
.detail-overview {
  font-size: 1rem;
  color: #d4d4dd;
  margin-top: 6px;
  max-width: 720px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 18px 0 6px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

/* ---------- TV episode selector ---------- */
.tv-controls {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 20px;
}
.tv-controls-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.season-select {
  height: 40px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 0 14px;
  font-size: 0.95rem;
  outline: none;
}
.season-select:focus { border-color: var(--accent); }
.episode-now {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.episode-now strong { color: var(--text); }

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.episode-item {
  display: flex;
  gap: 12px;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.episode-item:hover { border-color: rgba(229,9,20,0.5); }
.episode-item.active {
  border-color: var(--accent);
  background: rgba(229,9,20,0.08);
}
.episode-thumb {
  flex: 0 0 96px;
  height: 54px;
  border-radius: 4px;
  object-fit: cover;
  background: #1c1c26;
}
.episode-info { min-width: 0; }
.episode-num { font-size: 0.75rem; color: var(--accent); font-weight: 600; }
.episode-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.episode-rt { font-size: 0.75rem; color: var(--text-dim); }

.next-ep-bar { margin-top: 18px; }

/* ---------- States ---------- */
.loading, .error-msg {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 24px;
  font-size: 1rem;
}
.error-msg { color: #ff6b6b; }

.skeleton {
  flex: 0 0 auto;
  width: var(--card-w-desktop);
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #14141d 25%, #1d1d28 50%, #14141d 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 28px 24px 40px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* ===========================================================
   Mobile — breakpoint at 768px
   =========================================================== */
@media (max-width: 768px) {
  :root { --card-w-desktop: 120px; }

  .site-header { gap: 12px; padding: 0 14px; }
  .brand { font-size: 1.5rem; }
  .search-wrap { max-width: none; }

  .hero { min-height: 380px; padding: 32px 16px 40px; }
  .hero-title { font-size: 2.6rem; }
  .hero-overview { -webkit-line-clamp: 2; font-size: 0.9rem; }

  .row-scroll, .row-header, .genre-bar { padding-left: 14px; padding-right: 14px; }
  .row-title, .section-label { font-size: 1.15rem; }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px 14px;
  }

  .player-shell { padding: 0 14px 48px; }
  .iframe-wrap { border-radius: 0; }
  .detail { gap: 18px; }
  .detail-poster { flex: 0 0 130px; }
  .detail-title { font-size: 2.1rem; }

  .episode-grid { grid-template-columns: 1fr; }
}
