@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

:root {
  --primary: #EF3E3A;
  --secondary: #f9e368;
  --dark: #0a0a0a;
  --dark-light: #1a1a1a;
  --text: #ffffff;
  --text-muted: #b3b3b3;
  --gradient: linear-gradient(135deg, #EF3E3A 0%, #ff6b6b 100%);
}

body {
  background: var(--dark);
  color: var(--text);
  overflow-x: hidden;
}

/* ========== HEADER / NAVBAR ========== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #191919;
    z-index: 1000; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.lg {
    cursor: pointer;
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
}

.pop {
    color: #f9e368;
}

.together {
    color: #EF3E3A;
}

.nav_links {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav_links li {
    display: inline-block;
    padding: 0px 20px;
}

.nav_links li a {
    transition: all 0.3s ease 0s;
    text-decoration: none;
    color: var(--text);
}

.nav_links li a.active {
  position: relative;
  color: #fff;
}

.nav_links li a.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 2px;
  background-color: #EF3E3A;
  border-radius: 2px;
}

.nav_links li a:hover {
    color: #EF3E3A;
    text-shadow: 0 6px 15px rgba(239, 62, 58, 0.6);
}

.cta {
    display: inline-block;
    text-decoration: none;
}

/* ========== DESKTOP AUTH AREA ========== */
.desktop-auth {
    display: flex;
    align-items: center;
    gap: 15px;
}

.desktop-user-box {
    display: flex;
    align-items: center;
    gap: 15px;
}

#desktopUsername {
    font-size: 16px;
    font-weight: 600;
    color: #f9e368;
    padding: 8px 15px;
    background: rgba(249, 227, 104, 0.1);
    border-radius: 5px;
    white-space: nowrap;
}

/* ========== MOBILE MENU TOGGLE (HAMBURGER) ========== */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: #fff;
    border-radius: 3px;
    transition: 0.3s;
}

/* Hamburger animation when menu is open */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ========== MOBILE AUTH SECTION (INSIDE HAMBURGER) ========== */
/* CRITICAL: Hide mobile auth section on desktop to prevent duplicates */
.mobile-auth-section {
    display: none !important; /* Hidden on desktop by default */
}

.mobile-login-wrapper,
.mobile-user-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.mobile-login-btn {
    width: 80%;
    text-align: center;
}

.mobile-login-btn button {
    width: 100%;
    padding: 12px 25px;
}

.mobile-username {
    font-size: 18px;
    font-weight: 600;
    color: #f9e368;
    padding: 10px 20px;
    background: rgba(249, 227, 104, 0.1);
    border-radius: 5px;
    text-align: center;
}

.mobile-logout-btn {
    width: 80%;
    padding: 12px 25px;
}

/* Hero Section */
.hero-section {
  height: 80vh;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 60px;
  margin-top: 60px;
  overflow: hidden;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.95) 100%),
              url('https://images.unsplash.com/photo-1536440136628-849c177e76a1?w=1920&q=80');
  background-size: cover;
  background-position: center;
  filter: brightness(0.7);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

.hero-title {
  font-size: 56px;
  font-weight: 800;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero-description {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 30px;
  line-height: 1.6;
}

.hero-search-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin-bottom: 30px;
}

.hero-search-bar {
  width: 100%;
  padding: 16px 20px 16px 50px;
  border-radius: 30px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.15);
  color: var(--text);
  font-size: 16px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.hero-search-bar:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255,255,255,0.2);
}

.hero-search-bar::placeholder {
  color: rgba(255,255,255,0.6);
}

.hero-search-container .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

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

.btn {
  padding: 15px 35px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-primary {
  background: var(--gradient);
  color: white;
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(239, 62, 58, 0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.2);
  color: white;
  backdrop-filter: blur(10px);
}

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

/* Search Results Section */
.search-results-section {
  padding: 40px 60px;
  min-height: 300px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--secondary);
}

.view-all {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.3s ease;
}

.view-all:hover {
  color: var(--secondary);
}

/* Movie Sections */
.movie-section {
  padding: 40px 60px;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 25px;
  margin-top: 20px;
}

.movie-slider {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 20px;
  scroll-behavior: smooth;
}

.movie-slider::-webkit-scrollbar {
  height: 8px;
}

.movie-slider::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
}

.movie-slider::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.movie-card {
  min-width: 200px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--dark-light);
}

.movie-card:hover {
  transform: scale(1.05) translateY(-5px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.5);
}

.movie-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.movie-card:hover .movie-poster {
  filter: brightness(0.7);
}

.movie-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px;
  background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.movie-card:hover .movie-info {
  opacity: 1;
}

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

.movie-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--secondary);
  font-weight: 600;
}

/* Movie Detail Page */
.movie-detail-container {
  min-height: 100vh;
  background: var(--dark);
}

.movie-hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: flex-end;
  padding: 0;
  overflow: hidden;
}

