/*******************************
 * ESTILOS DE ACCESIBILIDAD E IHC
 * Mejoras para cumplir con WCAG 2.1 y principios de IHC
 *******************************/

/* ===== MEJORAS DE COLOR Y CONTRASTE ===== */

/* Variables CSS mejoradas para mejor contraste */
:root {
  /* Colores primarios con mejor contraste */
  --color-primary: #1d4ed8;
  --color-primary-light: #3b82f6;
  --color-primary-dark: #1e40af;
  --color-primary-darkest: #1e3a8a;
  
  /* Colores de apoyo con buen contraste */
  --color-secondary: #059669;
  --color-secondary-light: #10b981;
  --color-secondary-dark: #047857;
  
  /* Colores de estado con accesibilidad mejorada */
  --color-alert: #d97706;
  --color-error: #dc2626;
  --color-success: #059669;
  --color-info: #0284c7;
  
  /* Colores neutros optimizados */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  
  /* Colores de fondo y texto con contraste AA */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  
  /* Sombras más suaves para mejor legibilidad */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* ===== VARIABLES PARA IHC ===== */
  /* Tamaños de fuente para accesibilidad */
  --font-size-base: 16px;
  --font-size-large: 18px;
  --font-size-xlarge: 20px;
  --font-size-xxlarge: 24px;
  
  /* Espaciado mejorado para IHC */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 3rem;
  
  /* Tamaños mínimos de interacción para IHC */
  --min-touch-target: 44px;
  --min-touch-target-mobile: 48px;
}
  


/* ===== ESTILOS PARA SALTO AL CONTENIDO PRINCIPAL ===== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 6px;
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
}

/* ===== MEJORAS DE ACCESIBILIDAD PARA BOTONES ===== */
.btn {
  min-height: var(--min-touch-target);
  min-width: var(--min-touch-target);
  padding: 12px 24px;
  font-size: 16px;
  line-height: 1.5;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.btn:focus {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

/* Botones con iconos mejorados para IHC */
.btn ion-icon {
  margin-right: 8px;
  vertical-align: middle;
  font-size: 20px;
}

/* ===== CONTROLES DE ACCESIBILIDAD MEJORADOS ===== */
.accessibility-controls {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 10000;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(6px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  opacity: 0.7;
}

.accessibility-controls:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
  opacity: 0.9;
}

/* Estado aún más discreto cuando no está en uso */
.accessibility-controls:not(:hover):not(:focus-within) {
  opacity: 0.5;
  transform: translateY(0) scale(0.95);
}

.accessibility-toggle {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid transparent;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  transition: all 0.2s ease;
  opacity: 0.8;
}

.accessibility-toggle:hover {
  opacity: 1;
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.accessibility-toggle:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.accessibility-toggle:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  opacity: 1;
}

.accessibility-toggle[aria-expanded="true"] {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  border-radius: 6px 6px 0 0;
  opacity: 1;
}

.accessibility-options {
  padding: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  max-width: 280px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0 0 6px 6px;
  max-height: 60vh;
  overflow: auto;
}

.accessibility-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 6px 0;
}

.accessibility-option label {
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.9;
}

.accessibility-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-primary);
  margin-left: 8px;
}

.accessibility-option input[type="checkbox"]:focus {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
}

.form-help-text {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  margin-bottom: 8px;
  line-height: 1.3;
  opacity: 0.8;
}

/* Atajos de teclado */
.accessibility-shortcuts {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.accessibility-shortcuts h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  opacity: 0.9;
}

.shortcuts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shortcuts-list li {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.8;
}

.shortcuts-list kbd {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: monospace;
  font-size: 10px;
  min-width: 50px;
  text-align: center;
  opacity: 0.7;
}

/* ===== SECCIÓN DE AYUDA MEJORADA ===== */
.help-section {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
}

.help-button {
  background: var(--color-secondary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s ease;
  font-size: 24px;
}

.help-button:hover {
  background: var(--color-secondary-dark);
  transform: scale(1.05);
}

.help-button:focus {
  outline: 3px solid var(--color-secondary-light);
  outline-offset: 2px;
}

.help-text {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-primary);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.help-button:hover .help-text {
  opacity: 1;
  visibility: visible;
}

/* Menú de ayuda mejorado */
.help-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-gray-200);
  min-width: 300px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  z-index: 10000;
}

