/* ==========================================================================
   High Contrast Mode Overrides (WCAG 2.1 AAA & e-MAG Compliant)
   Suporte duplo a .is-contrast-mode e .high-contrast
   ========================================================================== */

/* 1. Base do Documento */
html.is-contrast-mode,
html.high-contrast,
body.is-contrast-mode,
body.high-contrast {
    background-color: #000000 !important;
    color: #ffffff !important;
}

/* Desativa transições durante o modo de contraste para alternância instantânea sem lag/jank */
html.is-contrast-mode *,
html.is-contrast-mode *::before,
html.is-contrast-mode *::after,
html.high-contrast *,
html.high-contrast *::before,
html.high-contrast *::after {
    transition: none !important;
}

/* 2. Topbar e Cabeçalho */
html.is-contrast-mode .hp-topbar,
html.high-contrast .hp-topbar,
body.is-contrast-mode .hp-topbar,
body.high-contrast .hp-topbar {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-bottom: 2px solid #ffff00 !important;
}

html.is-contrast-mode .hp-middlebar,
html.high-contrast .hp-middlebar,
body.is-contrast-mode .hp-middlebar,
body.high-contrast .hp-middlebar {
    background-color: #000000 !important;
    border-bottom: 1px solid #ffffff !important;
}

html.is-contrast-mode .hp-middlebar::before,
html.high-contrast .hp-middlebar::before,
body.is-contrast-mode .hp-middlebar::before,
body.high-contrast .hp-middlebar::before {
    background: #000000 !important;
}

html.is-contrast-mode .hp-logo-text,
html.high-contrast .hp-logo-text,
body.is-contrast-mode .hp-logo-text,
body.high-contrast .hp-logo-text {
    color: #ffff00 !important;
}

html.is-contrast-mode .hp-navbar,
html.high-contrast .hp-navbar,
body.is-contrast-mode .hp-navbar,
body.high-contrast .hp-navbar {
    background-color: #000000 !important;
    border-top: 2px solid #ffff00 !important;
    border-bottom: 2px solid #ffff00 !important;
}

html.is-contrast-mode .hp-nav-list a,
html.high-contrast .hp-nav-list a,
body.is-contrast-mode .hp-nav-list a,
body.high-contrast .hp-nav-list a {
    color: #ffff00 !important;
}

html.is-contrast-mode .hp-nav-list li ul,
html.high-contrast .hp-nav-list li ul,
body.is-contrast-mode .hp-nav-list li ul,
body.high-contrast .hp-nav-list li ul {
    background-color: #000000 !important;
    border: 2px solid #ffff00 !important;
}

html.is-contrast-mode .hp-nav-list li ul li a,
html.high-contrast .hp-nav-list li ul li a,
body.is-contrast-mode .hp-nav-list li ul li a,
body.high-contrast .hp-nav-list li ul li a {
    color: #ffff00 !important;
    border-bottom: 1px solid #555555 !important;
}

html.is-contrast-mode .hp-dropdown-menu,
html.high-contrast .hp-dropdown-menu,
body.is-contrast-mode .hp-dropdown-menu,
body.high-contrast .hp-dropdown-menu {
    background-color: #000000 !important;
    border: 2px solid #ffff00 !important;
    color: #ffffff !important;
}

html.is-contrast-mode .hp-dropdown-menu a,
html.is-contrast-mode .hp-dropdown-menu button,
html.high-contrast .hp-dropdown-menu a,
html.high-contrast .hp-dropdown-menu button,
body.is-contrast-mode .hp-dropdown-menu a,
body.is-contrast-mode .hp-dropdown-menu button,
body.high-contrast .hp-dropdown-menu a,
body.high-contrast .hp-dropdown-menu button {
    color: #ffff00 !important;
}

/* 3. Tipografia e Links Gerais */
html.is-contrast-mode h1, html.is-contrast-mode h2, html.is-contrast-mode h3,
html.is-contrast-mode h4, html.is-contrast-mode h5, html.is-contrast-mode h6,
html.high-contrast h1, html.high-contrast h2, html.high-contrast h3,
html.high-contrast h4, html.high-contrast h5, html.high-contrast h6,
body.is-contrast-mode h1, body.is-contrast-mode h2, body.is-contrast-mode h3,
body.is-contrast-mode h4, body.is-contrast-mode h5, body.is-contrast-mode h6,
body.high-contrast h1, body.high-contrast h2, body.high-contrast h3,
body.high-contrast h4, body.high-contrast h5, body.high-contrast h6 {
    color: #ffffff !important;
}

html.is-contrast-mode p, html.is-contrast-mode span, html.is-contrast-mode li,
html.high-contrast p, html.high-contrast span, html.high-contrast li,
body.is-contrast-mode p, body.is-contrast-mode span, body.is-contrast-mode li,
body.high-contrast p, body.high-contrast span, body.high-contrast li {
    color: #ffffff !important;
}

