/* TLDL App Common Styles — shared across authenticated pages */

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-alt: #222;
  --sidebar-bg: #141414;
  --sidebar-width: 240px;
  --text: #e0e0e0;
  --text-muted: #888;
  --primary: #6366f1;
  --primary-dim: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Base */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
h1 { margin-bottom: 0.5rem; font-size: 1.75rem; }
.subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Buttons */
button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  min-height: 44px;
}
button:hover { opacity: 0.9; }
button:active { opacity: 0.8; transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary {
  background: transparent;
  border: 1px solid #444;
  color: var(--text-muted);
}

.btn-edit {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid #444;
  padding: 0.25rem 0.5rem;
  min-height: auto;
  font-size: 0.75rem;
  margin-left: 0.4rem;
  display: inline;
  width: auto;
  margin-top: 0;
  vertical-align: middle;
  transition: all 0.15s ease;
}
.btn-edit:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  opacity: 1;
}
.title-edit-input {
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  color: var(--text);
  font-size: inherit;
  width: 100%;
  font-family: inherit;
}
.title-edit-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3); }

.btn-add {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid #444;
  padding: 0.25rem 0.5rem;
  min-height: auto;
  font-size: 0.75rem;
  margin-right: 0.25rem;
  transition: all 0.15s ease;
}
.btn-add:hover {
  background: var(--success);
  border-color: var(--success);
  color: white;
  opacity: 1;
}

.btn-delete {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid #444;
  padding: 0.25rem 0.5rem;
  min-height: auto;
  font-size: 0.75rem;
  transition: all 0.15s ease;
}
.btn-delete:hover {
  background: var(--error);
  border-color: var(--error);
  color: white;
  opacity: 1;
}

.btn-logout {
  background: transparent;
  border: 1px solid #444;
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  min-height: auto;
}
.btn-logout:hover { border-color: var(--error); color: var(--error); }

.fav-cell { width: 36px; text-align: center; padding-right: 0; vertical-align: top; }
.btn-fav {
  background: transparent;
  border: none;
  color: #555;
  font-size: 1.1rem;
  padding: 0.15rem 0.3rem;
  min-height: auto;
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1;
}
.btn-fav:hover { color: var(--warning); opacity: 1; }
.btn-fav.active { color: var(--warning); }

.actions-cell { width: 80px; text-align: center; white-space: nowrap; vertical-align: top; }

/* Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid #333;
}
th { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
td { word-break: break-word; }

/* Empty state for tables */
.empty-message {
  text-align: center;
  color: var(--text-muted);
}

/* Episode meta */
.episode-meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

/* Article common */
.article-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  margin-top: 0.2rem;
}

