/**
 * skargrid - Estilos básicos
 */

:root {
  --sg-primary: #003E6F; /* marca */
  --sg-accent: #007ACC; /* marca */
  --sg-accent-rgb: 0,122,204; /* para rgba() */
  --sg-gray: #444444;
  --sg-white: #FFFFFF;
  /* header background and text tokens - can be overridden by themes */
  --sg-thead-bg: #f8f9fa;
  --sg-thead-color: #495057;
}

.skargrid {
  width: 100%;
  min-width: max-content; /* Garante que a tabela não encolha */
  border-collapse: collapse;
  /* Use automatic table layout so column widths follow content and allow
    horizontal scrolling when needed. Fixed layout caused clipping/overlap
    in some responsive scenarios. */
  table-layout: auto;
  background-color: var(--sg-white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
}

.skargrid thead {
  /* Use CSS variables so theme variants can override header background/text.
     This ensures sticky header cells have a solid background even when
     positioned (sticky/fixed). */
  background-color: var(--sg-thead-bg);
  border-bottom: 2px solid #dee2e6;
}

.skargrid thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--sg-thead-color);
  font-size: 12px;
  letter-spacing: 0.5px;
  /* Make header cells stick to the top of the scrollable table container
     so vertical scrolling affects only the rows. Using `position: sticky`
     keeps the header aligned with the columns during horizontal scroll. */
  position: sticky;
  top: 0;
  z-index: 5;
  /* Ensure a solid background when sticking; prefer explicit token over
     inherit to avoid transparent behavior in some layouts. */
  background-color: var(--sg-thead-bg);
  user-select: none;
}

/* Ensure only the header text label is uppercased; avoid inheriting uppercase
   into other elements or into the body. */
.skargrid thead th .th-text {
  /* Keep header titles in their provided case by default. If you prefer
     uppercase, set this to 'uppercase' in your custom theme. */
  text-transform: none;
}

/* Force normal case for body cells in case other global styles apply */
.skargrid tbody td {
  text-transform: none;
}

/* Colunas ordenáveis */
.skargrid thead th.sortable {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.skargrid thead th.sortable:hover {
  background-color: #e9ecef;
}

.skargrid thead th.sortable.sorted {
  background-color: #e7f1ff;
  color: var(--sg-accent);
}

/* Container do conteúdo do cabeçalho */
.skargrid thead th .th-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}

.skargrid thead th .th-text-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.skargrid thead th .th-text {
  flex: 1;
  min-width: 0;
}

/* Prevent cells from overflowing into adjacent columns. Clip long text
   with ellipsis and keep a single line per cell. Horizontal scrollbar
   will appear on the container when table exceeds available width. */
.skargrid thead th .th-text,
.skargrid tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ícone de ordenação */
.skargrid thead th .sort-icon {
  font-size: 10px;
  color: #adb5bd;
  transition: color 0.2s ease;
  flex-shrink: 0;
  opacity: 0.6;
}

.skargrid thead th.sortable:hover .sort-icon {
  opacity: 1;
  color: #6c757d;
}

.skargrid thead th.sortable.sorted .sort-icon {
  opacity: 1;
  color: var(--sg-accent);
  font-size: 11px;
}

/* Botão de filtro no header */
.th-filter-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
  color: #6c757d;
}

.th-filter-btn:hover {
  background-color: rgba(var(--sg-accent-rgb), 0.08);
  color: var(--sg-accent);
}

.th-filter-btn.has-filter {
  color: var(--sg-accent);
  background-color: rgba(var(--sg-accent-rgb), 0.08);
}

.th-filter-btn svg {
  display: block;
}

.th-filter-btn .filter-count {
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--sg-accent);
  color: white;
  font-size: 9px;
  font-weight: 600;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* === Dropdown de Filtro === */
.skargrid-filter-dropdown {
  position: fixed;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  min-width: 250px;
  max-width: 320px;
  width: 280px;
  animation: dropdownFadeIn 0.2s ease;
  box-sizing: border-box;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid #dee2e6;
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  word-break: break-word;
}

/* Campo de busca interno do filtro */
.filter-search-wrapper {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f3f5;
  box-sizing: border-box;
}

.filter-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.filter-search-input:focus {
  border-color: var(--sg-accent);
  box-shadow: 0 0 0 2px rgba(var(--sg-accent-rgb), 0.08);
}

/* Select All */
.filter-select-all {
  padding: 10px 16px;
  border-bottom: 1px solid #f1f3f5;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #f8f9fa;
  font-weight: 500;
  font-size: 13px;
}

.filter-select-all input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--sg-accent);
}

