/* components.css — buttons, badges, cards, tables, forms, misc widgets */

/* Cards: a soft gradient surface, a 1px border and a gentle shadow that
   deepens slightly on hover -- no heavy elevation. */
.card {
  background: var(--card-gradient);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.stat-tile {
  background: var(--card-gradient);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease;
}
.stat-tile:hover { box-shadow: var(--shadow-hover); }
.stat-tile__label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
  margin-bottom: 0.35rem;
}
.stat-tile__value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat-tile__value.is-muted { color: var(--fg-subtle); font-size: 1rem; font-weight: 500; }
.stat-tile__basis {
  font-size: 0.72rem;
  color: var(--fg-subtle);
  margin-top: 0.25rem;
}

/* A larger, "hero" variant for the handful of numbers a page wants to lead
   with (e.g. stolen / frozen on the overview). */
.stat-tile--hero .stat-tile__value { font-size: 2.1rem; }
.stat-tile--positive .stat-tile__value { color: var(--ok); }
.stat-tile--negative .stat-tile__value { color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--fg);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}
.btn:hover { background: var(--bg-sunken); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-muted); color: var(--ok); }
.badge-warn { background: var(--warn-muted); color: var(--warn); }
.badge-danger { background: var(--danger-muted); color: var(--danger); }
.badge-neutral { background: var(--bg-sunken); color: var(--fg-muted); }
.badge-accent { background: var(--accent-muted); color: var(--accent); }
.badge-highrisk { background: var(--highrisk-muted); color: var(--highrisk); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-live { background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Compact, dense tables: no zebra stripes, a hover row and thin dividers
   do the work of separating rows. Numeric columns are right-aligned with
   tabular figures (set `cls: "num"` on the cell). */
table.data-table { font-size: 14px; }
table.data-table th, table.data-table td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table th {
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--bg);
  position: sticky;
  top: 0;
}
table.data-table tbody tr:hover { background: var(--row-hover); }
table.data-table td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 12rem; max-width: 22rem; }
table.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table th.num { text-align: right; }

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 0.9rem;
}

.not-available {
  color: var(--fg-subtle);
  font-style: italic;
}

.error-box {
  background: var(--danger-muted);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.86rem;
}
.info-box {
  background: var(--accent-muted);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.86rem;
}
.notice-box {
  background: var(--warn-muted);
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.86rem;
}
.success-box {
  background: var(--ok-muted);
  color: var(--ok);
  border: 1px solid var(--ok);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.86rem;
}

.field { margin-bottom: 0.9rem; }
.field label { display: block; font-weight: 600; font-size: 0.82rem; margin-bottom: 0.3rem; }
.field .hint { font-size: 0.74rem; color: var(--fg-subtle); margin-top: 0.25rem; }
.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--fg);
}
.field textarea { resize: vertical; min-height: 90px; font-family: var(--font-mono); font-size: 0.84rem; }
.field-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end; }
.field-row .field { flex: 1; min-width: 140px; margin-bottom: 0; }
.checkbox-field { display: flex; align-items: center; gap: 0.4rem; font-size: 0.84rem; }

.toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 0.9rem;
}
/* Filters inside a toolbar read as pill chips, not boxy form fields. */
.toolbar select,
.toolbar input[type="number"],
.toolbar input[type="search"] {
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
}

.pill-group { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.pill {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-raised);
  color: var(--fg-muted);
}
.pill:hover { color: var(--fg); border-color: var(--fg-subtle); }
.pill.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }

.bar-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.45rem; font-size: 0.82rem; }
.bar-row__label { width: 110px; flex-shrink: 0; color: var(--fg-muted); }
.bar-row__track { flex: 1; height: 10px; background: var(--bg-sunken); border-radius: 5px; overflow: hidden; }
.bar-row__fill { height: 100%; background: var(--accent); border-radius: 5px; }
.bar-row__value { width: 110px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--fg-muted); }

.pagination { display: flex; justify-content: center; margin: 1rem 0; }

.copy-btn {
  background: transparent;
  border: none;
  color: var(--fg-subtle);
  cursor: pointer;
  padding: 0 0.3rem;
}
.copy-btn:hover { color: var(--accent); }

.code-block {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  overflow-x: auto;
  font-size: 0.82rem;
  margin: 0 0 0.9rem;
}

.tag-list { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.methodology-list {
  font-size: 0.8rem;
  color: var(--fg-subtle);
  line-height: 1.6;
  padding-left: 1.1em;
  margin: 0;
}
.methodology-list li { margin-bottom: 0.3rem; }

/* "Traced hops" flow chip, colored by edge/movement kind. */
.flow { font-weight: 500; }
.flow[data-kind="transfer"] { color: var(--fg-muted); }
.flow[data-kind="bridge"], .flow[data-kind="xchain"] { color: var(--kind-bridge); }
.flow[data-kind="swap"] { color: var(--kind-dex); }
.flow[data-kind="deposit"], .flow[data-kind="cex"] { color: var(--kind-exchange); }
.flow[data-kind="mixer"] { color: var(--kind-mixer); }
.flow[data-kind="stable"] { color: var(--ok); }

tr.row-highlight { background: var(--accent-muted) !important; }
tr.traced-row { cursor: pointer; }
tr.traced-row:hover { background: var(--row-hover); }

.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sr-live { position: absolute; width: 1px; height: 1px; overflow: hidden; }

details.endpoint summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
}
details.endpoint { border-bottom: 1px solid var(--border); padding: 0.1rem 0; }
