/*!
 * widget-pansite.css
 * Styles fuer das Accessibility-Widget selbst sowie fuer die Effekte,
 * die es auf der Host-Seite umschaltet (Kontrast, Graustufen, Cursor, ...).
 */

/* ---------- Widget-Container & Toggle-Button ---------- */

.a11y-widget-container {
  --a11y-accent: #E39000;
  position: fixed;
  z-index: 2147483000;
  font-family: Arial, Helvetica, sans-serif; 
}

.a11y-widget-pos-bottom-right { right: 16px; bottom: 16px; }
.a11y-widget-pos-bottom-left  { left: 16px;  bottom: 16px; }
.a11y-widget-pos-top-right    { right: 16px; top: 16px; }
.a11y-widget-pos-top-left     { left: 16px;  top: 16px; }

.a11y-widget-toggle {
  width: 75px;
  height: 75px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--a11y-accent);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.15s ease;
}

.a11y-widget-toggle:hover { transform: scale(1.06); }

.a11y-widget-toggle:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 2px;
}

/* ---------- Panel ---------- */

.a11y-widget-panel {
  position: absolute;
  bottom: 62px;
  right: 0;
  width: 475px;
  max-height: 80vh;
  max-width: calc(100vw - 32px);
  overflow-y: auto;
  background: #ffffff;
  color: #1a1a1a;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  padding: 16px;
  box-sizing: border-box;
  transition: width 0.15s ease;
}

.a11y-widget-panel-admin {
  width: 760px;
}

.a11y-widget-pos-bottom-left .a11y-widget-panel,
.a11y-widget-pos-top-left .a11y-widget-panel {
  right: auto;
  left: 0;
}

.a11y-widget-pos-top-right .a11y-widget-panel,
.a11y-widget-pos-top-left .a11y-widget-panel {
  bottom: auto;
  top: 62px;
}

.a11y-widget-panel * { box-sizing: border-box; }
.a11y-widget-panel [hidden] { display: none !important; }

.a11y-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.a11y-widget-title {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
  flex: 1;
}

.a11y-widget-content-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.a11y-widget-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.a11y-widget-card {
  background: #f6f7f9;
  border: 1px solid #e2e6ea;
  border-radius: 8px;
  padding: 10px 12px 12px;
}

.a11y-widget-card-title,.a11y-widget-admin-group-title {
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e6ea;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a5560;
}

.a11y-widget-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.a11y-widget-admin-group-title:first-child { margin-top: 0; }

.a11y-widget-admin {
  flex: 1;
  min-width: 0;
  border-right: 1px solid #e2e2e2;
  padding-right: 16px;
}

.a11y-widget-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.a11y-widget-admin-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.a11y-widget-admin-row {
  display: flex;
  align-items: center;
  font-size: 14px;
  gap: 10px;
  cursor: pointer;
}

.a11y-widget-admin-row .a11y-widget-icon { color: var(--a11y-accent); }