.help-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-gray-200);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1;
}

.help-menu-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.help-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.help-close:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.help-close:focus {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
}

.help-menu-content {
  padding: 16px;
  max-height: calc(80vh - 56px);
  overflow: auto;
}

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

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

.help-section h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.help-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.help-option:hover {
  background: var(--bg-tertiary);
  border-color: var(--color-gray-300);
}

.help-option:focus {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
  background: var(--bg-tertiary);
}

.help-description {
  font-size: 12px;
  color: var(--text-muted);
  margin: -8px 0 12px 16px;
  line-height: 1.4;
}

/* ===== MODOS DE ACCESIBILIDAD ===== */

/* Modo de alto contraste */
body.high-contrast-mode {
  --color-primary: #0000ff;
  --color-secondary: #008000;
  --text-primary: #000000;
  --text-secondary: #333333;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  filter: contrast(1.2);
}

body.high-contrast-mode .accessibility-controls,
body.high-contrast-mode .help-section {
  opacity: 1 !important;
  filter: none !important;
  z-index: 10000 !important;
  display: block !important;
  pointer-events: auto !important;
  visibility: visible !important;
  position: fixed !important;
}
body.high-contrast-mode .accessibility-controls { bottom: 20px !important; left: 20px !important; }
body.high-contrast-mode .help-section { bottom: 20px !important; right: 20px !important; }

body.high-contrast-mode .btn {
  border-width: 2px;
}

body.high-contrast-mode .accessibility-toggle {
  background: #000000;
  color: #ffffff;
  border: 2px solid #ffffff;
}

body.high-contrast-mode .help-button {
  background: #000000;
  color: #ffffff;
  border: 2px solid #ffffff;
}

/* Modo de texto grande */
body.large-text-mode {
  font-size: var(--font-size-large);
}

body.large-text-mode h1 { font-size: 2.5rem; }
body.large-text-mode h2 { font-size: 2rem; }
body.large-text-mode h3 { font-size: 1.5rem; }
body.large-text-mode h4 { font-size: 1.25rem; }
body.large-text-mode h5 { font-size: 1.125rem; }
body.large-text-mode h6 { font-size: 1rem; }

body.large-text-mode .btn {
  font-size: 18px;
  padding: 16px 28px;
}

body.large-text-mode .accessibility-option label {
  font-size: 16px;
}

body.large-text-mode .help-option {
  font-size: 16px;
  padding: 16px;
}

/* Reducir animaciones */
body.reduced-motion * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* Indicadores de foco mejorados */
body.enhanced-focus-mode *:focus {
  outline: 3px solid var(--color-primary) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3) !important;
}

/* Diseño simplificado */
body.simplified-layout-mode {
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
}

body.simplified-layout-mode .btn {
  box-shadow: none;
  border: 1px solid var(--color-gray-300);
}

body.simplified-layout-mode .accessibility-controls,
body.simplified-layout-mode .help-menu {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body.simplified-layout-mode * {
  border-radius: 4px !important;
}

/* ===== FORMULARIO DE FEEDBACK ===== */
.feedback-form-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.feedback-form-content {
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.feedback-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-gray-200);
}

.feedback-form-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.feedback-form {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-gray-300);
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
  border-color: var(--color-primary);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ===== MEJORAS DE TIPOGRAFÍA PARA IHC ===== */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Títulos con mejor jerarquía visual */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* Párrafos con mejor legibilidad */
p {
  margin-bottom: 1rem;
  line-height: 1.6;
  max-width: 65ch; /* Máximo 65 caracteres por línea para mejor lectura */
}

/* Enlaces con mejor accesibilidad */
a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration-thickness: 2px;
}

