/**
 * Accessibility Features Styles
 *
 * @package Accessibility_Engesoftware
 */

/* Font Size Adjustments */
html[data-font-size="increase-1"] body * {
	font-size: calc(1em * 1.02) !important;
}

html[data-font-size="increase-2"] body * {
	font-size: calc(1em * 1.04) !important;
}

html[data-font-size="increase-3"] body * {
	font-size: calc(1em * 1.06) !important;
}

html[data-font-size="decrease-1"] body * {
	font-size: calc(1em * 0.98) !important;
}

html[data-font-size="decrease-2"] body * {
	font-size: calc(1em * 0.96) !important;
}

/* High Contrast Mode - Cores mais equilibradas */
html[data-high-contrast="true"] {
	filter: contrast(1.2) !important;
}

html[data-high-contrast="true"] body {
	background: #000 !important;
	color: #ffffff !important;
}

/* Textos e headings - preto em fundo claro, branco em fundo escuro */
html[data-high-contrast="true"] h1,
html[data-high-contrast="true"] h2,
html[data-high-contrast="true"] h3,
html[data-high-contrast="true"] h4,
html[data-high-contrast="true"] h5,
html[data-high-contrast="true"] h6,
html[data-high-contrast="true"] p,
html[data-high-contrast="true"] span,
html[data-high-contrast="true"] li,
html[data-high-contrast="true"] td,
html[data-high-contrast="true"] th,
html[data-high-contrast="true"] label,
html[data-high-contrast="true"] div {
	color: #ffffff !important;
}

/* Elementos com fundo claro/branco devem ter texto preto */
html[data-high-contrast="true"] [style*="background-color: #fff"],
html[data-high-contrast="true"] [style*="background-color: white"],
html[data-high-contrast="true"] [style*="background-color: #ffffff"],
html[data-high-contrast="true"] [style*="background-color: rgb(255, 255, 255)"],
html[data-high-contrast="true"] [style*="background: #fff"],
html[data-high-contrast="true"] [style*="background: white"],
html[data-high-contrast="true"] [style*="background: #ffffff"],
html[data-high-contrast="true"] [class*="bg-white"],
html[data-high-contrast="true"] [class*="background-white"],
html[data-high-contrast="true"] .elementor-widget-container[style*="background"],
html[data-high-contrast="true"] .elementor-column[style*="background-color"],
html[data-high-contrast="true"] .elementor-section[style*="background-color"] {
	color: #000000 !important;
}

/* Força texto preto em filhos de elementos com fundo claro */
html[data-high-contrast="true"] [style*="background-color: #fff"] *,
html[data-high-contrast="true"] [style*="background-color: white"] *,
html[data-high-contrast="true"] [style*="background-color: #ffffff"] *,
html[data-high-contrast="true"] [style*="background: #fff"] *,
html[data-high-contrast="true"] [style*="background: white"] *,
html[data-high-contrast="true"] [class*="bg-white"] *,
html[data-high-contrast="true"] .elementor-widget-container[style*="background"] *,
html[data-high-contrast="true"] .elementor-column[style*="background-color"] *,
html[data-high-contrast="true"] .elementor-section[style*="background-color"] * {
	color: #000000 !important;
}

/* Classe dinâmica adicionada por JavaScript para fundos claros */
html[data-high-contrast="true"] .wp-accessibility-light-bg,
html[data-high-contrast="true"] .wp-accessibility-light-bg *:not(a) {
	color: #000000 !important;
}

/* Links em fundos claros devem permanecer amarelos mas mais escuros */
html[data-high-contrast="true"] .wp-accessibility-light-bg a {
	color: #cc9900 !important;
	text-decoration: underline !important;
}

/* Links com amarelo mais suave */
html[data-high-contrast="true"] a {
	color: #ffdd00 !important;
	text-decoration: underline !important;
}

html[data-high-contrast="true"] a:hover {
	color: #ffffff !important;
	background: #ffdd00 !important;
}

html[data-high-contrast="true"] a:visited {
	color: #ff77ff !important;
}

/* Botões e elementos de formulário */
html[data-high-contrast="true"] button,
html[data-high-contrast="true"] .button,
html[data-high-contrast="true"] input[type="submit"],
html[data-high-contrast="true"] input[type="button"] {
	background: #ffffff !important;
	color: #000000 !important;
	border: 2px solid #ffffff !important;
}

html[data-high-contrast="true"] button:hover,
html[data-high-contrast="true"] .button:hover {
	background: #ffdd00 !important;
	color: #000000 !important;
	border: 2px solid #ffdd00 !important;
}

html[data-high-contrast="true"] input,
html[data-high-contrast="true"] select,
html[data-high-contrast="true"] textarea {
	background: #ffffff !important;
	color: #000000 !important;
	border: 2px solid #ffffff !important;
}

/* Manter imagens e logos visíveis */
html[data-high-contrast="true"] img {
	opacity: 0.9 !important;
	filter: contrast(1.1) !important;
}

/* Grayscale Mode */
html[data-grayscale="true"] {
	filter: grayscale(100%) !important;
}

/* Inverted Colors */
html[data-invert-colors="true"] {
	filter: invert(1) hue-rotate(180deg) !important;
}

html[data-invert-colors="true"] img,
html[data-invert-colors="true"] video {
	filter: invert(1) hue-rotate(180deg) !important;
}

/* Underline Links */
html[data-underline-links="true"] a {
	text-decoration: underline !important;
}

