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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a2e;
  --surface2: #16213e;
  --accent: #e94560;
  --accent-hover: #ff6b81;
  --text: #eee;
  --text-muted: #999;
  --border: #2a2a4a;
  --success: #2ecc71;
  --warning: #f39c12;
  --radius: 8px;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container { max-width: 960px; margin: 0 auto; padding: 24px; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.header h1 { font-size: 24px; font-weight: 700; }
.header h1 span { color: var(--accent); }
.header-actions { display: flex; gap: 8px; }

/* Manifest bar */
.manifest-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.manifest-bar label { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.manifest-bar input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 8px;
  font-size: 13px;
  font-family: monospace;
}
.manifest-bar .copied {
  color: var(--success);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}
.manifest-bar .copied.show { opacity: 1; }

/* Status bar */
.status-bar {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.status-bar span strong { color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* List cards */
.lists-grid { display: flex; flex-direction: column; gap: 12px; }

.list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.15s;
}
.list-card:hover { border-color: var(--accent); }

.list-card-info { flex: 1; }
.list-card-info h3 { font-size: 16px; margin-bottom: 4px; }
.list-card-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 12px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-ai { background: #7c3aed; color: #fff; }
.badge-auto { background: #0ea5e9; color: #fff; }
.badge-manual { background: #f59e0b; color: #000; }
.badge-movie { background: var(--surface2); color: var(--text-muted); }
.badge-series { background: var(--surface2); color: var(--text-muted); }

.list-card-actions { display: flex; gap: 6px; align-items: center; }

/* Toggle switch */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
}
textarea.form-control { resize: vertical; min-height: 80px; font-family: inherit; }
select.form-control { cursor: pointer; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.form-actions { display: flex; gap: 8px; margin-top: 24px; }

/* Mode selector */
.mode-selector { display: flex; gap: 8px; margin-bottom: 16px; }
.mode-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.mode-btn.active { border-color: var(--accent); color: var(--text); background: var(--surface); }
.mode-btn:hover { border-color: var(--accent); }

/* Preview grid */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.preview-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 2/3;
  background: var(--surface2);
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  font-size: 11px;
  line-height: 1.3;
}

/* Search results */
.search-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.search-result:hover { background: var(--surface2); }
.search-result img { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; }
.search-result-info { flex: 1; }
.search-result-info .name { font-size: 14px; }
.search-result-info .meta { font-size: 12px; color: var(--text-muted); }

/* Manual items list */
.manual-items { list-style: none; margin-top: 12px; }
.manual-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.manual-item img { width: 36px; height: 54px; object-fit: cover; border-radius: 4px; }
.manual-item .name { flex: 1; font-size: 14px; }
.manual-item .remove { color: var(--accent); cursor: pointer; font-size: 18px; }

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 360px;
}
.login-box h2 { margin-bottom: 24px; text-align: center; }
.login-error { color: var(--accent); font-size: 13px; margin-top: 8px; display: none; }

/* Genre tags */
.genre-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.genre-tag {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.genre-tag.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Range inputs */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; }

/* Responsive */
@media (max-width: 640px) {
  .form-row { flex-direction: column; }
  .header { flex-direction: column; gap: 12px; }
  .manifest-bar { flex-direction: column; }
}
