/* ===========================================================================
   GeoTER · Tema das tabelas (Tabulator 6.2)
   ---------------------------------------------------------------------------
   Vale para toda tabela .tabulator do sistema. O complemento em JS
   (wwwroot/js/tabela.js) aplica os padrões e compacta as colunas de ação de
   todas as tabelas, sem precisar mexer em cada tela.

   Princípio: a tabela é neutra. Sem zebra, sem linhas verticais no corpo,
   cabeçalho levemente acinzentado, uma única cor de destaque (o azul das
   séries) reservada para foco, edição e seleção. Os ícones de ação mantêm a
   cor de cada ação (salvar, excluir, mapa...).

   Tooltips e listas de edição são anexados ao <body> pelo Tabulator, fora da
   tabela — por isso o bloco "popups" no fim não começa com .tabulator.
   =========================================================================== */

.tabulator {
    --gt-tab-linha: #eef0f2;        /* divisória entre linhas */
    --gt-tab-cabecalho: #eef1f3;    /* fundo do cabeçalho */
    --gt-tab-cabecalho-linha: #dde2e6; /* divisórias dentro do cabeçalho */
    --gt-tab-hover: #f3f6fa;
    --gt-tab-selecao: #e8f0fb;
    --gt-tab-foco: var(--gt-serie-1);

    border: 1px solid var(--gt-border);
    border-radius: var(--gt-radius);
    background-color: var(--gt-surface);
    font-family: var(--gt-fonte);
    font-size: 13.5px;
    color: var(--gt-ink);
}

/* área sem linhas (tabela curta): branca, não o cinza padrão do tema */
.tabulator .tabulator-tableholder {
    background-color: var(--gt-surface);
}

/* --- cabeçalho ------------------------------------------------------------ */

.tabulator .tabulator-header {
    border-bottom: 1px solid var(--gt-border);
    background-color: var(--gt-tab-cabecalho);
    color: var(--gt-ink-2);
    font-weight: 600;
}

.tabulator .tabulator-header .tabulator-col {
    border-right: 1px solid var(--gt-tab-cabecalho-linha);
    background: var(--gt-tab-cabecalho);
}

.tabulator .tabulator-header .tabulator-col:last-child {
    border-right: 0;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
    padding: 8px 10px 6px;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
    font-size: 12.5px;
    line-height: 1.3;
}

.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols {
    border-top: 1px solid var(--gt-tab-cabecalho-linha);
}

@media (hover: hover) and (pointer: fine) {
    .tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element:hover {
        background-color: #e5e9ec;
    }
}

/* setas de ordenação: discretas; a ativa em tinta */
.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-sorter .tabulator-arrow {
    border-left-width: 4px;
    border-right-width: 4px;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="none"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
    border-bottom: 5px solid #c9ccd0;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
    border-bottom: 5px solid var(--gt-ink-2);
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
    border-top: 5px solid var(--gt-ink-2);
}

/* filtros de coluna: a mesma caixa dos formulários, em tamanho compacto */
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter {
    margin-top: 6px;
}

.tabulator .tabulator-header .tabulator-header-filter input,
.tabulator .tabulator-header .tabulator-header-filter select {
    box-sizing: border-box;
    width: 100%;
    height: 28px;
    padding: 0 8px !important;
    border: 1px solid var(--gt-border) !important;
    border-radius: 6px;
    background: var(--gt-surface);
    color: var(--gt-ink);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 400;
}

.tabulator .tabulator-header .tabulator-header-filter input::placeholder {
    color: #9a9892;
}

.tabulator .tabulator-header .tabulator-header-filter input:focus,
.tabulator .tabulator-header .tabulator-header-filter select:focus {
    outline: none;
    border-color: var(--gt-tab-foco) !important;
    box-shadow: 0 0 0 3px rgba(42, 120, 214, .14);
}

/* filtro preenchido: borda um tom mais forte, para ver quais estão ativos */
.tabulator .tabulator-header .tabulator-header-filter input:not(:placeholder-shown) {
    border-color: rgba(11, 11, 11, .28) !important;
}

/* colunas congeladas: um filete, não a barra dupla do tema padrão */
.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left,
.tabulator .tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-left {
    border-right: 1px solid var(--gt-border);
}