.filter-select-all label {
  cursor: pointer;
  user-select: none;
  color: #495057;
}

/* Lista de checkboxes com scroll */
.filter-list-wrapper {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 0;
}

/* Default browser scrollbar retained for .filter-list-wrapper */

.filter-list-item {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s ease;
}

.filter-list-item:hover {
  background-color: #f8f9fa;
}

/* Item desabilitado (não disponível com filtros atuais) */
.filter-list-item.filter-item-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.filter-list-item.filter-item-disabled:hover {
  background-color: transparent;
}

.filter-list-item.filter-item-disabled label {
  cursor: not-allowed;
  color: #adb5bd;
}

.filter-list-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--sg-accent);
  flex-shrink: 0;
}

.filter-list-item input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.filter-list-item label {
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: #495057;
  flex: 1;
}

/* Input filter (para text/number/date) */
.filter-input-wrapper {
  padding: 16px;
  box-sizing: border-box;
}

.filter-dropdown-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.filter-dropdown-input:focus {
  border-color: var(--sg-accent);
  box-shadow: 0 0 0 2px rgba(var(--sg-accent-rgb), 0.08);
}

/* Footer com botões */
.filter-dropdown-footer {
  padding: 12px 16px;
  border-top: 1px solid #dee2e6;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background-color: #f8f9fa;
  border-radius: 0 0 8px 8px;
}

.filter-btn-clear,
.filter-btn-apply {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn-clear {
  background-color: #e9ecef;
  color: #495057;
}

.filter-btn-clear:hover {
  background-color: #dee2e6;
}

.filter-btn-apply {
  background-color: var(--sg-accent);
  color: white;
}

.filter-btn-apply:hover {
  background-color: rgba(var(--sg-accent-rgb), .9);
}

/* Coluna de seleção */
.skargrid thead th.skargrid-select-header,
.skargrid tbody td.skargrid-select-cell {
  width: 40px;
  text-align: center;
  padding: 12px 8px;
}

/* Checkbox customizado */
.skargrid-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--sg-accent);
}

.skargrid tbody tr {
  border-bottom: 1px solid #dee2e6;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.skargrid tbody tr:hover {
  background-color: #f8f9fa;
}

.skargrid tbody tr.selected {
  background-color: #e7f1ff;
  box-shadow: inset 3px 0 0 var(--sg-accent);
}

.skargrid tbody tr.selected:hover {
  background-color: #d0e7ff;
}

.skargrid tbody tr:last-child {
  border-bottom: none;
}

.skargrid tbody td {
  padding: 12px 16px;
  color: #212529;
}

/* Container da tabela */
.skargrid-container {
  overflow-x: auto;
  margin: 20px 0;
}

/* Wrapper da tabela com paginação */
.skargrid-wrapper {
  background-color: var(--sg-white);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  /* Fill the host container when it has an explicit height so the inner
     table container can scroll internally instead of expanding the page. */
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* === Busca Global === */
.skargrid-search-container {
  padding: 16px 20px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.skargrid-search-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.skargrid-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 450px;
}

.skargrid-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  pointer-events: none;
  display: flex;
  align-items: center;
  z-index: 1;
}

.skargrid-search-icon svg {
  display: block;
}

.skargrid-search-input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 14px;
  color: var(--sg-gray);
  background-color: var(--sg-white);
  transition: all 0.2s ease;
  outline: none;
  font-family: inherit;
}

.skargrid-search-input:focus {
  border-color: var(--sg-accent);
  box-shadow: 0 0 0 3px rgba(var(--sg-accent-rgb), 0.08);
}

.skargrid-search-input::placeholder {
  color: #adb5bd;
}

.skargrid-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.skargrid-search-clear:hover {
  background-color: #e9ecef;
  color: var(--sg-gray);
}

/* Botão Limpar Filtros */
.skargrid-clear-filters-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background-color: var(--sg-white);
  border: 1px solid #dee2e6;
  border-radius: 6px;
  color: #6c757d;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  flex-shrink: 0;
  min-width: fit-content;
}

.skargrid-clear-filters-btn:hover {
  background-color: #f8f9fa;
  border-color: #adb5bd;
  color: #495057;
}

.skargrid-clear-filters-btn.has-filters {
  background-color: var(--sg-accent);
  border-color: var(--sg-accent);
  color: white;
}

/* ensure has-filters hover keeps contrast and isn't overridden by general hover */
.skargrid-clear-filters-btn.has-filters:hover,
.skargrid-clear-filters-btn.has-filters:focus {
  background-color: rgba(var(--sg-accent-rgb), 0.85);
  border-color: rgba(var(--sg-accent-rgb), 0.85);
  color: white;
}

