/* Accessibility Widget Styles */
:root {
  --a11y-slider-thumb: #25bebc;
  --a11y-slider-track: #ddd;
}

body,
p,
a,
span,
li,
h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: calc(1rem * var(--a11y-font-scale));
  line-height: var(--a11y-line-height);
}

.accessibility-slider,
.ui-slider.ui-slider-horizontal.ui-widget.ui-widget-content.ui-corner-all {
  background: var(--a11y-slider-track) !important;
}

.accessibility-slider::-webkit-slider-thumb {
  background: var(--a11y-slider-thumb) !important;
}

.accessibility-slider::-moz-range-thumb {
  background: var(--a11y-slider-thumb) !important;
}

#accessibility-widget {
  font-size: 14px !important;
  line-height: 1.2 !important;
}

.accessibility-widget {
  position: fixed;
  bottom: 15px;
  left: 15px;
  z-index: 99999;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

.accessibility-toggle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25bebc 0%, #1a9f9d 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 190, 188, 0.3);
  transition: all 0.3s ease;
}

.accessibility-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(37, 190, 188, 0.4);
}

.accessibility-toggle:focus-visible {
  outline: 3px solid #25bebc;
  outline-offset: 2px;
}

.accessibility-panel {
  position: absolute;
  bottom: 60px;
  left: 0;
  width: 400px;
  max-height: 650px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  z-index: 99999;
}

.accessibility-panel[hidden] {
  display: none;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.accessibility-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #0052cc;
  color: white;
  border-radius: 8px 8px 0 0;
}

.accessibility-header h2 {
  margin: 0;
  font-size: 16px;
  color: white;
  font-weight: 600;
}

.accessibility-close {
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.accessibility-close:hover {
  opacity: 0.8;
}

.accessibility-content {
  padding: 16px;
}

/* Grid layout for accessibility cards */
.accessibility-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.accessibility-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  text-align: center;
  transition: all 0.2s ease;
}

.accessibility-card:hover {
  background: #f0f1f3;
  border-color: #25bebc;
}

.accessibility-card h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  letter-spacing: 0.5px;
}

.card-icon {
  font-size: 24px;
  font-weight: bold;
  color: #25bebc;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Slider Styles - Enhanced for high contrast */
.accessibility-slider {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--a11y-slider-track, #ddd) !important;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  appearance: none;
}

.accessibility-slider::-webkit-slider-track {
  background: var(--a11y-slider-track, #ddd) !important;
  height: 4px;
  border-radius: 2px;
}

.accessibility-slider::-moz-range-track {
  background: var(--a11y-slider-track, #ddd) !important;
  height: 4px;
  border-radius: 2px;
  border: none;
}

.accessibility-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--a11y-slider-thumb, #25bebc) !important;
  cursor: pointer;
  border: none;
}

.accessibility-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--a11y-slider-thumb, #25bebc) !important;
  cursor: pointer;
  border: none;
}

.value-display {
  font-size: 12px;
  color: #555;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

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

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 20px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-switch input:checked+.slider {
  background-color: #25bebc;
}

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

.accessibility-tts-button {
  width: 100%;
  padding: 6px;
  background: #25bebc;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.3s ease;
}

.accessibility-tts-button:hover {
  background: #1a9f9d;
}

.accessibility-tts-button.stop {
  background: #e74c3c;
}

.accessibility-tts-button.stop:hover {
  background: #c0392b;
}

.accessibility-select {
  width: 100%;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  background: white;
  cursor: pointer;
}

.reset-button {
  width: 100%;
  padding: 10px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.3s ease;
}

.reset-button:hover {
  background: #c82333;
}

#read-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.12);
  z-index: 99998;
  display: none;
}

#read-mask .highlight {
  position: absolute;
  background: transparent;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  pointer-events: none;
  padding: 15px;
  border-bottom: 5px solid #25bebc;
  border-top: 5px solid #25bebc;
}

