/* ============================================================
   Archive Trust — playlist.css
   Searchable playlist / sample recordings table
   ============================================================ */

/* ── Continue listening banner ────────────────────── */
.at-continue-banner {
  margin-bottom: 20px;
  border: 1px solid var(--gold);
  background: rgba(139, 105, 20, 0.04);
  transition: opacity 0.3s;
}

.at-continue-banner__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
}

.at-continue-banner__icon {
  width: 28px;
  height: 28px;
  color: var(--gold);
  flex-shrink: 0;
}

.at-continue-banner__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.at-continue-banner__label {
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.at-continue-banner__title {
  font-family: var(--ff-serif);
  font-size: 1rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.at-continue-banner__meta {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.at-continue-banner__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.at-continue-banner__time {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  white-space: nowrap;
}

.at-continue-banner__btn {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--gold);
  color: var(--paper);
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.at-continue-banner__btn:hover {
  background: var(--gold-light);
}

.at-continue-banner__dismiss {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.at-continue-banner__dismiss:hover { color: var(--ink); }
.at-continue-banner__dismiss svg { width: 14px; height: 14px; display: block; }

@media (max-width: 640px) {
  .at-continue-banner__inner { flex-wrap: wrap; }
  .at-continue-banner__right { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .at-continue-banner__text { min-width: 100%; }
}

/* ── Row resume progress bar ──────────────────────── */
/* Rows with a saved position get a thin gold progress
   line along their bottom edge. CSS-only via custom property. */
.pt-row.pt-has-resume {
  position: relative;
}

.pt-row.pt-has-resume::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: var(--resume-pct, 0%);
  background: var(--gold);
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.2s;
}

.pt-row.pt-has-resume:hover::after {
  opacity: 1;
}

/* ── Playlist section wrapper ─────────────────────────────── */
.playlist-section {
  padding: 80px 0 100px;
  border-top: 1px solid var(--rule);
}

/* ── Controls bar ─────────────────────────────────────────── */
.playlist-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.playlist-controls__left {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.playlist-search {
  width: 100%;
  font-family: var(--ff-body);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-dark);
  padding: 10px 16px 10px 40px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.playlist-search::placeholder { color: var(--ink-muted); font-style: italic; }
.playlist-search:focus { border-color: var(--gold); }

.playlist-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
  display: flex;
}

.playlist-search-icon svg { width: 16px; height: 16px; }

.playlist-controls__filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.playlist-filter {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 1px solid var(--rule-dark);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.18s;
  -webkit-appearance: none;
  appearance: none;
  white-space: nowrap;
}

.playlist-filter:hover { border-color: var(--ink-soft); color: var(--ink-soft); }
.playlist-filter option { font-family: var(--ff-mono); font-size: 0.8rem; }

.playlist-filter--active,
.playlist-filter[data-active="true"] {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(139, 105, 20, 0.06);
}

.playlist-count {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* ── Availability toggle ──────────────────────────────────── */
.playlist-avail-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  cursor: pointer;
  white-space: nowrap;
  padding: 8px 12px;
  border: 1px solid var(--rule-dark);
  transition: all 0.18s;
  user-select: none;
}

.playlist-avail-toggle:hover { border-color: var(--ink-soft); color: var(--ink-soft); }
.playlist-avail-toggle.active { border-color: var(--gold); color: var(--gold); background: rgba(139, 105, 20, 0.06); }

.playlist-avail-toggle__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--rule-dark);
  flex-shrink: 0;
  transition: background 0.15s;
}

.playlist-avail-toggle.active .playlist-avail-toggle__dot { background: var(--gold); }

/* ── Speed control ────────────────────────────────────────── */
.playlist-speed {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--rule-dark);
  padding: 0 4px;
}

.playlist-speed__label {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0 8px 0 10px;
  white-space: nowrap;
}

.speed-btn {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  background: transparent;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 7px 8px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.speed-btn:hover { color: var(--ink); background: var(--paper-mid); }
.speed-btn.active { color: var(--gold); font-weight: 500; }

/* ── Table ────────────────────────────────────────────────── */
.playlist-table-wrap {
  border: 1px solid var(--rule);
  overflow: hidden;
}

.playlist-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Column widths */
.playlist-table .col-play     { width: 52px; }
.playlist-table .col-title    { width: auto; }
.playlist-table .col-speaker  { width: 280px; }
.playlist-table .col-venue    { width: 380px; }
.playlist-table .col-year     { width: 80px; }
.playlist-table .col-bookmark { width: 44px; }

/* Header row */
.playlist-table thead tr {
  background: var(--paper-mid);
  border-bottom: 2px solid var(--rule-dark);
}

.playlist-table th {
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: left;
  padding: 12px 14px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
  position: relative;
}

.playlist-table th:hover { color: var(--ink); }
.playlist-table th.sort-asc,
.playlist-table th.sort-desc { color: var(--gold); }

.playlist-table th[data-sort="year"] { text-align: right; padding-right: 14px; }

.playlist-table th.sort-asc::after  { content: ' ↑'; }
.playlist-table th.sort-desc::after { content: ' ↓'; }

/* Non-sortable header cells */
.playlist-table th.no-sort { cursor: default; }
.playlist-table th.no-sort:hover { color: var(--ink-muted); }

/* Body rows */
.playlist-table tbody tr {
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.12s;
}

.playlist-table tbody tr:last-child { border-bottom: none; }
.playlist-table tbody tr:hover { background: var(--paper-warm); }

/* Currently playing row */
.playlist-table tbody tr.pt-playing {
  background: rgba(139, 105, 20, 0.07);
}

.playlist-table tbody tr.pt-playing td.col-title { color: var(--gold); }

/* Unavailable row (no src URL) */
.playlist-table tbody tr.pt-unavailable {
  cursor: default;
  opacity: 0.45;
}

.playlist-table tbody tr.pt-unavailable:hover {
  background: transparent;
}

.playlist-table tbody tr.pt-unavailable .pt-play-btn {
  cursor: default;
  opacity: 0.4;
}

.playlist-table tbody tr.pt-unavailable .pt-play-btn:hover {
  background: transparent;
  color: var(--ink-muted);
  border-color: var(--rule-dark);
}

.playlist-table tbody tr.pt-unavailable .at-bookmark-btn {
  display: none;
}

/* Availability dot indicator */
.pt-avail-dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 7px;
  vertical-align: middle;
  flex-shrink: 0;
}

.pt-unavailable .pt-avail-dot { display: none; }

/* Cells */
.playlist-table td {
  padding: 13px 14px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Play button cell */
.playlist-table td.col-play {
  padding: 0 0 0 14px;
}

.pt-play-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--rule-dark);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.pt-play-btn svg { width: 9px; height: 10px; flex-shrink: 0; }

tr:not(.pt-unavailable):hover .pt-play-btn,
.pt-play-btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

tr.pt-playing .pt-play-btn {
  background: var(--gold);
  color: var(--paper);
  border-color: var(--gold);
}

/* Year */
.playlist-table td.col-year {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-align: right;
  padding-right: 14px;
  overflow: visible;
  white-space: nowrap;
}

.pt-unavailable td.col-year { color: var(--ink-muted); }

/* Title */
.playlist-table td.col-title {
  color: var(--ink);
  font-family: var(--ff-serif);
  font-size: 0.95rem;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

/* Bookmark column header — no sort indicator, no border artifact */
.playlist-table th[aria-label="Bookmark"] {
  padding: 0;
  border: none;
}

/* Bookmark cell */
.playlist-table td.col-bookmark {
  padding: 0 6px 0 0;
  text-align: right;
  vertical-align: middle;
  overflow: visible;
}

/* Star / bookmark button — in the playlist table */
.playlist-table .at-bookmark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rule-dark);
  border-radius: 2px;
  transition: color 0.15s, opacity 0.15s;
  opacity: 0;
  padding: 0;
  transform: none;
}

