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

/* ── 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-year    { width: 62px; }
.playlist-table .col-title   { width: auto; }
.playlist-table .col-speaker { width: 200px; }
.playlist-table .col-subject { width: 160px; }
.playlist-table .col-venue   { width: 180px; }
.playlist-table .col-dur     { width: 72px; }

/* 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.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);
}

/* 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);
  padding-left: 14px;
}

.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;
}

/* Speaker */
.playlist-table td.col-speaker {
  font-style: italic;
}

/* Subject tag */
.playlist-table td.col-subject {
  padding: 0 14px;
}

.pt-tag {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  background: var(--paper-mid);
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Venue */
.playlist-table td.col-venue {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Duration */
.playlist-table td.col-dur {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  text-align: right;
}

/* ── 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);
}

/* ── Unavailable toast ─────────────────────────────────────── */
.pt-unavail-toast {
  position: fixed;
  bottom: calc(var(--player-bar-h, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--paper-warm);
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 20px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 250;
  white-space: nowrap;
}

.pt-unavail-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Speed control in player bar ──────────────────────────── */
.at-player__speed {
  display: flex;
  align-items: center;
  gap: 0;
  border-left: 1px solid var(--player-rule);
  padding-left: 14px;
}

.at-player__speed-btn {
  background: none;
  border: none;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--player-muted);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.at-player__speed-btn:hover  { color: var(--player-text); background: rgba(255,255,255,0.06); }
.at-player__speed-btn.active { color: var(--player-gold); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 960px) {
  .playlist-table .col-venue  { display: none; }
  .playlist-table .col-subject { width: 130px; }
}

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

  .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-dur     { display: none; }
  .playlist-table .col-year    { width: 50px; }
}
