/* public/widget.css */

/* Import der OpenDyslexic Schriftart von Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Open+Dyslexic&display=swap");
/* Font Awesome CDN */
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css");

/* Definieren der CSS-Variablen für die Akzentfarbe und Buttonfarbe */
#accessibility-widget-container {
  --a11y-accent-color: #007bff; /* Standardwert, wird von JS überschrieben */
  --a11y-button-color: #007bff; /* Standardwert, wird von JS überschrieben */
  font-family: "Inter", sans-serif; /* Modernere Schriftart */
  /* Position wird inline im HTML gesetzt */
  filter: none !important; /* Wichtig: Verhindert, dass html-Filter das Widget beeinflusst */
}

/* Stil für den runden Toggle-Button */
.a11y-widget-toggle {
  width: 56px; /* Etwas größer */
  height: 56px; /* Etwas größer */
  border-radius: 50%;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); /* Deutlicherer Schatten */
  transition: all 0.3s ease; /* Sanfte Übergänge */
  position: relative;
  z-index: 10; /* Über dem Inhaltspanel */
  background-color: var(--a11y-button-color); /* Farbe vom JS gesetzt */
  font-size: 20px; /* Basis-Schriftgröße für em-Einheiten des Icons */
}

.a11y-widget-toggle:hover {
  transform: translateY(-2px); /* Leichter "Lift"-Effekt */
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Anpassung für Font Awesome Icons im Haupt-Toggle-Button */
.a11y-widget-toggle i {
  font-size: 28px; /* Deutlich größerer Icon-Font-Size */
  transition: transform 0.3s ease;
}

.a11y-widget-toggle:hover i {
  transform: scale(1.1); /* Icon vergrößert sich leicht */
}

/* Stil für das Badge auf dem Toggle-Button */
.a11y-active-badge {
  position: absolute;
  top: -5px; /* Position oben rechts */
  right: -5px;
  background-color: var(--a11y-accent-color); /* Akzentfarbe */
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 50%;
  min-width: 20px; /* Mindestbreite für einzelne Ziffern */
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px; /* Etwas Padding für zweistellige Zahlen */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 11; /* Über dem Toggle-Button */
}

/* Stil für das ausklappbare Inhaltspanel (Standardzustand) */
.a11y-widget-content {
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
  flex-direction: column;
  position: absolute;
  bottom: calc(56px + 15px); /* Höhe des Buttons (56px) + Abstand (15px) */
  right: 0;
  left: auto;
  width: 360px;
  overflow: hidden; /* Verhindert Scrollen auf dieser Ebene */

  /* Responsive height settings for mobile */
  min-height: 500px;
  max-height: 520px; /* Angepasst für Mobil */

  background-color: #ffffff; /* Weißer Hintergrund */

  border-radius: 20px; /* Erhöht für modernere Optik */
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2); /* Deutlicherer, aber weicherer Schatten */

  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  visibility: hidden; /* Wichtig: Standardmäßig unsichtbar */
  display: none; /* Verhindert das Flackern beim Laden */
}

/* Media query for desktop and larger screens */
@media (min-width: 768px) {
  .a11y-widget-content {
    min-height: 550px; /* Angepasst für Desktop */
    max-height: 700px; /* Angepasst für Desktop */
  }
}

/* Zustand "geöffnet" */
.a11y-widget-content.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition-delay: 0s;
  display: flex; /* Wird nur beim Öffnen auf flex gesetzt */
}

/* Header des Widget-Panels */
.a11y-widget-header {
  background-color: #007bff; /* Blauer Hintergrund */
  padding: 20px 25px; /* Erhöhtes Padding */
  color: #ffffff; /* Weißer Text */
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-top-left-radius: 20px; /* Angepasst an Panel-Radius */
  border-top-right-radius: 20px; /* Angepasst an Panel-Radius */
  border-bottom: 1px solid #0056b3; /* Trennlinie, dunklerer Blauton */
}

.a11y-widget-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.a11y-header-actions {
  display: flex;
  gap: 8px;
}

