*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #080c18;
  color: #e2e8f0;
  -webkit-tap-highlight-color: transparent;
}
body {
  display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 50% 0%, #0f1a3a 0%, #080c18 60%);
}
.container {
  max-width: 900px; margin: 0 auto; padding: 2rem 1.25rem;
  flex: 1; display: flex; flex-direction: column; gap: 1.5rem;
}
header { text-align: center; }
header h1 {
  font-size: 1.8rem; font-weight: 800;
  background: linear-gradient(135deg, #e94560, #a064ff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
header p { font-size: 0.85rem; color: #64748b; margin-top: 0.3rem; font-weight: 500; }

.search-section { display: flex; flex-direction: column; gap: 0.75rem; }
.search-bar { display: flex; gap: 0.5rem; }
.search-bar input {
  flex: 1; padding: 0.75rem 1rem; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05); color: #e2e8f0; font-size: 1rem; font-family: inherit;
  outline: none; transition: border-color 0.2s;
}
.search-bar input:focus { border-color: #e94560; }
.search-bar button {
  padding: 0.75rem 1.5rem; border-radius: 10px; border: none;
  background: linear-gradient(135deg, #e94560, #a064ff); color: #fff;
  font-weight: 600; font-size: 0.9rem; cursor: pointer; font-family: inherit;
  transition: transform 0.15s, opacity 0.2s;
}
.search-bar button:active { transform: scale(0.96); }
.search-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

.genre-filters {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.genre-chip {
  padding: 0.35rem 0.8rem; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #94a3b8; font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s; font-family: inherit; white-space: nowrap;
}
.genre-chip:hover { border-color: #e94560; color: #e2e8f0; }
.genre-chip.active { background: #e94560; border-color: #e94560; color: #fff; }

.disk-status {
  padding: 0.6rem 1rem; border-radius: 10px; font-size: 0.8rem;
  background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.2); color: #22c55e;
}
.disk-status.warning { background: rgba(234,179,8,0.1); border-color: rgba(234,179,8,0.3); color: #eab308; }
.disk-status.error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #ef4444; }

.results-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem;
}
.results-header span { font-weight: 600; font-size: 1rem; }
.results-count { color: #64748b; font-size: 0.8rem; }

.movie-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 640px) {
  .movie-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

.movie-card {
  border-radius: 12px; overflow: hidden; cursor: pointer;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.15s, border-color 0.2s;
}
.movie-card:active { transform: scale(0.97); }
.movie-card:hover { border-color: rgba(255,255,255,0.15); }
.movie-card-poster {
  width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block;
  background: rgba(255,255,255,0.03);
}
.movie-card-info { padding: 0.5rem 0.65rem 0.65rem; }
.movie-card-title { font-size: 0.8rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.movie-card-year { font-size: 0.7rem; color: #64748b; margin-top: 0.2rem; }

.pagination {
  display: flex; justify-content: center; gap: 0.5rem; margin-top: 1rem;
}
.pagination button {
  padding: 0.4rem 0.9rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #94a3b8; cursor: pointer; font-family: inherit; font-size: 0.8rem;
  transition: all 0.2s;
}
.pagination button:hover { border-color: #e94560; color: #e2e8f0; }
.pagination button.active { background: #e94560; border-color: #e94560; color: #fff; }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }

.downloads-list { display: flex; flex-direction: column; gap: 0.5rem; }
.download-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.8rem; border-radius: 10px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
}
.download-item .dl-title { flex: 1; font-size: 0.85rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.download-item .dl-status { font-size: 0.75rem; color: #64748b; }
.download-item .dl-progress { width: 60px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.1); overflow: hidden; }
.download-item .dl-progress-bar { height: 100%; border-radius: 2px; background: linear-gradient(90deg, #e94560, #a064ff); transition: width 0.5s; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
  padding: 1rem; overflow-y: auto;
}
.modal {
  background: #0f1a3a; border-radius: 16px; max-width: 600px; width: 100%;
  border: 1px solid rgba(255,255,255,0.08); position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 0.75rem; right: 0.75rem; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.5); color: #fff; font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-content { padding: 1.5rem; }

.movie-detail { display: flex; flex-direction: column; gap: 1rem; }
.movie-detail-header { display: flex; gap: 1rem; }
.movie-detail-poster { width: 120px; border-radius: 8px; flex-shrink: 0; }
.movie-detail-meta { flex: 1; }
.movie-detail-title { font-size: 1.3rem; font-weight: 700; }
.movie-detail-year { color: #64748b; font-size: 0.9rem; margin-top: 0.2rem; }
.movie-detail-rating { color: #f5c518; font-size: 0.9rem; margin-top: 0.3rem; }
.movie-detail-overview { font-size: 0.85rem; color: #94a3b8; line-height: 1.6; }
.movie-detail-genres { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.genre-tag { padding: 0.2rem 0.6rem; border-radius: 12px; background: rgba(233,69,96,0.15); color: #e94560; font-size: 0.75rem; }
.torrents-section { margin-top: 1rem; }
.torrents-section h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }
.torrent-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.75rem; border-radius: 8px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0.4rem; font-size: 0.8rem;
}
.torrent-item .torrent-info { flex: 1; }
.torrent-item .torrent-quality { font-weight: 600; color: #a064ff; }
.torrent-item .torrent-size { color: #64748b; }
.torrent-item .torrent-seed { color: #22c55e; }
.btn-download {
  padding: 0.35rem 0.8rem; border-radius: 8px; border: none;
  background: linear-gradient(135deg, #e94560, #a064ff); color: #fff;
  font-weight: 600; font-size: 0.75rem; cursor: pointer; font-family: inherit;
  transition: transform 0.15s;
}
.btn-download:active { transform: scale(0.95); }
.btn-download:disabled { opacity: 0.4; cursor: not-allowed; }

.loading-spinner {
  width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #e94560; border-radius: 50%; animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 2rem; color: #64748b; font-size: 0.9rem; }

.gallery-section .movie-card .movie-card-poster { aspect-ratio: auto; height: 120px; object-fit: cover; }

.gallery-thumb-fallback { display: none; }

.btn-action { transition: transform 0.15s, opacity 0.2s; }
.btn-action:active { transform: scale(0.96); }

.gallery-item { cursor: pointer; }
