:root {
  --bg-color: #0f1115;
  --surface-color: #1a1d24;
  --primary-color: #e50914; /* Red accent similar to Netflix */
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --glass-bg: rgba(26, 29, 36, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'Be Vietnam Pro', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: 70px;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.glass-header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
}

.movie-meta {
  font-size: 13px;
  color: #bbb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.movie-meta-stats {
  display: flex;
  gap: 12px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.highlight {
  color: var(--primary-color);
}

.nav-menu {
  display: flex;
  gap: 20px;
  font-weight: 500;
}

.nav-menu a {
  transition: color 0.2s;
}

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

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--surface-color);
  min-width: 200px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
  z-index: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  top: 100%;
  margin-top: 10px;
}

.dropdown-content.grid-dropdown {
  min-width: 280px;
  display: none;
  grid-template-columns: 1fr 1fr;
}

.dropdown:hover .dropdown-content.grid-dropdown {
  display: grid;
}

.dropdown-content a {
  color: white;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--primary-color);
}

.dropdown:hover .dropdown-content {
  display: block;
}

.btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
  font-weight: 600;
}

.btn-primary:hover {
  background: #f40612;
}

/* Modal */
.modal {
  display: none; 
  position: fixed; 
  z-index: 200; 
  left: 0;
  top: 0;
  width: 100%; 
  height: 100%; 
  overflow: auto; 
  background-color: rgba(0,0,0,0.6); 
  backdrop-filter: blur(5px);
}

.modal-content.glass-panel {
  background: var(--glass-bg);
  margin: 10% auto; 
  padding: 32px;
  border: 1px solid var(--glass-border);
  width: 90%;
  max-width: 400px;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {opacity: 0; transform: translateY(-20px);}
  to {opacity: 1; transform: translateY(0);}
}

.close-btn {
  color: var(--text-secondary);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-btn:hover {
  color: white;
}

.modal-title {
  margin-bottom: 8px;
}

.modal-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.2);
  color: white;
  font-family: inherit;
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary-color);
}

.btn-submit {
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  border: none;
  font-weight: 600;
  margin-top: 10px;
}

.form-footer {
  margin-top: 24px;
  font-size: 13px;
  text-align: center;
  color: var(--text-secondary);
}

.form-footer a {
  color: white;
}

.search-bar {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  overflow: hidden;
  padding: 4px 12px;
  align-items: center;
}

.search-bar input {
  background: transparent;
  border: none;
  color: white;
  padding: 8px;
  outline: none;
  font-family: 'Inter', sans-serif;
}

.search-bar button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.search-bar button:hover {
  color: white;
}

.back-link {
  color: var(--text-secondary);
  font-weight: 600;
  transition: color 0.2s;
}

.back-link:hover {
  color: white;
}

/* Hero Section */
.hero {
  position: relative;
  height: 60vh;
  min-height: 400px;
  display: flex;
  align-items: center;
  background: linear-gradient(to right, rgba(15, 17, 21, 1) 0%, rgba(15, 17, 21, 0.4) 100%), url('hero.png') center/cover no-repeat;
  margin-bottom: 40px;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, var(--bg-color) 0%, transparent 100%);
}

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

.hero-title {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(90deg, #fff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
}

/* Movies Grid */
.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 24px;
  font-weight: 600;
  position: relative;
  display: inline-block;
}

.section-header h2::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
}

.movies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.movie-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-color);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.movie-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.5);
  border-color: rgba(255, 255, 255, 0.1);
}

.movie-poster {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

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

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

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

.quality-badge {
  background: var(--primary-color);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

/* Skeleton Loading */
.skeleton-card {
  aspect-ratio: 2/3;
  background: linear-gradient(90deg, #1a1d24 25%, #262a33 50%, #1a1d24 75%);
  background-size: 400% 100%;
  animation: loading 1.5s infinite;
  border-radius: 12px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 60px;
}

.btn {
  background: var(--surface-color);
  color: white;
  border: 1px solid var(--glass-border);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Detail Page */
.player-wrapper {
  margin-top: 70px;
  background: #000;
  padding: 20px 0;
  border-bottom: 1px solid var(--glass-border);
}

.player-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

.player-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-color);
  color: var(--text-secondary);
}

.detail-container {
  margin-top: 40px;
  margin-bottom: 80px;
}

.movie-header {
  display: flex;
  gap: 32px;
}

.poster-container {
  flex-shrink: 0;
  width: 250px;
}

.poster-container img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.movie-info {
  flex-grow: 1;
}

.detail-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-origin {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 16px;
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.tag {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  color: #d1d5db;
}

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

.detail-content {
  color: #d1d5db;
  line-height: 1.8;
  margin-bottom: 32px;
}

.episodes-section h3 {
  margin-bottom: 16px;
  font-size: 20px;
}

.episodes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.episode-btn {
  background: var(--surface-color);
  border: 1px solid var(--glass-border);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.episode-btn:hover, .episode-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

/* Balanced Ads System (Thân thiện, Không gây khó chịu) */
.ad-slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 18px 0;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

.ad-label {
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.6;
}

/* Floating Side Banners: Only show on very wide screens (>= 1650px) to prevent covering content on laptops */
.ad-float-left, .ad-float-right {
  position: fixed;
  top: 110px;
  z-index: 99;
  display: none;
  background: rgba(26, 29, 36, 0.4);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(6px);
}

.ad-float-left { left: 15px; }
.ad-float-right { right: 15px; }

@media (min-width: 1650px) {
  .ad-float-left, .ad-float-right {
    display: block;
  }
}

.ad-side-close {
  position: absolute;
  top: -10px;
  right: -8px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.2s;
}

.ad-side-close:hover {
  transform: scale(1.15);
}

/* Floating Sticky Bottom Banner: Clean, unobtrusive glass capsule */
.ad-bottom-sticky {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: rgba(15, 17, 21, 0.92);
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--glass-border);
  border-bottom: none;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.6);
  padding: 6px 14px;
  text-align: center;
  backdrop-filter: blur(14px);
  max-width: 100vw;
  overflow: visible;
  transition: opacity 0.3s ease;
}

.ad-close-btn {
  position: absolute;
  top: -12px;
  right: -8px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  transition: transform 0.2s;
}

.ad-close-btn:hover {
  transform: scale(1.15);
}

/* Responsive Rules */
@media (max-width: 768px) {
  .ad-desktop {
    display: none;
  }
  .ad-mobile {
    display: flex;
  }
  .header-content {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 0;
    gap: 12px;
  }
  .header-left {
    width: 100%;
    justify-content: space-between;
  }
  .nav-menu {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
    width: 100%;
    font-size: 14px;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .search-bar {
    flex-grow: 1;
  }
  .hero-title {
    font-size: 28px;
  }
  .hero-subtitle {
    font-size: 14px;
  }
  .movies-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
  }
  .movie-title {
    font-size: 12px;
  }
  .movie-info-card {
    padding: 8px;
  }
  .detail-container {
    margin-top: 20px;
  }
  .movie-header {
    flex-direction: column;
    gap: 16px;
  }
  .poster-container {
    width: 100%;
  }
}
