/* ===================================================
   STREAMR CLONE — style.css
   =================================================== */

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

:root {
  --bg:       #0f0f0f;
  --surface:  #181818;
  --surface2: #222;
  --border:   #2e2e2e;
  --accent:   #e50914;
  --accent2:  #f40612;
  --text:     #e5e5e5;
  --muted:    #777;
  --muted2:   #555;
  --green:    #46d369;
  --nav-h:    60px;
  --r:        6px;
  --r2:       10px;
}

html { scroll-behavior: smooth; background: var(--bg); }

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

a, button { cursor: pointer; }
button { border: none; background: none; color: inherit; font: inherit; }

/* ===================== NAV ===================== */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 900;
  display: flex;
  align-items: center;
  padding: 0 4vw;
  gap: 2rem;
  transition: background .3s, box-shadow .3s;
  background: linear-gradient(180deg, rgba(0,0,0,.85) 0%, transparent 100%);
}
#nav.solid {
  background: rgba(15,15,15,.97);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--border);
}

.nav-logo {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
  user-select: none;
}

.nav-links {
  display: flex;
  gap: .15rem;
  align-items: center;
}
.nav-links a {
  padding: .45rem .85rem;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,.06); }
.nav-links a.active { color: var(--text); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,.1); }

.nav-search {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(15,15,15,.98);
  display: flex;
  align-items: center;
  padding: 0 4vw;
  gap: .75rem;
  transform: translateY(-100%);
  transition: transform .2s ease;
  backdrop-filter: blur(10px);
}
.nav-search.open { transform: translateY(0); }
.nav-search input {
  flex: 1;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: .95rem;
  padding: .55rem 1rem;
  outline: none;
  transition: border-color .2s;
}
.nav-search input::placeholder { color: var(--muted); }
.nav-search input:focus { border-color: #555; }

/* hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px; padding: 6px;
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: rgba(15,15,15,.98);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 850;
  display: flex;
  flex-direction: column;
  padding: .5rem;
  transform: translateY(-120%);
  transition: transform .25s ease;
  pointer-events: none;
}
.mobile-menu.open { transform: translateY(0); pointer-events: all; }
.mobile-menu a {
  padding: .85rem 1rem;
  border-radius: var(--r);
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
  text-decoration: none;
  transition: background .15s;
}
.mobile-menu a:hover { background: var(--surface2); }

/* ===================== HERO ===================== */
.hero {
  position: relative;
  height: min(90vh, 700px);
  display: flex;
  align-items: flex-end;
  padding: 0 4vw clamp(3rem,6vw,5rem);
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 20%;
  transition: opacity .6s;
}
.hero-gradient {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgba(15,15,15,.92) 35%, rgba(15,15,15,.3) 70%, transparent 100%),
    linear-gradient(to top, rgba(15,15,15,1) 0%, rgba(15,15,15,.6) 40%, transparent 80%);
}
.hero-content {
  position: relative; z-index: 2;
  max-width: min(500px, 90vw);
}
.hero-logo-img {
  max-width: 260px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.5));
}
.hero-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: .75rem;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .85rem;
  flex-wrap: wrap;
}
.hero-match {
  color: var(--green);
  font-weight: 600;
  font-size: .9rem;
}
.hero-year, .hero-type {
  font-size: .82rem;
  color: rgba(255,255,255,.65);
}
.hero-type {
  border: 1px solid rgba(255,255,255,.35);
  padding: 1px 8px;
  border-radius: 3px;
}
.hero-desc {
  font-size: .92rem;
  color: rgba(255,255,255,.78);
  line-height: 1.65;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-btns { display: flex; gap: .65rem; flex-wrap: wrap; }

.btn-play {
  display: flex; align-items: center; gap: .45rem;
  background: #fff; color: #000;
  font-weight: 700; font-size: .95rem;
  padding: .65rem 1.5rem;
  border-radius: var(--r);
  transition: background .15s, transform .1s;
}
.btn-play:hover { background: rgba(255,255,255,.85); transform: scale(1.02); }
.btn-play svg { flex-shrink: 0; }

.btn-more {
  display: flex; align-items: center; gap: .45rem;
  background: rgba(109,109,110,.7);
  color: #fff;
  font-weight: 600; font-size: .95rem;
  padding: .65rem 1.5rem;
  border-radius: var(--r);
  transition: background .15s, transform .1s;
}
.btn-more:hover { background: rgba(109,109,110,.5); transform: scale(1.02); }

/* hero nav dots */
.hero-dots {
  position: absolute;
  bottom: clamp(1rem, 3vw, 2rem);
  right: 4vw;
  display: flex; gap: .45rem;
  z-index: 2;
}
.hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  transition: background .25s, transform .25s;
  cursor: pointer;
  border: none;
}
.hero-dot.active { background: #fff; transform: scale(1.25); }

/* ===================== ROWS ===================== */
.page-content { padding-bottom: 4rem; }

.section {
  padding: 0 4vw;
  margin-bottom: 2.5rem;
}
.section-title {
  font-size: clamp(.9rem, 2vw, 1.05rem);
  font-weight: 600;
  margin-bottom: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
}
.section-title .see-all {
  margin-left: auto;
  font-size: .78rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s;
}
.section:hover .see-all { opacity: 1; }

.cards-row {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cards-row::-webkit-scrollbar { display: none; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .6rem;
}

/* ===================== CARD ===================== */
.card {
  flex: 0 0 clamp(130px, 16vw, 185px);
  scroll-snap-align: start;
  cursor: pointer;
  border-radius: var(--r);
  overflow: hidden;
  position: relative;
  background: var(--surface2);
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: scale(1.06); z-index: 10; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.cards-grid .card { flex: none; width: 100%; }

.card-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  transition: opacity .2s;
}
.card:hover .card-poster { opacity: .7; }

.card-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: .6rem;
  background: linear-gradient(to top, rgba(0,0,0,.85) 40%, transparent 100%);
  opacity: 0;
  transition: opacity .2s;
}
.card:hover .card-overlay { opacity: 1; }

.card-play-btn {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  margin-bottom: .4rem;
  transition: transform .15s, background .15s;
  align-self: flex-start;
}
.card-play-btn:hover { transform: scale(1.1); background: var(--accent2); }

.card-rating {
  font-size: .72rem;
  font-weight: 600;
  color: #f5c518;
}
.card-footer {
  padding: .45rem .4rem .5rem;
}
.card-name {
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.card-sub {
  font-size: .7rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ===================== WATCH MODAL ===================== */
.watch-modal {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 1000;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.watch-modal.open { transform: translateX(0); }

.watch-inner {
  min-height: 100vh;
  padding-bottom: 4rem;
}

.watch-topbar {
  position: sticky;
  top: 0; z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 4vw;
  background: rgba(15,15,15,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.back-btn {
  display: flex; align-items: center; gap: .35rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  padding: .4rem .75rem;
  border-radius: var(--r);
  transition: background .15s;
  flex-shrink: 0;
}
.back-btn:hover { background: var(--surface2); }
.watch-title-label {
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-shell {
  background: #000;
}
.embed-container {
  position: relative;
  padding-top: 56.25%;
  width: 100%;
  max-width: 100%;
}
.embed-container iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: none;
}

.player-controls-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .65rem 4vw;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.source-btns {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
}
.source-label {
  font-size: .75rem;
  color: var(--muted);
  margin-right: .25rem;
}
.src-btn {
  padding: .35rem .85rem;
  border-radius: 100px;
  font-size: .78rem;
  font-weight: 500;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background .15s, border-color .15s;
}
.src-btn:hover { background: #333; }
.src-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.episode-controls { }
.ep-selects {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.ep-selects label {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  color: var(--muted);
}
.ep-selects select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .4rem .75rem;
  border-radius: var(--r);
  font-size: .82rem;
  cursor: pointer;
  max-width: 240px;
}

.watch-details {
  padding: 1.5rem 4vw;
  max-width: 900px;
}
.wd-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .5rem; }
.wd-meta {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.wd-match { color: var(--green); font-weight: 600; font-size: .88rem; }
.wd-year, .wd-runtime, .wd-status {
  font-size: .82rem;
  color: rgba(255,255,255,.55);
}
.wd-badge {
  border: 1px solid rgba(255,255,255,.3);
  padding: 1px 7px;
  border-radius: 3px;
  font-size: .72rem;
  color: rgba(255,255,255,.6);
}
.wd-genres { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .85rem; }
.wd-genre {
  padding: .25rem .7rem;
  border-radius: 100px;
  font-size: .75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.wd-overview {
  font-size: .9rem;
  line-height: 1.7;
  color: rgba(255,255,255,.72);
  margin-bottom: 1rem;
}
.wd-cast { font-size: .82rem; color: var(--muted); line-height: 1.6; }
.wd-cast strong { color: rgba(255,255,255,.7); }

.related-section {
  padding: 0 4vw 2rem;
}
.related-section .section-title { margin-bottom: .85rem; }

/* ===================== PAGE HEADERS ===================== */
.page-hero {
  padding: calc(var(--nav-h) + 2rem) 4vw 1.5rem;
}
.page-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: .3rem;
}
.page-hero p { color: var(--muted); font-size: .9rem; }

/* genre pills */
.pills {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  padding: 0 4vw 1.5rem;
}
.pill {
  padding: .4rem 1rem;
  border-radius: 100px;
  font-size: .8rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.pill:hover { background: var(--surface2); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===================== SEARCH ===================== */
.search-page {
  padding: calc(var(--nav-h) + 1.5rem) 4vw 3rem;
}
.search-page h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.search-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}
.search-empty svg { margin-bottom: 1rem; opacity: .3; }
.search-empty p { font-size: .95rem; }

/* ===================== LOADING ===================== */
.skeleton-row {
  display: flex; gap: .5rem;
  padding: 0 4vw;
  margin-bottom: 2.5rem;
}
.skeleton-card {
  flex: 0 0 clamp(130px, 16vw, 185px);
  aspect-ratio: 2/3;
  border-radius: var(--r);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.skeleton-title {
  height: 1rem;
  width: clamp(120px,25vw,200px);
  border-radius: 4px;
  margin: 0 4vw .85rem;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

/* ===================== FOOTER ===================== */
.footer {
  text-align: center;
  padding: 2rem 4vw;
  border-top: 1px solid var(--border);
  color: var(--muted2);
  font-size: .78rem;
  line-height: 2;
}
.footer-logo {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--accent);
  display: block;
  margin-bottom: .5rem;
}
.footer a { color: var(--muted); text-decoration: underline; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .65rem 1.25rem;
  border-radius: var(--r2);
  font-size: .85rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 700px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .hero { height: 70vmax; min-height: 380px; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (min-width: 701px) {
  .hamburger { display: none; }
  .mobile-menu { display: none !important; }
}
