/* data-grid.css — unified Live Grid styling for the home page + /events page.
 * Builds on existing chip primitives (chain-badge-unified, token-pill, status-badge)
 * rather than inventing new chip styles. */

/* ------------------------------------------------------------------
 * .live-grid wrapper — unifies .data-table (home) and .app-table (/events)
 * ------------------------------------------------------------------ */
.live-grid {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.live-grid table {
  width: 100%;
  border-collapse: collapse;
}

.live-grid thead th {
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
  z-index: 1;
}

[data-theme="light"] .live-grid thead th {
  background: #f1f5f9;
  color: #334155;
}

.live-grid tbody td {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--fg);
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
}

.live-grid tbody tr:last-child td { border-bottom: none; }

.live-grid tbody tr {
  transition: background 0.12s ease;
}

.live-grid tbody tr:hover td {
  background: rgba(99, 255, 226, 0.05);
}

[data-theme="light"] .live-grid tbody tr:hover td {
  background: rgba(8, 145, 178, 0.06);
}

.live-grid .cell-time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.live-grid .cell-address {
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
  font-size: 12px;
}

.live-grid .cell-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
  font-size: 12.5px;
  white-space: nowrap;
}

.live-grid th.align-right,
.live-grid td.align-right { text-align: right; }

/* Compact density variant for the home preview grids */
.live-grid.compact tbody td,
.live-grid.compact thead th {
  padding: 8px 12px;
}

/* Empty / loading row */
.live-grid .grid-empty td {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

/* ------------------------------------------------------------------
 * Chain chip in grids — always [logo] + name.
 * Extends chain-badge-unified by ensuring a min visual rhythm in cells.
 * ------------------------------------------------------------------ */
.live-grid .chain-badge-unified {
  max-width: 100%;
}

.live-grid .chain-badge-unified .chain-badge-logo {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------
 * Event-type priority hierarchy via status-badge variants.
 * Strong visual weight cascades from sanctions → blacklist/freeze → role/burn → mint.
 * These selectors *extend* the existing status-badge tokens, they do not redefine them.
 * ------------------------------------------------------------------ */
.status-badge {
  gap: 6px;
  min-width: 0;            /* let badge shrink to its label in dense grids */
  padding: 4px 9px;
}

.status-badge .event-type-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-badge .event-type-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2.4;
}

/* Priority tier 1 — sanctions. Visually loudest. */
.status-badge.sanctioned,
.status-badge.tier-sanctions {
  background: #991b1b;
  color: #fef2f2;
  border: 1px solid #b91c1c;
  font-weight: 700;
  letter-spacing: 0.45px;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.25), 0 2px 6px rgba(127, 29, 29, 0.35);
}

/* Priority tier 2 — blacklist / freeze / seizure (danger). */
.status-badge.danger,
.status-badge.tier-enforcement {
  background: rgba(220, 38, 38, 0.22);
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.55);
  font-weight: 650;
}

[data-theme="light"] .status-badge.danger,
[data-theme="light"] .status-badge.tier-enforcement {
  background: rgba(220, 38, 38, 0.10);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.35);
}

/* Priority tier 3 — role / burn / freeze-recovery (warning). */
.status-badge.warning,
.status-badge.tier-issuer {
  background: rgba(217, 119, 6, 0.16);
  color: #fcd34d;
  border-color: rgba(217, 119, 6, 0.4);
  font-weight: 600;
}

[data-theme="light"] .status-badge.warning,
[data-theme="light"] .status-badge.tier-issuer {
  background: rgba(217, 119, 6, 0.10);
  color: #92400e;
  border-color: rgba(217, 119, 6, 0.35);
}

/* Priority tier 4 — success / whitelist / unblacklist. */
.status-badge.success {
  background: rgba(22, 163, 74, 0.16);
  color: #86efac;
  border-color: rgba(22, 163, 74, 0.4);
}

[data-theme="light"] .status-badge.success {
  background: rgba(22, 163, 74, 0.10);
  color: #166534;
  border-color: rgba(22, 163, 74, 0.35);
}

/* Priority tier 5 — mint / supply (quietest). */
.status-badge.info,
.status-badge.tier-supply {
  background: rgba(99, 102, 241, 0.13);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.35);
  font-weight: 500;
}

[data-theme="light"] .status-badge.info,
[data-theme="light"] .status-badge.tier-supply {
  background: rgba(99, 102, 241, 0.08);
  color: #3730a3;
  border-color: rgba(99, 102, 241, 0.30);
}

/* Hide the legacy severity-dot inside the new status-badge layout (icon replaces it). */
.live-grid .status-badge .severity-dot { display: none; }

/* Row-level priority emphasis — adds a subtle left border to high-priority rows. */
.live-grid tbody tr.row-tier-sanctions td:first-child {
  box-shadow: inset 3px 0 0 #dc2626;
}
.live-grid tbody tr.row-tier-enforcement td:first-child {
  box-shadow: inset 3px 0 0 rgba(220, 38, 38, 0.55);
}
.live-grid tbody tr.row-tier-issuer td:first-child {
  box-shadow: inset 3px 0 0 rgba(217, 119, 6, 0.55);
}

/* ------------------------------------------------------------------
 * Address cell — copy button + monospace, consistent across grids.
 * ------------------------------------------------------------------ */
.live-grid .address-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.live-grid .address-cell .cell-copy-btn {
  opacity: 0;
  transition: opacity 0.12s ease;
}

.live-grid tbody tr:hover .address-cell .cell-copy-btn {
  opacity: 1;
}

/* Issuer cell — name only by default; the small external-link icon is an affordance. */
.live-grid .issuer-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------
 * Sanctions agency coverage tiles (above the hero stats-bar).
 * ------------------------------------------------------------------ */
.sanctions-coverage { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.sanctions-coverage__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sanctions-coverage__title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

.sanctions-coverage__subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.sanctions-coverage__subtitle .text-link {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
}

.sanctions-coverage__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.sanctions-coverage__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 10px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 96px;
}

.sanctions-coverage__tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 255, 226, 0.10);
}

[data-theme="light"] .sanctions-coverage__tile:hover {
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.12);
}

.sanctions-coverage__count {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sanctions-coverage__flag {
  font-size: 20px;
  line-height: 1;
}

.sanctions-coverage__short {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

@media (max-width: 540px) {
  .sanctions-coverage__grid {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 8px;
  }
  .sanctions-coverage__tile {
    min-height: 84px;
    padding: 10px 8px;
  }
  .sanctions-coverage__count { font-size: 18px; }
  .sanctions-coverage__flag { font-size: 18px; }
}

/* ------------------------------------------------------------------
 * Responsive: hide low-priority columns on small viewports.
 * ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .live-grid thead th,
  .live-grid tbody td { padding: 8px 10px; font-size: 12px; }
  .live-grid .col-issuer,
  .live-grid .col-program,
  .live-grid .col-block { display: none; }
  .live-grid .cell-amount { font-size: 11.5px; }
}