.a11y-header-actions button {
  background: none;
  border: none;
  color: #ffffff; /* Weiße Icons */
  cursor: pointer;
  font-size: 1.2rem;
  padding: 6px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.a11y-header-actions button:hover {
  background-color: rgba(255, 255, 255, 0.1); /* Leichter Hover-Effekt */
}

/* Neuer Container für scrollbaren Inhalt */
.a11y-scrollable-content {
  flex-grow: 1; /* Nimmt den verbleibenden Platz ein */
  overflow-y: auto; /* Hier ist der Scrollbalken */
  overflow-x: hidden; /* Verhindert horizontales Scrollen */
  scrollbar-width: thin;
  scrollbar-color: var(--a11y-accent-color);
  display: flex; /* Ermöglicht Flex-Layout für Slider und Grid */
  flex-direction: column; /* Stapelt Slider und Grid vertikal */
}

/* Scrollbar-Styling für Webkit-Browser (Chrome, Safari) */
.a11y-scrollable-content::-webkit-scrollbar {
  width: 8px;
}

.a11y-scrollable-content::-webkit-scrollbar-track {
  background: #e0e0e0; /* Hellerer Track */
  border-radius: 10px;
}

.a11y-scrollable-content::-webkit-scrollbar-thumb {
  background-color: var(--a11y-accent-color);
  border-radius: 10px;
  border: 2px solid #e0e0e0; /* Angepasster Rand */
}

/* Container für die Slider-Reihen */
.a11y-sliders-container {
  display: flex;
  flex-direction: column;
  gap: 10px; /* Abstand zwischen den Reihen */
  padding: 15px;
  border-bottom: 1px solid #e0e0e0; /* Trennlinie zu den Kacheln */
  flex-shrink: 0; /* Verhindert, dass dieser Bereich schrumpft */
}

/* Einzelne Slider-Reihe */
.a11y-slider-row {
  background-color: #f0f0f0; /* Heller Hintergrund */
  border-radius: 10px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  box-shadow: none;
  transition: background-color 0.2s ease;
  width: 100%; /* Volle Breite */
}

.a11y-slider-row:hover {
  background-color: #e0e0e0;
}

.a11y-slider-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333333; /* Dunkler Text */
  margin-bottom: 8px;
}

.a11y-slider-control {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.a11y-slider-btn {
  background-color: #cccccc; /* Hellerer Button */
  border: none;
  border-radius: 8px; /* Etwas mehr abgerundet */
  width: 40px; /* Größere Buttons */
  height: 40px; /* Größere Buttons */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem; /* Größere Schrift */
  font-weight: bold;
  color: #333333; /* Dunkler Text */
  cursor: pointer;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.a11y-slider-btn:hover {
  background-color: #bbbbbb;
}

.a11y-slider-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333333; /* Dunkler Text */
  min-width: 40px; /* Ensure space for percentage */
  text-align: center; /* Zentriert den Wert */
  flex-grow: 1; /* Nimmt den restlichen Platz ein */
}

/* Grid für die Optionen (nur noch Toggle-Kacheln) */
.a11y-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 Spalten */
  gap: 12px; /* Kleinerer Abstand */
  padding: 15px; /* Innenabstand des Grids */
  flex-shrink: 0; /* Verhindert, dass dieser Bereich schrumpft */
}

/* Einzelne Option-Kachel (Toggle) */
.a11y-option-tile {
  background-color: #f0f0f0; /* Hellerer Hintergrund für inaktive Kacheln */
  border: none; /* Kein Rand */
  border-radius: 10px;
  padding: 15px; /* Angepasstes Padding für vertikale Ausrichtung */
  display: flex;
  flex-direction: column; /* Icon über Text */
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 80px; /* Einheitliche Höhe für vertikale Ausrichtung */
  box-shadow: none; /* Kein Schatten */
}

.a11y-option-tile:hover {
  background-color: #e0e0e0; /* Etwas helleres Grau beim Hover */
}

