/* ==========================================================================
   GPS Design System — Overrides Bootstrap 4
   --------------------------------------------------------------------------
   Escopo: .btn*, .form-control/select/textarea, label, legend, .card/.card-box, .alert, .modal-content, .dropdown-menu, .nav-tabs, .radio label. NAO redefinir .table nem .badge-* (34 templates geram PDF rasterizando o DOM vivo).
   Risco: ALTO — global. Passo 5.

REGRAS DE ESPECIFICIDADE (valem para todos os arquivos gps-*.css)
   --------------------------------------------------------------------------
   1. Todo seletor GPS comeca com `body.gps-theme` -> (0,2,1). Isso ganha de
      qualquer regra de uma classe do Adminox (0,1,0) e empata-ou-ganha das
      `.a .b` (0,2,0), vencendo o empate pela ordem de carga.
   2. Onde o Adminox for mais forte, SOMAR UM QUALIFICADOR semanticamente
      verdadeiro, nunca `!important`.
   3. `!important` SO em gps-shell.css. Este arquivo tem ZERO.
   4. Sem `@layer`, sem `:where()`/`:is()`.
   5. `:focus-visible`, nunca `:focus`, para o outline do DS.
   6. NAO brigar com as utilities do Bootstrap (`.text-*`, `.bg-*`, `.m-*`).
   7. Os 1.492 `style=""` inline continuam autoritativos.
   ========================================================================== */

/* ==========================================================================
   1. Botoes
   --------------------------------------------------------------------------
   TRES FALHAS DE CONTRASTE VIVAS no tema atual, todas com texto branco:
       .btn-primary  #93c47d -> 2,01:1   (149 usos)
       .btn-warning  #ffa91c -> 1,92:1   ( 73 usos)
       .btn-danger   #f96a74 -> 2,86:1   ( 35 usos)
   O minimo AA para texto e 4,5:1. A paleta do DS resolve as tres.

   DESVIO DELIBERADO DO PLANO — `.btn-primary` vai para o AZUL, nao o verde:
   o plano previa #4E7A46, mas os dados dizem o contrario. Dos 149 usos de
   .btn-primary apenas 55 sao submit, e 15+ telas tem mais de um (ate 13 em
   ciat/porques_ciat.html). Pintar tudo de verde violaria as duas regras
   inegociaveis do DS -- 2.1 (verde SO em acao positiva) e 2.2 (no maximo um
   primario verde por tela, severidade alta) -- para consertar a 10.1.
   O azul solido e variante legitima do DS (components.md) e da 5,42:1.
   O verde continua reservado: entra por classe opt-in na UNICA acao positiva
   de cada tela, via .gps-form__footer no piloto C.
   ========================================================================== */

body.gps-theme .btn {
    border-radius: var(--gps-radius-md);
    font-size: 13.5px;
    padding: 0.5rem 0.9rem;
    line-height: 1.3;
}

body.gps-theme .btn-lg {
    font-size: 14.5px;
    padding: 0.65rem 1.2rem;
}

body.gps-theme .btn-sm {
    font-size: 12.5px;
    padding: 0.35rem 0.7rem;
}

/* Azul solido — acao generica//navegacao. 5,42:1 com branco. */
body.gps-theme .btn-primary {
    background-color: var(--gps-blue);
    border-color: var(--gps-blue);
    color: #fff;
}

body.gps-theme .btn-primary:hover,
body.gps-theme .btn-primary:focus,
body.gps-theme .btn-primary:active,
body.gps-theme .btn-primary:not(:disabled):not(.disabled):active {
    background-color: var(--gps-blue-hover);
    border-color: var(--gps-blue-hover);
    color: #fff;
}

/* Secundario do DS: branco, borda #8C93A0, texto escuro. */
body.gps-theme .btn-secondary {
    background-color: var(--gps-card);
    border-color: var(--gps-border-input);
    color: var(--gps-text);
}

body.gps-theme .btn-secondary:hover,
body.gps-theme .btn-secondary:focus,
body.gps-theme .btn-secondary:active,
body.gps-theme .btn-secondary:not(:disabled):not(.disabled):active {
    background-color: var(--gps-surface);
    border-color: var(--gps-border-input);
    color: var(--gps-text);
}

/* Verde — acao positiva. 5,00:1. */
body.gps-theme .btn-success {
    background-color: var(--gps-green);
    border-color: var(--gps-green);
    color: #fff;
}