a:focus {
  outline: 3px solid var(--color-primary-light);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===== RESPONSIVE PARA ACCESIBILIDAD ===== */
@media (max-width: 768px) {
  .accessibility-controls {
    bottom: 10px;
    left: 10px;
  }
  
  .accessibility-toggle {
    padding: 10px;
    min-height: 40px;
    font-size: 12px;
  }
  
  .accessibility-options {
    max-width: 240px;
    padding: 10px;
  }
  
  .help-button {
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
  
  .help-menu {
    right: -10px;
    left: 10px;
    max-width: none;
  }
  
  .btn {
    min-height: var(--min-touch-target-mobile);
    padding: 16px 24px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== ANIMACIONES DE FEEDBACK ===== */
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ===== UTILIDADES DE ACCESIBILIDAD ===== */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus visible para teclado */
.focus-visible:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== IMPRESIÓN ACCESIBLE ===== */
@media print {
  .accessibility-controls,
  .help-section,
  #feedback-container {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
  
  a:after {
    content: " (" attr(href) ")";
    font-size: 10pt;
  }
}

/* ===== MEJORAS TIPOGRÁFICAS ===== */

/* Sistema de tipografía mejorado para legibilidad */
html {
  font-size: 16px; /* Tamaño base asegurado - mínimo 16px para IHC */
  line-height: 1.6; /* Mejor espaciado entre líneas */
}

/* Limitar a máximo 2-3 familias de fuentes para armonía visual */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 1rem; /* 16px mínimo */
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  text-align: left; /* Alineación izquierda para lectura natural */
}

/* Jerarquía tipográfica clara */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 { 
  font-size: 2.5rem; /* 40px */
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

h2 { 
  font-size: 2rem; /* 32px */
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1.25rem;
}

h3 { 
  font-size: 1.5rem; /* 24px */
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 1rem;
}

h4 { 
  font-size: 1.25rem; /* 20px */
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

h5 { 
  font-size: 1.125rem; /* 18px */
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

h6 { 
  font-size: 1rem; /* 16px */
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

/* Mejorar legibilidad de párrafos */
p {
  font-size: 1rem; /* 16px mínimo */
  line-height: 1.6;
  margin-bottom: 1rem;
  text-align: left; /* Alineación izquierda para lectura natural */
  max-width: 65ch; /* Longitud óptima de línea para lectura */
}

/* Asegurar tamaños mínimos para elementos de texto */
small, .small-text {
  font-size: 0.875rem; /* 14px mínimo */
  line-height: 1.5;
}

/* Mejorar legibilidad de listas */
li {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

/* Tamaños de fuente responsivos */
@media (max-width: 768px) {
  html { font-size: 15px; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.375rem; }
}

/* ===== ESPACIADO OPTIMIZADO PARA EVITAR SATURACIÓN VISUAL ===== */

/* Espaciado generoso entre secciones */
.section {
  padding: 4rem 0; /* 64px arriba y abajo */
  margin-bottom: 2rem;
}

.section + .section {
  margin-top: 2rem;
}

/* Espaciado amplio dentro de contenedores */
.container {
  padding: 0 1.5rem; /* 24px de espacio lateral */
  max-width: 1200px;
  margin: 0 auto;
}

/* Espaciado generoso para tarjetas y elementos de contenido */
.card {
  margin-bottom: 2rem; /* 32px entre tarjetas */
  padding: 2rem; /* 32px de espacio interno */
}

/* Espaciado amplio para listas y elementos de navegación */
.nav-item,
.list-item {
  margin-bottom: 1rem; /* 16px entre elementos */
  padding: 0.75rem 0; /* 12px arriba y abajo */
}

/* Espaciado generoso para botones y controles */
.btn,
.button,
.form-control {
  margin-bottom: 1rem; /* 16px entre elementos */
  margin-right: 1rem; /* 16px entre elementos horizontales */
  padding: 0.75rem 1.5rem; /* 12px 24px de espacio interno */
}

/* Espaciado amplio para formularios */
.form-group {
  margin-bottom: 2rem; /* 32px entre grupos de formulario */
}

.form-group label {
  margin-bottom: 0.5rem; /* 8px entre etiqueta y campo */
  display: block;
}

.form-group input,
.form-group select,
.form-group textarea {
  margin-bottom: 0.5rem; /* 8px debajo del campo */
}

/* Espaciado generoso para el contenido principal */
.main-content {
  padding: 3rem 0; /* 48px arriba y abajo */
}

.content-section {
  margin-bottom: 4rem; /* 64px entre secciones de contenido */
  padding: 2rem 0; /* 32px arriba y abajo */
}

/* Evitar saturación visual con espaciado consistente */
.element-spacing {
  margin-bottom: 1.5rem; /* 24px espacio estándar */
}

.double-spacing {
  margin-bottom: 3rem; /* 48px espacio doble */
}

.triple-spacing {
  margin-bottom: 4.5rem; /* 72px espacio triple */
}

/* ===== JERARQUÍA VISUAL CLARA Y POSICIONAMIENTO DE ELEMENTOS IMPORTANTES ===== */

/* Jerarquía clara con secciones bien definidas */
.page-header {
  padding: 2rem 0;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: left;
}

.page-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  text-align: left;
}

/* Secciones claramente delimitadas */
.content-section {
  margin-bottom: 4rem;
  padding: 2rem 0;
  position: relative;
}

.content-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--color-gray-200);
  margin-bottom: 2rem;
}

/* Posicionar elementos importantes en lugares visibles y accesibles */
.primary-action {
  position: relative;
  z-index: 10;
  margin: 2rem 0;
}

.cta-section {
  background-color: var(--bg-secondary);
  padding: 3rem 2rem;
  margin: 3rem 0;
  border-radius: 0.5rem;
  text-align: center;
}

/* Elementos importantes destacados visualmente */
.important-notice {
  background-color: var(--color-accent-primary);
  color: white;
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0.5rem;
  font-weight: 600;
  position: relative;
}

.important-notice::before {
  content: '⚠️';
  margin-right: 0.5rem;
  font-size: 1.2em;
}

/* Información crítica en posición prominente */
.critical-info {
  background-color: var(--color-error);
  color: white;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0.375rem;
  font-weight: 600;
  position: sticky;
  top: 1rem;
  z-index: 100;
}

/* Botones de acción principales claramente visibles */
.btn-primary-action {
  background-color: var(--color-accent-primary);
  color: white;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: inline-block;
  margin: 1rem 0;
  position: relative;
  overflow: hidden;
}

.btn-primary-action:hover {
  background-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary-action:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Navegación principal accesible desde cualquier parte de la página */
.main-navigation {
  position: sticky;
  top: 0;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--color-gray-200);
  z-index: 1000;
  padding: 1rem 0;
}

/* Elementos de ayuda siempre visibles */
.help-section {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10000;
}

.help-button {
  background-color: var(--color-accent-secondary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s ease-in-out;
}

.help-button:hover {
  transform: scale(1.1);
}

/* ===== MEJORAS DE ACCESIBILIDAD ===== */

/* Focus visible mejorado para navegación por teclado */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Skip link para navegación rápida */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
  transition: top 0.3s;
}

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

/* Mejoras para lectores de pantalla */
.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;
}

/* Texto con buen contraste mínimo 4.5:1 */
.text-high-contrast {
  color: var(--text-primary) !important;
}

.text-medium-contrast {
  color: var(--text-secondary) !important;
}

.text-low-contrast {
  color: var(--text-muted) !important;
}

/* Indicadores de campos requeridos */
.required {
  color: var(--color-error);
  font-weight: 600;
}

/* Mensajes de error accesibles */
.error-message {
  display: block;
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  min-height: 1.25rem;
}

.error-message:empty {
  display: none;
}

/* Texto de ayuda para formularios */
.form-help-text {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* Estados de error para campos */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.form-group input.error:focus,
.form-group select.error:focus,
.form-group textarea.error:focus {
  outline-color: var(--color-error);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}



/* Espaciado generoso para mejor legibilidad */
.container {
  max-width: 1200px;
  padding: 0 1.5rem;
  margin: 0 auto;
}

.section-spacing {
  padding: 4rem 0;
}

.content-spacing {
  margin-bottom: 2rem;
}

/* Espaciado entre elementos interactivos */
.btn + .btn {
  margin-left: 1rem;
}

.form-group + .form-group {
  margin-top: 1.5rem;
}

/* ===== MEJORAS DE BOTONES Y ENLACES ===== */

/* Botones con buen contraste y tamaño mínimo */
.btn {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  min-height: 44px; /* Tamaño mínimo táctil */
  text-align: center;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: white;
  border-color: var(--color-secondary);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  background-color: var(--color-primary);
  color: white;
}

/* Enlaces con mejor visibilidad */
a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease-in-out;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== MEJORAS DE FORMULARIOS ===== */

/* Formularios con etiquetas claras y campos accesibles */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
}

input, textarea, select {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--color-gray-300);
  border-radius: 0.375rem;
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  min-height: 44px; /* Tamaño mínimo táctil */
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Estados de error y éxito accesibles */
.form-group.error input {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.form-group.success input {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

.error-message {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: block;
}

.success-message {
  color: var(--color-success);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: block;
}

/* ===== MEJORAS DE NAVEGACIÓN ===== */

/* Navegación accesible con teclado */
.nav-links a {
  display: inline-block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-secondary);
  border-radius: 0.375rem;
  transition: all 0.2s ease-in-out;
  position: relative;
}

.nav-links a:hover {
  color: var(--color-primary);
  background-color: var(--bg-secondary);
}

.nav-links a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== ESTILOS ADICIONALES PARA FEEDBACK Y AYUDA ===== */

/* Estilos para el menú de ayuda */
.help-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--bg-primary);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  min-width: 280px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  animation: fadeIn 0.3s ease-out;
}

.help-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--color-gray-200);
  background-color: var(--bg-secondary);
  border-radius: 0.5rem 0.5rem 0 0;
}

.help-menu-header h4 {
  margin: 0;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.help-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.help-close:hover {
  background-color: var(--color-gray-200);
  color: var(--text-primary);
}

.help-menu-content {
  padding: 0.5rem;
}

.help-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  background: none;
  border: none;
  border-radius: 0.375rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.help-option:hover {
  background-color: var(--bg-secondary);
}

.help-option:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Estilos para el botón de cierre de feedback */
.feedback-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: inherit;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  margin-left: auto;
  transition: all 0.2s ease;
}

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

/* Estilos para el indicador de carga */
.loading-indicator {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

/* Estilos para el modo de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .reduced-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.reduced-motion {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

.nav-links a[aria-current="page"] {
  color: var(--color-primary);
  font-weight: 600;
}

.nav-links a[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background-color: var(--color-primary);
  border-radius: 1px;
}

/* ===== MEJORAS DE TARJETAS Y CONTENEDORES ===== */

/* Tarjetas con buen contraste y espaciado */
.card {
  background-color: var(--bg-primary);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ===== RESTRICCIÓN DE COLORES BRILLANTES PARA ELEMENTOS IMPORTANTES ===== */

/* Solo elementos importantes y CTAs pueden usar colores brillantes */
.btn-primary,
.btn-accent,
.cta-button,
.highlight-element,
.status-success,
.status-active {
  background-color: var(--color-accent-primary) !important;
  color: #ffffff !important;
}

.btn-secondary,
.btn-outline {
  background-color: var(--color-accent-secondary) !important;
  color: #ffffff !important;
}

.alert-warning,
.status-warning {
  background-color: var(--color-accent-warning) !important;
  color: #ffffff !important;
}

/* Restringir colores brillantes en elementos decorativos */
.decorative-element,
.background-pattern,
.section-divider,
.card-border {
  background-color: var(--color-neutral-light) !important;
  border-color: var(--color-gray-200) !important;
}

/* Asegurar que el texto use colores neutros para mejor legibilidad */
.body-text,
.paragraph,
.description,
.list-item {
  color: var(--color-neutral-dark) !important;
}

.subtle-text,
.helper-text,
.caption {
  color: var(--color-neutral-base) !important;
}

.card:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== MEJORAS DE ANIMACIONES ===== */

/* Animaciones suaves y accesibles */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Animaciones de fade suaves */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-fade-out {
  animation: fadeOut 0.3s ease-out;
}

/* ===== MEJORAS DE RESPONSIVE DESIGN ===== */

/* Tamaños de fuente fluidos */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .section-spacing {
    padding: 3rem 0;
  }
  
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }
}

/* Modo oscuro para mejorar la experiencia visual */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --color-gray-50: #1f2937;
    --color-gray-100: #111827;
    --color-gray-200: #374151;
    --color-gray-300: #4b5563;
    --color-gray-700: #d1d5db;
    --color-gray-800: #f9fafb;
    --color-gray-900: #ffffff;
  }
  
  body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
  }
}