.a11y-option-tile.is-active {
  background-color: var(--a11y-accent-color); /* Akzentfarbe, wenn aktiv */
  color: white; /* Weißer Text */
}

.a11y-option-icon {
  background-color: transparent; /* Kein Hintergrund für Icon */
  width: auto;
  height: auto;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0;
  margin-bottom: 8px; /* Abstand zwischen Icon und Label */
  color: #333333; /* Dunkleres Icon für weißen Hintergrund */
  transition: all 0.2s ease;
}

.a11y-option-tile.is-active .a11y-option-icon {
  color: #ffffff; /* Weißes Icon, wenn Kachel aktiv */
}

.a11y-option-icon i {
  font-size: 24px; /* Größe der Icons in den Kacheln */
}

.a11y-option-label {
  font-size: 0.85rem; /* Angepasste Schriftgröße */
  font-weight: 500;
  color: #333333; /* Dunkler Text für weißen Hintergrund */
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: break-word;
  transition: color 0.2s ease;
}

.a11y-option-tile.is-active .a11y-option-label {
  color: #ffffff; /* Weißer Text, wenn Kachel aktiv */
}

/* Stile für Barrierefreiheits-Funktionen, die auf das HTML-Element angewendet werden */

/* Farben umkehren */
html.a11y-invert-colors {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* Monochrom (Graustufen) */
html.a11y-grayscale {
  filter: grayscale(100%) !important;
}

/* Blaufilter */
html.a11y-blue-filter {
  /* Simuliert eine Blaufilterbrille: wärmere Töne, reduzierte Helligkeit/Kontrast */
  filter: sepia(0.4) hue-rotate(200deg) saturate(1.2) brightness(0.95) contrast(0.95) !important;
}

/* Dunkler Kontrast */
html.a11y-dark-contrast {
  filter: contrast(150%) brightness(80%) !important;
}

/* Heller Kontrast */
html.a11y-light-contrast {
  filter: contrast(80%) brightness(150%) !important;
}

/* Niedrige Sättigung */
html.a11y-low-saturation {
  filter: saturate(30%) !important;
}

/* Hohe Sättigung */
html.a11y-high-saturation {
  filter: saturate(200%) !important;
}

/* Bilder entfernen */
html.a11y-remove-images img:not([src$=".svg"]),
html.a11y-remove-images picture:not([src$=".svg"]),
html.a11y-remove-images object:not([src$=".svg"]),
html.a11y-remove-images embed:not([src$=".svg"]) {
  display: none !important;
}

/* Animationen deaktivieren */
html.a11y-disable-animations * {
  animation: none !important;
  transition: none !important;
}

/* Großer Cursor */
html.a11y-large-cursor {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><circle cx="24" cy="24" r="16" fill="rgba(0,0,0,0.3)" stroke="white" stroke-width="2"/></svg>')
    24 24, auto !important;
}

/* Dyslexie Schrift */
html.a11y-dyslexia-font {
  font-family: "Open Dyslexic", sans-serif !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.1em !important;
  line-height: 1.6 !important;
}

/* Links hervorheben */
html.a11y-highlight-links a {
  background-color: #ffff00 !important;
  color: black !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
  text-decoration: underline !important;
  outline: 2px solid orange !important;
  outline-offset: 2px !important;
}

/* Überschriften hervorheben */
html.a11y-highlight-headings h1,
html.a11y-highlight-headings h2,
html.a11y-highlight-headings h3,
html.a11y-highlight-headings h4,
html.a11y-highlight-headings h5,
html.a11y-highlight-headings h6 {
  background-color: rgba(255, 165, 0, 0.3) !important; /* Orange Hintergrund */
  border: 2px solid orange !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
}

/* Sicherstellen, dass die Schriftgröße des Widgets nicht von der globalen Einstellung beeinflusst wird */
#accessibility-widget-container,
#accessibility-widget-container * {
  font-size: initial !important;
  line-height: initial !important;
  letter-spacing: initial !important;
  zoom: 1 !important;
  -webkit-text-size-adjust: initial !important;
}