body.gps-theme .btn-success:hover,
body.gps-theme .btn-success:focus,
body.gps-theme .btn-success:active,
body.gps-theme .btn-success:not(:disabled):not(.disabled):active {
    background-color: var(--gps-green-hover);
    border-color: var(--gps-green-hover);
    color: #fff;
}

/* Vermelho — destrutivo/recusa. 6,54:1. */
body.gps-theme .btn-danger {
    background-color: var(--gps-red);
    border-color: var(--gps-red);
    color: #fff;
}

body.gps-theme .btn-danger:hover,
body.gps-theme .btn-danger:focus,
body.gps-theme .btn-danger:active,
body.gps-theme .btn-danger:not(:disabled):not(.disabled):active {
    background-color: var(--gps-red-hover);
    border-color: var(--gps-red-hover);
    color: #fff;
}

/* Ambar — atencao/devolucao. 5,57:1. */
body.gps-theme .btn-warning {
    background-color: var(--gps-amber);
    border-color: var(--gps-amber);
    color: #fff;
}

body.gps-theme .btn-warning:hover,
body.gps-theme .btn-warning:focus,
body.gps-theme .btn-warning:active,
body.gps-theme .btn-warning:not(:disabled):not(.disabled):active {
    background-color: var(--gps-amber-hover);
    border-color: var(--gps-amber-hover);
    color: #fff;
}

/* O DS nao tem tom "info": cai no azul claro destacado (components.md). */
body.gps-theme .btn-info {
    background-color: var(--gps-blue-bg);
    border-color: var(--gps-blue-border);
    color: var(--gps-blue-dark);
}

body.gps-theme .btn-info:hover,
body.gps-theme .btn-info:focus,
body.gps-theme .btn-info:active,
body.gps-theme .btn-info:not(:disabled):not(.disabled):active {
    background-color: var(--gps-blue-bg-hover);
    border-color: var(--gps-blue-border);
    color: var(--gps-blue-dark);
}

/* ==========================================================================
   2. Campos de formulario
   --------------------------------------------------------------------------
   A borda #dee2e6 do tema da 1,2:1 contra branco; o DS usa #8C93A0 (3,09:1),
   que e o minimo para contorno de componente em WCAG 2.1 AA (1.4.11).
   Altura ja era ~35,6px: vai a 36px, o valor do DS.
   ========================================================================== */

body.gps-theme .form-control,
body.gps-theme select.form-control,
body.gps-theme textarea.form-control {
    height: 36px;
    border: 1px solid var(--gps-border-input);
    border-radius: var(--gps-radius-md);
    font-size: 13.5px;
    color: var(--gps-text);
    padding: 0 10px;
}

body.gps-theme textarea.form-control {
    height: auto;
    padding: 8px 10px;
}

body.gps-theme .form-control:focus {
    border-color: var(--gps-blue);
    box-shadow: none;
}

body.gps-theme .form-control::placeholder {
    color: var(--gps-text-3);
}

/* Rotulo de campo: 12,5px secundario (tokens.md / components.md). */
body.gps-theme .form-group > label,
body.gps-theme label.col-form-label {
    font-size: 12.5px;
    color: var(--gps-text-2);
    margin-bottom: 5px;
}

/* O BS4 poe `legend { font-size: 1.5rem }` = 24px, grande demais ao lado do
   titulo de tela de 24px. O tratamento completo do DS (11px uppercase +
   filete) entra junto com .gps-form__section, no piloto C. */
body.gps-theme legend {
    font-size: 15px;
    font-weight: 600;
    color: var(--gps-text);
    margin-bottom: 12px;
}

/* Radios feitos a mao (convencao Adminox, nao .form-check). Em apr.html sao
   ~340 linhas na matriz de risco: aqui so o texto fica legivel, a estrutura
   nao e tocada. */
body.gps-theme .radio label {
    font-size: 13px;
    color: var(--gps-text);
}

/* ==========================================================================
   3. Cards
   ========================================================================== */

body.gps-theme .card,
body.gps-theme .card-box {
    border-radius: var(--gps-radius-lg);
    border: 1px solid var(--gps-border);
    box-shadow: var(--gps-shadow-sm);
    background-color: var(--gps-card);
}

body.gps-theme .card-box {
    padding: 18px;
}

/* ==========================================================================
   4. Alertas
   --------------------------------------------------------------------------
   Os 266 `data-dismiss` e 253 `class="close"` do BS4 seguem intactos: aqui
   so mudam cor e raio.
   ========================================================================== */

body.gps-theme .alert {
    border-radius: var(--gps-radius-md);
    font-size: 13px;
    padding: 10px 14px;
}

