/* Sistema de Acessibilidade - ConectEdu */

/* Variáveis CSS para temas */
:root {
  --a11y-font-size: 16px;
  --a11y-line-height: 1.5;
  --a11y-letter-spacing: normal;
  --a11y-contrast: normal;
  --a11y-highlight: none;
  --a11y-cursor: default;
  --a11y-focus-visible: auto;
}

/* Modo escuro */
[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #404040;
  --text-primary: #ffffff;
  --text-secondary: #e5e5e5;
  --text-muted: #a0a0a0;
  --border-color: #404040;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Aplicar tema */
[data-theme="dark"] body {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .bg-white {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .bg-gray-50 {
  background-color: var(--bg-primary) !important;
}

[data-theme="dark"] .bg-gray-100 {
  background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .bg-gray-200 {
  background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .text-gray-900 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-gray-800 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-gray-700 {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-gray-600 {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .text-gray-500 {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .border {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .border-gray-200 {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .border-gray-300 {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .shadow {
  box-shadow: var(--shadow) !important;
}

[data-theme="dark"] .shadow-lg {
  box-shadow: var(--shadow) !important;
}

[data-theme="dark"] .shadow-md {
  box-shadow: var(--shadow) !important;
}

/* Modo escuro para inputs e formulários */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: #3b82f6 !important;
}

/* Modo escuro para botões */
[data-theme="dark"] .btn,
[data-theme="dark"] button {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .btn:hover,
[data-theme="dark"] button:hover {
  background-color: var(--bg-primary) !important;
}

/* Modo escuro para cards e modais */
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Modo escuro para o painel de acessibilidade */
[data-theme="dark"] .a11y-panel {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .a11y-panel-header {
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .a11y-section-title {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .a11y-option {
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .a11y-option-label {
  color: var(--text-primary);
}

[data-theme="dark"] .a11y-select {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Fonte para disléxicos */
[data-font-family="dyslexic"] {
  font-family: 'Comic Neue', 'Comic Sans MS', cursive !important;
  font-weight: 400 !important;
  letter-spacing: 0.05em !important;
  line-height: 1.6 !important;
}

/* Tamanhos de fonte */
[data-font-size="small"] {
  font-size: 14px !important;
}

[data-font-size="normal"] {
  font-size: 16px !important;
}

[data-font-size="large"] {
  font-size: 18px !important;
}

[data-font-size="xlarge"] {
  font-size: 20px !important;
}

[data-font-size="xxlarge"] {
  font-size: 24px !important;
}

/* Espaçamento de linha */
[data-line-spacing="normal"] {
  line-height: 1.5 !important;
}

[data-line-spacing="relaxed"] {
  line-height: 1.75 !important;
}

[data-line-spacing="extra"] {
  line-height: 2 !important;
}

/* Alto contraste */
[data-contrast="high"] {
  filter: contrast(150%) brightness(110%) !important;
}

[data-contrast="high"] * {
  border-color: #000000 !important;
}

/* Destaque de links */
[data-highlight="links"] a {
  background-color: #ffff00 !important;
  color: #000000 !important;
  padding: 2px 4px !important;
  text-decoration: underline !important;
  font-weight: bold !important;
}

/* Cursor grande */
[data-cursor="large"] {
  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="M2 2 L8 2 L8 8 L2 8 Z" fill="black"/><path d="M8 2 L8 8 L14 8 L14 2 Z" fill="white"/></svg>'), auto !important;
}

/* Foco visível */
[data-focus="visible"] *:focus {
  outline: 3px solid #ff0000 !important;
  outline-offset: 2px !important;
}

/* Botão flutuante de acessibilidade */
.a11y-floating-btn {
  position: fixed;
  top: 20%;
  right: -24px;
  z-index: 9999;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 34px 0 0 34px;
  width: 68px;
  height: 68px;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 16px;
  transform: translateY(-50%);
}

.a11y-floating-btn:hover {
  transform: translateY(-50%) translateX(-6px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.a11y-floating-btn:focus {
  outline: 3px solid #ff0000;
  outline-offset: 2px;
}

/* Painel de acessibilidade */
.a11y-panel {
  position: fixed;
  top: 50%;
  right: 84px;
  width: 320px;
  max-width: calc(100vw - 40px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 9998;
  transform: translateY(-50%) translateX(20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
}

.a11y-panel.open {
  transform: translateY(-50%) translateX(0);
  opacity: 1;
  visibility: visible;
}

.a11y-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
}

.a11y-panel-title {
  font-weight: 600;
    font-size: 16px;
  margin: 0;
}

.a11y-panel-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.a11y-panel-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.a11y-panel-content {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.a11y-section {
  margin-bottom: 20px;
}

.a11y-section:last-child {
  margin-bottom: 0;
}

.a11y-section-title {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
    margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.a11y-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.a11y-option:last-child {
  border-bottom: none;
}

.a11y-option-label {
    font-size: 14px;
  color: #374151;
  flex: 1;
}

.a11y-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: #d1d5db;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.a11y-toggle.active {
  background-color: #10b981;
}

.a11y-toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.a11y-toggle.active .a11y-toggle-slider {
  transform: translateX(20px);
}

.a11y-select {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background-color: white;
  color: #374151;
  cursor: pointer;
  min-width: 120px;
}

.a11y-select:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.a11y-button {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.a11y-button:hover {
  background-color: #2563eb;
}

.a11y-button:focus {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.a11y-button.secondary {
  background-color: #6b7280;
}

.a11y-button.secondary:hover {
  background-color: #4b5563;
}

/* Responsividade mobile */
@media (max-width: 768px) {
  .a11y-floating-btn {
    width: 52px;
    height: 52px;
    font-size: 20px;
    top: auto;
    bottom: 16px;
    right: 16px;
    border-radius: 50%;
    justify-content: center;
    padding-left: 0;
    transform: none;
  }
  
  .a11y-panel {
    bottom: 80px;
    right: 16px;
    left: 16px;
    width: auto;
    top: auto;
    transform: translateY(20px);
  }

  .a11y-panel.open {
    transform: translateY(0);
  }
  
  .a11y-panel-content {
    max-height: 300px;
  }
}

/* Animações suaves */
* {
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Reduzir animações */
[data-reduced-motion="true"] * ,
[data-reduced-motion="true"] *::before,
[data-reduced-motion="true"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Melhorias para leitores de tela */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip links */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 10000;
  display: none;
}

.skip-link:focus {
  top: 6px;
}

/* Indicadores de estado */
.a11y-status {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s;
}
.a11y-status.show {
  opacity: 1;
}

/* Vlibras customizado */
[vw] {
  position: fixed !important;
  top: 20% !important;
  right: 20px !important;
  z-index: 9997 !important;
  /* Resetting inline styles from the script */
  bottom: initial !important;
  transform: none !important;
}

/* Modo de impress o */
@media print {
  .a11y-floating-btn,
  .a11y-panel,
  [vw] {
    display: none !important;
  }
}