/* High contrast mode with cyan text on black background */
html.accessibility-high-contrast {
  background-color: #000000 !important;
  color: #fcff3c !important;
}

html.accessibility-high-contrast body {
  background-color: #000000 !important;
  color: #fcff3c !important;
}

/* Exclude specific elements from high contrast overrides */
html.accessibility-high-contrast *:not(.accessibility-slider):not(.accessibility-slider *):not(.toggle-switch):not(.toggle-switch *):not(#read-mask):not(#read-mask *):not(.card-icon):not(.ui-slider) {
  background-color: #000000 !important;
  color: #fcff3c !important;
}

/* Fix for sliders in high contrast mode */
html.accessibility-high-contrast .accessibility-slider {
  background: #fcff3c !important;
  border: 1px solid #ffffff !important;
}

html.accessibility-high-contrast .accessibility-slider::-webkit-slider-track {
  background: #fcff3c !important;
}

html.accessibility-high-contrast .accessibility-slider::-moz-range-track {
  background: #fcff3c !important;
}

html.accessibility-high-contrast .accessibility-slider::-webkit-slider-thumb {
  background: #ffffff !important;
  border: 2px solid #fcff3c !important;
  width: 16px !important;
  height: 16px !important;
}

html.accessibility-high-contrast .accessibility-slider::-moz-range-thumb {
  background: #ffffff !important;
  border: 2px solid #fcff3c !important;
  width: 16px !important;
  height: 16px !important;
}

/* Fix for toggle switches in high contrast */
html.accessibility-high-contrast .toggle-switch .slider {
  background-color: #fcff3c !important;
}

html.accessibility-high-contrast .toggle-switch input:checked+.slider {
  background-color: #ffffff !important;
}

html.accessibility-high-contrast .toggle-switch .slider:before {
  background-color: #000000 !important;
}

/* Fix for read mask in high contrast */
html.accessibility-high-contrast #read-mask {
  background: rgba(0, 0, 0, 0.12) !important;
}

html.accessibility-high-contrast #read-mask .highlight {
  background: transparent !important;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6) !important;
  border-bottom: 5px solid #fcff3c !important;
  border-top: 5px solid #fcff3c !important;
}

/* Ensure the highlight remains visible in high contrast */
html.accessibility-high-contrast #read-mask,
html.accessibility-high-contrast #read-mask * {
  background: transparent !important;
  color: inherit !important;
}

/* High contrast styles for specific elements */
html.accessibility-high-contrast a {
  color: #ffffff !important;
  text-decoration: underline;
}

html.accessibility-high-contrast button,
html.accessibility-high-contrast .btn,
html.accessibility-high-contrast input[type="button"],
html.accessibility-high-contrast input[type="submit"] {
  background: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #ffffff !important;
}

html.accessibility-high-contrast input:not(.accessibility-slider),
html.accessibility-high-contrast textarea {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

html.accessibility-high-contrast #accessibility-panel {
  background: #000000 !important;
  border: 2px solid #fcff3c !important;
}

html.accessibility-high-contrast .accessibility-card {
  background: #111111 !important;
  border: 1px solid #fcff3c !important;
}

html.accessibility-high-contrast .card-icon {
  color: #fcff3c !important;
}

html.accessibility-high-contrast .value-display {
  color: #fcff3c !important;
}

html.accessibility-high-contrast .accessibility-select {
  background: #000000 !important;
  color: #fcff3c !important;
  border: 1px solid #fcff3c !important;
}

html.accessibility-high-contrast .accessibility-tts-button {
  background: #fcff3c !important;
  color: #000000 !important;
  border: 1px solid #fcff3c !important;
}

html.accessibility-high-contrast .reset-button {
  background: #ff4444 !important;
  color: #000000 !important;
  border: 1px solid #ff4444 !important;
}

/* Big cursor mode */
html.accessibility-big-cursor,
html.accessibility-big-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"><circle cx="18" cy="18" r="10" fill="red"/></svg>') 18 18, auto !important;
}

