:root {
  --primary-color: #e50914; /* Netflix-like red */
  --bg-color: #0f1115; /* Deep dark background */
  --card-bg: rgba(255, 255, 255, 0.05); /* Glassmorphism card bg */
  --text-color: #ffffff;
  --text-muted: #a1a1a1;
  --transition-speed: 0.3s;
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --header-bg: rgba(15, 17, 21, 0.8);
}

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

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Glassmorphism Header */
header {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 1.5rem 5%;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  transition: background var(--transition-speed);
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary-color);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 2px;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  margin-left: 20px;
  font-size: 1rem;
  font-weight: 500;
  transition: color var(--transition-speed);
}

nav a:hover {
  color: var(--primary-color);
}

/* Hero Section / Banner */
.hero-container {
  position: relative;
  width: 100%;
  height: 80vh;
  margin-top: 0; /* Behind header */
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
  background-size: cover;
  background-position: center top;
}

.hero-slide.active {
  opacity: 1;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%), linear-gradient(to right, rgba(15,17,21,0.8) 0%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 5% 5% 10% 5%;
}

.hero-content h1 {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.btn {
  display: inline-block;
  padding: 0.8rem 2rem;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all var(--transition-speed);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

.btn-primary:hover {
  background-color: #ff0f1a;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.6);
}

.btn-secondary {
  background: var(--card-bg);
  backdrop-filter: blur(4px);
  color: white;
  border: 1px solid var(--glass-border);
  margin-left: 10px;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
}

/* Listings Section */
.listings {
  padding: 2rem 5%;
  margin-top: -50px;
  position: relative;
  z-index: 10;
}

.category-row {
  margin-bottom: 3rem;
}

.category-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #fff;
  border-left: 4px solid var(--primary-color);
  padding-left: 10px;
}

/* Horizontal scrollable cards */
.cards-container {
  display: flex;
  overflow-x: auto;
  gap: 1.5rem;
  padding-bottom: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--bg-color);
}

.cards-container::-webkit-scrollbar {
  height: 8px;
}

.cards-container::-webkit-scrollbar-track {
  background: var(--bg-color);
}

.cards-container::-webkit-scrollbar-thumb {
  background-color: var(--primary-color);
  border-radius: 10px;
}

.card {
  flex: 0 0 auto;
  width: 250px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  transform: scale(1.05) translateY(-5px);
  box-shadow: var(--glass-shadow);
  z-index: 2;
}

.card img {
  width: 100%;
  height: 350px;
  object-fit: cover;
  transition: opacity var(--transition-speed);
}

.card-info {
  padding: 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  position: absolute;
  bottom: 0;
  width: 100%;
}

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

.card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* Series Details Page */
.series-details-wrapper {
  padding: 120px 5% 50px 5%;
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  min-height: 100vh;
}

.series-poster {
  flex: 0 0 350px;
  border-radius: 15px;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.series-poster img {
  width: 100%;
  display: block;
}

.series-info {
  flex: 1;
}

.series-info h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.meta-tags {
  display: flex;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.tag {
  background: rgba(255,255,255,0.1);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.2);
}

.tag.rating {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.series-description {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 800px;
}

.cast-crew {
  margin-bottom: 2rem;
}

.cast-crew p {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.cast-crew span {
  color: var(--text-muted);
}

/* Episodes Grid */
.episodes-section {
  margin-top: 3rem;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.episode-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform var(--transition-speed);
  position: relative;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.episode-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
}

.episode-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-bottom: 1px solid var(--glass-border);
}

.play-icon-overlay {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-speed), transform var(--transition-speed);
}

.episode-card:hover .play-icon-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.play-icon-overlay i {
  color: white;
  font-size: 20px;
  margin-left: 4px;
}

.episode-info {
  padding: 1rem;
}

.episode-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

/* Player Page */
.player-wrapper {
  padding: 100px 5% 50px 5%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #000;
}

.video-container {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  position: relative;
}

.video-js {
  width: 100%;
  height: 100%;
}

.player-header {
  margin-bottom: 20px;
  max-width: 1200px;
  margin: 0 auto 20px auto;
  width: 100%;
}

.back-btn {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transition-speed);
}

.back-btn:hover {
  color: var(--primary-color);
}

/* Loader */
.loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh;
  width: 100%;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.1);
  border-left-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error UI */
.error-message {
  text-align: center;
  padding: 4rem;
  color: #ff4d4d;
  background: rgba(255,0,0,0.1);
  border-radius: 10px;
  border: 1px solid rgba(255,0,0,0.2);
  margin: 2rem;
}

/* Search Form */
.nav-links {
  display: flex;
  align-items: center;
}

.search-form {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 5px 15px;
  margin-left: 20px;
  border: 1px solid var(--glass-border);
}

.search-form input {
  background: transparent;
  border: none;
  color: white;
  outline: none;
  font-size: 0.9rem;
  width: 150px;
  transition: width var(--transition-speed);
}

.search-form input:focus {
  width: 200px;
}

.search-form button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-speed);
}

.search-form button:hover {
  color: var(--primary-color);
}

/* Responsive (MUST BE AT THE BOTTOM) */
@media (max-width: 900px) {
  .series-details-wrapper {
    flex-direction: column;
  }
  .series-poster {
    max-width: 300px;
    margin: 0 auto;
  }
  .hero-content h1 {
    font-size: 2.5rem;
  }
  .hero-container {
    height: 50vh;
  }
}

.mobile-menu-btn {
  display: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
    margin-left: auto;
    margin-right: 15px;
  }
  
  .nav-links {
    display: none !important;
    flex-direction: column;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px 0;
    border-bottom: 1px solid var(--glass-border);
  }
  
  .nav-links.active {
    display: flex !important;
  }
  
  .nav-links a {
    margin: 15px 0;
    text-align: center;
    width: 100%;
  }

  .search-form {
    margin: 15px auto;
    width: 80%;
    justify-content: space-between;
  }
  
  .search-form input {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .card {
    width: 180px;
  }
  .card img {
    height: 250px;
  }
  .hero-content h1 {
    font-size: 2rem;
  }
  .btn {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
  }
}