/* Status badges */
.status {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.status-pending { background: #333; color: var(--warning); }
.status-summarized { background: #1e3a2f; color: var(--success); }
.status-podcasted { background: #1e293b; color: var(--primary); }
.status-failed { background: #2d1f1f; color: var(--error); }

/* Summary expand */
.summary-row td { padding-top: 0; border-bottom: 1px solid #444; }
.summary-expand summary, .summary-row a {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.summary-expand summary:hover { color: var(--primary); }

/* Summary content (shared by .summary-content and .summary) */
.summary-content,
.summary {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.summary-content h4, .summary h4 { font-size: 0.95rem; color: var(--text); margin: 0.75rem 0 0.35rem; }
.summary-content h4:first-child, .summary h4:first-child { margin-top: 0; }
.summary-content h5, .summary h5 { font-size: 0.9rem; color: var(--text); margin: 0.6rem 0 0.25rem; }
.summary-content ul, .summary ul { margin: 0.4rem 0 0.4rem 1.25rem; }
.summary-content li, .summary li { margin-bottom: 0.2rem; }
.summary-content p, .summary p { margin-bottom: 0.5rem; }
.summary-content p:last-child, .summary p:last-child { margin-bottom: 0; }
.summary-content a, .summary a { color: var(--primary); }
.summary-content code, .summary code { background: #2a2a2a; padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.85em; }
.summary-content strong, .summary strong { color: var(--text); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
.pagination-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.pagination button {
  min-height: 36px;
  padding: 0.5rem 1rem;
}

/* Utility: inline link with muted small text */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.9rem; }
.text-xs { font-size: 0.75rem; }
.link-view-all { color: var(--primary); font-size: 0.9rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.75rem; }
.mt-2 { margin-top: 1rem; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}
.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #2a2a2a;
}
.sidebar-header h1 {
  font-size: 1.25rem;
  white-space: nowrap;
}
.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
  list-style: none;
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}
.sidebar-nav li a:hover {
  background: var(--surface);
  color: var(--text);
}
.sidebar-nav li a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}
.sidebar-nav li a .nav-icon { font-size: 1.1rem; }
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid #2a2a2a;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.sidebar-footer .user-email {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.5rem;
}

/* --- Sidebar overlay for mobile --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* --- Hamburger button --- */
.hamburger {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 101;
  background: var(--surface);
  border: 1px solid #333;
  color: var(--text);
  font-size: 1.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  min-height: auto;
}

/* --- Dashboard main content --- */
.sidebar-layout { display: flex; min-height: 100vh; }
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  min-width: 0;
}
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.main-header h2 { font-size: 1.5rem; }
.main-header .header-actions { display: flex; gap: 0.75rem; align-items: center; }

/* --- Sections (shown/hidden by JS) --- */
.section { display: none; }
.section.active { display: block; }

/* --- Section title --- */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.section-title h2 { margin: 0; font-size: 1.3rem; }

/* --- Config --- */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.config-item label { display: block; color: var(--text-muted); font-size: 0.9rem; }
.config-item input, .config-item select {
  background: var(--bg);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.5rem;
  color: var(--text);
  width: 100%;
  margin-top: 0.25rem;
  font-size: 16px;
}
.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.input-row input,
.input-row select {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.5rem;
  color: var(--text);
  font-family: monospace;
  font-size: 14px;
}
.input-row select {
  font-family: inherit;
}

/* --- RSS Feed Management --- */
.rss-add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.rss-add-form input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 14px;
}
.rss-add-form button { white-space: nowrap; }
#rssAddStatus {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.card h3 { margin: 1.5rem 0 0.75rem; color: var(--text-muted); font-size: 1rem; }
.card h3.mt-0 { margin-top: 0; }

/* Badge */
.badge-new {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  margin-right: 0.4rem;
}
.feed-title { font-weight: 500; }

/* --- Feed Filter --- */
.feed-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.feed-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid #333;
  border-radius: 20px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
  user-select: none;
}
.feed-filter-item:has(input:checked) {
  border-color: var(--primary);
  color: var(--text);
  background: rgba(99, 102, 241, 0.1);
}
.feed-filter-item input {
  accent-color: var(--primary);
  margin: 0;
  cursor: pointer;
}
.feed-filter-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* --- Floating Action Button --- */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
  background: var(--primary);
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: auto;
  padding: 0;
}
.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  text-decoration: none;
}
.fab:active {
  transform: scale(0.95);
}

