/* ── List page layout ───────────────────────────────────────────────────── */
.list-page {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
  box-sizing: border-box;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}

.toolbar__title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  white-space: nowrap;
}

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── Search ─────────────────────────────────────────────────────────────── */
.list-search {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 var(--sp-2);
  height: 36px;
}

.list-search__icon {
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.list-search__input {
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--text-sm);
  color: var(--text-primary);
  width: 180px;
}

.list-search__clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 0 2px;
  line-height: 1;
}

.list-search__clear:hover { color: var(--text-primary); }

/* ── Filter bar ─────────────────────────────────────────────────────────── */
.list-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-4);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.list-filter__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.list-filter__label {
  font-size: var(--text-sm);
  color: var(--text-label);
  white-space: nowrap;
}

.list-filter__select,
.list-filter__input {
  height: 32px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
}

.list-filter__select:focus,
.list-filter__input:focus {
  border-color: var(--border-focus);
}

/* ── Table container ────────────────────────────────────────────────────── */
.list-table-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  overflow-y: visible;
  box-shadow: var(--shadow-xs);
  width: 100%;
  box-sizing: border-box;
  flex: 1 1 auto;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.list-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-4);
  color: var(--text-muted);
  gap: var(--sp-2);
}

.list-empty-state .material-symbols-outlined {
  font-size: 48px;
  opacity: 0.4;
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  background-color: var(--bg-card);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.list-pagination__controls {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.list-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: background-color var(--transition-fast);
}

.list-pagination__btn:hover:not(:disabled) {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.list-pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.list-pagination__btn.active {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Table (list-table / list-row / sortable-th) ────────────────────────── */
.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.list-row {
  transition: background-color var(--transition-fast);
}

.list-row:hover {
  background-color: var(--table-row-hover);
}

.list-row:nth-child(even) {
  background-color: var(--table-row-alt-bg);
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
}

.sortable-th:hover {
  background-color: var(--table-row-hover);
}

.sort-icon {
  font-size: 16px;
  color: var(--text-muted);
  vertical-align: middle;
  opacity: 0.5;
}

.sort-icon--active {
  opacity: 1;
  color: var(--primary);
}

/* ── Action column: see app_shell.css ───────────────────────────────────── */

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: none;
  color: var(--text-muted);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-icon:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.btn-icon--edit .material-symbols-outlined {
  font-size: 18px;
}

/* ── Badge ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

.badge--success {
  background-color: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}

.badge--warning {
  background-color: color-mix(in srgb, var(--warning) 15%, transparent);
  color: var(--warning);
}

.badge--muted {
  background-color: color-mix(in srgb, var(--text-muted) 15%, transparent);
  color: var(--text-muted);
}

.badge--draft {
  background-color: color-mix(in srgb, var(--info) 15%, transparent);
  color: var(--info);
}

.badge--default {
  background-color: color-mix(in srgb, var(--border) 30%, transparent);
  color: var(--text-secondary);
}

/* ── Footer / count ─────────────────────────────────────────────────────── */
.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border);
  background-color: var(--bg-card);
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.list-footer__count {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── Empty cell (no-results inside table) ───────────────────────────────── */
.list-empty-cell {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-muted);
}

.list-empty-cell .material-symbols-outlined {
  font-size: 36px;
  display: block;
  margin: 0 auto var(--sp-2);
  opacity: 0.4;
}

/* ── Legacy ─────────────────────────────────────────────────────────────── */
.list_field_container {
  /* Reuse a common container class */
  /* Add any specific overrides if necessary */
  margin: 0.5rem;
  min-height: 0;
}

.list_field {
  /* Reuse a common input field class */

  height: 2rem; /* Specific override */
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid grey;
  box-sizing: border-box;
}