/* Show star when row is hovered or bookmarked */
tr:hover .at-bookmark-btn,
.at-bookmark-btn.bookmarked {
  opacity: 1;
}

.playlist-table .at-bookmark-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
}

.playlist-table .at-bookmark-btn:hover {
  color: var(--gold);
  transform: none;
}

.playlist-table .at-bookmark-btn.bookmarked {
  color: var(--gold);
}

.playlist-table .at-bookmark-btn.bookmarked svg {
  fill: var(--gold);
}

/* Speaker */
.playlist-table td.col-speaker {
  font-style: italic;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

/* Subject — removed */

/* Venue */
.playlist-table td.col-venue {
  font-size: 0.8rem;
  color: var(--ink-muted);
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

/* Duration — removed */

/* ── Pagination ────────────────────────────────────────────── */
.playlist-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.pg-btn {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 7px 12px;
  border: 1px solid var(--rule-dark);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 36px;
  text-align: center;
}

.pg-btn:hover { border-color: var(--ink-soft); color: var(--ink-soft); }
.pg-btn.active { border-color: var(--gold); color: var(--gold); background: rgba(139, 105, 20, 0.06); }
.pg-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }

.pg-ellipsis {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: var(--ink-muted);
  padding: 7px 4px;
}

/* ── Empty state ───────────────────────────────────────────── */
.playlist-empty {
  padding: 48px 24px;
  text-align: center;
  border-bottom: none;
}

.playlist-empty__icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

.playlist-empty__text {
  font-family: var(--ff-serif);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--ink-muted);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .playlist-table .col-venue  { width: 260px; }
  .playlist-table .col-speaker { width: 220px; }
}

