/*
  Wortic macOS UI Kit — Table
  wm-table — usa <table> nativo.

  Glowup 2026: contêiner branco com anel hairline + sombra de contato,
  header discreto (sem caps gritado, sem fundo cinza), linhas respiráveis
  com hairlines de 0.5px, hover/seleção com transição e scrollbar fina.
*/

@layer components {
  .wm-table-wrap {
    background: var(--wm-surface-primary);
    border-radius: var(--wm-radius-list-group, 12px);
    box-shadow:
      0 0 0 var(--wm-border-width-hairline) var(--wm-separator),
      var(--wm-shadow-1);
    overflow-y: hidden;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--wm-scrollbar-thumb) transparent;
  }
  .wm-table-wrap::-webkit-scrollbar {
    height: 8px;
  }
  .wm-table-wrap::-webkit-scrollbar-track {
    background: transparent;
  }
  .wm-table-wrap::-webkit-scrollbar-thumb {
    background: var(--wm-scrollbar-thumb);
    border-radius: var(--wm-radius-pill);
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  .wm-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--wm-scrollbar-thumb-hover);
    background-clip: padding-box;
  }

  .wm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--wm-font-size-subheadline);
  }

  /* Header discreto, como o Finder: 11px, peso médio, cor secundária,
     sem uppercase e sem fundo cinza de formulário. */
  .wm-table thead th {
    text-align: start;
    font-size: var(--wm-font-size-caption);
    font-weight: var(--wm-font-weight-medium);
    color: var(--wm-label-secondary);
    background: var(--wm-surface-primary);
    padding: var(--wm-space-4) var(--wm-space-6);
    border-bottom: var(--wm-border-width-hairline) solid var(--wm-separator);
    white-space: nowrap;
  }

  .wm-table th[aria-sort] {
    cursor: pointer;
    user-select: none;
    transition: color var(--wm-duration-fast) var(--wm-ease-standard);
  }
  .wm-table th[aria-sort]:hover {
    color: var(--wm-label-primary);
  }
  .wm-table th .wm-icon {
    margin-inline-start: var(--wm-space-2);
    color: var(--wm-label-quaternary);
    vertical-align: -2px;
    transition:
      color var(--wm-duration-fast) var(--wm-ease-standard),
      transform var(--wm-duration-fast) var(--wm-ease-emphasized);
  }
  .wm-table th[aria-sort="ascending"] .wm-icon,
  .wm-table th[aria-sort="descending"] .wm-icon {
    color: var(--wm-accent);
  }
  .wm-table th[aria-sort="ascending"] .wm-icon {
    transform: rotate(180deg);
  }
  .wm-table th[aria-sort="ascending"],
  .wm-table th[aria-sort="descending"] {
    color: var(--wm-label-primary);
    font-weight: var(--wm-font-weight-semibold);
  }

  /* Linhas respiráveis: 10px de bloco, hairline de 0.5px. */
  .wm-table tbody td {
    padding: var(--wm-space-5) var(--wm-space-6);
    color: var(--wm-label-primary);
    border-bottom: var(--wm-border-width-hairline) solid var(--wm-separator);
    vertical-align: middle;
    transition: background var(--wm-duration-fast) var(--wm-ease-standard);
  }

  .wm-table tbody tr:last-child td {
    border-bottom: none;
  }

  .wm-table--zebra tbody tr:nth-child(even) td {
    background: var(--wm-fill-quaternary);
  }

  .wm-table tbody tr.wm-table__row--selectable:hover td {
    background: var(--wm-fill-quaternary);
    cursor: pointer;
  }
  .wm-table tbody tr.wm-table__row--selectable:active td {
    background: var(--wm-fill-tertiary);
  }
  .wm-table tbody tr.is-selected td,
  .wm-table--zebra tbody tr.is-selected td {
    background: var(--wm-accent-fill);
  }
  .wm-table tbody tr.is-selected:hover td {
    background: var(--wm-accent-fill-strong);
  }

  .wm-table--compact th,
  .wm-table--compact td {
    padding-block: var(--wm-space-2);
  }

  .wm-table__cell--numeric {
    text-align: end;
    font-variant-numeric: tabular-nums;
  }

  .wm-table__empty {
    padding: var(--wm-space-12);
    text-align: center;
    color: var(--wm-label-tertiary);
    line-height: var(--wm-line-height-relaxed);
  }

  .wm-table-toolbar {
    display: flex;
    align-items: center;
    gap: var(--wm-space-4);
    padding: var(--wm-space-4) var(--wm-space-6);
    border-bottom: var(--wm-border-width-hairline) solid var(--wm-separator);
    background: var(--wm-surface-primary);
  }

  .wm-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--wm-space-4) var(--wm-space-6);
    border-top: var(--wm-border-width-hairline) solid var(--wm-separator);
    background: var(--wm-surface-primary);
    font-size: var(--wm-font-size-caption);
    color: var(--wm-label-tertiary);
    font-variant-numeric: tabular-nums;
  }
}