/* Readable Font */
html[data-readable-font="true"] * {
	font-family: Arial, Helvetica, sans-serif !important;
}

/* Increased Line Height */
html[data-line-height="true"] p,
html[data-line-height="true"] li,
html[data-line-height="true"] div {
	line-height: 1.8 !important;
	letter-spacing: 0.05em !important;
}

/* Highlight Links on Hover */
html[data-highlight-links="true"] a:hover,
html[data-highlight-links="true"] a:focus {
	background: #ffff00 !important;
	color: #000 !important;
	outline: 3px solid #ffff00 !important;
	outline-offset: 2px !important;
}

/* Big Cursor */
html[data-big-cursor="true"],
html[data-big-cursor="true"] * {
	cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M3 3 L3 27 L13 19 L17 27 L21 25 L17 17 L27 17 Z" fill="black" stroke="white" stroke-width="1"/></svg>') 0 0, auto !important;
}

/* Keyboard Navigation Highlights */
html[data-keyboard-nav="true"] *:focus {
	outline: 4px solid #ff6600 !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 6px rgba(255, 102, 0, 0.3) !important;
}

/* ARIA Labels and Screen Reader Support */
.sr-only,
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus,
.screen-reader-text:focus {
	position: static;
	width: auto;
	height: auto;
	overflow: visible;
	clip: auto;
	white-space: normal;
}

/* Ensure sufficient contrast for form elements */
input:focus,
textarea:focus,
select:focus,
button:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* Remove animations for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* High contrast mode media query support */
@media (prefers-contrast: high) {
	* {
		outline-width: 2px;
	}
}

/* Focus visible polyfill */
.js-focus-visible :focus:not(.focus-visible) {
	outline: none;
}

/* Ensure images have alt text indicator in dev mode */
img:not([alt]) {
	border: 5px dashed red;
}

/* Buttons and interactive elements minimum size (WCAG 2.5.5) */
/* Limitado aos elementos do plugin para nao afetar outros componentes */
.wp-acessibilidade-toolbar button,
.wp-acessibilidade-toolbar a,
.wp-acessibilidade-toolbar input[type="button"],
.wp-acessibilidade-toolbar input[type="submit"],
.wp-acessibilidade-toolbar input[type="reset"] {
	min-height: 44px;
	min-width: 44px;
}

/* Text spacing adjustments for readability */
html[data-text-spacing="true"] p {
	line-height: 1.5 !important;
	letter-spacing: 0.12em !important;
	word-spacing: 0.16em !important;
}

html[data-text-spacing="true"] h1,
html[data-text-spacing="true"] h2,
html[data-text-spacing="true"] h3,
html[data-text-spacing="true"] h4,
html[data-text-spacing="true"] h5,
html[data-text-spacing="true"] h6 {
	margin-bottom: 0.5em !important;
}

/* Color blindness filters */
html[data-color-filter="protanopia"] {
	filter: url('#protanopia-filter');
}

html[data-color-filter="deuteranopia"] {
	filter: url('#deuteranopia-filter');
}

html[data-color-filter="tritanopia"] {
	filter: url('#tritanopia-filter');
}

/* Ensure toolbar is not affected by accessibility features */
.wp-acessibilidade-toolbar,
.wp-acessibilidade-toolbar *,
.wp-acessibilidade-whatsapp,
.wp-acessibilidade-whatsapp * {
	font-size: 14px !important;
	line-height: 1.4 !important;
	letter-spacing: normal !important;
	word-spacing: normal !important;
	filter: none !important;
}

/* Ensure toolbar buttons maintain their colors in high contrast mode */
html[data-high-contrast="true"] .wp-acessibilidade-toolbar,
html[data-high-contrast="true"] .wp-acessibilidade-toolbar *,
html[data-high-contrast="true"] .wp-acessibilidade-toggle,
html[data-high-contrast="true"] .wp-acessibilidade-panel,
html[data-high-contrast="true"] .wp-acessibilidade-whatsapp,
html[data-high-contrast="true"] .wp-acessibilidade-whatsapp * {
	filter: none !important;
	background-color: inherit !important;
	color: inherit !important;
	border-color: inherit !important;
}

/* Specifically preserve the toggle button appearance */
html[data-high-contrast="true"] .wp-acessibilidade-toggle {
	background-color: var(--toolbar-color, #047034) !important;
}

html[data-high-contrast="true"] .wp-acessibilidade-toggle .wp-acessibilidade-icon {
	opacity: 1 !important;
	visibility: visible !important;
}

/* Preserve WhatsApp button color */
html[data-high-contrast="true"] .wp-acessibilidade-whatsapp {
	background-color: var(--toolbar-color, #047034) !important;
}

html[data-high-contrast="true"] .wp-acessibilidade-whatsapp svg {
	opacity: 1 !important;
	visibility: visible !important;
}

html[data-high-contrast="true"] .wp-acessibilidade-whatsapp svg path {
	fill: #ffffff !important;
}

/* Ensure accessibility statement page content is always visible and readable */
.wp-acessibilidade-statement {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	position: relative !important;
	max-width: 100% !important;
}

.wp-acessibilidade-statement h2,
.wp-acessibilidade-statement h3,
.wp-acessibilidade-statement p,
.wp-acessibilidade-statement ul,
.wp-acessibilidade-statement li,
.wp-acessibilidade-statement a {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.wp-acessibilidade-statement ul {
	list-style: disc !important;
	margin-left: 20px !important;
}

.wp-acessibilidade-statement li {
	display: list-item !important;
}