.skargrid-clear-filters-btn svg {
  display: block;
  flex-shrink: 0;
}

.skargrid-clear-filters-btn .filter-count-badge {
  background-color: white;
  color: var(--sg-accent);
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.skargrid-clear-filters-btn:not(.has-filters) .filter-count-badge {
  background-color: var(--sg-accent);
  color: white;
}

/* Paginação */
.skargrid-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid #dee2e6;
  flex-wrap: wrap;
  gap: 12px;
}

.skargrid-pagination-info {
  color: #6c757d;
  font-size: 14px;
  font-weight: 500;
}

.skargrid-pagination-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.skargrid-pagination-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid #dee2e6;
  background-color: var(--sg-white);
  color: var(--sg-gray);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.skargrid-pagination-btn:hover:not(:disabled) {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

.skargrid-pagination-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  background-color: #f8f9fa;
}

.skargrid-pagination-btn.active {
  background-color: var(--sg-accent);
  color: #ffffff;
  border-color: var(--sg-accent);
}

.skargrid-pagination-btn.active:hover {
  background-color: rgba(var(--sg-accent-rgb), 0.75);
  border-color: rgba(var(--sg-accent-rgb), 0.75);
  color: #ffffff;
}

.skargrid-pagination-ellipsis {
  padding: 0 8px;
  color: #6c757d;
  font-weight: 500;
}

.skargrid-page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6c757d;
  font-size: 14px;
}

.skargrid-page-size-select {
  padding: 6px 12px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background-color: #ffffff;
  color: #495057;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.skargrid-page-size-select:hover {
  border-color: #adb5bd;
}
.skargrid-page-size-select:focus {
  outline: none;
  border-color: var(--sg-accent);
  box-shadow: 0 0 0 3px rgba(var(--sg-accent-rgb), 0.08);
}
/* === Loading Overlay === */
.skargrid-table-container {
  position: relative;
  min-height: 200px;
  overflow-x: auto;
  /* enable internal vertical scrolling so the table respects host height */
  overflow-y: auto;
  max-height: 100%;
}

/* Estilização do scroll horizontal */
/* Default browser scrollbar retained for .skargrid-table-container */

.skargrid-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  background-color: var(--sg-accent);
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}

.skargrid-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--sg-accent);
}

.skargrid-spinner svg {
  color: var(--sg-accent);
}

.skargrid-spinner span {
  font-size: 14px;
  font-weight: 500;
  color: #495057;
}

.skargrid-wrapper {
  position: relative;
}

/* Responsividade */
@media screen and (max-width: 768px) {
  .skargrid {
    font-size: 12px;
  }

  .skargrid thead th,
  .skargrid tbody td {
    padding: 8px 12px;
  }

  .skargrid-pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .skargrid-pagination-info,
  .skargrid-pagination-controls,
  .skargrid-page-size {
    justify-content: center;
  }

  .skargrid-pagination-btn {
    min-width: 32px;
    height: 32px;
    font-size: 13px;
  }
}

/* ============================================
   DARK THEME
   ============================================ */

.skargrid-wrapper.skargrid-dark {
  background-color: #1e1e1e;
  color: #e0e0e0;
  /* dark theme overrides for header tokens to avoid transparent/white header */
  --sg-thead-bg: #252525;
  --sg-thead-color: #b0b0b0;
}

/* Tabela dark */
.skargrid-wrapper.skargrid-dark .skargrid {
  background-color: #2d2d2d;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  color: #e0e0e0;
}

/* Cabeçalho dark */
.skargrid-wrapper.skargrid-dark .skargrid thead {
  background-color: #252525;
  border-bottom: 2px solid #404040;
}

.skargrid-wrapper.skargrid-dark .skargrid thead th {
  color: #b0b0b0;
}

.skargrid-wrapper.skargrid-dark .skargrid thead th.sortable:hover {
  background-color: #2f2f2f;
}

.skargrid-wrapper.skargrid-dark .skargrid thead th.sortable.sorted {
  background-color: #1a3a52;
  color: var(--sg-accent);
}

/* Linhas dark */
.skargrid-wrapper.skargrid-dark .skargrid tbody tr {
  border-bottom: 1px solid #404040;
}

.skargrid-wrapper.skargrid-dark .skargrid tbody tr:hover {
  background-color: #353535;
}

.skargrid-wrapper.skargrid-dark .skargrid tbody tr.selected {
  background-color: #1a3a52;
}

.skargrid-wrapper.skargrid-dark .skargrid tbody td {
  color: #e0e0e0;
}

/* Busca dark */
.skargrid-wrapper.skargrid-dark .skargrid-search-container {
  background-color: #2d2d2d;
  border-bottom: 1px solid #404040;
}