/* Dyslexia font */
@import url('https://fonts.googleapis.com/css2?family=Open+Dyslexic&display=swap');

html.accessibility-dyslexia-font,
html.accessibility-dyslexia-font *:not(i):not(.welcome-button):not(.btn):not(.owl-nav):not(.owl-prev):not(.owl-next) {
  font-family: "Open Dyslexic", "Comic Sans MS", "Arial Rounded MT Bold", "Arial", sans-serif !important;
  letter-spacing: 0.05em !important;
  line-height: 1.6 !important;
}


/* Focus indicators */
html.accessibility-show-focus a:focus-visible,
html.accessibility-show-focus button:focus-visible,
html.accessibility-show-focus input:focus-visible,
html.accessibility-show-focus textarea:focus-visible,
html.accessibility-show-focus select:focus-visible {
  outline: 3px solid #25bebc !important;
  outline-offset: 2px !important;
}/* Enhanced animation disabling that targets common carousel libraries */
html.accessibility-disable-animations * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
    animation-delay: 0s !important;
    transition-delay: 0s !important;
    animation-play-state: paused !important;
}

/* Specifically target carousels and sliders */
html.accessibility-disable-animations .carousel,
html.accessibility-disable-animations .owl-carousel,
html.accessibility-disable-animations .slick-slider,
html.accessibility-disable-animations .main-slider,
html.accessibility-disable-animations .slider,
html.accessibility-disable-animations [class*="carousel"],
html.accessibility-disable-animations [class*="slider"] {
    animation: none !important;
    transition: none !important;
}

/* Target animation attributes and classes */
html.accessibility-disable-animations [data-animation],
html.accessibility-disable-animations [data-animation-in],
html.accessibility-disable-animations [data-animation-out],
html.accessibility-disable-animations .animated,
html.accessibility-disable-animations .fadeIn,
html.accessibility-disable-animations .fadeInLeft,
html.accessibility-disable-animations .fadeInRight,
html.accessibility-disable-animations .fadeInUp,
html.accessibility-disable-animations .fadeInDown,
html.accessibility-disable-animations .slideInLeft,
html.accessibility-disable-animations .slideInRight,
html.accessibility-disable-animations .zoomIn,
html.accessibility-disable-animations .bounceIn {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}

/* BUT allow the accessibility widget animations */
html.accessibility-disable-animations .accessibility-panel,
html.accessibility-disable-animations .accessibility-toggle,
html.accessibility-disable-animations .accessibility-widget,
html.accessibility-disable-animations .accessibility-card {
    animation-duration: 0.3s !important;
    transition-duration: 0.3s !important;
    animation-delay: 0s !important;
    transition-delay: 0s !important;
    animation-play-state: running !important;
}

/* Specifically allow the panel slideUp animation */
html.accessibility-disable-animations .accessibility-panel {
    animation: slideUp 0.3s ease !important;
}


html.accessibility-disable-animations .main-slider-welcome-text,
html.accessibility-disable-animations .slider-cell,
html.accessibility-disable-animations .main-title,
html.accessibility-disable-animations .sub-title,
html.accessibility-disable-animations .welcome-button2 {
    animation: none !important;
    transition: none !important;
    animation-duration: 0s !important;
    transition-duration: 0s !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .accessibility-toggle {
    width: 45px;
    height: 45px;
    font-size: 10px;
  }

  .accessibility-panel {
    width: 90vw;
    max-width: 380px;
    right: -45vw;
    transform: translateX(50%);
  }

  .accessibility-grid {
    grid-template-columns: 1fr;
  }
}

/* Dyslexia font faces */
@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/npm/opendyslexic@1.0.5/fonts/OpenDyslexic-Regular.otf") format("opentype");
  font-weight: normal;
}

@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/npm/opendyslexic@1.0.5/fonts/OpenDyslexic-Bold.otf") format("opentype");
  font-weight: bold;
}