/* Hubcapp — dark theme, light text, accent green */
:root {
  --bg: #0f0f10;
  --panel: #1a1b1e;
  --text: #e8e8e8;
  --muted: #8a8d93;
  --accent: #1db954;
  --border: #2a2b30;
  --row-missing: #3a2a2a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

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

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #141516;
}
.logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}
.logo:hover {
  text-decoration: none;
  opacity: 0.92;
}
.logo-img {
  display: block;
  height: 2rem;
  width: auto;
  max-width: min(200px, 42vw);
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.25rem;
  align-items: center;
  font-size: 0.95rem;
}
.nav a {
  color: var(--muted);
}
.nav a:hover {
  color: var(--accent);
}
.nav .auth-link {
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  text-decoration: none;
}
.nav .auth-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.site-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.btn,
button.btn {
  display: inline-block;
  background: var(--accent);
  color: #0b0b0c;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: none;
  text-decoration: none;
  font-size: 0.95rem;
}
.btn:hover,
button.btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}
.note.warning {
  background: #2a2520;
  border: 1px solid #5a4a2a;
  color: #e0c8a0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0 0 1rem;
}

.hint,
.note,
.breadcrumbs {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.bpm-fill-bar,
.bpm-scan-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.bpm-fill-bar .hint {
  margin: 0;
}
.breadcrumbs a {
  color: var(--accent);
}
.breadcrumbs a:hover {
  text-decoration: underline;
}

.playlist-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.playlist-list li a {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
}
.playlist-list li a:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.pname {
  font-weight: 500;
}
.pmeta {
  color: var(--muted);
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th,
td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tr:last-child td {
  border-bottom: none;
}
tr.row-missing {
  background: var(--row-missing);
  opacity: 0.9;
}
tr.row-missing td {
  color: #c0c0c0;
}
tr.row-manual-bpm .cell-bpm {
  color: var(--accent);
  font-weight: 500;
}
.cell-bpm {
  cursor: pointer;
  outline: none;
}
.cell-bpm:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
  border-radius: 4px;
}
.cell-bpm-input {
  width: 4.25rem;
  box-sizing: border-box;
  padding: 0.2rem 0.35rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
}

.error-box {
  text-align: center;
  padding: 2rem 1rem;
}
.error-box p {
  color: var(--muted);
}

/* Configurator */
.config-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.config-row label {
  font-weight: 500;
  white-space: nowrap;
}
select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.95rem;
}
select:focus {
  outline: none;
  border-color: var(--accent);
}
.num-hours-input {
  width: 5rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.95rem;
}
.num-hours-input:focus {
  outline: none;
  border-color: var(--accent);
}
.config-row .hint {
  color: var(--muted);
  font-size: 0.85rem;
}
.output-set-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.output-set-section .section-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--accent);
}
.output-set-section .hint {
  margin: 0 0 1rem;
}
.output-set-fields {
  margin-bottom: 0;
}
.hour-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.hour-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--accent);
}
.block-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.field-group label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.playlist-select {
  min-width: 240px;
}
.generate-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #0b0b0c;
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-danger {
  display: inline-block;
  background: transparent;
  border: 1px solid #6b2525;
  color: #e07070;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-danger:hover {
  border-color: #e07070;
  text-decoration: none;
}
.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}
.generate-status {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Result page */
.result-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}
.result-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}
.result-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.result-label {
  font-weight: 600;
}
.result-tracks {
  font-size: 0.85rem;
  color: var(--muted);
}
.result-link {
  font-size: 0.9rem;
  font-weight: 500;
}
.missing-warning {
  color: #e0c8a0;
  background: #2a2520;
  border: 1px solid #5a4a2a;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ── Template bar (load) ─────────────────────────────────────────────────── */
.template-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}
.template-bar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.template-bar select {
  min-width: 220px;
}
.template-bar .btn-secondary {
  white-space: nowrap;
}

/* ── Save template section ───────────────────────────────────────────────── */
.save-template-section {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.save-template-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text);
}
.save-template-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}
.save-template-row input[type="text"] {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
}
.save-template-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}
.save-template-row .btn-secondary {
  white-space: nowrap;
}
#save-template-status {
  margin-top: 0.5rem;
  font-size: 0.87rem;
  color: var(--accent);
}

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.dashboard-section {
  margin-bottom: 2.5rem;
}
.dashboard-section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.schedule-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: flex-end;
}
.schedule-form .field-group {
  min-width: 150px;
}
.time-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.time-sep {
  color: var(--muted);
  font-weight: 600;
}
.schedule-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.schedule-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
}
.schedule-paused {
  opacity: 0.55;
}
.schedule-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.schedule-name {
  font-weight: 600;
  font-size: 0.97rem;
}
.schedule-time {
  font-size: 0.85rem;
  color: var(--accent);
}
.schedule-last {
  font-size: 0.8rem;
  color: var(--muted);
}
.badge-paused {
  font-size: 0.75rem;
  background: #2a2520;
  color: #e0c8a0;
  border: 1px solid #5a4a2a;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  width: fit-content;
}
.schedule-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Logs table ──────────────────────────────────────────────────────────── */
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.log-table th,
.log-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.log-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 500;
}
.log-table tr:last-child td {
  border-bottom: none;
}
.log-status-success { color: var(--accent); font-weight: 500; }
.log-status-failed  { color: #e07070; font-weight: 500; }
.log-error {
  cursor: help;
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 0.3rem;
}
.log-pl-link {
  display: block;
  font-size: 0.85rem;
  color: var(--accent);
}

.result-dedup {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 0.6rem;
}
.result-dedup-clean {
  color: var(--accent);
}

/* Background generate progress panel */
.generate-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  margin: 1.2rem 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.progress-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: hubcap-spin 0.9s linear infinite;
  flex: 0 0 auto;
}
.progress-message {
  margin: 0;
  color: var(--text);
}
@keyframes hubcap-spin {
  to { transform: rotate(360deg); }
}