.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right,
.tabulator .tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-right {
    border-left: 1px solid var(--gt-border);
}

/* --- linhas e células ----------------------------------------------------- */

.tabulator .tabulator-row {
    min-height: 36px;
    border-bottom: 1px solid var(--gt-tab-linha);
    background-color: var(--gt-surface);
}

/* sem zebra: a divisória já separa as linhas */
.tabulator .tabulator-row.tabulator-row-even {
    background-color: var(--gt-surface);
}

@media (hover: hover) and (pointer: fine) {
    .tabulator .tabulator-row.tabulator-selectable:hover,
    .tabulator .tabulator-row:hover {
        background-color: var(--gt-tab-hover);
        cursor: default;
    }
}

.tabulator .tabulator-row.tabulator-selected {
    background-color: var(--gt-tab-selecao);
}

.tabulator .tabulator-row .tabulator-cell {
    padding: 8px 10px;
    border-right: 0;
    line-height: 1.35;
}

/* edição: só a borda de foco, o conteúdo continua legível */
.tabulator .tabulator-row .tabulator-cell.tabulator-editing {
    padding: 0;
    border: 1px solid var(--gt-tab-foco);
    border-radius: 4px;
    box-shadow: 0 0 0 3px rgba(42, 120, 214, .14);
    background: var(--gt-surface);
}

.tabulator .tabulator-row .tabulator-cell.tabulator-editing input,
.tabulator .tabulator-row .tabulator-cell.tabulator-editing select,
.tabulator .tabulator-row .tabulator-cell.tabulator-editing textarea {
    padding: 7px 9px !important;
    font-family: inherit;
    font-size: inherit;
    color: var(--gt-ink);
}

.tabulator .tabulator-row .tabulator-cell.tabulator-validation-fail {
    border: 1px solid var(--gt-danger);
    border-radius: 4px;
}

.tabulator .tabulator-row .tabulator-cell.tabulator-validation-fail input,
.tabulator .tabulator-row .tabulator-cell.tabulator-validation-fail select {
    color: var(--gt-danger);
}

/* --- ações por linha ------------------------------------------------------
   Gerados por GtTabela.acao() (wwwroot/js/tabela.js). Cada ação tem sua cor
   fixa — azul salva, vermelho exclui, verde abre o mapa —; o hover só
   acrescenta um fundo suave do mesmo tom. */
.gt-tabela__acao.material-icons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 18px;
    color: var(--gt-ink-2);
    cursor: pointer;
    transition: background-color .12s ease;
}

.gt-tabela__acao--primaria.material-icons {
    color: var(--gt-serie-1);
}

.gt-tabela__acao--perigo.material-icons {
    color: var(--gt-danger);
}

.gt-tabela__acao--sucesso.material-icons {
    color: #2e8b3e;
}

/* Telas que montam o próprio ícone colorido ('<span class="material-icons"
   style="color:red">delete</span>') recebem o mesmo tamanho e caixa; a cor
   inline de cada tela é mantida. */
.tabulator .tabulator-cell.gt-tabela__col-acao .material-icons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 18px;
    vertical-align: middle;
    cursor: pointer;
    transition: background-color .12s ease;
}

.tabulator .tabulator-cell.gt-tabela__col-acao:hover .material-icons {
    background: #eef1f3;
}

.tabulator .tabulator-cell:hover .gt-tabela__acao {
    background: #eef1f3;
}

.tabulator .tabulator-cell:hover .gt-tabela__acao--primaria {
    background: #e8f0fb;
}

.tabulator .tabulator-cell:hover .gt-tabela__acao--perigo {
    background: #fdf1f1;
}

.tabulator .tabulator-cell:hover .gt-tabela__acao--sucesso {
    background: #ecf6ee;
}

/* colunas de ação: centralizadas, sem preenchimento lateral sobrando */
.tabulator .tabulator-cell.gt-tabela__col-acao {
    padding: 4px 2px;
    text-align: center;
}

/* sem título, as colunas de ícone leem como um bloco: sem divisória entre elas */
.tabulator .tabulator-header .tabulator-col.gt-tabela__col-acao {
    border-right-color: transparent;
}

.tabulator .tabulator-col.gt-tabela__col-acao .tabulator-col-content {
    padding-left: 2px;
    padding-right: 2px;
    text-align: center;
}

