/* Hand-maintained styles loaded AFTER the compiled tailwind.css. Self-contained
 * (no framework variables). Holds the things Tailwind can't generate from the
 * templates: class names emitted at runtime by Rust (score-*, badge-*), the
 * D3-injected SVG chart styling, the pagination strip, and the aria-busy spinner. */

:root {
  --ink: #111111;
  --muted: #6b7280;
  --line-soft: #e6e4da; /* subtle row divider */
  --hover: #fbf6d9; /* faint accent tint for row hover */
  --accent: #ffd400;
  --accent-2: #2b6bff;
  --good: #15a34a;
  --mid: #ea7a00;
  --bad: #dc2626;
}

.muted {
  color: var(--muted);
}
.nowrap {
  white-space: nowrap;
}

/* Compact, brutalist data table. Wrap in a .card for the thick outer border. */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.data-table th,
.data-table td {
  padding: 0.3rem 0.5rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line-soft);
}
.data-table thead th {
  border-bottom: 2px solid var(--ink);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}
.data-table tbody tr:hover {
  background: var(--hover);
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table a {
  color: var(--accent-2);
  font-weight: 600;
}
.data-table a:hover {
  text-decoration: underline;
}
.data-table a.score-bad {
  color: var(--bad);
}

/* Score colouring (class chosen in views.rs). */
.score-good {
  color: var(--good);
  font-weight: 700;
}
.score-mid {
  color: var(--mid);
  font-weight: 700;
}
.score-bad {
  color: var(--bad);
  font-weight: 700;
}

/* Anonymity-level badges: square bordered chips. */
.badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border: 1.5px solid var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: #fff;
  white-space: nowrap;
}
.badge-elite {
  background: var(--good);
  color: #fff;
}
.badge-anonymous {
  background: var(--accent-2);
  color: #fff;
}
.badge-transparent {
  background: var(--bad);
  color: #fff;
}
.badge-unknown {
  background: #d4d4d4;
  color: var(--ink);
}

/* Pagination strip below the proxy table. */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.6rem;
}
.pagination button.page-link,
.pagination span.page-link {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.pagination button.page-link:hover:not(:disabled) {
  background: var(--accent);
}
.pagination button.page-link:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination span.page-link.current {
  background: var(--ink);
  color: #fff;
  cursor: default;
}
.pagination .page-gap {
  padding: 0 0.15rem;
  color: var(--muted);
}
.pagination .page-info {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Dashboard charts (D3 builds the <svg> nodes, so this stays plain CSS). */
.charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (min-width: 900px) {
  .charts {
    grid-template-columns: 1fr 1fr;
  }
}
.charts article {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--ink);
  background: #fff;
  box-shadow: 4px 4px 0 0 var(--ink);
}
.charts article header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.chart {
  width: 100%;
  min-height: 260px;
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
}
.chart .axis text {
  font-size: 0.7rem;
  fill: var(--muted);
}
.chart .axis-label,
.chart .legend text {
  font-size: 0.72rem;
  fill: var(--muted);
}
.chart-empty {
  padding: 2rem 0;
  text-align: center;
}

/* Hover tooltip + crosshair (built by attachHover in charts.js). */
.chart-overlay {
  cursor: crosshair;
}
.chart-guide {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 3 2;
  opacity: 0.55;
}
.chart-dot {
  stroke: #fff;
  stroke-width: 1.5;
}
.chart-tip {
  position: absolute;
  z-index: 50;
  pointer-events: none;
  display: none;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 0 var(--ink);
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: nowrap;
}
.chart-tip .tip-time {
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.chart-tip .tip-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.chart-tip .tip-swatch {
  width: 9px;
  height: 9px;
  display: inline-block;
}

/* Spinner for aria-busy elements (Pico used to supply this). Covers the htmx
 * indicators, the table "Loading…" placeholder, and the "detecting…" row state.
 * htmx toggles .htmx-indicator opacity, so the indicators stay hidden until a
 * request is in flight. */
[aria-busy="true"]::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.4em;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