body.gps-theme .alert-success {
    background-color: var(--gps-green-bg);
    border-color: var(--gps-green-border);
    color: var(--gps-green-hover);
}

body.gps-theme .alert-danger {
    background-color: var(--gps-red-bg);
    border-color: var(--gps-red-border);
    color: var(--gps-red);
}

body.gps-theme .alert-warning {
    background-color: var(--gps-amber-bg);
    border-color: var(--gps-amber-border);
    color: var(--gps-amber);
}

body.gps-theme .alert-info,
body.gps-theme .alert-primary {
    background-color: var(--gps-blue-bg);
    border-color: var(--gps-blue-border);
    color: var(--gps-blue-dark);
}

body.gps-theme .alert-secondary {
    background-color: #F0F0F2;
    border-color: var(--gps-border);
    color: var(--gps-text-2);
}

/* ---- EXCECAO AO ORCAMENTO DE !important (era 4, vai a 9) ----
   Os templates escrevem `alert alert-danger text-danger` -- 240 casos:
   168 danger, 57 success, 9 primary, 5 warning, 1 secondary. A utility
   `.text-*` carrega `!important` e pinta o texto no tom CHEIO do botao.
   Isso JA FALHAVA antes do DS (#32c861 sobre o fundo antigo = 1,94:1); o
   fundo novo nao piorou nada (1,93:1), mas da para consertar de vez:
       hoje   #32c861/#f96a74/#ffa91c -> 1,93 / 2,50 / 1,75  FALHA AA
       DS     #3E6B38/#B3261E/#9A5800 -> 5,49 / 5,72 / 5,08  PASSA
   Dentro de .alert a utility e redundante com .alert-*, entao aqui -- e so
   aqui -- anulamos um `!important` com outro, exatamente como permite a
   regra 3 (anular um !important que ja existe no Adminox). O escopo e
   estreito de proposito: `.alert.text-*`, nunca `.text-*` solto. */
body.gps-theme .alert.text-success   { color: var(--gps-green-hover) !important; }
body.gps-theme .alert.text-danger    { color: var(--gps-red) !important; }
body.gps-theme .alert.text-warning   { color: var(--gps-amber) !important; }
body.gps-theme .alert.text-primary   { color: var(--gps-blue-dark) !important; }
body.gps-theme .alert.text-secondary { color: var(--gps-text-2) !important; }

/* ==========================================================================
   5. Dropdowns
   ========================================================================== */

body.gps-theme .dropdown-menu {
    border-radius: var(--gps-radius-md);
    border: 1px solid var(--gps-border);
    box-shadow: var(--gps-shadow-lg);
    font-size: 13px;
    padding: 4px 0;
}

body.gps-theme .dropdown-item {
    padding: 7px 14px;
    color: var(--gps-text);
}

body.gps-theme .dropdown-item:hover,
body.gps-theme .dropdown-item:focus {
    background-color: var(--gps-surface);
    color: var(--gps-text);
}

/* Dropdown do usuario: 228px (layout.md). */
body.gps-theme .navbar-custom .profile-dropdown {
    min-width: 228px;
}

/* ==========================================================================
   6. Modais — so o involucro
   --------------------------------------------------------------------------
   O header azul de 46px, as larguras 420/760 e o focus trap sao OPT-IN via
   .gps-modal (passo 6). Mexer nos 182 modais existentes esta fora de escopo.
   ========================================================================== */

body.gps-theme .modal-content {
    border-radius: var(--gps-radius-md);
    border: none;
    box-shadow: var(--gps-shadow-lg);
}

body.gps-theme .modal-backdrop.show {
    background-color: var(--gps-backdrop);
    opacity: 1;
}

/* ==========================================================================
   7. Abas
   ========================================================================== */

body.gps-theme .nav-tabs {
    border-bottom: 1px solid var(--gps-border);
}

body.gps-theme .nav-tabs .nav-link {
    font-size: 13.5px;
    color: var(--gps-text-2);
    border: none;
}

body.gps-theme .nav-tabs .nav-link.active {
    color: var(--gps-blue-dark);
    font-weight: 600;
    background-color: transparent;
    border: none;
    box-shadow: inset 0 -2px 0 var(--gps-blue);
}

/* ==========================================================================
   NAO ENTRA NESTE ARQUIVO
   --------------------------------------------------------------------------
   .table / .table-striped -> 34 templates rasterizam o DOM em PDF; zebra e
                              thead colorido sao opt-in via .gps-table.
   .badge-*                -> 1.141 badges solidos; o chip de fundo claro e
                              aditivo via .gps-chip.
   Ambos no passo 6.
   ========================================================================== */
