:root {
  --bg: #0f0f1a;
  --bg2: #1a1a2e;
  --card: #1e1e36;
  --text: #f0f0f5;
  --text2: #9e9eb8;
  --accent: #6366f1;
  --accent2: #818cf8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,15,26,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.header-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 24px;
}
.logo { font-size: 24px; font-weight: 800; text-decoration: none; color: #fff; }
.logo span { color: var(--accent); }

.search-form { flex: 1; max-width: 480px; display: flex; gap: 8px; }
.search-form input {
  flex: 1; padding: 10px 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg2); color: var(--text); font-size: 14px; outline: none;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
  padding: 10px 20px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 14px; cursor: pointer;
}
.search-form button:hover { background: var(--accent2); }

nav { display: flex; align-items: center; gap: 16px; position: relative; }
nav a { color: var(--text2); text-decoration: none; font-size: 14px; transition: color .2s; }
nav a:hover { color: #fff; }
.fav-link { display: flex; align-items: center; gap: 4px; }

.nav-dropdown { position: relative; }
.nav-dropdown .nav-link { cursor: default; }
.dropdown-content {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: var(--card); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 8px; min-width: 200px; z-index: 200;
}
.nav-dropdown:hover .dropdown-content,
.nav-dropdown:focus-within .dropdown-content { display: block; }
.dropdown-content a {
  display: block; padding: 8px 12px; border-radius: 8px; font-size: 13px; white-space: nowrap;
}
.dropdown-content a:hover { background: rgba(255,255,255,0.05); }

#app { max-width: 1280px; margin: 0 auto; padding: 24px 20px; }

.loading { text-align: center; padding: 80px 0; color: var(--text2); font-size: 18px; }

.page-title { font-size: 28px; font-weight: 700; margin-bottom: 24px; }
.page-subtitle { color: var(--text2); font-size: 14px; margin-top: -16px; margin-bottom: 24px; }

/* Filters bar */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 16px; background: var(--card); border-radius: 16px; margin-bottom: 24px;
}
.filters-bar select, .filters-bar input {
  padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg2); color: var(--text); font-size: 13px; outline: none;
}
.filters-bar select:focus, .filters-bar input:focus { border-color: var(--accent); }
.filters-bar input[type="number"] { width: 80px; }
.filter-btn {
  padding: 6px 14px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1);
  background: transparent; color: var(--text2); font-size: 12px; cursor: pointer; transition: all .2s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.reset-btn {
  background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer;
  margin-left: auto;
}

/* Movie grid */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.movie-card {
  background: var(--card); border-radius: 14px; overflow: hidden;
  cursor: pointer; transition: all .3s; text-decoration: none; color: inherit;
}
.movie-card:hover { transform: scale(1.03); box-shadow: 0 8px 30px rgba(99,102,241,0.15); }
.movie-card .poster {
  aspect-ratio: 2/3; background: var(--bg2); position: relative; overflow: hidden;
}
.movie-card .poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.movie-card:hover .poster img { transform: scale(1.1); }
.movie-card .poster .no-poster {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--text2); font-size: 13px; text-align: center; padding: 20px;
}
.movie-card .ratings {
  position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px;
}
.movie-card .ratings span {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
}
.rating-kp { background: #eab308; color: #000; }
.rating-imdb { background: #3b82f6; color: #fff; }
.movie-card .info { padding: 12px; }
.movie-card .info h3 { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movie-card .info .meta { font-size: 12px; color: var(--text2); margin-top: 4px; }
.movie-card .info .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.movie-card .info .tags span {
  font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--bg2); color: var(--text2);
}

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 32px; }
.pagination button {
  padding: 10px 24px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg2); color: var(--text); font-size: 14px; cursor: pointer; transition: all .2s;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); }
.pagination button:disabled { opacity: 0.3; cursor: default; }
.pagination span { font-size: 14px; color: var(--text2); }

