/* ===== Podcast Suite — Dark Studio Design System ===== */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ───────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:          #0b0b0e;
  --surface:     #141419;
  --surface-2:   #1b1b21;
  --surface-3:   #22222a;
  --surface-hover: rgba(255,255,255,0.04);
  --surface-active: rgba(255,255,255,0.07);

  /* Text */
  --text:        #e2e2e8;
  --text-2:      rgba(226,226,232,0.50);
  --text-3:      rgba(226,226,232,0.28);
  --text-muted:  rgba(226,226,232,0.50);

  /* Borders */
  --border:      rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.13);

  /* Accent */
  --accent:       #5046e5;
  --accent-dark:  #3f36d4;
  --accent-light: rgba(80,70,229,0.14);
  --accent-brand: #1104c5;

  /* Semantic */
  --success:  #22c55e;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;

  /* Aliases */
  --primary: var(--accent);
  --primary-dark: var(--accent-dark);
  --primary-light: var(--accent-light);
  --color-accent: var(--accent);

  /* Sidebar */
  --sidebar-bg:   #08080b;
  --sidebar-text: rgba(255,255,255,0.72);
  --sidebar-muted: rgba(255,255,255,0.32);
  --sidebar-active: rgba(255,255,255,0.08);
  --sidebar-hover:  rgba(255,255,255,0.05);
  --sidebar-sep:    rgba(255,255,255,0.07);

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  --shadow:    0 4px 16px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.07);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  /* Layout */
  --sidebar-w: 212px;
  --topbar-h:  52px;

  /* Fonts */
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --transition: 0.12s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }
code { font-family: var(--font-mono); }

/* ── Typography ──────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.3;
  color: var(--text);
}
.mono { font-family: var(--font-mono); }
.text-muted   { color: var(--text-2); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ── Utility ─────────────────────────────────────────── */
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--sidebar-sep);
}

.sidebar-logo {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--sidebar-sep);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-logo .logo-wave {
  flex-shrink: 0;
}

.sidebar-logo .logo-wave rect {
  fill: var(--accent);
  opacity: 0.85;
}

.logo-wave rect:nth-child(1) { animation: wave 1.4s 0.0s ease-in-out infinite alternate; }
.logo-wave rect:nth-child(2) { animation: wave 1.4s 0.2s ease-in-out infinite alternate; }
.logo-wave rect:nth-child(3) { animation: wave 1.4s 0.1s ease-in-out infinite alternate; }
.logo-wave rect:nth-child(4) { animation: wave 1.4s 0.3s ease-in-out infinite alternate; }
.logo-wave rect:nth-child(5) { animation: wave 1.4s 0.15s ease-in-out infinite alternate; }