html.is-contrast-mode a,
html.high-contrast a,
body.is-contrast-mode a,
body.high-contrast a {
    color: #ffff00 !important;
}

html.is-contrast-mode a:hover,
html.high-contrast a:hover,
body.is-contrast-mode a:hover,
body.high-contrast a:hover {
    color: #ffffff !important;
    text-decoration: underline !important;
}

/* 4. Cards, Seções e Elementos de Grade (Transparência, Home, Ouvidoria) */
html.is-contrast-mode .eixo-card,
html.high-contrast .eixo-card,
body.is-contrast-mode .eixo-card,
body.high-contrast .eixo-card,
html.is-contrast-mode .govbr-card,
html.high-contrast .govbr-card,
body.is-contrast-mode .govbr-card,
body.high-contrast .govbr-card,
html.is-contrast-mode .ouvidoria-card,
html.high-contrast .ouvidoria-card,
body.is-contrast-mode .ouvidoria-card,
body.high-contrast .ouvidoria-card,
html.is-contrast-mode .ouvidoria-panel,
html.high-contrast .ouvidoria-panel,
body.is-contrast-mode .ouvidoria-panel,
body.high-contrast .ouvidoria-panel,
html.is-contrast-mode .chart-card,
html.high-contrast .chart-card,
body.is-contrast-mode .chart-card,
body.high-contrast .chart-card {
    background-color: #000000 !important;
    border: 2px solid #ffffff !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

html.is-contrast-mode .eixo-card:hover,
html.high-contrast .eixo-card:hover,
body.is-contrast-mode .eixo-card:hover,
body.high-contrast .eixo-card:hover {
    border-color: #ffff00 !important;
    background-color: #1a1a1a !important;
}

html.is-contrast-mode .eixo-card i,
html.high-contrast .eixo-card i,
body.is-contrast-mode .eixo-card i,
body.high-contrast .eixo-card i {
    color: #ffff00 !important;
}

/* 5. Formulários, Inputs e Botões */
html.is-contrast-mode input,
html.is-contrast-mode textarea,
html.is-contrast-mode select,
html.high-contrast input,
html.high-contrast textarea,
html.high-contrast select,
body.is-contrast-mode input,
body.is-contrast-mode textarea,
body.is-contrast-mode select,
body.high-contrast input,
body.high-contrast textarea,
body.high-contrast select {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

html.is-contrast-mode input:focus,
html.is-contrast-mode textarea:focus,
html.is-contrast-mode select:focus,
html.high-contrast input:focus,
html.high-contrast textarea:focus,
html.high-contrast select:focus,
body.is-contrast-mode input:focus,
body.is-contrast-mode textarea:focus,
body.is-contrast-mode select:focus,
body.high-contrast input:focus,
body.high-contrast textarea:focus,
body.high-contrast select:focus {
    border-color: #ffff00 !important;
    outline: 2px solid #ffff00 !important;
}

html.is-contrast-mode button,
html.is-contrast-mode .btn,
html.is-contrast-mode .govbr-btn,
html.high-contrast button,
html.high-contrast .btn,
html.high-contrast .govbr-btn,
body.is-contrast-mode button,
body.is-contrast-mode .btn,
body.is-contrast-mode .govbr-btn,
body.high-contrast button,
body.high-contrast .btn,
body.high-contrast .govbr-btn {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}

html.is-contrast-mode button:hover,
html.high-contrast button:hover,
body.is-contrast-mode button:hover,
body.high-contrast button:hover {
    background-color: #ffff00 !important;
    color: #000000 !important;
}

/* 6. Foco Visível WCAG AAA (Navegação por Teclado) */
html.is-contrast-mode :focus-visible,
html.high-contrast :focus-visible,
body.is-contrast-mode :focus-visible,
body.high-contrast :focus-visible {
    outline: 3px solid #ffff00 !important;
    outline-offset: 3px !important;
}

/* 7. Tabelas */
html.is-contrast-mode table,
html.high-contrast table,
body.is-contrast-mode table,
body.high-contrast table {
    background-color: #000000 !important;
    border: 2px solid #ffffff !important;
}

html.is-contrast-mode th,
html.high-contrast th,
body.is-contrast-mode th,
body.high-contrast th {
    background-color: #111111 !important;
    color: #ffff00 !important;
    border: 1px solid #ffffff !important;
}

html.is-contrast-mode td,
html.high-contrast td,
body.is-contrast-mode td,
body.high-contrast td {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #444444 !important;
}

/* 8. Rodapé Institucional */
html.is-contrast-mode #footer,
html.high-contrast #footer,
body.is-contrast-mode #footer,
body.high-contrast #footer,
html.is-contrast-mode .govbr-footer,
html.high-contrast .govbr-footer,
body.is-contrast-mode .govbr-footer,
body.high-contrast .govbr-footer {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-top: 3px solid #ffff00 !important;
}
