/* ── Reset + Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: #0a0a14;
  color: #e8e8f0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }

/* ── Header ── */
.site-header {
  background: #0f0f23;
  border-bottom: 2px solid #e50914;
  position: sticky; top: 0; z-index: 100;
  padding: 0 20px;
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  height: 60px;
}
.logo { font-size: 1.4rem; font-weight: 700; color: #e50914; white-space: nowrap; }
.main-nav { display: flex; align-items: center; gap: 18px; }
.main-nav a { color: #ccc; font-size: .95rem; }
.main-nav a:hover { color: #fff; }

/* dropdown */
.dropdown { position: relative; cursor: pointer; }
.dropdown > span { color: #ccc; font-size: .95rem; }
.dropdown:hover > span { color: #fff; }
.dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0;
  background: #1a1a2e; border: 1px solid #333; border-radius: 8px;
  padding: 8px 0; min-width: 160px; max-height: 380px; overflow-y: auto;
  z-index: 200;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 8px 16px; color: #ccc; font-size: .9rem; }
.dropdown-menu a:hover { background: #252545; color: #fff; }

/* search */
.search-form { display: flex; flex: 1; max-width: 340px; }
.search-form input {
  flex: 1; padding: 7px 12px; border-radius: 6px 0 0 6px;
  border: 1px solid #444; background: #0f0f23; color: #fff; font-size: .9rem;
}
.search-form button {
  padding: 7px 12px; border-radius: 0 6px 6px 0;
  background: #e50914; border: none; cursor: pointer; font-size: .95rem;
}

/* lang switcher */
.lang-switcher { display: flex; gap: 6px; flex-wrap: wrap; }
.lang-switcher a {
  padding: 3px 7px; border-radius: 4px; font-size: .75rem;
  color: #aaa; border: 1px solid #333;
}
.lang-switcher a:hover, .lang-switcher a.active {
  background: #e50914; color: #fff; border-color: #e50914;
}

/* ── Main ── */
main { flex: 1; }
.page-wrap { max-width: 1400px; margin: 0 auto; padding: 24px 20px; }

/* ── Hero ── */
.hero { text-align: center; padding: 48px 20px 32px; }
.hero h1 { font-size: 2.2rem; color: #fff; margin-bottom: 10px; }
.hero p { color: #aaa; font-size: 1.1rem; }

.page-title {
  font-size: 1.8rem; font-weight: 700; margin-bottom: 24px;
  padding-bottom: 12px; border-bottom: 2px solid #e50914;
}

/* ── Movie Grid ── */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.movie-grid.small {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.movie-card {
  display: flex; flex-direction: column;
  background: #1a1a2e; border-radius: 10px; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.movie-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(229,9,20,.3); }
.movie-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.no-poster {
  width: 100%; aspect-ratio: 2/3; background: #252545;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}
.no-poster.large { aspect-ratio: 2/3; font-size: 4rem; }
.card-info { padding: 8px 10px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-size: .85rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: .75rem; color: #888; }

/* ── Pagination ── */
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 32px; }
.pagination a { padding: 8px 18px; background: #1a1a2e; border-radius: 6px; }
.pagination a:hover { background: #e50914; }
.pagination span { color: #aaa; }

.empty { text-align: center; padding: 60px 20px; color: #666; font-size: 1.1rem; }

/* ── Movie Detail ── */
.movie-detail { max-width: 1200px; margin: 0 auto; padding: 32px 20px; }
.detail-top { display: flex; gap: 32px; margin-bottom: 32px; }
.detail-poster { flex-shrink: 0; width: 240px; border-radius: 12px; overflow: hidden; }
.detail-poster img { width: 100%; display: block; }
.detail-info { flex: 1; }
.detail-info h1 { font-size: 2rem; margin-bottom: 12px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; color: #bbb; font-size: .95rem; }
.meta-row a:hover { color: #e50914; }
.overview { color: #ccc; line-height: 1.7; font-size: 1rem; max-width: 680px; }
.watch-btn {
  display: inline-block; margin-top: 20px; padding: 12px 28px;
  background: #e50914; color: #fff; border-radius: 8px; font-size: 1.05rem; font-weight: 600;
}
.watch-btn:hover { background: #c40812; }

.player-wrap {
  width: 100%; background: #000; border-radius: 12px; overflow: hidden;
  aspect-ratio: 16/9; margin-bottom: 40px;
}
.player-wrap iframe { width: 100%; height: 100%; display: block; }
.no-embed { text-align: center; padding: 40px; color: #666; background: #1a1a2e; border-radius: 12px; margin-bottom: 40px; }

.related h2 { font-size: 1.3rem; margin-bottom: 16px; }

/* ── Footer ── */
.site-footer {
  background: #0f0f23; border-top: 1px solid #222;
  text-align: center; padding: 20px; color: #555; font-size: .85rem;
}

/* ── RTL ── */
.rtl .header-inner { direction: rtl; }
.rtl .dropdown-menu { left: auto; right: 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .logo { font-size: 1.2rem; }
  .search-form { max-width: 100%; order: 3; width: 100%; }
  .detail-top { flex-direction: column; }
  .detail-poster { width: 160px; }
  .hero h1 { font-size: 1.5rem; }
  .movie-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
