/* ==========================================
   StreamFlix – Premium Mobile‑First UI/UX
   ========================================== */
:root {
  --primary: #e50914;
  --bg: #0a0a0c;
  --card-bg: #181818;
  --text: #ffffff;
  --text-dim: #a0a0a0;
  --border: #2a2a2a;
  --glass: rgba(20, 20, 20, 0.85);
}

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

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

/* ========== NAVBAR ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4%;
  z-index: 100;
  transition: background 0.3s;
  backdrop-filter: blur(6px);
}
.navbar.scrolled {
  background: rgba(10,10,12,0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.6);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 40px;
}
.logo {
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s;
}
.logo:hover {
  transform: scale(1.05);
}

nav {
  display: flex;
  gap: 24px;
}
nav a {
  color: #e5e5e5;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
nav a:hover,
nav a.active {
  color: #fff;
  font-weight: 600;
}

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

.search-box {
  display: flex;
  align-items: center;
  background: rgba(0,0,0,0.5);
  border: 1px solid #444;
  border-radius: 20px;
  padding: 6px 14px;
  transition: border 0.2s;
}
.search-box:focus-within {
  border-color: var(--primary);
}
.search-box i {
  color: #aaa;
  margin-right: 8px;
}
.search-box input {
  background: transparent;
  border: none;
  color: white;
  outline: none;
  font-size: 0.85rem;
  width: 180px;
}

.lang-select {
  background: #222;
  color: white;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  display: none;            /* hidden on mobile (we move it to mobile menu) */
}
.lang-select:focus {
  border-color: var(--primary);
}

.user-profile i {
  font-size: 28px;
  color: #e5e5e5;
  cursor: pointer;
}

/* ----- Hamburger ----- */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: 250;
}
.hamburger span {
  width: 25px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: 0.3s;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 150;
}

/* Mobile menu panel */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 75%;
  max-width: 300px;
  height: 100vh;
  background: rgba(10,10,12,0.98);
  backdrop-filter: blur(20px);
  z-index: 200;
  flex-direction: column;
  padding: 80px 30px 30px;
  gap: 25px;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  display: flex;            /* always flex, just hidden via transform */
}
.mobile-menu.open {
  transform: translateX(0);
}
.mobile-menu a,
.mobile-menu label {
  color: white;
  font-size: 1.1rem;
  text-decoration: none;
  font-weight: 500;
  display: block;
}
.mobile-menu .lang-select-mobile {
  margin-top: 20px;
  background: #333;
  color: white;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 1rem;
  width: 100%;
  display: block;
}