@keyframes wave {
  from { transform: scaleY(0.6); transform-origin: center; }
  to   { transform: scaleY(1.0); transform-origin: center; }
}

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.sidebar-logo-sub {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 0 10px;
  margin: 16px 0 6px;
}
.nav-section-label:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item svg { opacity: 0.6; flex-shrink: 0; }
.nav-item:hover  { background: var(--sidebar-hover); color: #fff; }
.nav-item:hover svg { opacity: 0.9; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active svg { opacity: 1; }

.sidebar-bottom {
  flex-shrink: 0;
  padding: 10px 8px 14px;
  border-top: 1px solid var(--sidebar-sep);
}
.sidebar-user {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 9px;
}
.sidebar-user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10.5px;
  color: var(--sidebar-muted);
  text-transform: capitalize;
}

/* ── Main Content ─────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.no-sidebar .main-content { margin-left: 0; }

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(11,11,14,0.85);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.breadcrumb {
  flex: 1;
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { color: var(--text-3); font-size: 11px; }
.breadcrumb-current {
  color: var(--text);
  font-weight: 500;
  font-size: 13.5px;
}

.page-body {
  flex: 1;
  padding: 28px 32px;
}

/* ── Auth Layout ──────────────────────────────────────── */
body.no-sidebar {
  background: var(--bg);
  min-height: 100vh;
}
body.no-sidebar .main-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
body.no-sidebar .page-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-wrap {
  width: 100%;
  max-width: 380px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.auth-logo-text {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.auth-logo-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
}
.auth-card h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.auth-card .auth-sub {
  font-size: 13.5px;
  color: var(--text-2);
  margin-bottom: 28px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Alerts ───────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13.5px;
  border-left: 2px solid var(--accent);
  background: var(--accent-light);
  color: var(--text);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 16px;
}
.alert-success { border-color: var(--success); background: rgba(34,197,94,0.08); }
.alert-error, .alert-danger { border-color: var(--danger); background: rgba(239,68,68,0.08); }
.alert-warning { border-color: var(--warning); background: rgba(245,158,11,0.08); }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label, .form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.form-control, .form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface-2);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-control::placeholder, .form-input::placeholder { color: var(--text-3); }
.form-hint  { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }

/* File input */
.file-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
  background: var(--surface-2);
}
.file-drop:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.file-drop-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
  color: var(--text-2);
}
.file-drop-label {
  font-size: 13.5px;
  color: var(--text-2);
}
.file-drop-label strong { color: var(--accent); }
.file-drop-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
  font-family: var(--font-mono);
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  font-family: var(--font-body);
  text-decoration: none;
  letter-spacing: -0.1px;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary  {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { filter: brightness(0.9); }

.btn-sm  { padding: 5px 11px; font-size: 12.5px; }
.btn-lg  { padding: 10px 20px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}
.card-body  { padding: 18px; }

/* ── Page header ──────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.page-subtitle { font-size: 13.5px; color: var(--text-2); }
.page-actions  { display: flex; gap: 8px; align-items: center; }

/* ── Tables ───────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table thead tr { border-bottom: 1px solid var(--border-strong); }
.table th {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  font-family: var(--font-body);
}
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-2);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover td { background: var(--surface-hover); }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.badge-primary, .badge-info    { background: var(--accent-light); color: #8b82f8; }
.badge-success, .badge-done    { background: rgba(34,197,94,0.10); color: #4ade80; }
.badge-warning, .badge-orange  { background: rgba(245,158,11,0.12); color: #fbbf24; }
.badge-danger,  .badge-error,
.badge-red                     { background: rgba(239,68,68,0.10); color: #f87171; }
.badge-secondary, .badge-muted,
.badge-gray, .badge-pending    { background: var(--surface-3); color: var(--text-2); }
.badge-recorded                { background: rgba(59,130,246,0.10); color: #60a5fa; }
.badge-running                 {
  background: var(--accent-light);
  color: #8b82f8;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── Progress ─────────────────────────────────────────── */
.progress {
  height: 3px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #8b82f8 100%);
  border-radius: 99px;
  transition: width 0.4s ease;
  position: relative;
}
.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  animation: shimmer 1.5s ease-in-out infinite;
  background-size: 200% 100%;
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Job Item ─────────────────────────────────────────── */
.job-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.job-item:last-child { border-bottom: none; padding-bottom: 0; }
.job-item:first-child { padding-top: 0; }
.job-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.job-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.job-log {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.job-log div::before {
  content: '› ';
  color: var(--accent);
  opacity: 0.7;
}

.job-error {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--danger);
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(239,68,68,0.07);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--danger);
}

/* ── Output Item ──────────────────────────────────────── */
.output-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.output-item:last-child { border-bottom: none; padding-bottom: 0; }
.output-item:first-child { padding-top: 0; }
.output-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.output-pushed {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--success);
}
.output-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Episode meta strip ───────────────────────────────── */
.ep-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.ep-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-2);
}
.ep-meta-item svg { opacity: 0.5; }

/* ── Section label ────────────────────────────────────── */
.section-label {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Grid ─────────────────────────────────────────────── */
.grid   { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
@media (max-width:960px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width:900px) { .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width:600px) { .grid-3 { grid-template-columns: 1fr; } }

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-3);
}
.empty-state-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  color: var(--text-3);
}
.empty-state p { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.empty-state small { font-size: 12.5px; color: var(--text-3); }
