:root {
  --bg: #141414;
  --bg-elevated: #181818;
  --bg-card: #232323;
  --text: #fff;
  --text-muted: #b3b3b3;
  --text-secondary: #808080;
  --red: #e50914;
  --red-hover: #f40612;
  --line: rgba(255,255,255,.1);
  --shadow: 0 8px 32px rgba(0,0,0,.8);
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(.4,0,.2,1);
  --nav-height: 68px;
  --card-width: 240px;
  --card-height: 135px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Netflix Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }

/* ==================== NAVIGATION ==================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 60px;
  background: linear-gradient(180deg, rgba(0,0,0,.9) 0%, transparent 100%);
  z-index: 100;
  transition: background var(--transition-normal);
}
.nav.scrolled {
  background: rgba(20,20,20,.97);
  box-shadow: 0 2px 20px rgba(0,0,0,.5);
}

.brand {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  gap: 1px;
}
.brand-red { color: var(--red); }

.nav-links {
  display: flex;
  gap: 20px;
}
.navlink {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition-fast);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.navlink:hover, .navlink.active {
  color: var(--text);
}
.navlink.active {
  font-weight: 600;
}

.nav-spacer { flex: 1; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Search Box */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  font-size: 20px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.search-icon:hover { transform: scale(1.1); }
.searchbox {
  width: 0;
  padding: 7px 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all var(--transition-normal);
}
.search-container.active .searchbox {
  width: 240px;
  padding: 7px 12px 7px 40px;
  border-color: var(--text);
  background: rgba(0,0,0,.8);
}
.search-container.active .search-icon {
  position: absolute;
  left: 10px;
}

/* Notifications & Profile */
.nav-icon {
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  transition: color var(--transition-fast);
}
.nav-icon:hover { color: var(--text-muted); }

.profile-menu {
  position: relative;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--red) 0%, #b20710 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.avatar:hover { transform: scale(1.05); }

.profile-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 200px;
  background: rgba(0,0,0,.95);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: 200;
}
.profile-dropdown::before {
  content: '';
  position: absolute;
  top: -8px; right: 12px;
  border: 8px solid transparent;
  border-bottom-color: rgba(0,0,0,.95);
}
.profile-menu:hover .profile-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.dropdown-item:hover {
  background: rgba(255,255,255,.1);
  color: var(--text);
}
.dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