/* Movie detail */
.movie-detail { max-width: 1100px; margin: 0 auto; }
.player-wrapper {
  aspect-ratio: 16/9; background: #000; border-radius: 16px; overflow: hidden; margin-bottom: 32px;
  position: relative; cursor: pointer;
}
.player-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.player-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; transition: background .3s;
}
.player-wrapper:hover .player-overlay { background: rgba(0,0,0,0.5); }
.play-btn {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(99,102,241,0.9);
  display: flex; align-items: center; justify-content: center; transition: transform .3s;
}
.player-wrapper:hover .play-btn { transform: scale(1.1); }
.play-btn svg { width: 32px; height: 32px; fill: #fff; margin-left: 3px; }
.player-label {
  position: absolute; bottom: 16px; left: 16px;
  background: rgba(0,0,0,0.6); padding: 6px 14px; border-radius: 10px;
  font-size: 14px; color: #fff;
}
.player-wrapper iframe { width: 100%; height: 100%; border: none; }
.season-episode-bar { margin-bottom: 32px; }

.detail-grid { display: grid; grid-template-columns: 280px 1fr; gap: 32px; }
.detail-poster { width: 100%; border-radius: 14px; }
.detail-title { font-size: 30px; font-weight: 700; }
.detail-original { color: var(--text2); font-size: 18px; margin-top: 4px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.badge {
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.badge-kp { background: rgba(234,179,8,0.15); color: #eab308; }
.badge-imdb { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-year { background: var(--bg2); color: var(--text2); }
.badge-age { background: rgba(239,68,68,0.15); color: #f87171; }

.detail-genres { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.detail-genres button {
  padding: 6px 14px; border-radius: 20px; border: none; font-size: 12px;
  background: rgba(99,102,241,0.1); color: var(--accent2); cursor: pointer;
}
.detail-genres button:hover { background: rgba(99,102,241,0.2); }

.detail-desc { color: var(--text2); line-height: 1.7; margin-top: 20px; font-size: 15px; }

.voice-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; max-height: 200px; overflow-y: auto; }
.voice-tabs::-webkit-scrollbar { width: 4px; }
.voice-tabs::-webkit-scrollbar-thumb { background: #3b3b5c; border-radius: 2px; }
.voice-tab {
  padding: 8px 16px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
  background: transparent; color: var(--text2); font-size: 13px; cursor: pointer; transition: all .2s;
}
.voice-tab:hover { border-color: var(--accent); }
.voice-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.voice-tab .dub-link { display: inline-flex; margin-left: 4px; font-size: 11px; opacity: 0.5; transition: opacity .2s; cursor: pointer; }
.voice-tab:hover .dub-link { opacity: 1; }
.voice-tab .ad-badge { font-size: 10px; margin-left: 3px; }
.voice-tab .no-ad-badge { font-size: 10px; margin-left: 3px; }
.voice-tab.active .no-ad-badge { filter: brightness(0.8); }

.detail-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 24px; font-size: 13px; color: var(--text2); }

.fav-btn {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
  font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 16px; transition: all .2s; background: var(--bg2); color: var(--text2);
}
.fav-btn:hover { background: rgba(255,255,255,0.05); }
.fav-btn.active { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3); }

/* Actors */
.detail-actors { margin-top: 20px; }
.detail-actors h4 { font-size: 14px; color: var(--text2); margin-bottom: 8px; }
.actor-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.actor-chip {
  padding: 6px 14px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1);
  background: var(--bg2); color: var(--text2); font-size: 12px; cursor: pointer; transition: all .2s;
}
.actor-chip:hover { border-color: var(--accent); color: var(--accent); }

/* Toast */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card); padding: 12px 24px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1); font-size: 14px;
  opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 999;
}
#toast.show { opacity: 1; }

/* Empty state */
.empty-state { text-align: center; padding: 80px 0; color: var(--text2); }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .search-form { max-width: 100%; order: 3; }
  .movie-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-poster { max-width: 280px; }
}
