@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700&display=swap');

/* ==========================================================================
   WIDGET FLOTANTE Y PANEL DE ACCESIBILIDAD (ESTILO SIENNA / USERWAY)
   ========================================================================== */

/* Botón flotante (Oculto por preferencia de navegación en sidebar) */
#av-btn-accesibilidad {
  display: none !important;
}

/* Enlace de accesibilidad en el sidebar */
#av-sidebar-link {
  cursor: pointer;
}

#av-sidebar-link.has-active .av-sidebar-badge {
  display: inline-block !important;
}

/* Fondo oscurecido del panel */
#av-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999995;
}

#av-panel-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Contenedor del panel lateral (Offcanvas / Drawer) */
#av-panel-accesibilidad {
  position: fixed;
  top: 0;
  right: -460px;
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  background: #f8fafc;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
  z-index: 9999998;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1e293b;
}

#av-panel-accesibilidad.open {
  right: 0;
}

/* Cabecera del panel */
.av-header {
  background: var(--av-accent-gradient, linear-gradient(135deg, #007aff 0%, #0056b3 100%));
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.av-header-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.av-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.av-btn-icon-header {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.av-btn-icon-header:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.av-btn-icon-header:active {
  transform: scale(0.94);
}

/* Contenido con scroll */
.av-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

/* Secciones */
.av-section {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
  border: 1px solid #e2e8f0;
}

.av-section-title {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--av-accent-primary, #007aff);
  margin-top: 0;
  margin-bottom: 14px;
}

/* Filas de perfiles de accesibilidad */
.av-profile-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.av-profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  transition: all 0.2s ease;
}

.av-profile-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.av-profile-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  padding-right: 12px;
}

.av-profile-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.av-profile-item.active .av-profile-icon {
  background: var(--av-accent-soft, rgba(0, 122, 255, 0.12));
  color: var(--av-accent-primary, #007aff);
}

.av-profile-text {
  display: flex;
  flex-direction: column;
}

.av-profile-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  margin-bottom: 2px;
}

.av-profile-desc {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.25;
}

/* Switch estilo iOS */
.av-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.av-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.av-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}

.av-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.av-switch input:checked + .av-slider {
  background: var(--av-accent-gradient, var(--av-accent-primary, #007aff));
}

.av-switch input:checked + .av-slider:before {
  transform: translateX(20px);
}

/* Tarjeta de ajuste de tamaño de fuente */
.av-font-size-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.av-font-size-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.av-font-size-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.av-btn-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  transition: all 0.2s ease;
}

.av-btn-step:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.av-btn-step:active {
  transform: scale(0.92);
}

.av-font-size-val {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 44px;
  text-align: center;
  color: var(--av-accent-primary, #007aff);
}

/* Grilla de tarjetas interactivas */
.av-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.av-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.av-card-btn {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  min-height: 86px;
  gap: 8px;
}

.av-card-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.av-card-btn:active {
  transform: scale(0.96);
}

.av-card-btn.active {
  background: var(--av-accent-soft, rgba(0, 122, 255, 0.12));
  border-color: var(--av-accent-primary, #007aff);
  box-shadow: 0 0 0 1px var(--av-accent-primary, #007aff), 0 4px 12px var(--av-accent-shadow, rgba(0, 122, 255, 0.25));
}

.av-card-icon {
  font-size: 22px;
  line-height: 1;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  transition: color 0.2s ease;
}

.av-card-btn.active .av-card-icon {
  color: var(--av-accent-primary, #007aff);
}

.av-card-text {
  font-size: 0.74rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.2;
}

.av-card-btn.active .av-card-text {
  color: var(--av-accent-primary, #007aff);
}

/* Pie del panel con botón de reseteo */
.av-footer {
  padding: 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.av-btn-reset {
  width: 100%;
  padding: 12px 18px;
  background: var(--av-accent-gradient, var(--av-accent-primary, #007aff));
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px var(--av-accent-shadow, rgba(0, 122, 255, 0.25));
  transition: all 0.2s ease;
}

.av-btn-reset:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 16px var(--av-accent-shadow, rgba(0, 122, 255, 0.35));
  transform: translateY(-1px);
}

.av-btn-reset:active {
  transform: scale(0.98);
}

/* ==========================================================================
   ESTILOS DE ACCESIBILIDAD APLICADOS AL SITIO
   ========================================================================== */

/* 1. Zoom de fuente */
html[data-av-font-size="90"] body, html[data-av-font-size="90"] .c-main, html[data-av-font-size="90"] .card { font-size: 11px !important; }
html[data-av-font-size="100"] body { font-size: 12px !important; }
html[data-av-font-size="110"] body, html[data-av-font-size="110"] .c-main, html[data-av-font-size="110"] .card { font-size: 13.5px !important; }
html[data-av-font-size="120"] body, html[data-av-font-size="120"] .c-main, html[data-av-font-size="120"] .card { font-size: 15px !important; }
html[data-av-font-size="130"] body, html[data-av-font-size="130"] .c-main, html[data-av-font-size="130"] .card { font-size: 16.5px !important; }
html[data-av-font-size="140"] body, html[data-av-font-size="140"] .c-main, html[data-av-font-size="140"] .card { font-size: 18px !important; }
html[data-av-font-size="150"] body, html[data-av-font-size="150"] .c-main, html[data-av-font-size="150"] .card { font-size: 19.5px !important; }

/* 2. Grosor de fuente */
html.av-font-bold body,
html.av-font-bold p,
html.av-font-bold span:not(.fa):not(.fas):not(.far):not(.av-ui-icon),
html.av-font-bold a,
html.av-font-bold li,
html.av-font-bold td,
html.av-font-bold th,
html.av-font-bold label,
html.av-font-bold div:not(#av-panel-accesibilidad *) {
  font-weight: 700 !important;
}

/* 3. Altura de línea */
html.av-line-height body,
html.av-line-height p,
html.av-line-height span:not(#av-panel-accesibilidad *),
html.av-line-height div:not(#av-panel-accesibilidad *),
html.av-line-height td,
html.av-line-height li {
  line-height: 1.95 !important;
}

/* 4. Espaciado entre letras */
html.av-letter-spacing body,
html.av-letter-spacing p,
html.av-letter-spacing span:not(.fa):not(.fas):not(.far):not(#av-panel-accesibilidad *),
html.av-letter-spacing a:not(#av-panel-accesibilidad *),
html.av-letter-spacing div:not(#av-panel-accesibilidad *),
html.av-letter-spacing li,
html.av-letter-spacing td {
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}

/* 5. Fuente para dislexia */
html.av-dyslexia-font,
html.av-dyslexia-font body,
html.av-dyslexia-font *:not(.fa):not(.fas):not(.far):not(.fab):not([class*="cil-"]):not(#av-panel-accesibilidad *) {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

/* 6. Destacar enlaces */
html.av-highlight-links a:not(#av-panel-accesibilidad *):not(.c-header-nav-link):not(.c-sidebar-nav-link) {
  text-decoration: underline 2px solid var(--av-accent-primary, #007aff) !important;
  background-color: #fef08a !important;
  color: #000000 !important;
  font-weight: 700 !important;
  padding: 0 4px !important;
  border-radius: 3px !important;
}

/* 7. Destacar títulos */
html.av-highlight-titles h1,
html.av-highlight-titles h2,
html.av-highlight-titles h3,
html.av-highlight-titles h4,
html.av-highlight-titles h5,
html.av-highlight-titles h6,
html.av-highlight-titles .card-title,
html.av-highlight-titles .card-header:not(#av-panel-accesibilidad *) {
  border-left: 5px solid var(--av-accent-primary, #007aff) !important;
  background: var(--av-accent-soft, rgba(0, 122, 255, 0.09)) !important;
  padding-left: 10px !important;
  border-radius: 4px !important;
}

/* 8. Super Focus */
html.av-super-focus a:focus,
html.av-super-focus button:focus,
html.av-super-focus input:focus,
html.av-super-focus select:focus,
html.av-super-focus textarea:focus,
html.av-super-focus [tabindex]:focus {
  outline: 3px solid #ff9800 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px rgba(255, 152, 0, 0.45) !important;
}

/* 9. Guía de lectura */
#av-reading-guide {
  position: fixed;
  left: 0;
  width: 100vw;
  height: 38px;
  background: rgba(255, 235, 59, 0.22);
  border-top: 2.5px solid #f59e0b;
  border-bottom: 2.5px solid #f59e0b;
  pointer-events: none;
  z-index: 99999999;
  display: none;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
  transform: translateY(-50%);
}

/* 10. Cursor grande */
html.av-big-cursor,
html.av-big-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" fill="%23000000" stroke="%23ffffff" stroke-width="1.8"><path d="M3 2l14 11-6 1 4 8-3 1.5-4-8-5 5V2z"/></svg>'), auto !important;
}

/* 11. Ajustes de color */
html.av-monochrome body {
  filter: grayscale(100%) !important;
}

html.av-low-saturation body {
  filter: saturate(35%) !important;
}

html.av-high-saturation body {
  filter: saturate(220%) !important;
}

html.av-high-contrast body {
  filter: contrast(160%) !important;
}

html.av-light-contrast body,
html.av-light-contrast .c-app,
html.av-light-contrast .c-wrapper,
html.av-light-contrast .c-body,
html.av-light-contrast .c-main,
html.av-light-contrast .card:not(#av-panel-accesibilidad *) {
  background-color: #ffffff !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

html.av-dark-contrast body,
html.av-dark-contrast .c-app,
html.av-dark-contrast .c-wrapper,
html.av-dark-contrast .c-body,
html.av-dark-contrast .c-main,
html.av-dark-contrast .card:not(#av-panel-accesibilidad *),
html.av-dark-contrast .c-header,
html.av-dark-contrast .c-footer {
  background-color: #0a0a0a !important;
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}

html.av-dark-contrast a:not(#av-panel-accesibilidad *) {
  color: #00ffff !important;
}

/* 12. Herramientas adicionales */
html.av-stop-animations *,
html.av-stop-animations *::before,
html.av-stop-animations *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

html.av-hide-images img:not(.av-ui-img),
html.av-hide-images svg:not(.av-ui-icon):not(#av-panel-accesibilidad *):not(#av-btn-accesibilidad *),
html.av-hide-images video,
html.av-hide-images iframe,
html.av-hide-images canvas:not(#av-panel-accesibilidad *) {
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Badge de información de imágenes */
.av-img-alt-badge {
  display: inline-block;
  background: var(--av-accent-gradient, var(--av-accent-primary, #007aff));
  color: #ffffff;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  margin-top: 4px;
  margin-bottom: 4px;
  max-width: 100%;
  word-break: break-word;
}

/* Lector de pantalla flotante */
#av-tts-player {
  position: fixed;
  bottom: 86px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 24px;
  display: none;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  z-index: 9999992;
  font-size: 12px;
  border: 1px solid #334155;
}

#av-tts-player.active {
  display: flex;
}

.av-tts-btn {
  background: #3b82f6;
  border: none;
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
}

/* Modal de Estructura de Página */
#av-page-structure-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: 90vw;
  max-height: 80vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  z-index: 99999999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

#av-page-structure-modal.open {
  display: flex;
}

.av-structure-header {
  background: var(--av-accent-gradient, var(--av-accent-primary, #007aff));
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.av-structure-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

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

.av-structure-list li {
  margin-bottom: 8px;
}

.av-structure-list a {
  display: block;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  color: #0f172a;
  text-decoration: none;
  font-size: 13px;
  border-left: 4px solid #3b82f6;
  transition: all 0.15s ease;
}

.av-structure-list a:hover {
  background: var(--av-accent-soft, rgba(0, 122, 255, 0.12));
  border-left-color: var(--av-accent-primary, #007aff);
  color: var(--av-accent-primary, #007aff);
}

.av-structure-list a.level-h1 { font-weight: 700; font-size: 14px; margin-left: 0; }
.av-structure-list a.level-h2 { font-weight: 600; margin-left: 12px; }
.av-structure-list a.level-h3 { font-weight: 500; margin-left: 24px; }
.av-structure-list a.level-h4 { font-weight: 400; margin-left: 36px; }

/* Responsive móvil */
@media (max-width: 576px) {
  #av-panel-accesibilidad {
    width: 100vw;
    right: -100vw;
  }
  #av-btn-accesibilidad {
    bottom: 16px;
    right: 16px;
    width: 46px;
    height: 46px;
  }
}

/* ==========================================================================
   MODO OSCURO PARA EL PANEL DE ACCESIBILIDAD (.c-dark-theme)
   ========================================================================== */
.c-dark-theme #av-panel-accesibilidad {
  background: #181b26 !important;
  color: #f1f5f9 !important;
  box-shadow: -8px 0 36px rgba(0, 0, 0, 0.6) !important;
}

.c-dark-theme #av-panel-accesibilidad .av-section {
  background: #1e2230 !important;
  border-color: #2d3348 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
}

.c-dark-theme #av-panel-accesibilidad .av-section-title {
  color: var(--av-accent-primary, #60a5fa) !important;
}

.c-dark-theme #av-panel-accesibilidad .av-profile-item {
  background: #1e2230 !important;
  border-color: #2a2f42 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-profile-item:hover {
  background: #252b3d !important;
  border-color: #3b4259 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-profile-icon {
  background: #272d3f !important;
  color: #e2e8f0 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-profile-item.active .av-profile-icon {
  background: var(--av-accent-soft, rgba(0, 122, 255, 0.25)) !important;
  color: var(--av-accent-primary, #60a5fa) !important;
}

.c-dark-theme #av-panel-accesibilidad .av-profile-name {
  color: #f8fafc !important;
}

.c-dark-theme #av-panel-accesibilidad .av-profile-desc {
  color: #94a3b8 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-slider {
  background-color: #334155 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-font-size-card {
  background: #1e2230 !important;
  border-color: #2d3348 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-font-size-label {
  color: #f1f5f9 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-btn-step {
  background: #272d3f !important;
  border-color: #3b4259 !important;
  color: #f1f5f9 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-btn-step:hover {
  background: #323950 !important;
  border-color: #4b5563 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-card-btn {
  background: #1e2230 !important;
  border-color: #2d3348 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-card-btn:hover {
  background: #272d3f !important;
  border-color: #475569 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-card-btn.active {
  background: var(--av-accent-soft, rgba(0, 122, 255, 0.22)) !important;
  border-color: var(--av-accent-primary, #60a5fa) !important;
}

.c-dark-theme #av-panel-accesibilidad .av-card-icon {
  color: #cbd5e1 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-card-btn.active .av-card-icon {
  color: var(--av-accent-primary, #60a5fa) !important;
}

.c-dark-theme #av-panel-accesibilidad .av-card-text {
  color: #cbd5e1 !important;
}

.c-dark-theme #av-panel-accesibilidad .av-card-btn.active .av-card-text {
  color: var(--av-accent-primary, #60a5fa) !important;
}

.c-dark-theme #av-panel-accesibilidad .av-footer {
  background: #181b26 !important;
  border-top-color: #2d3348 !important;
}

.c-dark-theme #av-page-structure-modal {
  background: #181b26 !important;
  border-color: #2d3348 !important;
  color: #f8fafc !important;
}

.c-dark-theme #av-page-structure-modal .av-structure-list a {
  background: #1e2230 !important;
  color: #e2e8f0 !important;
  border-left-color: #3b82f6 !important;
}

.c-dark-theme #av-page-structure-modal .av-structure-list a:hover {
  background: var(--av-accent-soft, rgba(0, 122, 255, 0.22)) !important;
  color: var(--av-accent-primary, #60a5fa) !important;
}

