/* ---------------------------------------------------------------------------
 * keywords.css — page-specific styles for the Keywords template
 * ---------------------------------------------------------------------------
 * Extracted from the former inline <style>${pageStyles}</style> block in
 * templates/keywords.ts (App-Building Bible principle 5). The brand-token
 * interpolations (${brand.*}) are resolved here to their literal values, which
 * are the single source of truth in templates/layout.ts:
 *   primary #4951EF  primaryLight #EEEFFE  bg #F9FAFB  surface #FFFFFF
 *   ink #09090B  muted #71717A  border #E4E4E7  borderLight #F4F4F5
 *   radiusCard 16px  radiusSmall 12px  radiusInput 10px
 *   fontMono 'JetBrains Mono','SF Mono','Cascadia Code',monospace
 *
 * Modal/toast visibility toggles via the `visible` class (added by the client
 * module); dynamic difficulty-bar width/colour move to CSS custom properties
 * set from data-* attributes (principle 17).
 * --------------------------------------------------------------------------- */

.kw-stats {
  display: flex; gap: 12px;
  padding: 16px 24px 0;
}
.kw-stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 16px;
  background: #FFFFFF;
  border: 1px solid #F4F4F5;
  border-radius: 12px;
  min-width: 100px;
}
.kw-stat__value {
  font-size: 20px; font-weight: 700; letter-spacing: -.02em;
  color: #09090B; font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.kw-stat__label { font-size: 11px; color: #71717A; font-weight: 500; }

/* Table */
.kw-table-wrap { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 260px); }

.kw-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.kw-table th {
  text-align: left; padding: 8px 12px;
  font-size: 10px; font-weight: 600; color: #71717A;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid #E4E4E7;
  background: #F9FAFB;
  position: sticky; top: 0; z-index: 2;
  white-space: nowrap;
}
.kw-table th.num { text-align: right; }
.kw-table td {
  padding: 6px 12px;
  border-bottom: 1px solid #F4F4F5;
  vertical-align: middle;
}
.kw-table tr:hover td { background: #F9FAFB; }
.kw-col-check { width: 32px; padding-left: 16px; }
.kw-col-actions { padding-right: 16px; }
.kw-table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace; font-size: 11px; }
.kw-cell {
  max-width: 280px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-weight: 500;
}
.truncate-cell { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kw-table input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: #4951EF; }

/* Keyword cell text + generic muted / mono helpers */
.kw-keyword-text { color: #09090B; font-weight: 500; }
.kw-muted { color: #71717A; }
.kw-note { color: #71717A; font-size: 11px; }
.kw-source { font-size: 11px; color: #71717A; }
.kw-added { font-size: 11px; color: #71717A; }

/* Difficulty bar */
.kw-diff { display: flex; align-items: center; gap: 4px; }
.kw-diff-track { width: 32px; height: 4px; background: #F4F4F5; border-radius: 2px; overflow: hidden; }
.kw-diff-fill { height: 100%; border-radius: 2px; width: var(--diff-w, 0%); background: var(--diff-c, #71717A); }
.kw-diff-val { font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace; font-size: 11px; }

/* Row action buttons */
.kw-row-actions { display: flex; gap: 4px; }

/* Toolbar / filters */
.kw-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 24px; flex-wrap: wrap;
}
.kw-toolbar-divider { width: 1px; height: 20px; background: #E4E4E7; }

.kw-filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 24px;
  border-bottom: 1px solid #F4F4F5;
  flex-wrap: wrap;
}
.kw-filter-label { font-size: 11px; color: #71717A; margin-right: 4px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; font-size: 11px; font-weight: 500;
  border: 1px solid #E4E4E7; border-radius: 980px;
  background: #FFFFFF; color: #71717A;
  cursor: pointer; transition: all 120ms ease;
  text-decoration: none;
}
.filter-chip:hover { border-color: #71717A; color: #09090B; }
.filter-chip.active { background: #EEEFFE; border-color: #4951EF; color: #4951EF; }

/* Bulk bar */
.kw-bulk-bar {
  display: none; align-items: center; gap: 8px;
  padding: 8px 24px;
  background: #EEEFFE;
  border-bottom: 1px solid #4951EF;
  font-size: 13px; color: #4951EF; font-weight: 500;
}
.kw-bulk-bar.visible { display: flex; }
.kw-bulk-danger { color: #DC2626; }

/* Pagination */
.kw-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid #E4E4E7;
  font-size: 12px; color: #71717A;
}
.kw-pagination-pager { display: flex; gap: 8px; }

/* Tabs */
.kw-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid #E4E4E7;
  padding: 0 24px;
}
.kw-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  color: #71717A; border: none; background: none;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color 120ms ease;
}
.kw-tab:hover { color: #09090B; }
.kw-tab.active { color: #4951EF; border-bottom-color: #4951EF; }

/* Page header */
.kw-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #E4E4E7;
  background: #FFFFFF;
  position: sticky; top: 0; z-index: 10;
}
.kw-header h1 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.kw-header-actions { display: flex; gap: 8px; }
.kw-file-input { display: none; }

/* Modal overlay */
.kw-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.kw-modal-overlay.visible { opacity: 1; pointer-events: auto; }
.kw-modal {
  background: #FFFFFF; border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,.15);
  padding: 24px; width: 100%; max-width: 480px;
}
.kw-modal h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.kw-modal .form-row { margin-bottom: 12px; }
.kw-modal label { display: block; font-size: 12px; font-weight: 600; color: #71717A; margin-bottom: 4px; }
.kw-modal input, .kw-modal select {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid #E4E4E7;
  border-radius: 10px; font-size: 13px; background: #FFFFFF;
}
.kw-modal input:focus, .kw-modal select:focus {
  outline: none; border-color: #4951EF; box-shadow: 0 0 0 2px #EEEFFE;
}
.kw-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Toast notification */
.kw-toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 10px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 500; z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  transform: translateY(100px); opacity: 0; transition: all .3s ease;
}
.kw-toast.visible { transform: translateY(0); opacity: 1; }
.kw-toast--success { background: #059669; color: #fff; }
.kw-toast--error { background: #DC2626; color: #fff; }
.kw-toast--info { background: #4951EF; color: #fff; }

/* Empty state */
.kw-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px; text-align: center;
}
.kw-empty__title { font-size: 16px; font-weight: 600; color: #09090B; margin-bottom: 8px; }
.kw-empty__desc { font-size: 13px; color: #71717A; max-width: 400px; line-height: 1.6; margin-bottom: 20px; }
.kw-empty__actions { display: flex; gap: 8px; }
