:root {
  --bg: #0b1020;
  --card: #141b2f;
  --card-2: #1a2340;
  --text: #e7ecf7;
  --muted: #93a0bd;
  --primary: #7c5cff;
  --primary-2: #a78bfa;
  --accent: #f43f5e;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --border: rgba(255, 255, 255, 0.09);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #2b1b52 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

.hero { display: flex; justify-content: center; margin-bottom: 26px; }
.hero-img {
  width: 100%;
  max-width: 920px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  letter-spacing: 0.3px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; }

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="url"], input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d1426;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.22);
}

.row { display: flex; gap: 10px; }
.row input { flex: 1; }

.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.format-option { cursor: pointer; }
.format-option input { display: none; }
.format-box {
  padding: 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #0d1426;
  transition: border-color 0.15s, background 0.15s;
}
.format-box strong { display: block; margin-bottom: 4px; }
.format-box small { color: var(--muted); line-height: 1.4; }
.format-option input:checked + .format-box {
  border-color: var(--primary);
  background: rgba(124, 92, 255, 0.14);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: #243055;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); opacity: 0.95; }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), #5b3df0);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
}
.btn.danger { background: rgba(239, 68, 68, 0.18); border: 1px solid rgba(239, 68, 68, 0.4); }
.btn.warn { background: rgba(245, 158, 11, 0.16); border: 1px solid rgba(245, 158, 11, 0.4); }
.btn.ok { background: rgba(34, 197, 94, 0.16); border: 1px solid rgba(34, 197, 94, 0.4); }
.btn.big { width: 100%; padding: 14px; font-size: 1.02rem; margin-top: 6px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.82rem;
  cursor: pointer;
}
.chip.active {
  background: rgba(124, 92, 255, 0.2);
  border-color: var(--primary);
  color: var(--text);
}

.job-list { display: flex; flex-direction: column; gap: 14px; }
.empty { color: var(--muted); text-align: center; padding: 26px 10px; }

.job {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.job-thumb {
  width: 110px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  background: #0d1426;
}
.job-main { min-width: 0; }
.job-title {
  font-weight: 650;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-meta {
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.badge.downloading { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
.badge.paused, .badge.interrupted { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.badge.completed { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.badge.failed, .badge.canceled { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.badge.scraping, .badge.queued { background: rgba(167, 139, 250, 0.18); color: #c4b5fd; }

.progress {
  height: 12px;
  border-radius: 999px;
  background: #0d1426;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
}
.progress.done > i { background: linear-gradient(90deg, #16a34a, #4ade80); }

.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 6px 0 10px;
}
.progress-labels .pct { color: var(--text); font-weight: 700; }

.job-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.job-actions .btn { padding: 7px 12px; font-size: 0.82rem; }

.job.error-note {
  border-color: rgba(239, 68, 68, 0.35);
}
.error-text {
  color: #fca5a5;
  font-size: 0.82rem;
  margin: 8px 0 0;
  word-break: break-word;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 30px;
}
footer strong { color: var(--primary-2); }

.cookie-hint {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.88rem;
}
.cookie-hint p { color: var(--muted); margin: 8px 0 10px; line-height: 1.5; }

@media (max-width: 640px) {
  .job { grid-template-columns: 1fr; }
  .job-thumb { width: 100%; height: 150px; }
}