/* --- rodapé e paginação --------------------------------------------------- */

.tabulator .tabulator-footer {
    border-top: 1px solid var(--gt-border);
    background-color: var(--gt-surface);
    color: var(--gt-ink-2);
    font-weight: 400;
    font-size: 13px;
}

.tabulator .tabulator-footer .tabulator-footer-contents {
    padding: 8px 12px;
}

.tabulator .tabulator-footer .tabulator-paginator {
    color: var(--gt-ink-2);
}

.tabulator .tabulator-footer .tabulator-paginator label {
    margin-right: 6px;
    color: var(--gt-ink-muted);
}

.tabulator .tabulator-footer .tabulator-page-size {
    height: 28px;
    margin-right: 12px;
    padding: 0 6px;
    border: 1px solid var(--gt-border);
    border-radius: 6px;
    background: var(--gt-surface);
    font-family: inherit;
    font-size: 12.5px;
    color: var(--gt-ink);
}

.tabulator .tabulator-footer .tabulator-page {
    min-width: 30px;
    height: 28px;
    margin: 0 1px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-family: inherit;
    font-size: 12.5px;
    color: var(--gt-ink-2);
}

@media (hover: hover) and (pointer: fine) {
    .tabulator .tabulator-footer .tabulator-page:not(:disabled):hover {
        background: var(--gt-plane);
        color: var(--gt-ink);
        cursor: pointer;
    }
}

/* página atual: peso e um fundo neutro, não o vermelho do tema padrão */
.tabulator .tabulator-footer .tabulator-page.active {
    background: #e9edf0;
    color: var(--gt-ink);
    font-weight: 600;
}

.tabulator .tabulator-footer .tabulator-page:disabled {
    opacity: .4;
}

.tabulator .tabulator-footer .tabulator-page-counter {
    color: var(--gt-ink-muted);
}

/* --- vazio e carregando --------------------------------------------------- */

.tabulator .tabulator-placeholder .tabulator-placeholder-contents {
    padding: 28px 16px;
    color: var(--gt-ink-muted);
    font-size: 13.5px;
    font-weight: 400;
}

.tabulator .tabulator-alert {
    background: rgba(255, 255, 255, .72);
}

.tabulator .tabulator-alert .tabulator-alert-msg {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid var(--gt-border);
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(11, 11, 11, .08);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--gt-ink-2);
}

.tabulator .tabulator-alert .tabulator-alert-msg.tabulator-alert-state-error {
    border-color: rgba(208, 59, 59, .35);
    color: var(--gt-danger);
}

.gt-tabela__carregando {
    width: 16px;
    height: 16px;
    border: 2px solid #dfe3e7;
    border-top-color: var(--gt-ink-2);
    border-radius: 50%;
    animation: gt-girar .8s linear infinite;
}

@keyframes gt-girar {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gt-tabela__carregando {
        animation-duration: 2.4s;
    }
}

/* --- popups (globais: o Tabulator os anexa ao <body>) --------------------- */

.tabulator-popup-container {
    border: 1px solid var(--gt-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(11, 11, 11, .12);
    font-family: var(--gt-fonte);
    font-size: 13px;
}

.tabulator-popup-container.tabulator-tooltip {
    max-width: min(420px, 100%);
    padding: 7px 10px;
    border-radius: 6px;
    background: var(--gt-ink);
    border-color: transparent;
    color: #fff;
    font-size: 12.5px;
    line-height: 1.4;
}

.tabulator-edit-list {
    padding: 4px;
    font-size: 13px;
}

.tabulator-edit-list .tabulator-edit-list-item {
    padding: 6px 8px;
    border-radius: 5px;
    color: var(--gt-ink);
}

@media (hover: hover) and (pointer: fine) {
    .tabulator-edit-list .tabulator-edit-list-item:hover {
        background: var(--gt-plane);
        color: var(--gt-ink);
    }
}

.tabulator-edit-list .tabulator-edit-list-item.active {
    background: #e8f0fb;
    color: var(--gt-ink);
}

.tabulator-edit-list .tabulator-edit-list-item.focused {
    outline: 1px solid var(--gt-serie-1);
}

.tabulator-edit-list .tabulator-edit-list-notice {
    padding: 8px;
    color: var(--gt-ink-muted);
}