.movie-hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center top;
}

.movie-hero-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(10, 10, 10, 1) 0%, rgba(10, 10, 10, 0.8) 40%, rgba(10, 10, 10, 0.3) 70%, transparent 100%);
}

.movie-hero-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, rgba(10, 10, 10, 0.95) 0%, rgba(10, 10, 10, 0.7) 30%, rgba(10, 10, 10, 0.4) 50%, rgba(10, 10, 10, 0.7) 70%, rgba(10, 10, 10, 0.95) 100%);
}

.movie-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 50px;
  max-width: 1400px;
  width: 100%;
  padding: 0 60px 60px;
  margin: 0 auto;
}

.movie-poster-large {
  width: 280px;
  height: 420px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  flex-shrink: 0;
}

.movie-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 20px;
}

.movie-type-year {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 500;
}

.movie-detail-title {
  font-size: 52px;
  font-weight: 800;
  margin-bottom: 20px;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.movie-detail-meta {
  display: flex;
  gap: 25px;
  align-items: center;
  margin-bottom: 20px;
  font-size: 15px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

.imdb-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary);
  font-weight: 700;
  font-size: 20px;
}

.genre-tags {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.genre-tag {
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.genre-tag:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.movie-actions {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

/* Overview Section */
.overview-section {
  padding: 60px;
  background: var(--dark);
  max-width: 1400px;
  margin: 0 auto;
}

.overview-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 25px;
  color: var(--text);
}

.movie-description {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-muted);
  max-width: 1000px;
  margin-bottom: 0;
}

/* Additional Info Grid */
.additional-info {
  padding: 60px;
  background: var(--dark-light);
  max-width: 1400px;
  margin: 0 auto;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
}

.info-item h3 {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item p {
  font-size: 16px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.6;
}

.trailer-section {
  padding: 60px;
  background: var(--dark);
  max-width: 1400px;
  margin: 0 auto;
}

.trailer-container {
  width: 100%;
}

.trailer-container h2 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 25px;
  color: var(--text);
}

.trailer-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  background: var(--dark-light);
}

.trailer-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Loading Animation */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  font-size: 18px;
  color: var(--text-muted);
}

.spinner {
  border: 3px solid rgba(255,255,255,0.1);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-right: 15px;
}

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

/* No Results */
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.no-results-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 1024px) {
  header {
    padding: 15px 30px;
  }

  .movie-section,
  .search-results-section,
  .trailer-section,
  .overview-section,
  .additional-info {
    padding: 40px 30px;
  }

  .hero-section {
    padding: 0 30px;
  }

  .hero-title {
    font-size: 42px;
  }

  .movie-hero-content {
    padding: 0 30px 40px;
  }

  .movie-detail-title {
    font-size: 42px;
  }

  .movie-poster-large {
    width: 220px;
    height: 330px;
  }
}

@media (max-width: 768px) {
  /* Mobile menu toggle visible */
  .mobile-menu-toggle {
    display: flex;
  }

  /* Hide desktop auth */
  .desktop-auth {
    display: none !important;
  }

  /* Navigation menu */
  nav {
    position: fixed;
    right: -100%;
    top: 65px;
    flex-direction: column;
    background: rgba(25, 25, 25, 0.98);
    width: 100%;
    text-align: center;
    transition: 0.3s;
    box-shadow: 0 10px 27px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  nav.active {
    right: 0;
  }

  .nav_links {
    flex-direction: column;
    width: 100%;
    padding: 20px 0;
  }

  .nav_links li {
    width: 100%;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .nav_links li a {
    font-size: 16px;
  }

  /* Show mobile auth section inside hamburger menu */
  .mobile-auth-section {
    display: block !important;
    width: 100%;
    padding: 20px 0;
    border-top: 2px solid rgba(239, 62, 58, 0.3);
    margin-top: 10px;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-description {
    font-size: 16px;
  }

  .hero-search-container {
    max-width: 100%;
  }

  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .movie-hero-content {
    flex-direction: column;
    gap: 25px;
    padding: 0 20px 30px;
  }

  .movie-poster-large {
    width: 200px;
    height: 300px;
    margin: 0 auto;
  }

  .movie-detail-title {
    font-size: 32px;
    text-align: center;
  }

  .movie-type-year {
    text-align: center;
  }

  .movie-detail-meta {
    justify-content: center;
    gap: 15px;
  }

  .genre-tags {
    justify-content: center;
  }

  .imdb-rating {
    justify-content: center;
  }

  .movie-actions {
    justify-content: center;
  }

  .overview-section,
  .additional-info,
  .trailer-section {
    padding: 40px 20px;
  }

  .overview-title,
  .trailer-container h2 {
    font-size: 24px;
  }

  .movie-description {
    font-size: 15px;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .section-title {
    font-size: 22px;
  }
}