/* Table-shaped tool, styled scoped to this page rather than editing the
   shared assets/css/tools.css (other tools are being built in parallel by
   other agents, avoiding shared-file edits keeps this build isolated).
   Reuses the same design tokens (--space-*, --color-*, --radius-*,
   --category-color) defined in assets/css/base.css so it reads as part of
   the same system, not a bolted-on widget. */

.state-compare-card {
  overflow: visible;
}

.state-compare-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-3);
}

.state-compare-controls .form-field {
  flex: 1 1 260px;
  margin-bottom: 0;
}

.state-compare-controls input[type="text"] {
  width: 100%;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--color-bg-card);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
}

.state-compare-controls input[type="text"]:focus {
  border-color: var(--category-color, var(--color-primary));
  outline: none;
}

.state-compare-count {
  font-size: 0.875rem;
  color: var(--color-neutral-400);
  margin: 0 0 var(--space-2);
}

.state-compare-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.state-compare-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.state-compare-table caption {
  text-align: left;
  padding: var(--space-2);
  font-size: 0.8125rem;
  color: var(--color-neutral-400);
}

/* This tool's page is the only place caption text needs to be hidden
   visually but kept for screen readers, no shared utility class exists
   in assets/css/base.css yet, so it is scoped here rather than assuming
   one and silently breaking. */
.state-compare-table caption.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.state-compare-table th,
.state-compare-table td {
  padding: var(--space-2);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.state-compare-table thead th {
  position: sticky;
  top: 0;
  background: var(--color-bg-card);
  z-index: 1;
}

.state-compare-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}

.state-compare-table th[data-sort] button {
  all: unset;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.state-compare-table th[data-sort] button::after {
  content: '\2195';
  font-size: 0.75em;
  opacity: 0.4;
}

.state-compare-table th.is-sorted button::after {
  opacity: 1;
}

.state-compare-table th[aria-sort="ascending"] button::after {
  content: '\2191';
}

.state-compare-table th[aria-sort="descending"] button::after {
  content: '\2193';
}

.state-compare-table__state {
  font-weight: 600;
}

.state-compare-table__code {
  font-weight: 400;
  color: var(--color-neutral-400);
  font-size: 0.8125rem;
}

.state-compare-table td.is-yes {
  color: var(--category-color, var(--color-primary));
  font-weight: 600;
}

.state-compare-table td.is-no {
  color: var(--color-neutral-400);
}

.state-compare-table tbody tr:hover {
  background: var(--color-neutral-100);
}

@media (max-width: 639px) {
  .state-compare-table {
    font-size: 0.875rem;
  }
}