.a11y-widget-admin-checkbox {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.a11y-widget-admin-row-text {
  flex: 1;
  min-width: 0;
}

.a11y-widget-admin-move {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.a11y-widget-admin-move-btn {
  width: 22px;
  height: 22px;
  font-size: 9px;
  padding: 0;
}

.a11y-widget-admin-snippet {
  width: 100%;
  font-family: "Courier New", monospace;
  font-size: 11px;
  padding: 8px;
  border: 1px solid #c9c9c9;
  border-radius: 6px;
  resize: vertical;
  background: #f7f7f7;
  color: #1a1a1a;
}

.a11y-widget-admin-text-input {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #c9c9c9;
  border-radius: 6px;
  color: #1a1a1a;
  background: #ffffff;
}

.a11y-widget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.a11y-widget-row-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  flex: 1;
}

.a11y-widget-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.a11y-widget-row-label .a11y-widget-icon { color: var(--a11y-accent); }

.a11y-widget-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.a11y-widget-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.a11y-widget-btn {
  font-family: inherit;
  font-size: 16px;
  border: 1px solid #c9c9c9;
  background: #f5f5f5;
  color: #1a1a1a;
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
  line-height: 1;
}

.a11y-widget-btn:hover { background: #e9e9e9; }

.a11y-widget-btn:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 1px;
}

.a11y-widget-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.a11y-widget-btn:disabled:hover { background: #f5f5f5; }

.a11y-widget-readaloud-controls {
  display: flex;
  gap: 8px;
}

.a11y-widget-btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
}

.a11y-widget-close {
  border: none;
  background: transparent;
  width: 28px;
  height: 28px;
}

.a11y-widget-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.a11y-widget-stepper-value {
  min-width: 40px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.a11y-widget-choice-active {
  background: var(--a11y-accent);
  border-color: var(--a11y-accent);
  color: #fff;
}

.a11y-widget-choice-active:hover {
  background: #fff;
  color: var(--a11y-accent);
}

.a11y-widget-switch {
  min-width: 52px;
}

.a11y-widget-switch-on {
  background: var(--a11y-accent);
  border-color: var(--a11y-accent);
  color: #fff;
}

.a11y-widget-switch-on:hover {
  background: #fff;
  color: var(--a11y-accent);
}

.a11y-widget-color-input {
  width: 40px;
  height: 28px;
  padding: 0;
  border: 1px solid #c9c9c9;
  border-radius: 6px;
  cursor: pointer;
}

.a11y-widget-voice-select {
  max-width: 60%;
  font-family: inherit;
  font-size: 13px;
  padding: 4px 6px;
  border: 1px solid #c9c9c9;
  border-radius: 6px;
  background: #ffffff;
  color: #1a1a1a;
}

.a11y-widget-image-desc {
  position: fixed;
  display: none;
  z-index: 2147483001;
  background: #000000;
  color: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  max-width: 320px;
  pointer-events: none;
}

.a11y-widget-footer {
  margin-top: 10px;
  border-top: 1px solid #e2e2e2;
  padding-top: 10px;
}

.a11y-widget-reset {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff0f0;
  border-color: #e5a3a3;
  color: #7a1f1f;
  font-weight: 600;
}

.a11y-widget-reset:hover { background: #ffe2e2; }

.a11y-widget-hint {
  margin: -4px 0 0;
  font-size: 14px;
  line-height: 1.35;
  color: #666;
}

/* ---------- Seitenstruktur-Panel ---------- */

.a11y-widget-section > .a11y-widget-row-label {
  /* Als Sektions-Header darf sich der Label-Container nicht wie ein Flex-Kind
     im Row-Kontext benehmen (flex: 1 waere im Column-Container schaedlich). */
  flex: none;
}

.a11y-widget-page-structure-content {
  max-height: 240px;
  overflow-y: auto;
  margin-top: 2px;
}

.a11y-widget-page-structure-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.a11y-widget-page-structure-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13.5px;
  color: #1a1a1a;
  cursor: pointer;
}

.a11y-widget-page-structure-item:hover {
  background: #f0f2f5;
  border-color: #dfe3e8;
}

.a11y-widget-page-structure-item:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 1px;
}

.a11y-widget-page-structure-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--a11y-accent);
  min-width: 32px;
}

.a11y-widget-page-structure-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .a11y-widget-panel-admin { width: calc(100vw - 32px); }
  .a11y-widget-panel-admin .a11y-widget-content-row { flex-direction: column; }
  .a11y-widget-panel-admin .a11y-widget-admin {
    border-right: none;
    border-bottom: 1px solid #e2e2e2;
    padding-right: 0;
    padding-bottom: 16px;
  }
}

@media (max-width: 400px) {
  .a11y-widget-panel { width: calc(100vw - 32px); }
}

/* ---------- Effekte auf der Host-Seite ---------- */