/* --- Passkey Management --- */
.passkey-list { display: flex; flex-direction: column; gap: 0.625rem; }
.passkey-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid #333; border-radius: 10px;
  padding: 0.875rem 1rem; gap: 1rem;
}
.passkey-info { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.passkey-icon { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; flex-shrink: 0; }
.passkey-icon-fallback { width: 28px; height: 28px; border-radius: 6px; background: #444; flex-shrink: 0; }
.passkey-details { display: flex; flex-direction: column; min-width: 0; }
.passkey-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.passkey-dates { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.passkey-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.passkey-actions button { width: auto; padding: 0.35rem 0.75rem; font-size: 0.8rem; margin-top: 0; border-radius: 6px; }
.btn-passkey-rename { background: transparent; border: 1px solid #444; color: var(--text-muted); }
.btn-passkey-rename:hover { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-passkey-delete { background: transparent; border: 1px solid #444; color: var(--text-muted); }
.btn-passkey-delete:hover { border-color: var(--error); color: var(--error); background: transparent; }

/* --- Mobile article card layout (shared by dashboard and articles-page) --- */
@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }
  .card { padding: 1rem; }
  th, td { padding: 0.5rem; font-size: 0.875rem; }

  /* Sidebar responsive */
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .hamburger {
    display: block;
  }
  .sidebar-header {
    padding-left: 3.5rem;
  }
  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: 3.5rem;
  }
  .main-header h2 { font-size: 1.2rem; }
  .card { border-radius: 8px; }
  .config-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .input-row { flex-direction: column; align-items: stretch; }
  .input-row input, .input-row select { font-size: 12px; }
  button { padding: 0.75rem 1.25rem; }
  .rss-add-form { flex-direction: column; }
  .rss-add-form button { width: 100%; }
  .fab { bottom: 1.5rem; right: 1.5rem; }

  /* Article table → card layout */
  .article-table-cards .table-container { overflow-x: visible; }
  .article-table-cards table,
  .article-table-cards thead,
  .article-table-cards tbody,
  .article-table-cards th { display: block; width: 100%; }
  .article-table-cards thead { display: none; }
  .article-table-cards table { min-width: 0; }
  .article-table-cards tr[data-article-id]:not(.summary-row) {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 0.15rem 0.5rem;
    align-items: start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #333;
  }
  .article-table-cards tr[data-article-id]:not(.summary-row) td { display: block; border-bottom: none; padding: 0; }
  .article-table-cards tr[data-article-id]:not(.summary-row) td.fav-cell {
    grid-column: 1; width: auto;
  }
  .article-table-cards tr[data-article-id]:not(.summary-row) td:nth-child(2) {
    grid-column: 2; font-size: 0.95rem; line-height: 1.4;
  }
  .article-table-cards tr[data-article-id]:not(.summary-row) td:nth-child(2) .article-title a {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .article-table-cards tr[data-article-id]:not(.summary-row) td.actions-cell {
    grid-column: 3; width: auto; text-align: right;
  }
  .article-table-cards .btn-edit { display: none; }
  .article-table-cards tr.summary-row { display: block; border-bottom: 1px solid #444; }
  .article-table-cards tr.summary-row td { display: block; padding: 0 0 0.75rem 0; border-bottom: none; }

  /* Episode table → card layout */
  .episode-table-cards .table-container { overflow-x: visible; }
  .episode-table-cards table,
  .episode-table-cards thead,
  .episode-table-cards tbody,
  .episode-table-cards th { display: block; width: 100%; }
  .episode-table-cards thead { display: none; }
  .episode-table-cards table { min-width: 0; }
  .episode-table-cards tr[data-episode-id] {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 0.15rem 0.5rem;
    align-items: start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #333;
  }
  .episode-table-cards tr[data-episode-id] td { display: block; border-bottom: none; padding: 0; }
  .episode-table-cards tr[data-episode-id] td.fav-cell {
    grid-column: 1; width: auto;
  }
  /* Title + meta */
  .episode-table-cards tr[data-episode-id] td:nth-child(2) {
    grid-column: 2; font-size: 0.95rem; line-height: 1.4;
  }

  /* Favorites article card layout (3-column: fav, title, date) */
  .fav-article-table-cards .table-container { overflow-x: visible; }
  .fav-article-table-cards table,
  .fav-article-table-cards thead,
  .fav-article-table-cards tbody,
  .fav-article-table-cards th { display: block; width: 100%; }
  .fav-article-table-cards thead { display: none; }
  .fav-article-table-cards table { min-width: 0; }
  .fav-article-table-cards tr[data-article-id] {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 0 0.5rem;
    align-items: start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #333;
  }
  .fav-article-table-cards tr[data-article-id] td { display: block; border-bottom: none; padding: 0; }
  .fav-article-table-cards tr[data-article-id] td.fav-cell {
    grid-row: 1; grid-column: 1; width: auto;
  }
  .fav-article-table-cards tr[data-article-id] td:nth-child(2) {
    grid-row: 1; grid-column: 2; font-size: 0.95rem; line-height: 1.4;
  }
  .fav-article-table-cards tr[data-article-id] td.actions-cell {
    grid-column: 3; width: auto; text-align: right;
  }
}

/* --- Desktop table min-width (for sidebar layout) --- */
@media (min-width: 769px) {
  .sidebar-layout table { min-width: 380px; }
  .sidebar-layout .table-container {
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
  }
}

/* --- Standalone page layout (non-sidebar pages) --- */
body.article-table-cards {
  padding: 2rem;
}
@media (max-width: 768px) {
  body.article-table-cards {
    padding: 0.75rem;
  }
  body.article-table-cards .card {
    padding: 0.75rem;
  }
}

body.episode-table-cards {
  padding: 2rem;
}
@media (max-width: 768px) {
  body.episode-table-cards {
    padding: 0.75rem;
  }
  body.episode-table-cards .card {
    padding: 0.75rem;
  }
}

/* --- Transcript page --- */
.transcript-page {
  line-height: 1.8;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  padding-bottom: 5rem;
}
.transcript-page header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #333;
}
.transcript-page h1 { font-size: 1.5rem; }
.transcript-page h2 {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin: 2rem 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.date { color: var(--text-muted); }
/* Floating podcast player */
.floating-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid #333;
  z-index: 1000;
  padding: 0;
}
.player-progress {
  width: 100%;
  height: 4px;
  position: relative;
}
.player-seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #444;
  outline: none;
  margin: 0;
  padding: 0;
  display: block;
  cursor: pointer;
}
.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  margin-top: -5px;
}
.player-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}
.player-seek::-webkit-slider-runnable-track {
  height: 4px;
}
.player-seek::-moz-range-track {
  height: 4px;
  background: #444;
}
.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  max-width: 800px;
  margin: 0 auto;
}
.player-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.player-btn {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.25rem;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}
.player-btn:hover {
  color: var(--primary);
}
.player-btn-play {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 48px;
  height: 48px;
}
.player-btn-play:hover {
  color: #fff;
  opacity: 0.9;
}
.player-btn-skip {
  width: 36px;
  height: 36px;
}
.player-btn-speed {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 3rem;
  text-align: center;
}
.player-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 5rem;
}
.article-card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}
.article-card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.source { color: var(--text-muted); font-size: 0.9rem; }
.script-block {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
  padding-bottom: 6rem;
}
.script-para {
  margin: 0 0 1em 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid transparent;
  border-radius: 4px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
}
.script-para:hover {
  background-color: rgba(255, 255, 255, 0.05);
}
.script-para.active {
  background-color: rgba(59, 130, 246, 0.15);
  border-left-color: var(--primary, #3b82f6);
}
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
}
.transcript-page .btn-fav {
  font-size: 1.4rem;
  vertical-align: middle;
}
.transcript-page .btn-add {
  margin-left: 0.5rem;
  margin-right: 0;
  vertical-align: middle;
  border-radius: 4px;
}
.btn-fav-article {
  background: transparent;
  border: none;
  color: #555;
  font-size: 1.1rem;
  padding: 0.15rem 0.3rem;
  min-height: auto;
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1;
  vertical-align: middle;
  margin-right: 0.25rem;
}
.btn-fav-article:hover { color: var(--warning); }
.btn-fav-article.active { color: var(--warning); }