@media (max-width: 960px) {
  .playlist-table .col-venue  { width: 200px; }
}

@media (max-width: 760px) {
  .playlist-table .col-venue  { display: none; }
  .playlist-table .col-speaker { width: 180px; }

  .playlist-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .playlist-count { margin-left: 0; }
  .playlist-speed { align-self: flex-start; }
}

@media (max-width: 520px) {
  .playlist-table .col-speaker { display: none; }
  .playlist-table .col-year    { width: 50px; }
}

/* ── Mobile (≤ 480px) ─────────────────────────────────────── */
@media (max-width: 480px) {
  .playlist-section {
    padding: 48px 0 64px;
  }

  /* Controls */
  .playlist-controls {
    gap: 10px;
  }

  .playlist-controls__filters {
    gap: 6px;
  }

  .playlist-filter,
  .playlist-avail-toggle {
    font-size: 0.6rem;
    padding: 7px 10px;
  }

  .playlist-count {
    font-size: 0.6rem;
  }

  /* Speed control: compact on mobile */
  .playlist-speed__label { display: none; }
  .speed-btn { padding: 7px 6px; }

  /* Table: switch to a card-style layout */
  .playlist-table-wrap {
    border: none;
    border-top: 1px solid var(--rule);
  }

  .playlist-table,
  .playlist-table thead,
  .playlist-table tbody,
  .playlist-table th,
  .playlist-table td,
  .playlist-table tr {
    display: block;
    width: 100%;
  }

  /* Hide the header row — labels are implicit on cards */
  .playlist-table thead {
    display: none;
  }

  /* Each row becomes a card */
  .playlist-table tbody tr {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
  }

  .playlist-table tbody tr:last-child {
    border-bottom: none;
  }

  /* Play button cell — fixed width, vertically centred */
  .playlist-table td.col-play {
    display: flex;
    align-items: center;
    padding: 2px 0 0 0;
    flex-shrink: 0;
    width: 36px;
  }

  /* Title cell takes all remaining width */
  .playlist-table td.col-title {
    flex: 1;
    white-space: normal;
    overflow: visible;
    padding: 0;
    font-size: 0.92rem;
    line-height: 1.35;
  }

  /* Year: inline after title, right-aligned */
  .playlist-table td.col-year {
    display: flex;
    align-items: flex-start;
    padding: 2px 0 0 0;
    flex-shrink: 0;
    width: 44px;
    text-align: right;
    font-size: 0.65rem;
    justify-content: flex-end;
  }

  /* Speaker and venue: hidden on smallest screens */
  .playlist-table td.col-speaker,
  .playlist-table td.col-venue,
  .playlist-table td.col-bookmark {
    display: none;
  }

  /* Pagination: smaller buttons */
  .pg-btn {
    padding: 6px 9px;
    font-size: 0.6rem;
    min-width: 30px;
  }
}

/* ── Semantic search results panel ────────────────────────── */

.semantic-results {
  border-top: 1px solid var(--rule);
  padding: 32px 0 40px;
}

.semantic-results__header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
  padding: 0 var(--side-pad, 40px);
}

.semantic-results__label {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.semantic-results__count,
.semantic-results__loading {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.semantic-results__loading::after {
  content: '';
  animation: semantic-dots 1.2s infinite;
}

@keyframes semantic-dots {
  0%   { content: ''; }
  33%  { content: '.'; }
  66%  { content: '..'; }
  100% { content: '...'; }
}

.semantic-results__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--rule);
  margin: 0 var(--side-pad, 40px);
}

.semantic-result {
  padding: 18px 24px;
  background: var(--paper);
  transition: background 0.15s;
}

.semantic-result:hover {
  background: var(--paper-warm);
}

.semantic-result + .semantic-result {
  border-top: 1px solid var(--rule);
}

.semantic-result__meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 12px;
  margin-bottom: 6px;
}

.semantic-result__title {
  font-family: var(--ff-serif);
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.3;
}

.semantic-result__speaker {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
}

.semantic-result__year {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.semantic-result__snippet {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.semantic-result__snippet mark {
  background: rgba(139, 105, 20, 0.15);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 2px;
}

.semantic-result__footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

.semantic-result__timestamp {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.semantic-result__play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: none;
  border: 1px solid var(--rule-dark);
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.semantic-result__play:hover {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.semantic-result__unavailable {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  opacity: 0.6;
}

.pt-unknown {
  color: var(--ink-soft);
  font-style: italic;
}

@media (max-width: 760px) {
  .semantic-results__list,
  .semantic-results__header {
    margin: 0 20px;
  }
  .semantic-result { padding: 14px 16px; }
}
