/* ============================================================
   SpotDL Web – Stylesheet
   Modern dark theme, responsive layout
   ============================================================ */

:root {
  --bg: #0f1117;
  --bg-2: #1a1d27;
  --bg-3: #21253a;
  --border: #2e3250;
  --primary: #1db954;
  --primary-dk: #17a349;
  --danger: #e74c3c;
  --warning: #f39c12;
  --text: #e8eaf0;
  --text-muted: #8892b0;
  --text-dim: #555d80;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Fira Mono", monospace;
}

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

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

/* ─── Utilities ─────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.page {
  min-height: 100vh;
  display: flex;
}

/* ─── Login ─────────────────────────────────────────────────── */
#page-login {
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    ellipse at 50% 0%,
    #1c2a4a 0%,
    var(--bg) 60%
  );
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  text-align: center;
}

.login-card .logo {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.login-card h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, var(--primary), #4af28a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

/* ─── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ─── Fields ─────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  text-align: left;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field small {
  font-size: 0.78rem;
  color: var(--text-dim);
}

input[type="text"],
input[type="password"],
input[type="url"],
select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
  width: 100%;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.18);
}

select {
  cursor: pointer;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  transition:
    background 0.18s,
    opacity 0.18s,
    transform 0.1s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #000;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dk);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(231, 76, 60, 0.1);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-full {
  width: 100%;
}
.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
}

/* ─── Error messages ─────────────────────────────────────────── */
.error-msg {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.4);
  border-radius: var(--radius-sm);
  color: #f08080;
  font-size: 0.88rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
}

/* ─── App Layout ─────────────────────────────────────────────── */
#page-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}

.sidebar-logo {
  font-weight: 700;
  font-size: 1.15rem;
  padding: 0 1.5rem 1.5rem;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.75rem;
}

.nav-item {
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.65rem 0.9rem;
  text-align: left;
  transition:
    background 0.15s,
    color 0.15s;
  width: 100%;
}

.nav-item:hover {
  background: var(--bg-3);
  color: var(--text);
}
.nav-item.active {
  background: rgba(29, 185, 84, 0.12);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  font-size: 1rem;
}

.sidebar-footer {
  padding: 0 0.75rem;
  margin-top: auto;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
}

/* ─── Views ──────────────────────────────────────────────────── */
.view {
  display: none;
}
.view.active {
  display: block;
}

.view-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.view-header .view-title {
  margin-bottom: 0;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1.5rem 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}

/* ─── Download card ──────────────────────────────────────────── */
.download-card {
  padding: 1.75rem;
}

/* ─── Log box ────────────────────────────────────────────────── */
.log-box {
  background: #0a0c14;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #b0ffb8;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  max-height: 320px;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-box:empty::before {
  content: "Warte auf Ausgabe…";
  color: var(--text-dim);
}

/* ─── Job card ───────────────────────────────────────────────── */
.job-card {
  padding: 1.25rem;
}

.job-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.job-url {
  color: var(--text-muted);
  font-size: 0.82rem;
  word-break: break-all;
  flex: 1;
}

.badge {
  border-radius: 99px;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.badge-running {
  background: rgba(243, 156, 18, 0.15);
  color: var(--warning);
}
.badge-done {
  background: rgba(29, 185, 84, 0.15);
  color: var(--primary);
}
.badge-error {
  background: rgba(231, 76, 60, 0.15);
  color: var(--danger);
}
.badge-queued {
  background: rgba(136, 146, 176, 0.1);
  color: var(--text-muted);
}

/* ─── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.breadcrumb button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}
.breadcrumb button:hover {
  text-decoration: underline;
}
.breadcrumb .sep {
  color: var(--text-dim);
}

/* ─── Files list ─────────────────────────────────────────────── */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.file-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s;
}

.file-item:hover {
  border-color: var(--text-dim);
}

.file-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.file-name {
  flex: 1;
  font-size: 0.9rem;
  word-break: break-word;
}
.file-size {
  color: var(--text-dim);
  font-size: 0.78rem;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  gap: 0.5rem;
}

/* ─── Jobs history ───────────────────────────────────────────── */
#jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.job-row {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.job-row-url {
  font-size: 0.88rem;
  word-break: break-all;
}
.job-row-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

/* ─── Empty state ─────────────────────────────────────────────── */
.empty-state {
  color: var(--text-dim);
  font-size: 0.92rem;
  text-align: center;
  padding: 3rem 1rem;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar {
    width: 56px;
    min-width: 56px;
  }
  .sidebar-logo,
  .nav-item span:last-child,
  .sidebar-footer .btn {
    display: none;
  }
  .nav-item {
    justify-content: center;
  }
  .main-content {
    padding: 1.25rem;
  }
  .row {
    grid-template-columns: 1fr;
  }
}