/* ==================== HERO / BILLBOARD ==================== */
.billboard {
  position: relative;
  height: 85vh;
  min-height: 500px;
  max-height: 900px;
  overflow: hidden;
}
.billboard-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  filter: brightness(0.6);
}
.billboard-gradient {
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(90deg, rgba(20,20,20,.95) 0%, transparent 50%),
    linear-gradient(180deg, transparent 60%, var(--bg) 100%),
    linear-gradient(180deg, rgba(0,0,0,.4) 0%, transparent 15%);
}
.billboard-content {
  position: absolute;
  bottom: 20%;
  left: 60px;
  max-width: 550px;
  z-index: 10;
}
.billboard-logo {
  font-size: 62px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 20px;
  text-shadow: 2px 4px 20px rgba(0,0,0,.8);
}
.billboard-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
}
.match { color: #46d369; }
.rating {
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,.4);
  font-size: 12px;
}
.billboard-desc {
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  text-shadow: 1px 2px 8px rgba(0,0,0,.6);
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.billboard-buttons {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 28px;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon { font-size: 24px; }
.btn-play {
  background: var(--text);
  color: #141414;
}
.btn-play:hover { background: rgba(255,255,255,.75); }
.btn-info {
  background: rgba(109,109,110,.7);
  color: var(--text);
}
.btn-info:hover { background: rgba(109,109,110,.4); }
.btn-red {
  background: var(--red);
  color: var(--text);
}
.btn-red:hover { background: var(--red-hover); }

/* ==================== CONTENT ROWS ==================== */
.content-area {
  position: relative;
  margin-top: -100px;
  z-index: 10;
  padding-bottom: 60px;
}

.row-section {
  padding: 0 60px;
  margin-bottom: 48px;
}
.row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.row-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.row-explore {
  font-size: 12px;
  color: #54b9c5;
  opacity: 0;
  transform: translateX(-10px);
  transition: all var(--transition-fast);
}
.row-header:hover .row-explore {
  opacity: 1;
  transform: translateX(0);
}

/* Slider Container */
.slider-container {
  position: relative;
  overflow: visible;
}
.slider {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  padding: 20px 0 120px;
  margin: -20px 0 -120px;
  scrollbar-width: none;
}
.slider::-webkit-scrollbar { display: none; }

/* Slider Controls */
.slider-prev, .slider-next {
  position: absolute;
  top: 0;
  bottom: 120px;
  width: 55px;
  background: rgba(20,20,20,.7);
  border: none;
  color: var(--text);
  font-size: 40px;
  cursor: pointer;
  z-index: 20;
  opacity: 0;
  transition: opacity var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slider-container:hover .slider-prev,
.slider-container:hover .slider-next { opacity: 1; }
.slider-prev { left: 0; border-radius: 0 4px 4px 0; }
.slider-next { right: 0; border-radius: 4px 0 0 4px; }
.slider-prev:hover, .slider-next:hover { background: rgba(20,20,20,.9); }

/* ==================== CARDS ==================== */
.card {
  position: relative;
  flex-shrink: 0;
  width: var(--card-width);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-slow), z-index 0ms var(--transition-slow);
}
.card:hover {
  transform: scale(1.15);
  z-index: 50;
  overflow: visible;
  transition: transform var(--transition-slow), z-index 0ms 0ms;
}
.card:first-child:hover { transform: scale(1.15) translateX(10%); }
.card:last-child:hover { transform: scale(1.15) translateX(-10%); }

.card-img {
  width: 100%;
  height: var(--card-height);
  object-fit: cover;
  border-radius: 4px;
  transition: border-radius var(--transition-fast);
}
.card:hover .card-img {
  border-radius: 4px 4px 0 0;
}

/* Card Hover Expansion */
.card-details {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  padding: 16px;
  border-radius: 0 0 4px 4px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
}
.card:hover .card-details {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 200ms;
}

.card-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.card-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
  background: transparent;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.card-btn:hover {
  border-color: var(--text);
  background: rgba(255,255,255,.1);
}
.card-btn.primary {
  background: var(--text);
  border-color: var(--text);
  color: #141414;
}
.card-btn.primary:hover { background: rgba(255,255,255,.8); }
.card-btn-expand { margin-left: auto; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 8px;
}
.card-match { color: #46d369; font-weight: 600; }
.card-rating {
  padding: 1px 5px;
  border: 1px solid rgba(255,255,255,.4);
  font-size: 10px;
}
.card-duration { color: var(--text-muted); }

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

.card-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.card-genre-dot { color: var(--text-secondary); }

/* Continue Watching Progress Bar */
.progress-bar {
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 0 0 4px 4px;
  overflow: hidden;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}
.progress-fill {
  height: 100%;
  background: var(--red);
  transition: width var(--transition-normal);
}

/* Top 10 Badge */
.top10-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--red);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 3px;
}

/* New Episode Badge */
.new-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--red);
  color: var(--text);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 2px;
  text-transform: uppercase;
}

/* ==================== MODAL / PREVIEW ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 32px 0;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: min(900px, 95vw);
  background: var(--bg-elevated);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 64px rgba(0,0,0,.6);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
  margin: auto;
}
.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-video-container {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
}
.modal-video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.modal-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(transparent, var(--bg-elevated));
  pointer-events: none;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: none;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background var(--transition-fast);
}
.modal-close:hover { background: #333; }

.modal-title-area {
  position: absolute;
  bottom: 60px;
  left: 48px;
  right: 48px;
  z-index: 10;
}
.modal-title {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 20px;
  text-shadow: 2px 4px 16px rgba(0,0,0,.8);
}
.modal-buttons {
  display: flex;
  gap: 10px;
}

.modal-body {
  padding: 24px 48px 48px;
}
.modal-info-row {
  display: flex;
  gap: 40px;
}
.modal-main-info { flex: 2; }
.modal-side-info { flex: 1; }

.modal-metadata {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 15px;
}
.modal-match { color: #46d369; font-weight: 600; }
.modal-rating {
  padding: 2px 8px;
  border: 1px solid rgba(255,255,255,.4);
  font-size: 13px;
}

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

.modal-label {
  font-size: 14px;
  margin-bottom: 8px;
}
.modal-label-title { color: var(--text-secondary); }
.modal-label-value { color: var(--text); }

/* ==================== BROWSE PAGE ==================== */
.page-container {
  padding-top: calc(var(--nav-height) + 24px);
  min-height: 100vh;
}