/* ===== MEJORAS DE ALINEACIÓN Y LECTURA ===== */

/* Alineación de texto optimizada para lectura */
.text-left {
  text-align: left !important;
}

.text-center {
  text-align: center !important;
}

.text-right {
  text-align: right !important;
}

/* Evitar justificación completa que dificulta la lectura */
.text-justify {
  text-align: left !important; /* Override para mejor legibilidad */
}

/* Longitud óptima de línea para lectura (45-75 caracteres) */
.reading-width {
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

/* Espaciado entre párrafos para mejor legibilidad */
.content-spacing p {
  margin-bottom: 1.5rem;
}

.content-spacing p:last-child {
  margin-bottom: 0;
}

/* ===== MEJORAS DE FEEDBACK VISUAL ===== */

/* Estados de hover y focus más claros */
.interactive-element {
  transition: all 0.2s ease-in-out;
}

.interactive-element:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.interactive-element:active {
  transform: translateY(0);
}

/* Indicadores visuales claros */
.loading-indicator {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-gray-300);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== UTILIDADES DE ACCESIBILIDAD ===== */

/* Ocultar visualmente pero mantener accesible para lectores de pantalla */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Mostrar solo cuando tiene focus */
.show-on-focus {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.show-on-focus:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
}

/* Asegurar que los elementos interactivos sean lo suficientemente grandes */
.min-tap-target {
  min-width: 44px;
  min-height: 44px;
}

/* Mejorar la legibilidad del texto */
.text-readable {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  max-width: 65ch;
}

/* ===== MEJORAS DE CONSISTENCIA ===== */

/* Asegurar consistencia en todos los elementos */
* {
  box-sizing: border-box;
}

/* Reset consistente de márgenes */
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
dl, dd, ol, ul,
figure, table, fieldset, legend {
  margin: 0;
}

/* Espaciado consistente */
.content-flow > * + * {
  margin-top: 1.5rem;
}

.content-flow > * + h2,
.content-flow > * + h3,
.content-flow > * + h4 {
  margin-top: 2rem;
}

.content-flow > h2 + *,
.content-flow > h3 + *,
.content-flow > h4 + * {
  margin-top: 1rem;
}

/* ===== MECANISMOS DE FEEDBACK Y RETROALIMENTACIÓN ===== */

/* Feedback visual inmediato para acciones del usuario */
.user-feedback {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 1000;
  max-width: 320px;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.feedback-success {
  background-color: var(--color-success);
  color: white;
  border-left: 4px solid #065f46;
}

.feedback-error {
  background-color: var(--color-error);
  color: white;
  border-left: 4px solid #991b1b;
}

.feedback-info {
  background-color: var(--color-info);
  color: white;
  border-left: 4px solid #0c4a6e;
}

.feedback-warning {
  background-color: var(--color-alert);
  color: white;
  border-left: 4px solid #92400e;
}

/* Indicadores de progreso visuales */
.progress-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.75rem;
  background-color: var(--bg-secondary);
  border-radius: 0.375rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--color-gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Estados de carga claros */
.loading-state {
  position: relative;
  opacity: 0.7;
  pointer-events: none;
}

.loading-state::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-gray-300);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===== PREVENCIÓN DE ERRORES Y DESHACER ACCIONES ===== */

/* Confirmaciones de acciones críticas */
.action-confirmation {
  background-color: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.confirmation-message {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}

.confirmation-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-confirm {
  background-color: var(--color-success);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cancel {
  background-color: var(--color-gray-300);
  color: var(--text-primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-confirm:hover {
  background-color: #047857;
}

.btn-cancel:hover {
  background-color: var(--color-gray-400);
}

/* Función de deshacer acciones */
.undo-action {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-gray-800);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.undo-button {
  background-color: transparent;
  color: #60a5fa;
  border: 1px solid #60a5fa;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.undo-button:hover {
  background-color: #60a5fa;
  color: white;
}

/* Validación en tiempo real para prevenir errores */
.real-time-validation {
  position: relative;
}

.validation-message {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  padding: 0.25rem 0;
  transition: all 0.2s ease;
}

.validation-success {
  color: var(--color-success);
}

.validation-error {
  color: var(--color-error);
}

/* ===== REDUCCIÓN DE CARGA COGNITIVA ===== */

/* Contenido claro y simple con jerarquía visual */
.cognitive-friendly {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  max-width: 65ch;
  margin-bottom: 1.5rem;
}

.cognitive-friendly h1,
.cognitive-friendly h2,
.cognitive-friendly h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.cognitive-friendly h1 {
  font-size: 2rem;
  margin-top: 0;
}

.cognitive-friendly h2 {
  font-size: 1.5rem;
}

.cognitive-friendly h3 {
  font-size: 1.25rem;
}

/* Agrupación lógica de información relacionada */
.info-group {
  background-color: var(--bg-secondary);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.info-group-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
}

/* Paso a paso claro para procesos complejos */
.step-by-step {
  counter-reset: step-counter;
}

.step-item {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 2rem;
  counter-increment: step-counter;
}

.step-item::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  background-color: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.step-item h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}

/* Resaltado de información importante */
.highlight-box {
  background-color: #dbeafe;
  border-left: 4px solid var(--color-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 0.375rem 0.375rem 0;
}

.highlight-box h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--color-primary);
  font-weight: 600;
}

/* Información adicional colapsable para reducir la carga inicial */
.collapsible-info {
  background-color: var(--bg-secondary);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.375rem;
  margin: 1rem 0;
}

.collapsible-header {
  background-color: transparent;
  border: none;
  width: 100%;
  text-align: left;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
}

.collapsible-header:hover {
  background-color: var(--color-gray-100);
}

.collapsible-header:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.collapsible-content {
  padding: 0 1.5rem 1rem;
  display: none;
}

.collapsible-content[aria-expanded="true"] {
  display: block;
}

.collapsible-icon {
  transition: transform 0.2s ease;
}

.collapsible-header[aria-expanded="true"] .collapsible-icon {
  transform: rotate(180deg);
}

/* ===== MECANISMOS DE PERSONALIZACIÓN ===== */

/* Controles de accesibilidad personalizables */
.accessibility-controls {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 10000;
  background-color: var(--bg-primary);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: var(--shadow-lg);
  max-width: 280px;
}

.accessibility-toggle {
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  width: 100%;
  margin-bottom: 0.5rem;
  transition: background-color 0.2s ease;
}

.accessibility-toggle:hover {
  background-color: var(--color-primary-dark);
}

.accessibility-options {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-gray-200);
}

.accessibility-options[aria-expanded="true"] {
  display: block;
}

.accessibility-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.accessibility-option label {
  font-size: 0.875rem;
  color: var(--text-primary);
  margin: 0;
  cursor: pointer;
}

.accessibility-option input[type="checkbox"] {
  width: auto;
  min-height: auto;
  margin: 0;
}

/* Modos de visualización personalizables */
.high-contrast-mode {
  --color-primary: #000000;
  --color-secondary: #000000;
  --text-primary: #000000;
  --text-secondary: #333333;
  --bg-primary: #ffffff;
  --bg-secondary: #f0f0f0;
}

.large-text-mode {
  font-size: 1.125rem;
}

.large-text-mode h1 { font-size: 3rem; }
.large-text-mode h2 { font-size: 2.5rem; }
.large-text-mode h3 { font-size: 2rem; }
.large-text-mode h4 { font-size: 1.75rem; }
.large-text-mode h5 { font-size: 1.5rem; }
.large-text-mode h6 { font-size: 1.25rem; }

/* ===== RESPONSIVE Y MULTI-DISPOSITIVO ===== */

/* Optimización para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .button,
  .form-control,
  .nav-links a {
    min-height: 48px; /* Tamaño táctil mínimo mayor */
    padding: 0.875rem 1.25rem;
  }
  
  .interactive-element:hover {
    transform: none; /* Desactivar hover en dispositivos táctiles */
  }
}

/* Optimización para navegación por voz */
.voice-navigation {
  position: fixed;
  top: 2rem;
  left: 2rem;
  z-index: 1000;
  background-color: var(--bg-primary);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: var(--shadow-lg);
}

.voice-command {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background-color: var(--color-gray-100);
  border: 1px solid var(--color-gray-300);
  border-radius: 0.375rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-command:hover {
  background-color: var(--color-gray-200);
  border-color: var(--color-primary);
}

.voice-command:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}