@import "reddit-index.css";

/* ── Splash palette override ─────────────────────────────── */
/* Remap reddit dark-grey vars to the paperflow navy/maroon system. */

.eval-index {
  /* ── Surfaces ── */
  --bg-canvas: #0c1220;
  --bg-body: rgba(26, 32, 53, 0.5);
  --bg-card: rgba(26, 32, 53, 0.5);
  --bg-hover: rgba(26, 32, 53, 0.8);
  --border-default: #2a3550;

  /* ── Inputs ── */
  --input-bg: #141c2e;
  --input-border: #2a3550;

  /* ── Text ── */
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-link: #e2e8f0;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* ── Accent (maroon) ── */
  --accent: #f47171;
  --accent-bright: #ff8585;
  --accent-dim: rgba(169, 28, 33, 0.12);

  /* ── Findings bar ── */
  --bar-passed: #f47171;
  --bar-bg: #2a3550;

  /* ── Legacy compat (reddit-index.css references) ── */
  --text-mod: #f47171;
  --flair-bg: rgba(169, 28, 33, 0.12);
  --flair-text: #f47171;
}

/* ── Background grid (matches splash) ─────────────────────── */

.eval-index .bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(169, 28, 33, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(169, 28, 33, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
  pointer-events: none;
}

.eval-index .subreddit {
  position: relative;
  z-index: 1;
}

/* ── Site header (matches splash) ─────────────────────────── */

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 16px;
  border-bottom: 1px solid rgba(169, 28, 33, 0.15);
  max-width: 1200px;
  margin: 0 auto;
}

.header-logo {
  font-size: 1.75rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.header-logo span {
  color: #d4393f;
}

.header-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.header-nav a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: #ffffff;
}

.header-nav a.active {
  color: var(--accent);
}

/* ── Page title ───────────────────────────────────────────── */

.breadcrumb {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}

.breadcrumb:hover {
  color: var(--accent);
}

.page-title {
  padding: 2.5rem 0 1.5rem;
}

.page-title h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.page-subtitle code {
  font-size: 0.85rem;
  background: var(--accent-dim);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-primary);
}

/* ── Sidebar ──────────────────────────────────────────────── */

.eval-index .sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
}

.eval-index .sidebar-card-header {
  background: var(--accent-dim);
  border-bottom: 1px solid var(--border-default);
}

/* ── Post cards (root index only) ─────────────────────────── */

.eval-index .post-votebar {
  display: none;
}

.eval-index .post-card {
  padding-left: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  transition: border-color 0.3s, transform 0.3s;
}

.eval-index .post-card:hover {
  border-color: #3d4f6f;
  transform: translateY(-2px);
}

.eval-index .related-list a {
  color: var(--text-link);
  text-decoration: none;
}

.eval-index .related-list a:hover {
  text-decoration: underline;
}

/* ── Filter bar ───────────────────────────────────────────── */

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
  margin-bottom: 12px;
}

.filter-search {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.6rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.filter-search::placeholder {
  color: #4a5568;
}

.filter-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(169, 28, 33, 0.15);
}

#filter-audience {
  max-width: 140px;
}

.filter-select {
  flex: 0 0 auto;
  padding: 0.6rem 2rem 0.6rem 0.75rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px 6px;
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(169, 28, 33, 0.15);
}

.row-count {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── Table ────────────────────────────────────────────────── */

.eval-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-body);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
}

.eval-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.eval-table thead th::after {
  content: "";
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.eval-table thead th.sort-asc::after {
  content: " \25B2";
  color: #e2e8f0;
}

.eval-table thead th.sort-desc::after {
  content: " \25BC";
  color: #e2e8f0;
}

.eval-table tbody tr {
  border-bottom: 1px solid rgba(42, 53, 80, 0.5);
  transition: background 0.15s;
}

.eval-table tbody tr:hover {
  background: var(--bg-hover);
}

.eval-table tbody td {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: top;
}

.eval-table td.col-authors {
  color: var(--text-secondary);
}

.eval-table td a {
  color: var(--text-link);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.eval-table td:first-child a {
  color: #14b8a6;
}

.eval-table td a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ── Badges ───────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

td.col-audience {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* Audience badges — per-group colors */
.badge-ewg  { background: rgba(20,184,166,0.12); color: #14b8a6; border: 1px solid rgba(20,184,166,0.25); }
.badge-lewg { background: rgba(110,168,254,0.12); color: #6ea8fe; border: 1px solid rgba(110,168,254,0.25); }
.badge-cwg  { background: rgba(240,160,80,0.12);  color: #f0a050; border: 1px solid rgba(240,160,80,0.25); }
.badge-lwg  { background: rgba(167,139,250,0.12); color: #a78bfa; border: 1px solid rgba(167,139,250,0.25); }
.badge-sg   { background: rgba(134,239,172,0.12); color: #86efac; border: 1px solid rgba(134,239,172,0.25); }
.badge-wg21 { background: rgba(148,163,184,0.10); color: #94a3b8; border: 1px solid rgba(148,163,184,0.20); }
.badge-unknown { background: rgba(100,116,139,0.10); color: var(--text-muted); border: 1px solid rgba(100,116,139,0.18); }

/* Type badges — per-type colors */
.badge-directional { background: rgba(251,191,36,0.12);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.badge-wording     { background: rgba(139,92,246,0.12);  color: #8b5cf6; border: 1px solid rgba(139,92,246,0.25); }
.badge-proposal    { background: rgba(236,72,153,0.12);  color: #ec4899; border: 1px solid rgba(236,72,153,0.25); }

/* ── Findings mini-bar ────────────────────────────────────── */

.findings-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.findings-bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--bar-bg);
  border-radius: 3px;
  overflow: hidden;
}

.findings-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
}

/* Findings color coding by ratio */
.findings-fill.findings-green  { background: #22c55e; }
.findings-fill.findings-yellow { background: #eab308; }
.findings-fill.findings-red    { background: #ef4444; }

.findings-text {
  font-size: 13px;
  white-space: nowrap;
}

.findings-text.findings-green  { color: #22c55e; }
.findings-text.findings-yellow { color: #eab308; }
.findings-text.findings-red    { color: #ef4444; }

/* ── Pagination (root index) ──────────────────────────────── */

.eval-index .page-link {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  color: var(--text-link);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.eval-index .page-link:hover {
  background: var(--bg-hover);
  border-color: #3d4f6f;
  transform: translateY(-1px);
}

/* ── Footer ───────────────────────────────────────────────── */

.site-footer {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 16px;
  border-top: 1px solid rgba(169, 28, 33, 0.15);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer a {
  color: #d4393f;
  text-decoration: none;
}

/* ── Mobile card breakpoint ───────────────────────────────── */

@media (max-width: 768px) {
  .site-header {
    padding: 1rem 8px;
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .filter-search {
    flex: 1 1 100%;
  }

  .filter-select {
    flex: 1 1 auto;
  }

  .row-count {
    flex: 1 1 100%;
    text-align: center;
  }

  .eval-table thead {
    display: none;
  }

  .eval-table,
  .eval-table tbody,
  .eval-table tr,
  .eval-table td {
    display: block;
  }

  .eval-table tbody tr {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    margin-bottom: 8px;
    padding: 10px 12px;
  }

  .eval-table tbody td {
    padding: 4px 0;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .eval-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-right: 12px;
    flex-shrink: 0;
  }

  .col-authors,
  .col-type {
    display: none;
  }
}