.skargrid-wrapper.skargrid-dark .skargrid-search-input {
  background-color: #252525;
  border: 1px solid #404040;
  color: #e0e0e0;
}

.skargrid-wrapper.skargrid-dark .skargrid-search-input::placeholder {
  color: #707070;
}

.skargrid-wrapper.skargrid-dark .skargrid-search-input:focus {
  border-color: var(--sg-accent);
}

.skargrid-wrapper.skargrid-dark .skargrid-search-icon {
  color: #707070;
}

.skargrid-wrapper.skargrid-dark .skargrid-search-clear {
  color: #707070;
}

.skargrid-wrapper.skargrid-dark .skargrid-search-clear:hover {
  color: #e0e0e0;
}

/* Filtros dark */
.skargrid-wrapper.skargrid-dark .skargrid-filter-dropdown {
  background-color: #252525;
  border: 1px solid #404040;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.skargrid-wrapper.skargrid-dark .skargrid-filter-search {
  background-color: #2d2d2d;
  border: 1px solid #404040;
  color: #e0e0e0;
}

.skargrid-wrapper.skargrid-dark .skargrid-filter-search::placeholder {
  color: #707070;
}

.skargrid-wrapper.skargrid-dark .skargrid-filter-item {
  color: #e0e0e0;
}

.skargrid-wrapper.skargrid-dark .skargrid-filter-item:hover {
  background-color: #353535;
}

.skargrid-wrapper.skargrid-dark .skargrid-filter-item.disabled {
  color: #505050;
  background-color: #1e1e1e;
}

.skargrid-wrapper.skargrid-dark .skargrid-filter-item input[type="checkbox"]:disabled {
  opacity: 0.3;
}

.skargrid-wrapper.skargrid-dark .skargrid-clear-filters-btn {
  background-color: #252525;
  color: #e0e0e0;
  border: 1px solid #404040;
}

.skargrid-wrapper.skargrid-dark .skargrid-clear-filters-btn:hover {
  background-color: #353535;
  border-color: var(--sg-accent);
}

/* Paginação dark */
.skargrid-wrapper.skargrid-dark .skargrid-pagination {
  background-color: #2d2d2d;
  border-top: 1px solid #404040;
}

.skargrid-wrapper.skargrid-dark .skargrid-pagination-info {
  color: #b0b0b0;
}

.skargrid-wrapper.skargrid-dark .skargrid-pagination-btn {
  background-color: #252525;
  color: #e0e0e0;
  border: 1px solid #404040;
}

.skargrid-wrapper.skargrid-dark .skargrid-pagination-btn:hover:not(:disabled) {
  background-color: #353535;
  border-color: var(--sg-accent);
}

.skargrid-wrapper.skargrid-dark .skargrid-pagination-btn:disabled {
  background-color: #1e1e1e;
  color: #505050;
  border-color: #303030;
}

.skargrid-wrapper.skargrid-dark .skargrid-pagination-btn.active {
  background-color: #1a3a52;
  color: var(--sg-accent);
  border-color: var(--sg-accent);
}

.skargrid-wrapper.skargrid-dark .skargrid-page-size select {
  background-color: #252525;
  color: #e0e0e0;
  border: 1px solid #404040;
}

.skargrid-wrapper.skargrid-dark .skargrid-page-size select:hover {
  border-color: var(--sg-accent);
}

/* Checkbox dark */
.skargrid-wrapper.skargrid-dark .skargrid-checkbox {
  border: 2px solid #505050;
}

.skargrid-wrapper.skargrid-dark .skargrid-checkbox:checked {
  background-color: var(--sg-accent);
  border-color: var(--sg-accent);
}

/* Loading dark */
.skargrid-wrapper.skargrid-dark .skargrid-loading-overlay {
  background-color: rgba(30, 30, 30, 0.85);
}

.skargrid-wrapper.skargrid-dark .skargrid-spinner {
  border-color: #404040;
  border-top-color: var(--sg-accent);
}

/* Default browser scrollbar in dark theme (no custom styling) */

/* ============================================
   CONFIGURAÇÃO DE COLUNAS
   ============================================ */

