/* Cross-tenant snippet admin behavior styles (KnowBrow-owned). */

:root {
  --kb-sticky-top: 64px;
  --kb-filter-row-height: 48px;
  /* Theme tokens (FE-owned). Fallbacks preserve baseline contrast. */
  --kb-snippet-header-bg: #e8f1fc;
  --kb-snippet-filter-row-bg: #f5f9ff;
  --kb-snippet-filter-input-text: #0f233b;
  --kb-snippet-filter-input-bg: #ffffff;
  --kb-snippet-filter-input-border: #c5d4e6;
  --kb-snippet-filter-placeholder: #445f7e;
  --kb-snippet-filter-focus-border: #8caed4;
  --kb-snippet-selected-row-bg: #d8e6f7;
  --kb-snippet-selected-row-text: #102842;
  --kb-snippet-checkbox-accent: #0f3b68;
  --kb-snippet-checkbox-border: #25486f;
  --kb-snippet-checkbox-bg: #ffffff;
  --kb-snippet-hover-row-bg: #123f6a;
  --kb-snippet-hover-row-text: #ffd66f;
}

/* Generic sticky fallback. */
body.kb-snippet-list-page .listing table thead tr:first-child th,
body.kb-snippet-list-page table.listing thead tr:first-child th,
body.kb-snippet-list-page table.w-table thead tr:first-child th,
body.kb-snippet-list-page table.kb-sticky-table thead tr:first-child th {
  position: sticky;
  top: calc(var(--kb-sticky-top) + var(--kb-filter-row-height)) !important;
  z-index: 34 !important;
  background: var(--kb-snippet-header-bg) !important;
}

body.kb-snippet-list-page table.kb-sticky-table thead tr.kb-filter-row th {
  position: sticky !important;
  top: var(--kb-sticky-top) !important;
  z-index: 35 !important;
  background: var(--kb-snippet-filter-row-bg) !important;
}

/* When filter row exists, keep actual heading row below it. */
body.kb-snippet-list-page table.kb-sticky-table thead tr.kb-filter-row + tr th {
  top: calc(var(--kb-sticky-top) + var(--kb-filter-row-height)) !important;
}

/* Force sticking even without kb-sticky-table class. */
body.kb-snippet-list-page .listing table thead tr.kb-filter-row th,
body.kb-snippet-list-page table.w-table thead tr.kb-filter-row th {
  position: sticky !important;
  top: var(--kb-sticky-top) !important;
  z-index: 35 !important;
  background: var(--kb-snippet-filter-row-bg) !important;
}

body.kb-snippet-list-page .listing table thead tr.kb-filter-row + tr th,
body.kb-snippet-list-page table.w-table thead tr.kb-filter-row + tr th {
  position: sticky !important;
  top: calc(var(--kb-sticky-top) + var(--kb-filter-row-height)) !important;
  z-index: 34 !important;
  background: var(--kb-snippet-header-bg) !important;
}

body.kb-snippet-list-page .listing table thead th,
body.kb-snippet-list-page table.w-table thead th,
body.kb-snippet-list-page table.kb-sticky-table thead th {
  background-clip: padding-box;
}

body.kb-snippet-list-page .kb-header-filter {
  color: var(--kb-snippet-filter-input-text) !important;
  background-color: var(--kb-snippet-filter-input-bg) !important;
  border: 1px solid var(--kb-snippet-filter-input-border) !important;
  min-height: 44px !important;
}

body.kb-snippet-list-page .kb-header-filter::placeholder {
  color: var(--kb-snippet-filter-placeholder) !important;
  opacity: 1 !important;
}

body.kb-snippet-list-page .kb-header-filter:focus {
  color: var(--kb-snippet-filter-input-text) !important;
  background-color: var(--kb-snippet-filter-input-bg) !important;
  border-color: var(--kb-snippet-filter-focus-border) !important;
}

/* Selected-row contrast baseline. */
body.kb-snippet-list-page .listing tbody tr[aria-selected="true"],
body.kb-snippet-list-page .listing tbody tr.selected,
body.kb-snippet-list-page .w-table tbody tr[aria-selected="true"],
body.kb-snippet-list-page .w-table tbody tr.selected {
  background: var(--kb-snippet-selected-row-bg) !important;
}

body.kb-snippet-list-page .listing tbody tr[aria-selected="true"] td,
body.kb-snippet-list-page .listing tbody tr.selected td,
body.kb-snippet-list-page .w-table tbody tr[aria-selected="true"] td,
body.kb-snippet-list-page .w-table tbody tr.selected td {
  color: var(--kb-snippet-selected-row-text) !important;
}

/* Checkbox contrast baseline (border/fill against row backgrounds). */
body.kb-snippet-list-page input[type="checkbox"] {
  accent-color: var(--kb-snippet-checkbox-accent) !important;
  border: 2px solid var(--kb-snippet-checkbox-border) !important;
  background: var(--kb-snippet-checkbox-bg) !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75) !important;
}

body.kb-snippet-list-page input[type="checkbox"]:checked {
  accent-color: var(--kb-snippet-checkbox-accent) !important;
}

/* High-contrast hover baseline in KnowBrow (tenant can refine, not break). */
body.kb-snippet-list-page .listing tbody tr:hover,
body.kb-snippet-list-page .w-table tbody tr:hover {
  background: var(--kb-snippet-hover-row-bg) !important;
}

body.kb-snippet-list-page .listing tbody tr:hover td,
body.kb-snippet-list-page .w-table tbody tr:hover td,
body.kb-snippet-list-page .listing tbody tr:hover a,
body.kb-snippet-list-page .w-table tbody tr:hover a {
  color: var(--kb-snippet-hover-row-text) !important;
}