/* ========== HERO ========== */
.hero {
  position: relative;
  height: 90vh;
  background-size: cover;
  background-position: center 20%;
  margin-bottom: 20px;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(0deg, var(--bg) 0%, transparent 100%);
  z-index: 2;
}
.hero-content {
  position: absolute;
  bottom: 25%;
  left: 4%;
  max-width: 550px;
  z-index: 3;
  padding-right: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  text-shadow: 2px 2px 10px rgba(0,0,0,0.8);
  margin-bottom: 16px;
  line-height: 1.2;
}
.hero p {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  text-shadow: 1px 1px 6px rgba(0,0,0,0.8);
  margin-bottom: 28px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-play,
.btn-more {
  padding: 14px 30px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-play {
  background: white;
  color: black;
}
.btn-play:hover {
  opacity: 0.85;
  transform: scale(1.03);
}
.btn-more {
  background: rgba(109,109,110,0.6);
  color: white;
  backdrop-filter: blur(4px);
}
.btn-more:hover {
  background: rgba(109,109,110,0.8);
}

/* ========== ROWS ========== */
.rows-container {
  padding: 0 4% 50px;
  margin-top: -120px;
  position: relative;
  z-index: 5;
}

.row {
  margin-bottom: 50px;
}
.row h2 {
  margin-bottom: 16px;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 700;
}
.row-posters {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 12px;
  padding-bottom: 12px;
  scrollbar-width: thin;
}
.row-posters::-webkit-scrollbar {
  height: 6px;
}
.row-posters::-webkit-scrollbar-track {
  background: transparent;
}
.row-posters::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

.poster-card {
  flex: 0 0 auto;
  width: 180px;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}
.poster-card:hover {
  transform: scale(1.08);
  z-index: 20;
  box-shadow: 0 10px 25px rgba(0,0,0,0.8);
}
.poster-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}
.poster-info {
  padding: 8px 6px;
  background: var(--card-bg);
}
.poster-info h3 {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.poster-info p {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ========== MODAL (detail & search) ========== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-content {
  background: var(--card-bg);
  margin: 40px auto;
  width: 92%;
  max-width: 950px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
  position: relative;
}
.close {
  position: absolute;
  right: 20px;
  top: 18px;
  color: white;
  font-size: 32px;
  cursor: pointer;
  z-index: 10;
  background: rgba(0,0,0,0.6);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  height: 400px;
  background-size: cover;
  background-position: center 20%;
  position: relative;
}
.modal-backdrop::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 150px;
  background: linear-gradient(0deg, var(--card-bg) 0%, transparent 100%);
}
.modal-details {
  padding: 25px 40px 35px;
}
.modal-details h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 14px;
}
.modal-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 18px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.modal-overview {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 25px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.cast-list {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.cast-member {
  width: 90px;
  text-align: center;
}
.cast-member img {
  width: 100%;
  border-radius: 6px;
  aspect-ratio: 1;
  object-fit: cover;
}
.cast-name {
  font-weight: 600;
  margin-top: 6px;
  font-size: 0.8rem;
}
.cast-character {
  color: var(--text-dim);
  font-size: 0.7rem;
}

/* ========== SEARCH GRID ========== */
.search-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 28px;
  justify-content: center;
}
.search-grid .poster-card {
  width: 150px;
}

/* ========== PLAYER PAGE ========== */
.player-container {
  max-width: 1400px;
  margin: 80px auto 30px;
  padding: 0 20px;
}
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.7);
}
.video-wrapper iframe,
.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player-controls {
  margin: 20px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
}
.server-selector {
  display: flex;
  gap: 8px;
}
.server-btn {
  background: #333;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.server-btn.active {
  background: var(--primary);
  box-shadow: 0 0 12px rgba(229,9,20,0.5);
}

.episode-selector {
  display: flex;
  gap: 10px;
}
select {
  padding: 8px 14px;
  background: #222;
  color: white;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 0.85rem;
}
.back-btn {
  background: transparent;
  color: white;
  border: 1px solid #555;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.back-btn:hover {
  background: rgba(255,255,255,0.1);
}

.title-section {
  margin-bottom: 20px;
}
.title-section h2 {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  margin-bottom: 6px;
}
.title-section p {
  color: var(--text-dim);
}

/* Episode picker (Netflix style) */
.episode-picker {
  margin-top: 30px;
}

/* "See all" link on homepage */
.see-all {
  font-size: 0.7em;
  color: var(--primary);
  text-decoration: none;
  margin-left: 10px;
  font-weight: 400;
}
.see-all:hover {
  text-decoration: underline;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 992px) {
  .hamburger {
    display: flex;
  }
  nav {
    display: none;
  }
  .lang-select {
    display: none;
  }
  .hero {
    height: 70vh;
  }
  .hero-content {
    bottom: 20%;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0 15px;
    height: 56px;
  }
  .nav-left {
    gap: 15px;
  }
  .logo {
    font-size: 1.5rem;
  }
  .search-box input {
    width: 120px;
  }
  .hero {
    height: 60vh;
  }
  .poster-card {
    width: 140px;
  }
  .modal-content {
    width: 96%;
    margin: 20px auto;
  }
  .modal-backdrop {
    height: 250px;
  }
  .modal-details {
    padding: 15px 20px;
  }
  .player-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .episode-selector {
    flex-wrap: wrap;
  }
  .episode-grid {
    grid-template-columns: 1fr;
  }
  .episode-card {
    flex-direction: column;
  }
  .episode-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.6rem;
  }
  .poster-card {
    width: 110px;
  }
  .search-box input {
    width: 90px;
  }
  .modal-meta {
    flex-direction: column;
    gap: 5px;
  }
}
