/* =========================================================
   ALTO CONTRASTE (botao "Alto contraste" do rodape -> body.darkmode)
   Padrao classico de alto contraste: fundo preto, texto branco, links e foco em
   amarelo, bordas brancas, sem sombras/gradientes/imagens de fundo. Relacao de
   contraste >= 15:1 (WCAG 2.x AAA). Carregado depois de novo-layout.css.
   Widgets de terceiros (VLibras, UserWay) ficam de fora.
   ========================================================= */

body.darkmode {
  --bg: #000000;
  --surface: #000000;
  --surface-alt: #000000;
  --texto: #FFFFFF;
  --texto-suave: #FFFFFF;
  --borda: #FFFFFF;
  --link: #FFFF00;
  --link-hover: #FFFFFF;
  --sobre-azul: #FFFFFF;
  --sobre-azul-suave: #FFFFFF;
  --sombra: none;
  --sombra-sm: none;
}

html:has(body.darkmode), body.darkmode { background: #000 !important; color: #fff !important; }

body.darkmode *:not([vw]):not([vw] *):not([class*="uw-"]):not([class*="uw-"] *):not([id^="userway"]):not([id^="userway"] *):not(svg):not(svg *):not(img):not(video):not(iframe):not(canvas):not(option) {
  background-color: #000 !important;
  background-image: none !important;
  color: #fff !important;
  box-shadow: none !important;
  text-shadow: none !important;
  border-color: #fff !important;
}

/* links: amarelo e sublinhado (nao dependem so de cor) */
body.darkmode a,
body.darkmode a * { color: #ff0 !important; text-decoration: underline !important; }
body.darkmode a:hover,
body.darkmode a:hover * { color: #fff !important; background-color: #000 !important; }

/* botoes: amarelo com texto preto, borda branca */
body.darkmode button,
body.darkmode .nl-btn,
body.darkmode .btn,
body.darkmode .btn-primary,
body.darkmode .btn-default,
body.darkmode input[type="button"],
body.darkmode input[type="submit"] {
  background-color: #ff0 !important;
  color: #000 !important;
  border: 2px solid #fff !important;
  text-decoration: none !important;
}
body.darkmode button *,
body.darkmode .nl-btn *,
body.darkmode .btn * { color: #000 !important; background-color: transparent !important; }
body.darkmode button[aria-pressed="true"] { outline: 3px solid #fff; }
body.darkmode button:hover,
body.darkmode .nl-btn:hover,
body.darkmode .btn:hover { background-color: #fff !important; color: #000 !important; }

/* campos de formulario */
body.darkmode input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
body.darkmode select,
body.darkmode textarea {
  background-color: #000 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
}
body.darkmode ::placeholder { color: #fff !important; opacity: .8; }

/* tabelas: grade visivel */
body.darkmode table, body.darkmode th, body.darkmode td { border: 1px solid #fff !important; }
body.darkmode th { font-weight: 700; }

/* foco sempre visivel */
body.darkmode a:focus, body.darkmode button:focus, body.darkmode input:focus,
body.darkmode select:focus, body.darkmode textarea:focus, body.darkmode [tabindex]:focus {
  outline: 3px solid #ff0 !important;
  outline-offset: 2px;
}

/* icones SVG herdam a cor do texto; imagens ganham contorno */
body.darkmode svg { fill: currentColor; }
body.darkmode .nl-icon { color: inherit; }
body.darkmode img { outline: 1px solid #fff; }

/* sem animacoes de fundo/transicoes que reduzam o contraste */
body.darkmode * { transition: none !important; }