/* --- Login/Signup page styles (scoped to .centered) --- */
:root {
  --primary-hover: #818cf8;
  --success-bg: #14532d;
  --error-bg: #7f1d1d;
}

html, body {
  height: 100%;
}

.centered {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}

.container {
  width: 100%;
  max-width: 400px;
}

.centered .tagline {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.centered h1 {
  font-size: 2rem;
}

.centered .card {
  border-radius: 16px;
}

/* Forms (scoped to .centered for login/signup pages) */
.centered label {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-align: left;
}

.centered input[type="text"],
.centered input[type="url"],
.centered input[type="email"],
.centered input[type="password"],
.centered select {
  width: 100%;
  background: var(--bg);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 1rem;
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s;
}

.centered input:focus,
.centered select:focus {
  outline: none;
  border-color: var(--primary);
}

.centered input::placeholder {
  color: var(--text-muted);
}

/* Buttons scoped to .centered (login/signup pages) */
.centered button,
.centered .btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  transition: background-color 0.2s, transform 0.1s;
  text-decoration: none;
  display: block;
  text-align: center;
}

.centered button:hover,
.centered .btn:hover {
  background: var(--primary-hover);
}

.centered button:active,
.centered .btn:active {
  transform: scale(0.98);
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: 500;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
}

/* Links */
.links {
  text-align: center;
  margin-top: 1.5rem;
}

