:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;
  --bg-hover: #1a3a6a;
  --text-primary: #eaeaea;
  --text-secondary: #a0a0a0;
  --text-muted: #666;
  --accent: #e94560;
  --accent-hover: #ff6b81;
  --accent-gradient: linear-gradient(135deg, #e94560, #ff6b81);
  --card-radius: 12px;
  --transition: all 0.3s ease;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  padding: 0 40px;
  z-index: 1000;
  border-bottom: 1px solid rgba(233, 69, 96, 0.2);
}

.logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.logo span {
  color: var(--accent);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 40px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: 30px;
  padding: 8px 20px;
  width: 100%;
  max-width: 600px;
  border: 1px solid transparent;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(233, 69, 96, 0.2);
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  padding: 8px 0;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  transition: var(--transition);
}

.search-btn:hover {
  color: var(--accent);
}

.header-right {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.nav-btn:hover, .nav-btn.active {
  color: var(--text-primary);
  background: rgba(233, 69, 96, 0.15);
}

.main {
  flex: 1;
  margin-top: 70px;
  padding: 30px 40px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

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

.section-header h2 {
  font-size: 24px;
  font-weight: 600;
}

.source-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--bg-secondary);
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

.movie-card {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  aspect-ratio: 2/3;
}

.movie-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.movie-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.movie-card:hover img {
  transform: scale(1.05);
}

.movie-card .card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 12px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  opacity: 0;
  transition: var(--transition);
}

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

.movie-card .card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.movie-card .card-year {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.movie-card .card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.movie-card .card-poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 48px;
}

.detail-backdrop {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  height: 50vh;
  background-size: cover;
  background-position: center;
  filter: blur(20px);
  opacity: 0.3;
  z-index: -1;
}

.detail-content {
  display: flex;
  gap: 40px;
  padding-top: 20px;
}

.detail-poster {
  flex-shrink: 0;
  width: 300px;
}

.detail-poster img {
  width: 100%;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
}

.detail-info {
  flex: 1;
  padding-top: 20px;
}

.detail-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
}

.detail-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.meta-item {
  font-size: 14px;
  color: var(--text-secondary);
}

.meta-item.rating {
  color: #ffd700;
  font-weight: 600;
}

.source-badge {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.detail-desc {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 700px;
}

.detail-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 30px;
}

.btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-secondary.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.torrent-info {
  background: var(--bg-secondary);
  border-radius: var(--card-radius);
  padding: 20px;
  margin-top: 20px;
}

.torrent-info h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--accent);
}

.player-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.player-header {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.5);
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  padding: 0 16px 0 0;
  transition: var(--transition);
}

.close-btn:hover {
  color: var(--accent);
}

.player-header h3 {
  flex: 1;
  font-size: 18px;
  font-weight: 500;
}

.player-quality select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.player-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.video-js {
  width: 100%;
  max-width: 1200px;
  height: 70vh;
}

.loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--bg-secondary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 18px;
}

@media (max-width: 768px) {
  .header {
    padding: 0 16px;
  }

  .header-center {
    padding: 0 16px;
  }

  .header-right {
    display: none;
  }

  .main {
    padding: 20px 16px;
  }

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

  .detail-content {
    flex-direction: column;
    gap: 20px;
  }

  .detail-poster {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
  }

  .detail-title {
    font-size: 24px;
  }

  .video-js {
    height: 50vh;
  }
}

@media (max-width: 480px) {
  .movie-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .movie-card .card-title {
    font-size: 11px;
  }
}
