:root {
  --bg: #0a0a0a;
  --bg2: #141414;
  --bg3: #1a1a1a;
  --bg4: #232323;
  --text: #e5e5e5;
  --text-dim: #808080;
  --accent: #e50914;
  --accent-hover: #b20710;
  --netflix-red: #e50914;
  --netflix-dark: #141414;
  --card-hover: #232323;
  --row-hover: rgba(255,255,255,0.08);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Netflix Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== HEADER / NAV ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 4%;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.3s;
  background: transparent;
}

.navbar.scrolled {
  background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, transparent 100%);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -1px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 20px;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.search-btn:hover { color: var(--text-dim); }

.avatar-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

/* ===== HERO / BANNER ===== */
.hero {
  position: relative;
  height: 80vh;
  min-height: 500px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: brightness(0.4);
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 50%),
              linear-gradient(to right, var(--bg) 0%, transparent 60%);
}

.hero-content {
  position: absolute;
  bottom: 15%;
  left: 4%;
  max-width: 600px;
  z-index: 2;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.hero-year { color: var(--text-dim); }
.hero-rating {
  background: var(--bg4);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}
.hero-score { color: #46d369; font-weight: 600; }
.hero-match { color: #46d369; }

.hero-description {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-play {
  background: #fff;
  color: #000;
}

.btn-play:hover { background: rgba(255,255,255,0.85); }

.btn-list {
  background: rgba(109, 109, 110, 0.7);
  color: #fff;
}

.btn-list:hover { background: rgba(109, 109, 110, 0.4); }

/* ===== CONTENT ROWS ===== */
.content-section {
  padding: 0 4%;
  margin-bottom: 40px;
  position: relative;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.section-title:hover { color: var(--text-dim); }

.slider-wrapper {
  position: relative;
}

.slider {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px 0;
  scrollbar-width: none;
}

.slider::-webkit-scrollbar { display: none; }

.slider-card {
  flex-shrink: 0;
  width: 200px;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  background: var(--bg2);
}

.slider-card:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  z-index: 10;
}

.slider-card:hover .card-overlay {
  opacity: 1;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--bg3);
}

.card-thumb-loaded {
  background: none;
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 100%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.slider-wrapper:hover .slider-nav { opacity: 1; }
.slider-nav:hover { background: rgba(0,0,0,0.8); }
.slider-nav.left { left: 0; border-radius: 0 4px 4px 0; }
.slider-nav.right { right: 0; border-radius: 4px 0 0 4px; }

/* ===== GENRE PAGES ===== */
.genre-grid {
  padding: 80px 4% 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

/* ===== DETAIL MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
}

.modal-close {
  position: fixed;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
  z-index: 2001;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal-close:hover { background: rgba(255,255,255,0.1); }

.modal {
  background: var(--bg2);
  border-radius: 8px;
  max-width: 900px;
  width: 100%;
  position: relative;
  overflow: hidden;
  margin: auto;
}

.modal-hero {
  position: relative;
  height: 50vh;
  min-height: 300px;
}

.modal-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.5);
}

.modal-hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg2) 0%, transparent 60%);
}

.modal-hero-content {
  position: absolute;
  bottom: 20px;
  left: 30px;
  right: 30px;
}

.modal-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 12px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-body {
  padding: 0 30px 30px;
}

.modal-meta {
  display: flex;
  gap: 12px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.modal-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
}

.modal-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--bg4);
  margin-bottom: 20px;
}

.modal-tab {
  padding: 10px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.modal-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.modal-tab:hover { color: var(--text); }

/* ===== SEARCH ===== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1500;
  padding-top: 80px;
  display: none;
  overflow-y: auto;
}

.search-overlay.active { display: block; }

.search-input-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 4%;
}

.search-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--bg4);
  color: var(--text);
  font-size: 1.2rem;
  padding: 16px 20px;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-results {
  max-width: 800px;
  margin: 24px auto 0;
  padding: 0 4%;
}

.search-result-item {
  display: flex;
  gap: 16px;
  padding: 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover { background: var(--bg2); }

.search-result-thumb {
  width: 100px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--bg3);
}

.search-result-info h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.search-result-info p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.search-no-results {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.login-bg {
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%230a0a0a" fill-opacity="0.9" d="M0 0L1440 0L1440 320L0 320Z"/></svg>') no-repeat center bottom;
  background-size: cover;
  filter: brightness(0.3);
}

.login-box {
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
  padding: 60px 50px;
  border-radius: 8px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255,255,255,0.05);
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 30px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-input {
  background: var(--bg4);
  border: 1px solid transparent;
  color: var(--text);
  font-size: 1rem;
  padding: 14px 16px;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: var(--accent);
}

.login-input::placeholder { color: var(--text-dim); }

.login-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  color: #e87c03;
  font-size: 0.85rem;
  margin-top: -8px;
  display: none;
}

.login-error.show { display: block; }

.login-demo-note {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ===== FOOTER ===== */
.footer {
  padding: 40px 4%;
  background: var(--bg);
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
  max-width: 900px;
}

.footer-col h4 {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.footer-col a:hover { color: var(--text); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero { height: 60vh; min-height: 400px; }
  .hero-content { bottom: 10%; left: 5%; right: 5%; }
  .hero-description { -webkit-line-clamp: 2; }
  .slider-card { width: 140px; }
  .genre-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .login-box { margin: 0 20px; padding: 40px 30px; }
  .modal-hero { height: 40vh; }
  .modal-body { padding: 0 20px 20px; }
  .modal-hero-content { left: 20px; right: 20px; }
  .nav-links { display: none; }
}

/* ===== HOVER CARDS ===== */
.poster-card {
  flex-shrink: 0;
  width: 200px;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  background: var(--bg2);
}

.poster-card:hover {
  transform: scale(1.04) translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
  z-index: 10;
}

.poster-img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: var(--bg3);
}

.poster-info {
  padding: 8px;
}

.poster-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.poster-year {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ===== TRANSITIONS ===== */
.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== LOGO ===== */
.logo-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===== PLAYER EMBED ===== */
.player-container {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}

.player-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}