.page-header {
  padding: 0 60px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 38px;
  font-weight: 700;
  margin: 0;
}

.genre-selector {
  display: flex;
  gap: 12px;
  padding: 0 60px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.genre-pill {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.genre-pill:hover { background: rgba(255,255,255,.1); }
.genre-pill.active {
  background: var(--text);
  color: #141414;
  border-color: var(--text);
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 0 60px 60px;
}
.grid-card {
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.grid-card:hover { transform: scale(1.05); }
.grid-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.grid-card-info {
  padding: 12px;
  background: var(--bg-card);
}
.grid-card-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
  min-height: 100vh;
  background: 
    linear-gradient(rgba(0,0,0,.65), rgba(0,0,0,.65)),
    radial-gradient(circle at 30% 20%, rgba(229,9,20,.3), transparent 50%),
    var(--bg);
  display: flex;
  flex-direction: column;
}

.login-nav {
  padding: 24px 60px;
}
.login-nav .brand { font-size: 36px; }

.login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(450px, 100%);
  background: rgba(0,0,0,.75);
  border-radius: 4px;
  padding: 60px 68px 48px;
}

.login-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 28px;
}

.form-group {
  margin-bottom: 16px;
}
.form-input {
  width: 100%;
  padding: 16px;
  border-radius: 4px;
  border: none;
  background: #333;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: background var(--transition-fast);
}
.form-input:focus { background: #454545; }
.form-input::placeholder { color: var(--text-secondary); }

.form-btn {
  width: 100%;
  padding: 16px;
  border-radius: 4px;
  border: none;
  background: var(--red);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 24px;
  transition: background var(--transition-fast);
}
.form-btn:hover { background: var(--red-hover); }

.form-error {
  color: #e87c03;
  font-size: 13px;
  margin-top: 6px;
  min-height: 20px;
}

.form-footer {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}
.form-footer a {
  color: var(--text);
  text-decoration: none;
}
.form-footer a:hover { text-decoration: underline; }

/* ==================== EMPTY STATES ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state-text {
  font-size: 18px;
}

/* ==================== LOADING / SKELETON ==================== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, #2a2a2a 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  width: var(--card-width);
  height: var(--card-height);
  flex-shrink: 0;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .nav { padding: 0 30px; }
  .row-section { padding: 0 30px; }
  .billboard-content { left: 30px; max-width: 400px; }
  .billboard-logo { font-size: 42px; }
  .modal-body { padding: 20px 30px 30px; }
  .page-header { padding: 0 30px; }
  .genre-selector { padding: 0 30px; }
  .grid-container { padding: 0 30px 30px; }
}

@media (max-width: 768px) {
  :root {
    --card-width: 160px;
    --card-height: 90px;
    --nav-height: 56px;
  }
  .nav { padding: 0 16px; gap: 12px; }
  .nav-links { display: none; }
  .brand { font-size: 22px; }
  .row-section { padding: 0 16px; }
  .row-title { font-size: 16px; }
  .billboard { height: 70vh; }
  .billboard-content { left: 16px; right: 16px; max-width: none; bottom: 15%; }
  .billboard-logo { font-size: 32px; }
  .billboard-desc { font-size: 14px; -webkit-line-clamp: 2; }
  .btn { padding: 8px 16px; font-size: 14px; }
  .card:hover { transform: none; }
  .card-details { display: none; }
  .modal-content { width: 100%; border-radius: 0; }
  .modal-title { font-size: 28px; }
  .modal-info-row { flex-direction: column; gap: 20px; }
  .login-card { padding: 40px 24px; }
  .page-header { padding: 0 16px; }
  .genre-selector { padding: 0 16px; }
  .grid-container { padding: 0 16px 16px; gap: 12px; }
}

/* ==================== UTILITIES ==================== */
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.text-center { text-align: center; }

