/* =============================================
   StreamFlix - Main Stylesheet
   ============================================= */

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

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --accent: #e50914;
  --accent2: #ff3d3d;
  --text: #f0f0f0;
  --text2: #aaa;
  --card-radius: 8px;
  --nav-h: 68px;
}

html { scroll-behavior: smooth; }

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

/* ---- NAVBAR ---- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 999;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
  transition: background 0.3s;
}
.navbar.scrolled {
  background: rgba(10,10,15,0.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}
.logo-icon {
  background: var(--accent);
  color: white;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
}
.logo-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 2px;
  color: white;
}
.nav-links {
  display: flex;
  gap: 32px;
}
.nav-link {
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: white; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.search-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}
.search-btn:hover { color: white; background: rgba(255,255,255,0.1); }

/* ---- HERO ---- */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  transition: background-image 1s ease;
  transform: scale(1.05);
  animation: heroZoom 20s ease-in-out infinite alternate;
}
@keyframes heroZoom {
  from { transform: scale(1.05); }
  to { transform: scale(1.12); }
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(10,10,15,0.95) 0%,
    rgba(10,10,15,0.6) 50%,
    rgba(10,10,15,0.1) 100%
  ),
  linear-gradient(
    to top,
    rgba(10,10,15,1) 0%,
    transparent 40%
  );
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 60px 80px;
  max-width: 650px;
}
.hero-badges { display: flex; gap: 8px; margin-bottom: 14px; }
.hd-badge {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}
.hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.05;
  letter-spacing: 2px;
  margin-bottom: 16px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.hero-desc {
  font-size: 15px;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 16px;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 28px;
}
.hero-type-badge {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  color: white;
}
.hero-actions { display: flex; gap: 14px; }
.btn-play {
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-play:hover { background: var(--accent2); transform: scale(1.03); }
.btn-info {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  backdrop-filter: blur(6px);
}
.btn-info:hover { background: rgba(255,255,255,0.22); }

/* ---- MAIN CONTENT ---- */
.main-content {
  position: relative;
  z-index: 2;
  padding: 0 40px 60px;
  background: var(--bg);
}

/* ---- ROW SECTIONS ---- */
.row-section { margin-bottom: 48px; }
.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.title-bar {
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
}
.cards-wrapper { overflow-x: auto; padding-bottom: 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
.cards-wrapper::-webkit-scrollbar { height: 4px; }
.cards-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.cards-row {
  display: flex;
  gap: 14px;
  width: max-content;
}

/* ---- CARD ---- */
.card {
  width: 180px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.25s;
}
.card:hover { transform: scale(1.06); }
.card-poster-wrap {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  aspect-ratio: 2/3;
  background: var(--bg3);
}
.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.3s;
}
.card:hover .card-poster { filter: brightness(0.5); }
.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.25s;
}
.card:hover .card-overlay { opacity: 1; }
.card-play-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.card-play-btn:hover { background: var(--accent2); }
.card-info-btn {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.card-rating {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.75);
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.card-info { padding: 8px 2px 0; }
.card-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-year { font-size: 12px; color: var(--text2); margin-top: 3px; }

/* ---- FOOTER ---- */
.footer {
  background: var(--bg2);
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 40px;
  text-align: center;
}
.footer .nav-logo { justify-content: center; margin-bottom: 14px; }
.footer-note { font-size: 12px; color: var(--text2); margin-bottom: 8px; }
.footer-copy { font-size: 12px; color: rgba(255,255,255,0.3); }

/* ---- LOADING / SPINNER ---- */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 80px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- SEARCH PAGE ---- */
.search-page { padding: 100px 40px 60px; }
.search-box-wrap { display: flex; gap: 12px; margin-bottom: 40px; }
.search-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }
.search-btn-submit {
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

/* ---- DETAIL PAGE ---- */
.detail-page { padding-top: var(--nav-h); }
.detail-backdrop {
  width: 100%;
  height: 70vh;
  object-fit: cover;
  display: block;
  position: relative;
}
.detail-backdrop-wrap {
  position: relative;
  height: 70vh;
  overflow: hidden;
}
.detail-backdrop-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-backdrop-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 50%);
}
.detail-body {
  padding: 0 60px 60px;
  margin-top: -120px;
  position: relative;
  z-index: 2;
  display: flex;
  gap: 40px;
  align-items: flex-start;
}
.detail-poster {
  width: 220px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.detail-poster img { width: 100%; display: block; }
.detail-info { flex: 1; padding-top: 40px; }
.detail-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(36px, 5vw, 60px);
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 20px;
}
.detail-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.genre-tag {
  background: rgba(229,9,20,0.15);
  border: 1px solid rgba(229,9,20,0.3);
  color: var(--accent2);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
}
.detail-overview {
  font-size: 15px;
  line-height: 1.8;
  color: #ccc;
  margin-bottom: 30px;
  max-width: 700px;
}
.detail-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 40px; }

/* TV season selector */
.season-select {
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 20px;
}
.ep-btn {
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.08);
  color: white;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s, border-color 0.2s;
}
.ep-btn:hover, .ep-btn.active { background: var(--accent); border-color: var(--accent); }

/* ---- WATCH PAGE ---- */
.watch-page { padding-top: var(--nav-h); background: #000; min-height: 100vh; }
.player-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  position: relative;
}
.player-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.watch-info {
  padding: 30px 60px;
  background: var(--bg);
}
.watch-title { font-family: 'Bebas Neue', sans-serif; font-size: 36px; letter-spacing: 2px; margin-bottom: 8px; }
.watch-meta { font-size: 14px; color: var(--text2); margin-bottom: 20px; }
.back-btn {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 20px;
}
.back-btn:hover { background: rgba(255,255,255,0.2); }

/* ---- MOVIES / TV LIST PAGE ---- */
.list-page { padding: 100px 40px 60px; }
.list-page h1 { font-family: 'Bebas Neue', sans-serif; font-size: 42px; letter-spacing: 2px; margin-bottom: 32px; }
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.load-more-btn {
  display: block;
  margin: 0 auto;
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  padding: 14px 40px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.load-more-btn:hover { background: var(--accent); border-color: var(--accent); }

/* ---- CAST ---- */
.cast-section { margin-top: 40px; }
.cast-section h3 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.cast-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.cast-card { flex-shrink: 0; width: 100px; text-align: center; }
.cast-photo {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 8px;
  display: block;
  background: var(--bg3);
}
.cast-name { font-size: 12px; font-weight: 500; }
.cast-char { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* ---- SIMILAR ROW ---- */
.similar-section { padding: 40px 60px 60px; }
.similar-section h3 { font-size: 20px; font-weight: 600; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .navbar { padding: 0 20px; }
  .nav-links { display: none; }
  .hero-content { padding: 0 24px 60px; }
  .main-content { padding: 0 16px 40px; }
  .detail-body { flex-direction: column; padding: 0 20px 40px; }
  .detail-poster { width: 160px; }
  .watch-info { padding: 20px; }
  .similar-section { padding: 20px; }
  .list-page { padding: 100px 16px 40px; }
  .search-page { padding: 100px 16px 60px; }
}
