/* ============================================================================
   SkillProof — shared table controls (filter chips + search + sort)
   Site-wide standard (2026-06-01): every data table carries this control bar.
   Auto-injected by table-controls.js. Uses each portal's --pgn-* tokens.
   ============================================================================ */
.table-controls {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px 0;
  font-family: 'Lato', 'Segoe UI', Arial, sans-serif;
}
.table-controls .tc-label {
  font-size: 13px; color: var(--pgn-color-gray-600); margin-right: 2px;
  display: inline-flex; align-items: center;
}
.table-controls .tc-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.table-controls .tc-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.table-controls .tc-chip {
  font-family: inherit; font-size: 13px; line-height: 1; cursor: pointer;
  padding: 6px 12px; border-radius: 50rem;
  border: 1px solid var(--pgn-color-gray-200);
  background: var(--pgn-color-white); color: var(--pgn-color-gray-700);
  transition: background 120ms, border-color 120ms, color 120ms;
}
.table-controls .tc-chip:hover { background: var(--pgn-color-bg-light); }
.table-controls .tc-chip.active {
  background: var(--pgn-color-brand-base); border-color: var(--pgn-color-brand-base);
  color: #fff; font-weight: 700;
}

.table-controls .tc-search { position: relative; display: inline-flex; align-items: center; }
.table-controls .tc-search .material-icons-outlined {
  position: absolute; left: 8px; font-size: 16px;
  color: var(--pgn-color-gray-600); pointer-events: none;
}
.table-controls .tc-search input {
  font-family: inherit; font-size: 13px; padding: 6px 8px 6px 30px;
  border: 1px solid var(--pgn-color-gray-200); border-radius: 6px;
  background: var(--pgn-color-white); color: var(--pgn-color-gray-700);
  width: 200px; max-width: 48vw;
}
.tc-sort {
  /* Bare selector (no .table-controls prefix) so this also applies to chip-bar
     sorts that addChipBarSort injects into hand-coded chip bars without a
     .table-controls ancestor (e.g. SA S2 Access Control People/Skills/Schools).
     appearance:none is required so the browser respects our background in
     BOTH light and dark mode — Chrome otherwise paints the OS-default white
     on native <select>, ignoring even `background-color` longhand. Custom
     caret restored via SVG below. */
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  font-family: inherit; font-size: 13px; padding: 6px 28px 6px 8px;
  border: 1px solid var(--pgn-color-gray-200); border-radius: 6px;
  background-color: var(--pgn-color-white); color: var(--pgn-color-gray-700); cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23666666' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.table-controls .tc-chip:focus-visible,
.table-controls .tc-search input:focus-visible,
.tc-sort:focus-visible {
  outline: 3px solid var(--pgn-color-brand-base); outline-offset: 2px;
}
/* "No matching rows" message row, shown when filter/search hides everything */
tr.tc-empty-row td {
  text-align: center; color: var(--pgn-color-gray-600);
  font-style: italic; padding: 16px;
}

/* Search box injected into bespoke filter-chip bars (heatmaps, card grids, curated tables) */
.tc-chip-search { position: relative; display: inline-flex; align-items: center; }
.tc-chip-search .material-icons-outlined {
  position: absolute; left: 8px; font-size: 16px;
  color: var(--pgn-color-gray-600); pointer-events: none;
}
.tc-chip-search input {
  font-family: 'Lato', 'Segoe UI', Arial, sans-serif; font-size: 13px;
  padding: 6px 8px 6px 30px; border: 1px solid var(--pgn-color-gray-200);
  border-radius: 6px; background: var(--pgn-color-white);
  color: var(--pgn-color-gray-700); width: 200px; max-width: 48vw;
}
.tc-chip-search input:focus-visible { outline: 3px solid var(--pgn-color-brand-base); outline-offset: 2px; }
/* Search-hide composes with bespoke chip filtering (AND semantics) */
.tc-search-hide { display: none !important; }

/* Sticky section nav + scroll-spy for long analytics pages */
.an-tabs {
  position: sticky; top: 0; z-index: 50;
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 0; margin: 0 0 16px 0;
  background: var(--pgn-color-bg-light);
  border-bottom: 1px solid var(--pgn-color-gray-200);
}
.an-tab {
  font-family: 'Lato', 'Segoe UI', Arial, sans-serif; font-size: 13px; cursor: pointer;
  padding: 6px 14px; border-radius: 50rem;
  border: 1px solid var(--pgn-color-gray-200);
  background: var(--pgn-color-white); color: var(--pgn-color-gray-700);
  transition: background 120ms, color 120ms, border-color 120ms;
}
.an-tab:hover { background: var(--pgn-color-bg-light); }
.an-tab.active { background: var(--pgn-color-brand-base); border-color: var(--pgn-color-brand-base); color: #fff; font-weight: 700; }
.an-tab:focus-visible { outline: 3px solid var(--pgn-color-brand-base); outline-offset: 2px; }
.an-anchor { display: block; height: 0; margin: 0; padding: 0; scroll-margin-top: 64px; }

/* Dark-mode defense: native <select>/<input> form elements sometimes ignore
   the `background` shorthand even when CSS variables resolve correctly
   (Chrome falls back to the OS default white). Use `background-color`
   (longhand) explicitly for all themed form controls in dark mode. */
[data-theme="dark"] .table-controls .tc-chip,
[data-theme="dark"] .table-controls .tc-search input,
[data-theme="dark"] .tc-sort,
[data-theme="dark"] .tc-chip-search input,
[data-theme="dark"] .an-tab {
  background-color: var(--pgn-color-white);
  color: var(--pgn-color-gray-700);
  border-color: var(--pgn-color-gray-200);
}
[data-theme="dark"] .table-controls .tc-chip.active,
[data-theme="dark"] .an-tab.active {
  background-color: var(--pgn-color-brand-base);
  color: #fff;
  border-color: var(--pgn-color-brand-base);
}
[data-theme="dark"] .an-tabs {
  background-color: var(--pgn-color-bg-light);
  border-bottom-color: var(--pgn-color-gray-200);
}

/* ----------------------------------------------------------------------------
   Toast — transient confirmation (e.g. export success). Shared across portals.
   role=status/aria-live on the wrapper announces the message to screen readers.
   Solid success-colored pill: white text is legible in BOTH light and dark.
   ---------------------------------------------------------------------------- */
.tc-toast-wrap {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.tc-toast {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 16px 24px; border-radius: 8px;
  background: var(--pgn-color-success-base); color: #fff;
  font-family: 'Lato', 'Segoe UI', Arial, sans-serif; font-size: 14px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  opacity: 0; transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: auto; max-width: 90vw;
}
.tc-toast.show { opacity: 1; transform: translateY(0); }
.tc-toast .material-icons-outlined { font-size: 18px; }

/* ----------------------------------------------------------------------------
   Export menu — one consistent "Export ▾" dropdown in every filtered table's
   control bar. Formats are set per data nature (PDF+CSV human / MD+JSON machine)
   by the shared module. Styled to match the chip/search/sort controls.
   ---------------------------------------------------------------------------- */
.tc-export { position: relative; display: inline-flex; }
.tc-export-btn {
  appearance: none; -webkit-appearance: none; font-family: inherit; font-size: 13px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px 12px; border-radius: 6px;
  border: 1px solid var(--pgn-color-gray-200);
  background-color: var(--pgn-color-white); color: var(--pgn-color-gray-700);
  transition: background-color 120ms, border-color 120ms;
}
.tc-export-btn:hover { background-color: var(--pgn-color-bg-light); }
.tc-export-btn .material-icons-outlined { font-size: 16px; }
.tc-export-btn .tc-export-caret { font-size: 18px; margin-left: -4px; }
.tc-export-btn:focus-visible { outline: 3px solid var(--pgn-color-brand-base); outline-offset: 2px; }
.tc-export-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 60;
  min-width: 168px; padding: 4px; flex-direction: column; gap: 2px; display: none;
  background-color: var(--pgn-color-white);
  border: 1px solid var(--pgn-color-gray-200); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.tc-export.open .tc-export-menu { display: flex; }
.tc-export-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px; border: none; border-radius: 6px; cursor: pointer;
  background: none; font-family: inherit; font-size: 13px; color: var(--pgn-color-gray-700);
}
.tc-export-item:hover { background-color: var(--pgn-color-bg-light); }
.tc-export-item .material-icons-outlined { font-size: 18px; color: var(--pgn-color-gray-600); }
.tc-export-item:focus-visible { outline: 2px solid var(--pgn-color-brand-base); outline-offset: -2px; }
/* Dark-mode: native form/popover surfaces need explicit background-color (see note above) */
[data-theme="dark"] .tc-export-btn,
[data-theme="dark"] .tc-export-menu,
[data-theme="dark"] .tc-export-item {
  background-color: var(--pgn-color-white);
  color: var(--pgn-color-gray-700);
  border-color: var(--pgn-color-gray-200);
}
