/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0d0f14;
  --surface:      #161b24;
  --surface-2:    #1e2533;
  --border:       #2a3347;
  --border-light: #3a4560;
  --text:         #e8ecf4;
  --text-muted:   #7a899e;
  --text-dim:     #4a5568;
  --accent:       #6366f1;
  --accent-hover: #818cf8;
  --accent-glow:  rgba(99,102,241,0.25);
  --green:        #22c55e;
  --yellow:       #f59e0b;
  --red:          #ef4444;
  --radius:       10px;
  --radius-sm:    6px;
  --sidebar-w:    220px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Space Grotesk', sans-serif; font-size: 15px; line-height: 1.5; }

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

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}
.logo-icon { font-size: 22px; filter: brightness(0) saturate(100%) invert(50%) sepia(90%) saturate(600%) hue-rotate(210deg); }
.logo-text { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent-hover); }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer { margin-top: auto; }
.badge-beta {
  display: inline-block;
  background: var(--accent-glow);
  color: var(--accent-hover);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 100px;
  border: 1px solid var(--accent);
}

/* ─── Main ─── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ─── Page Header ─── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 3px; }

/* ─── Submit Card ─── */
.submit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.submit-form {}
.input-row { display: flex; gap: 12px; }
.input-wrap { position: relative; flex: 1; }
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.url-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  padding: 12px 14px 12px 44px;
  outline: none;
  transition: border-color 0.15s;
}
.url-input:focus { border-color: var(--accent); }
.url-input::placeholder { color: var(--text-dim); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-spinner { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.submit-hint { color: var(--text-dim); font-size: 12px; margin-top: 10px; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 10px; padding: 10px 14px; background: rgba(239,68,68,0.1); border-radius: var(--radius-sm); border: 1px solid rgba(239,68,68,0.2); }

/* ─── Section Header ─── */
.section-header { display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: 16px; font-weight: 600; color: var(--text); }
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--border-light); color: var(--text); }

/* ─── Jobs List ─── */
.jobs-list { display: flex; flex-direction: column; gap: 10px; }
.loading-state, .empty-state { color: var(--text-muted); font-size: 14px; padding: 20px 0; text-align: center; }

.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.job-card:hover { border-color: var(--border-light); background: var(--surface-2); }
.job-card.selected { border-color: var(--accent); background: var(--accent-glow); }

.job-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.job-status.pending, .job-status.processing { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); animation: pulse 1.5s infinite; }
.job-status.done { background: var(--green); }
.job-status.failed { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.job-info { flex: 1; min-width: 0; }
.job-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-url { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'DM Mono', monospace; }
.job-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.job-clip-count { font-size: 12px; color: var(--text-muted); }
.job-time { font-size: 12px; color: var(--text-dim); }
.status-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
}
.status-label.pending, .status-label.processing { background: rgba(245,158,11,0.15); color: var(--yellow); }
.status-label.done { background: rgba(34,197,94,0.15); color: var(--green); }
.status-label.failed { background: rgba(239,68,68,0.15); color: var(--red); }

/* ─── Clips Panel ─── */
.clips-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.clips-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.clips-title { font-size: 18px; font-weight: 600; }
.clips-meta { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.clips-list { display: flex; flex-direction: column; gap: 12px; }

.clip-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.clip-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.clip-timestamps {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--accent-hover);
  background: var(--accent-glow);
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--accent);
  flex-shrink: 0;
}
.clip-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.score-bar {
  height: 4px;
  width: 60px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.score-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 2px; }

.clip-caption { font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.clip-reason { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

.clip-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.clip-tag {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
}

.clip-actions { display: flex; gap: 8px; }
.btn-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent-hover); }
.btn-yt-link {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-yt-link:hover { border-color: var(--red); color: #ff6b6b; }

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

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 20px 16px; }
  .input-row { flex-direction: column; }
  .btn-primary { width: 100%; justify-content: center; }
}