.links a,
.help a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
}

.links a:hover,
.help a:hover {
  text-decoration: underline;
}

.help {
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Error message */
.error {
  background: var(--error-bg);
  color: var(--error);
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Credentials display */
.credentials {
  background: var(--bg);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
  text-align: left;
}

.credentials label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.credentials code {
  display: block;
  background: #333;
  padding: 0.5rem;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.85rem;
  word-break: break-all;
  margin-bottom: 0.75rem;
}

.credentials code:last-child {
  margin-bottom: 0;
}

/* Divider with centered label */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.25rem 0;
  gap: 0.75rem;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #333;
}

/* Secondary (outline) button variant for centered pages */
.centered .btn-secondary {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.centered .btn-secondary:hover {
  background: var(--primary);
  color: white;
}

.warning {
  background: #422006;
  color: var(--warning);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

/* Tags */
.article-tags, .episode-tags {
  margin-top: 0.4rem;
}

.tags-toggle {
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  list-style: none;
}

.tags-toggle::-webkit-details-marker {
  display: none;
}

.tags-toggle::before {
  content: '▸ ';
}

[open] > .tags-toggle::before {
  content: '▾ ';
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

a.tag, .tag {
  background: var(--surface);
  border: 1px solid #444;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  white-space: nowrap;
  text-decoration: none;
}

a.tag:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.link-clear-filter {
  color: var(--primary);
  font-size: 0.85rem;
}

/* --- Add page --- */
.centered h1 { text-align: center; margin-bottom: 2rem; }
.centered .alert { transition: opacity 0.3s ease; }
.centered button:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- Status indicator classes --- */
.status-ok { color: #10b981; }
.status-warn { color: #f59e0b; }

/* --- Banner notification --- */
.banner { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.banner-warn { background: #fef3c7; color: #78350f; border: 1px solid #fcd34d; }
.banner a { color: inherit; font-weight: 600; }

/* --- Notifications bell + panel --- */
.notifications-wrap { position: relative; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 1.25rem; position: relative; }
.badge { position: absolute; top: -4px; right: -6px; background: #ef4444; color: #fff; font-size: 0.7rem; border-radius: 999px; padding: 0 6px; min-width: 16px; text-align: center; }
.notif-panel { position: fixed; left: 0.75rem; bottom: 120px; width: 320px; max-width: calc(100vw - 1.5rem); max-height: 60vh; overflow-y: auto; background: var(--surface, #1a1a1a); color: var(--text, #e0e0e0); border: 1px solid var(--border, #333); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 101; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border, #333); }
.notif-item { list-style: none; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border, #333); }
.notif-item.read { opacity: 0.6; }
.notif-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: #6b7280; margin-top: 0.25rem; }
.notif-empty { list-style: none; padding: 1rem; color: #6b7280; text-align: center; }
.notif-error .notif-msg { color: #b91c1c; }
.notif-warning .notif-msg { color: #92400e; }

.job-runs-area { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border, #333); display: flex; flex-direction: column; gap: 0.35rem; }
.job-run { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text, #e0e0e0); }
.job-run-running { color: #2563eb; }
.job-run-running .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #2563eb; animation: job-run-pulse 1.2s ease-in-out infinite; }
.job-run-queued { color: #9ca3af; }
@keyframes job-run-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
