/* ESBvaktin Speeches Tracker — Styles
 *
 * Prefix: st-* (speeches-tracker)
 * Reuses ct-* shared control classes from discourse-tracker.css pattern.
 * Uses global CSS custom properties from style.css.
 */

/* ── Layout ──────────────────────────────────────────────────────── */

#speeches-tracker {
  padding: 1rem;
  font-family: var(--font);
  color: var(--text);
}

/* ── Stats ───────────────────────────────────────────────────────── */

.st-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.ct-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  text-align: center;
  min-width: 70px;
}

.ct-stat-num {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
}

.ct-stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.ct-stat-loading {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.5rem;
}

/* ── Controls ────────────────────────────────────────────────────── */

.ct-controls {
  margin-bottom: 1.25rem;
}

.ct-search-wrap {
  margin-bottom: 0.75rem;
}

.ct-search {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color var(--transition);
}

.ct-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.ct-filter-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ct-select {
  flex: 1;
  min-width: 120px;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.ct-loading,
.ct-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

/* ── Speaker filter banner ───────────────────────────────────────── */

.st-speaker-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.st-clear-speaker {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background var(--transition);
}

.st-clear-speaker:hover {
  background: var(--bg-alt);
}

/* ── Results ─────────────────────────────────────────────────────── */

.st-results {
  margin-top: 0.5rem;
}

/* ── Grid ────────────────────────────────────────────────────────── */

.st-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

/* ── Group headers ───────────────────────────────────────────────── */

.st-group {
  margin-bottom: 2rem;
}

.st-group-header {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.st-group-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

/* ── Debate card ─────────────────────────────────────────────────── */

.st-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.st-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Stretched link — title link covers the entire card */
.st-card-link {
  color: inherit;
  text-decoration: none;
}

.st-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
}

.st-card-link:hover {
  text-decoration: none;
}

.st-card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.st-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.st-card-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.st-card-meta time {
  white-space: nowrap;
}

/* ── Session badge ───────────────────────────────────────────────── */

.st-session-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── Party pills ─────────────────────────────────────────────────── */

.st-parties {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.st-party-pill {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Party colours */
.party-xd { background: #003897; color: #fff; }
.party-s { background: #e30613; color: #fff; }
.party-b { background: #007a33; color: #fff; }
.party-m { background: #003459; color: #fff; }
.party-c { background: #ff8c00; color: #fff; }
.party-v { background: #00843d; color: #fff; }
.party-p { background: #660099; color: #fff; }
.party-f { background: #ffdd00; color: #1a1a1a; }
.party-hr { background: #009fe3; color: #fff; }
.party-other { background: var(--grey, #6b7280); color: #fff; }

/* ── Speaker pills ───────────────────────────────────────────────── */

.st-speakers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.st-speaker-name {
  white-space: nowrap;
}

.st-speaker-words {
  font-size: 0.65rem;
  opacity: 0.7;
}

/* ── Card footer ─────────────────────────────────────────────────── */

.st-card-footer {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.st-card-stat {
  white-space: nowrap;
}

/* ── Althingi link — sits above the stretched card link ──────────── */

.st-althingi-link {
  position: relative;
  z-index: 1;
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}

.st-althingi-link:hover {
  color: #fff;
  background: var(--accent);
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .st-grid {
    grid-template-columns: 1fr;
  }

  .ct-filter-row {
    flex-direction: column;
  }

  .ct-select {
    min-width: unset;
  }

  .st-card-meta {
    flex-wrap: wrap;
  }

  .st-card-footer {
    flex-wrap: wrap;
  }
}
