/* ==========================================================================
   PEPTIDESTX DESIGN SYSTEM — TABLES & BADGES
   ========================================================================== */

/* ---------------------------------------------------------------------
   DATA TABLE
   Purpose: primary vehicle for spec sheets, COA test-result rows, order
   history. Mono type for all data cells reinforces "this is verified,
   exact data" per brand voice.
   --------------------------------------------------------------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 14px;
}

.data-table caption {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--color-graphite-500);
  margin-bottom: var(--space-3);
}

.data-table thead th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-graphite-500);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-graphite-border-light-strong);
  white-space: nowrap;
}

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

.data-table thead th[aria-sort] .sort-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.5;
  transition: transform var(--dur-base) var(--ease-out);
}

.data-table thead th[aria-sort="ascending"] .sort-icon {
  opacity: 1;
  transform: rotate(180deg);
}

.data-table thead th[aria-sort="descending"] .sort-icon {
  opacity: 1;
}

.data-table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-graphite-border-light);
  color: var(--color-obsidian);
  vertical-align: middle;
}

.data-table tbody td.is-mono,
.data-table td[data-type="numeric"],
.data-table td[data-type="code"] {
  font-family: var(--font-mono);
  font-size: 13px;
}

.data-table tbody tr {
  transition: background-color var(--dur-fast) var(--ease-out);
}

.data-table.is-hoverable tbody tr:hover {
  background: var(--color-cloud-grey);
}

.data-table.is-hoverable tbody tr:hover td {
  cursor: pointer;
}

/* Row-level focus (keyboard nav on interactive tables) */
.data-table tbody tr:focus-within {
  background: var(--color-cloud-grey);
  outline: 2px solid var(--color-royal-violet);
  outline-offset: -2px;
}

/* Zebra striping OFF by default — flat rows read as more precise/clinical;
   only enable .is-striped on very dense tables (30+ rows) where scanning
   aid outweighs the visual quietness this brand otherwise prefers. */
.data-table.is-striped tbody tr:nth-child(even) {
  background: var(--color-cloud-grey);
}

/* Responsive: convert to stacked label/value rows below 640px */
@media (max-width: 640px) {
  .data-table.is-responsive thead {
    display: none;
  }

  .data-table.is-responsive tbody tr {
    display: block;
    border-bottom: 1px solid var(--color-graphite-border-light-strong);
    padding: var(--space-4) 0;
  }

  .data-table.is-responsive tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    padding: var(--space-2) 0;
  }

  .data-table.is-responsive tbody td::before {
    content: attr(data-label);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-graphite-500);
    margin-right: var(--space-4);
  }
}

/* Empty-cell convention: never leave blank, always show a explicit dash */
.data-table .cell-empty {
  color: var(--color-graphite-300);
}

/* ---------------------------------------------------------------------
   STATUS BADGE
   Purpose: compact semantic state markers (in stock / low stock / out
   of stock / QC passed / pending / discontinued).
   --------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.badge svg {
  width: 12px;
  height: 12px;
}

.badge--success {
  background: var(--color-verified-green-bg);
  color: var(--color-verified-green);
}

.badge--neutral {
  background: var(--color-cloud-grey);
  color: var(--color-graphite-500);
}

.badge--warning {
  background: #FBF1E3;
  color: var(--color-alert-amber);
}

.badge--error {
  background: #FBEAE9;
  color: var(--color-signal-red);
}

.badge--dark {
  background: var(--color-obsidian);
  color: var(--color-white);
}

/* ---------------------------------------------------------------------
   TRUST BADGE
   Purpose: larger, standalone credibility markers (e.g. "Third-Party
   Verified", "ISO-Aligned Testing") used on PDPs and the About/Quality
   pages — distinct from status badges in that they carry an icon +
   two-line label and are never tied to a specific SKU's live state.
   --------------------------------------------------------------------- */

.trust-badge {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-graphite-border-light);
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.trust-badge__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--color-royal-violet);
}

.trust-badge__icon svg {
  width: 100%;
  height: 100%;
}

.trust-badge__title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--color-obsidian);
}

.trust-badge__subtitle {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-graphite-500);
}

.trust-badge--on-dark {
  background: var(--color-obsidian-elevated);
  border-color: var(--color-graphite-border-dark);
}

.trust-badge--on-dark .trust-badge__title {
  color: var(--color-white);
}

.trust-badge--on-dark .trust-badge__subtitle {
  color: var(--color-graphite-300);
}