html.a11y-lh-1 body,
html.a11y-lh-1 body * {
  line-height: 1.6 !important;
}

html.a11y-lh-2 body,
html.a11y-lh-2 body * {
  line-height: 2 !important;
}

html.a11y-lh-3 body,
html.a11y-lh-3 body * {
  line-height: 2.4 !important;
}

html.a11y-align-left body,
html.a11y-align-left body * {
  text-align: left !important;
}

html.a11y-align-center body,
html.a11y-align-center body * {
  text-align: center !important;
}

html.a11y-align-right body,
html.a11y-align-right body * {
  text-align: right !important;
}

html.a11y-font-readable body,
html.a11y-font-readable body * {
  font-family: Arial, Helvetica, "Segoe UI", sans-serif !important;
}

html.a11y-font-dyslexia body,
html.a11y-font-dyslexia body * {
  font-family: "Comic Sans MS", "Comic Sans", Verdana, Arial, sans-serif !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.06em !important;
}

html.a11y-contrast-dark,
html.a11y-contrast-dark body {
  background-color: #121212 !important;
  color: #f1f1f1 !important;
}
html.a11y-contrast-dark a { color: #8ab4ff !important; }
html.a11y-contrast-dark img,
html.a11y-contrast-dark video { filter: brightness(0.9); }

html.a11y-contrast-high,
html.a11y-contrast-high body {
  background-color: #000000 !important;
  color: #ffffff !important;
}
html.a11y-contrast-high a { color: #ffe600 !important; }
html.a11y-contrast-high * {
  border-color: #ffffff !important;
}

html.a11y-contrast-sepia,
html.a11y-contrast-sepia body {
  background-color: #f4ecd8 !important;
  color: #3d2b1f !important;
}
html.a11y-contrast-sepia a { color: #6b4a1f !important; }

html.a11y-contrast-invers,
html.a11y-contrast-invers body {
  background-color: #003a75 !important;
  color: #ffffff !important;
}
html.a11y-contrast-invers a { color: #ffe600 !important; }
html.a11y-contrast-invers img,
html.a11y-contrast-invers video { filter: brightness(0.9); }

html.a11y-contrast-yellow,
html.a11y-contrast-yellow body {
  background-color: #fff9c4 !important;
  color: #000000 !important;
}
html.a11y-contrast-yellow a { color: #003a75 !important; }

html.a11y-contrast-cream,
html.a11y-contrast-cream body {
  background-color: #fdfaf0 !important;
  color: #00335c !important;
}
html.a11y-contrast-cream a { color: #7a3a00 !important; }

html.a11y-contrast-terminal,
html.a11y-contrast-terminal body {
  background-color: #0a1a0a !important;
  color: #c6ffc6 !important;
}
html.a11y-contrast-terminal a { color: #ffe600 !important; }
html.a11y-contrast-terminal img,
html.a11y-contrast-terminal video { filter: brightness(0.9); }

html.a11y-custom-bg,
html.a11y-custom-bg body {
  background-color: var(--a11y-custom-bg) !important;
}

html.a11y-underline-links a {
  text-decoration: underline !important;
  background-color: rgba(255, 230, 0, 0.35) !important;
}

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

html.a11y-cursor-medium-black,
html.a11y-cursor-medium-black * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path d="M3 2l18 8-7 2-2 7-9-17z" fill="black" stroke="white" stroke-width="1"/></svg>') 4 4, auto !important;
}

html.a11y-cursor-medium-white,
html.a11y-cursor-medium-white * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path d="M3 2l18 8-7 2-2 7-9-17z" fill="white" stroke="black" stroke-width="1.5"/></svg>') 4 4, auto !important;
}

html.a11y-cursor-large-black,
html.a11y-cursor-large-black * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path d="M3 2l18 8-7 2-2 7-9-17z" fill="black" stroke="white" stroke-width="1"/></svg>') 4 4, auto !important;
}

html.a11y-cursor-large-white,
html.a11y-cursor-large-white * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path d="M3 2l18 8-7 2-2 7-9-17z" fill="white" stroke="black" stroke-width="1.5"/></svg>') 4 4, auto !important;
}

html.a11y-hide-images img,
html.a11y-hide-images picture,
html.a11y-hide-images svg,
html.a11y-hide-images video {
  display: none !important;
}

html.a11y-hide-images .a11y-widget-toggle svg {
  display: inline-block !important;
}

html.a11y-focus-highlight :focus {
  outline: 4px solid #ffbf47 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 6px rgba(255, 191, 71, 0.35) !important;
}

html.a11y-stop-animations *,
html.a11y-stop-animations *::before,
html.a11y-stop-animations *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* ---------- Nur-Text-Modus ---------- */

/* Grundtypografie zwingen (dunkler Text auf weissem Hintergrund, Serifenschrift). */
html.a11y-plain-text,
html.a11y-plain-text body {
  background: #ffffff !important;
  color: #222222 !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-size: 18px !important;
  line-height: 1.7 !important;
}

/* Layout-"Chrome" ausblenden - Header, Nav-Menues, Footer, Sidebars.
   Nur direkte Body-Kinder oder eindeutig gerollte Landmarks; navs INNERHALB
   des Hauptinhalts (z.B. Inhaltsverzeichnisse) bleiben erhalten. */
html.a11y-plain-text body > header,
html.a11y-plain-text body > nav,
html.a11y-plain-text body > footer,
html.a11y-plain-text body > aside,
html.a11y-plain-text [role="banner"],
html.a11y-plain-text [role="contentinfo"],
html.a11y-plain-text [role="complementary"] {
  display: none !important;
}

/* Einspaltig, zentriert, angenehme Zeilenlaenge. */
html.a11y-plain-text body {
  max-width: 72ch !important;
  margin: 0 auto !important;
  padding: 32px 20px !important;
}

/* Dekorative Hintergrundgrafiken und Schatten entfernen. */
html.a11y-plain-text body * {
  background-image: none !important;
  box-shadow: none !important;
}

/* Media responsiv und blockig. */
html.a11y-plain-text img,
html.a11y-plain-text video,
html.a11y-plain-text picture {
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
  margin: 16px 0 !important;
}

html.a11y-plain-text a {
  color: #0057b7 !important;
  text-decoration: underline !important;
}

.a11y-reading-mask {
  position: fixed;
  left: 0;
  right: 0;
  /* Farbe/Deckkraft werden per Inline-Style aus state.readingMaskColor +
     state.readingMaskOpacityIndex berechnet und gesetzt. */
  z-index: 2147482999;
  pointer-events: none;
}

.a11y-reading-mask-top {
  top: 0;
  height: 0;
}

.a11y-reading-mask-bottom {
  bottom: 0;
  top: 100%;
}

.a11y-reading-mask-ruler {
  top: 0;
  height: 60px;
}

.a11y-widget-magnifier {
  position: fixed;
  display: none;
  z-index: 2147483001;
  background: #000000;
  color: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 28px;
  line-height: 1.4;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  max-height: 60vh;
  overflow-y: auto;
}

/* ---------- Vorlesefunktion: Inline-Toolbar am Highlight ---------- */

.a11y-widget-reader-toolbar {
  position: fixed;
  z-index: 2147483002;
  display: flex;
  gap: 4px;
  background: #1a1a1a;
  color: #ffffff;
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-family: Arial, Helvetica, sans-serif;
}

.a11y-widget-reader-toolbar[hidden] { display: none; }

.a11y-widget-reader-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.a11y-widget-reader-btn:hover { background: rgba(255, 255, 255, 0.15); }

.a11y-widget-reader-btn:focus-visible {
  outline: 2px solid #ffbf47;
  outline-offset: 1px;
}

.a11y-widget-reader-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