/* Modal de configuração */
.skargrid-column-config-modal {
  position: absolute;
  top: 50px;
  right: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #dee2e6;
  width: 380px;
  max-height: 550px;
  overflow: hidden;
  z-index: 1000;
  animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.skargrid-config-header {
  background: white;
  color: #495057;
  padding: 16px;
  border-bottom: 1px solid #dee2e6;
}

.skargrid-config-header h3 {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  color: #212529;
}

.skargrid-config-header p {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: #6c757d;
}

.skargrid-config-header-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.skargrid-config-action-btn {
  padding: 6px 14px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  color: #495057;
}

.skargrid-config-action-btn:hover {
  background: #f8f9fa;
}
/* corrected selector name below */
.skargrid-config-move-btn:hover:not(:disabled) {
  background: var(--sg-accent);
  color: white;
  border-color: var(--sg-accent);
  transform: scale(1.1);
}

.skargrid-config-action-btn-primary {
  background: var(--sg-accent);
  color: white;
  border-color: var(--sg-accent);
}

.skargrid-config-action-btn-primary:hover {
  background: rgba(var(--sg-accent-rgb), 0.9);
  border-color: rgba(var(--sg-accent-rgb), 0.9);
}

.skargrid-config-list {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

.skargrid-config-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.2s ease;
  cursor: move;
}

.skargrid-config-item:hover {
  background-color: #f8f9fa;
}

.skargrid-config-item.dragging {
  opacity: 0.5;
  background-color: #e7f3ff;
}

.skargrid-config-item:last-child {
  border-bottom: none;
}

.skargrid-drag-handle {
  color: #adb5bd;
  font-size: 14px;
  cursor: grab;
  user-select: none;
  line-height: 1;
  padding: 4px;
}

.skargrid-drag-handle:active {
  cursor: grabbing;
}

.skargrid-config-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--sg-accent);
}

/* ensure checkboxes inside column config modal use the skargrid-checkbox styles */
.skargrid-config-item .skargrid-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--sg-accent);
  flex-shrink: 0;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-item .skargrid-checkbox:checked {
  background-color: var(--sg-accent);
  border-color: var(--sg-accent);
}

.skargrid-config-item label {
  flex: 1;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  user-select: none;
}

.skargrid-config-move-btn {
  background: #e9ecef;
  border: 1px solid #dee2e6;
  color: #495057;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skargid-config-move-btn:hover:not(:disabled) {
  background: var(--sg-accent);
  color: white;
  border-color: var(--sg-accent);
  transform: scale(1.1);
}

.skargrid-config-move-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.skargrid-config-move-btn:active:not(:disabled) {
  transform: scale(0.95);
}

/* Footer com botões de ação */
.skargrid-config-footer {
  display: flex;
  gap: 10px;
  padding: 16px;
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  border-radius: 0 0 12px 12px;
  justify-content: space-between;
  align-items: center;
}

.skargrid-config-footer-actions {
  display: flex;
  gap: 8px;
}

.skargrid-config-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.skargrid-config-btn-primary {
  background: var(--sg-accent);
  color: white;
  box-shadow: 0 2px 4px rgba(var(--sg-accent-rgb), 0.25);
}

.skargrid-config-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(var(--sg-accent-rgb), 0.32);
}

.skargrid-config-btn-secondary {
  background: white;
  color: #495057;
  border: 1px solid #dee2e6;
}

.skargrid-config-btn-secondary:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.skargrid-config-btn:active {
  transform: translateY(0);
}

/* Dark theme para configuração */
.skargrid-wrapper.skargrid-dark .skargrid-column-config-modal {
  background: #2d2d2d;
  border-color: #404040;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.skargrid-wrapper.skargrid-dark .skargrid-config-header {
  background: #2d2d2d;
  border-bottom-color: #404040;
  color: #e0e0e0;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-header h3 {
  color: #e0e0e0;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-header p {
  color: #a0a0a0;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-action-btn {
  background: #353535;
  color: #e0e0e0;
  border-color: #505050;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-action-btn:hover {
  background: #404040;
  border-color: #606060;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-action-btn-primary {
  background: var(--sg-accent);
  color: white;
  border-color: var(--sg-accent);
}

.skargrid-wrapper.skargrid-dark .skargrid-config-action-btn-primary:hover {
  background: rgba(var(--sg-accent-rgb), 0.85);
  border-color: rgba(var(--sg-accent-rgb), 0.85);
}

.skargrid-wrapper.skargrid-dark .skargrid-config-item {
  border-bottom-color: #404040;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-item:hover {
  background-color: #353535;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-item.dragging {
  background-color: #2a4a6a;
}

.skargrid-wrapper.skargrid-dark .skargrid-drag-handle {
  color: #6c757d;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-item label {
  color: #e0e0e0;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-move-btn {
  background: #353535;
  border-color: #505050;
  color: #e0e0e0;
}

.skargrid-wrapper.skargrid-dark .skargrid-config-move-btn:hover:not(:disabled) {
  background: var(--sg-accent);
  border-color: var(--sg-accent);
}
