/**
 * Barrierefreiheits-Widget (A11y Widget)
 * WCAG 2.1 AA konform
 * Isolierte Klassen mit Namespace: .a11y-widget__*
 */

/* ===== FAB (Floating Action Button) ===== */
.a11y-widget__fab {
    position: fixed;
    top: 50%;
    right: max(20px, env(safe-area-inset-right));
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    background: var(--a11y-widget-color, #EC661C);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
}

.a11y-widget__fab:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.a11y-widget__fab:focus {
    outline: 3px solid #EC661C;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px rgba(174, 154, 99, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.a11y-widget__fab:active {
    transform: translateY(-50%) scale(0.95);
}

.a11y-widget__fab i {
    pointer-events: none;
}

/* ===== Panel ===== */
.a11y-widget__panel {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom));
    right: max(20px, env(safe-area-inset-right));
    width: 420px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) translateX(0);
    pointer-events: none;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    overflow: hidden;
    will-change: opacity, transform;
}

.a11y-widget__panel--open {
    opacity: 1 !important;
    transform: translateY(0) translateX(0) !important;
    pointer-events: auto !important;
    display: flex !important;
    visibility: visible !important;
}

/* Mobile: Bottom Sheet */
@media (max-width: 768px) {
    .a11y-widget__fab {
        top: auto;
        bottom: max(20px, env(safe-area-inset-bottom));
        transform: none;
    }
    
    .a11y-widget__fab:hover {
        transform: scale(1.05);
    }
    
    .a11y-widget__fab:active {
        transform: scale(0.95);
    }
    
.a11y-widget__panel {
    width: 100%;
    max-width: 100%;
    bottom: max(20px, env(safe-area-inset-bottom)) !important;
    right: max(20px, env(safe-area-inset-right)) !important;
    left: auto !important;
    top: auto !important;
    border-radius: 12px 12px 0 0;
    max-height: 90vh;
    position: fixed !important;
    transform: translateY(0) translateX(0) !important;
    filter: none !important;
    z-index: 999999 !important;
}
}

/* ===== Panel Header ===== */
.a11y-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--a11y-widget-color, #EC661C);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.a11y-widget__header .a11y-widget__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.a11y-widget__header .a11y-widget__title i {
    font-size: 20px;
    color: #ffffff;
}

.a11y-widget__title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.a11y-widget__close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    min-width: 40px;
    min-height: 40px;
}

.a11y-widget__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.a11y-widget__close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ===== Panel Content ===== */
.a11y-widget__content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.a11y-widget__intro {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.a11y-widget__legal {
    margin: 0 0 24px 0;
    padding: 12px;
    background: #f8f9fa;
    border-left: 3px solid #EC661C;
    border-radius: 4px;
}

.a11y-widget__legal small {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

/* ===== Sections ===== */
.a11y-widget__section {
    margin-bottom: 16px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.a11y-widget__section:last-child {
    margin-bottom: 0;
}

.a11y-widget__section-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.a11y-widget__section-header:hover {
    background: #e9ecef;
}

.a11y-widget__section-header:focus {
    outline: 2px solid #EC661C;
    outline-offset: -2px;
}

.a11y-widget__section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

.a11y-widget__section-icon {
    font-size: 14px;
    color: #6c757d;
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 12px;
}

.a11y-widget__section-icon--rotated {
    transform: rotate(180deg);
}

.a11y-widget__section-content {
    display: none;
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

.a11y-widget__section-content--expanded {
    display: block;
}

/* ===== Profiles ===== */
.a11y-widget__profiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.a11y-widget__profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 13px;
}

.a11y-widget__profile:hover {
    border-color: #EC661C;
    background: #f8f9fa;
}

.a11y-widget__profile:focus {
    outline: 2px solid #EC661C;
    outline-offset: 2px;
}

.a11y-widget__profile--active {
    border-color: #EC661C;
    background: #e7f3ff;
}

.a11y-widget__profile i {
    font-size: 20px;
    color: #2c3e50;
    flex-shrink: 0;
}

.a11y-widget__profile-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.a11y-widget__profile-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.a11y-widget__profile-content span {
    font-size: 11px;
    color: #666;
}

/* ===== Options ===== */
.a11y-widget__option {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.a11y-widget__option:last-child {
    margin-bottom: 0;
}

.a11y-widget__label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.a11y-widget__label-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 15px;
    color: #333;
}

.a11y-widget__label-text i {
    font-size: 18px;
    color: #2c3e50;
}

.a11y-widget__description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* ===== Toggle Switch ===== */
.a11y-widget__toggle {
    position: relative;
    width: 52px;
    height: 28px;
    min-width: 52px;
    min-height: 28px;
    background: #ccc;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
    flex-shrink: 0;
}

.a11y-widget__toggle[aria-pressed="true"] {
    background: #EC661C;
}

.a11y-widget__toggle:focus {
    outline: 2px solid #EC661C;
    outline-offset: 2px;
}

.a11y-widget__toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.a11y-widget__toggle[aria-pressed="true"] .a11y-widget__toggle-slider {
    transform: translateX(24px);
}

/* ===== Toggle Group (mit Select) ===== */
.a11y-widget__toggle-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ===== Button Group (für Farbschwäche) ===== */
.a11y-widget__button-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    width: 100%;
    max-width: 120px;
}

.a11y-widget__value-btn {
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    color: #495057;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
}

.a11y-widget__value-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.a11y-widget__value-btn:focus {
    outline: 2px solid #EC661C;
    outline-offset: 2px;
}

.a11y-widget__value-btn[aria-pressed="true"] {
    background: #EC661C;
    color: white;
    border-color: #EC661C;
}

.a11y-widget__value-btn[aria-pressed="true"]:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.a11y-widget__size-select {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    min-width: 100px;
}

.a11y-widget__size-select:focus {
    outline: 2px solid #EC661C;
    outline-offset: 2px;
    border-color: #EC661C;
}

/* ===== Slider ===== */
.a11y-widget__slider-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.a11y-widget__slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.a11y-widget__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #EC661C;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.a11y-widget__slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.a11y-widget__slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #EC661C;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.a11y-widget__slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.a11y-widget__slider:focus {
    outline: 2px solid #EC661C;
    outline-offset: 2px;
}

.a11y-widget__slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 10px;
}

.a11y-widget__slider-value {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    text-align: center;
    min-height: 20px;
}

/* Select */
.a11y-widget__select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 150px;
    flex-shrink: 0;
}

.a11y-widget__select:focus {
    outline: 2px solid #EC661C;
    outline-offset: 2px;
    border-color: #EC661C;
}

/* Farbpicker für Kontrast */
.a11y-widget__color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.a11y-widget__color-btn {
    position: relative;
    width: 35px;
    height: 35px;
    border-radius: 4px;
    border: 2px solid #dee2e6;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.a11y-widget__color-btn:hover {
    transform: scale(1.05);
    border-color: #EC661C;
    box-shadow: 0 2px 8px rgba(174, 154, 99, 0.3);
}

.a11y-widget__color-btn:focus {
    outline: 2px solid #EC661C;
    outline-offset: 2px;
}

.a11y-widget__color-btn--active {
    border-color: #EC661C;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(174, 154, 99, 0.2);
}

.a11y-widget__color-btn-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #495057;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s, bottom 0.2s;
    pointer-events: none;
    background: white;
    padding: 2px 4px;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.a11y-widget__color-btn:hover .a11y-widget__color-btn-label {
    opacity: 1;
    bottom: -24px;
}

.a11y-widget__color-btn[data-value="default"] {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
}

.a11y-widget__color-btn[data-value="default"]::before {
    content: '—';
    position: absolute;
    font-size: 24px;
    color: #6c757d;
    font-weight: bold;
}

/* ===== Actions ===== */
.a11y-widget__actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
}

.a11y-widget__reset {
    width: 100%;
    padding: 12px 20px;
    background: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.a11y-widget__reset:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.a11y-widget__reset:focus {
    outline: 2px solid #EC661C;
    outline-offset: 2px;
}

/* ===== Panel Footer ===== */
.a11y-widget__footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.a11y-widget__footer-links {
    margin-bottom: 12px;
}

.a11y-widget__footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #495057;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.a11y-widget__footer-link:hover {
    color: #2c3e50;
    text-decoration: underline;
}

.a11y-widget__footer-link i {
    font-size: 14px;
}

.a11y-widget__footer-powered {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 11px;
    color: #6c757d;
}

.a11y-widget__footer-powered-text {
    font-weight: 500;
}

.a11y-widget__footer-logo {
    height: 20px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
}

.a11y-widget__reset:active {
    transform: scale(0.98);
}

/* ===== Live Region ===== */
.a11y-widget__live-region {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===== Applied Styles (via data-attributes) ===== */

/* Schriftgröße - rem-basiert */
html[data-a11y-font-size] {
    font-size: calc(1rem * var(--a11y-font-scale, 1));
}

html[data-a11y-font-size] body {
    font-size: 1rem;
}

/* Zeilenhöhe */
html[data-a11y-line-height] * {
    line-height: var(--a11y-line-height, 1.5) !important;
}

/* Absatzabstand */
html[data-a11y-paragraph-spacing] p {
    margin-bottom: var(--a11y-paragraph-spacing, 0) !important;
}

html[data-a11y-paragraph-spacing] p + p {
    margin-top: var(--a11y-paragraph-spacing, 0) !important;
}

/* Kontrast-Modi */
html[data-a11y-contrast="high"] {
    --a11y-color-bg: #ffffff;
    --a11y-color-text: #000000;
    --a11y-color-link: #0000ff;
    --a11y-color-border: #000000;
    --a11y-focus-ring: 3px solid #000000;
}

html[data-a11y-contrast="high"] body {
    background: var(--a11y-color-bg) !important;
    color: var(--a11y-color-text) !important;
}

html[data-a11y-contrast="high"] a {
    color: var(--a11y-color-link) !important;
    text-decoration: underline !important;
}

html[data-a11y-contrast="high"] a:focus,
html[data-a11y-contrast="high"] button:focus,
html[data-a11y-contrast="high"] input:focus,
html[data-a11y-contrast="high"] select:focus,
html[data-a11y-contrast="high"] textarea:focus {
    outline: var(--a11y-focus-ring) !important;
    outline-offset: 2px !important;
}

/* Dunkler Modus - Schrift komplett weiß, Hintergrund schwarz */
html[data-a11y-contrast="dark"] body {
    background: #000000 !important;
    color: #ffffff !important;
}

html[data-a11y-contrast="dark"] body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab) {
    background: #000000 !important;
    color: #ffffff !important;
}

/* Alle Content-Elemente */
html[data-a11y-contrast="dark"] main,
html[data-a11y-contrast="dark"] section,
html[data-a11y-contrast="dark"] article,
html[data-a11y-contrast="dark"] div:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab),
html[data-a11y-contrast="dark"] p,
html[data-a11y-contrast="dark"] h1,
html[data-a11y-contrast="dark"] h2,
html[data-a11y-contrast="dark"] h3,
html[data-a11y-contrast="dark"] h4,
html[data-a11y-contrast="dark"] h5,
html[data-a11y-contrast="dark"] h6,
html[data-a11y-contrast="dark"] li,
html[data-a11y-contrast="dark"] span,
html[data-a11y-contrast="dark"] td,
html[data-a11y-contrast="dark"] th {
    background: #000000 !important;
    color: #ffffff !important;
}

html[data-a11y-contrast="dark"] a {
    color: #4a9eff !important;
    text-decoration: underline !important;
}

html[data-a11y-contrast="dark"] button,
html[data-a11y-contrast="dark"] input,
html[data-a11y-contrast="dark"] select,
html[data-a11y-contrast="dark"] textarea {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

/* Heller Modus - Schrift komplett schwarz, Hintergrund weiß */
html[data-a11y-contrast="light"] body {
    background: #ffffff !important;
    color: #000000 !important;
}

html[data-a11y-contrast="light"] body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab) {
    background: #ffffff !important;
    color: #000000 !important;
}

/* Alle Content-Elemente */
html[data-a11y-contrast="light"] main,
html[data-a11y-contrast="light"] section,
html[data-a11y-contrast="light"] article,
html[data-a11y-contrast="light"] div:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab),
html[data-a11y-contrast="light"] p,
html[data-a11y-contrast="light"] h1,
html[data-a11y-contrast="light"] h2,
html[data-a11y-contrast="light"] h3,
html[data-a11y-contrast="light"] h4,
html[data-a11y-contrast="light"] h5,
html[data-a11y-contrast="light"] h6,
html[data-a11y-contrast="light"] li,
html[data-a11y-contrast="light"] span,
html[data-a11y-contrast="light"] td,
html[data-a11y-contrast="light"] th {
    background: #ffffff !important;
    color: #000000 !important;
}

html[data-a11y-contrast="light"] a {
    color: #0066cc !important;
    text-decoration: underline !important;
}

html[data-a11y-contrast="light"] button,
html[data-a11y-contrast="light"] input,
html[data-a11y-contrast="light"] select,
html[data-a11y-contrast="light"] textarea {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
}

/* Individuelle Farbauswahl */
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) body {
    background: var(--a11y-contrast-bg-color) !important;
}

html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) body {
    color: var(--a11y-contrast-text-color) !important;
}

html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab) {
    background: var(--a11y-contrast-bg-color) !important;
}

html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab) {
    color: var(--a11y-contrast-text-color) !important;
}

/* Alle Content-Elemente für individuelle Farben */
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) main,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) section,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) article,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) div:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab),
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) p,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) h1,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) h2,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) h3,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) h4,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) h5,
html[data-a11y-contrast="custom"][data-a11y-contrast-background]:not([data-a11y-contrast-background="default"]) h6 {
    background: var(--a11y-contrast-bg-color) !important;
}

html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) main,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) section,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) article,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) div:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab),
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) p,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) h1,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) h2,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) h3,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) h4,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) h5,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) h6,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) li,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) span,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) td,
html[data-a11y-contrast="custom"][data-a11y-contrast-text]:not([data-a11y-contrast-text="default"]) th {
    color: var(--a11y-contrast-text-color) !important;
}

/* Bewegung reduzieren */
html[data-a11y-motion="reduce"] *,
html[data-a11y-motion="reduce"] *::before,
html[data-a11y-motion="reduce"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* Fokus hervorheben */
html[data-a11y-focus="enhance"] *:focus {
    outline: 3px solid #EC661C !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 3px rgba(174, 154, 99, 0.3) !important;
}

/* Dyslexie-freundliche Schrift */
html[data-a11y-font="dyslexic"] {
    font-family: 'Comic Sans MS', 'Trebuchet MS', system-ui, -apple-system, sans-serif !important;
    letter-spacing: 0.05em !important;
}

/* ===== Lesehilfen ===== */

/* Lesezeile */
#a11y-reading-guide {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: #EC661C;
    pointer-events: none;
    z-index: 9996;
    box-shadow: 0 0 4px rgba(174, 154, 99, 0.5);
}

html[data-a11y-reading-guide="small"] #a11y-reading-guide {
    height: 2px;
}

html[data-a11y-reading-guide="medium"] #a11y-reading-guide {
    height: 3px;
}

html[data-a11y-reading-guide="large"] #a11y-reading-guide {
    height: 4px;
}

#a11y-reading-guide-arrow {
    position: fixed;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid #EC661C;
    pointer-events: none;
    z-index: 9997;
    filter: drop-shadow(0 2px 4px rgba(174, 154, 99, 0.5));
    transform: translateX(-50%);
}

html[data-a11y-reading-guide="small"] #a11y-reading-guide-arrow {
    border-left-width: 6px;
    border-right-width: 6px;
    border-bottom-width: 10px;
}

html[data-a11y-reading-guide="medium"] #a11y-reading-guide-arrow {
    border-left-width: 8px;
    border-right-width: 8px;
    border-bottom-width: 12px;
}

html[data-a11y-reading-guide="large"] #a11y-reading-guide-arrow {
    border-left-width: 10px;
    border-right-width: 10px;
    border-bottom-width: 14px;
}

/* Lesemaske */
#a11y-reading-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: transparent;
    pointer-events: none;
    z-index: 9995;
    overflow: hidden;
}

#a11y-reading-mask-hole {
    position: fixed;
    left: 0;
    width: 100%;
    background: transparent;
    pointer-events: none;
    transition: height 0.2s ease, top 0.1s ease;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
}

html[data-a11y-reading-mask="small"] #a11y-reading-mask-hole {
    height: 100px !important;
}

html[data-a11y-reading-mask="medium"] #a11y-reading-mask-hole {
    height: 200px !important;
}

html[data-a11y-reading-mask="large"] #a11y-reading-mask-hole {
    height: 300px !important;
}

/* Text-to-Speech Highlight */
.a11y-reading-highlight {
    background: rgba(174, 154, 99, 0.2) !important;
    outline: 2px solid #EC661C !important;
    outline-offset: 2px !important;
    transition: background 0.2s;
}

/* Bilder ausblenden */
html[data-a11y-hide-images="true"] img {
    display: none !important;
    visibility: hidden !important;
}

html[data-a11y-hide-images="true"] * {
    background-image: none !important;
}

/* Blaufilter - NUR auf body-Inhalt, NICHT auf Panel/FAB */
html[data-a11y-blue-filter="true"] body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab) {
    filter: brightness(0.95) contrast(1.05) !important;
}

html[data-a11y-blue-filter="true"] body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 200, 0, 0.1);
    pointer-events: none;
    z-index: 99997; /* Unter Panel und FAB */
    mix-blend-mode: multiply;
}

/* Panel-Wrapper komplett ausschließen */
#a11y-widget-panel-wrapper,
#a11y-widget-panel-wrapper *,
#a11y-widget-fab,
#a11y-widget-fab * {
    filter: none !important;
}

/* Farbschwäche-Filter - NUR auf body-Inhalt, NICHT auf Panel/FAB */
html {
    --a11y-color-filter: none;
    --a11y-grayscale-value: 0%;
    --a11y-red-value: 0%;
    --a11y-green-value: 0%;
    --a11y-blue-value: 0%;
}

/* Farbschwäche-Filter - NUR auf body-Inhalt, NICHT auf body selbst (verhindert Panel-Beeinflussung) */
html[data-a11y-color-blindness-red] body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab),
html[data-a11y-color-blindness-green] body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab),
html[data-a11y-color-blindness-blue] body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab),
html[data-a11y-color-blindness-grayscale] body > *:not(#a11y-widget-panel-wrapper):not(#a11y-widget-fab) {
    filter: var(--a11y-color-filter, none);
}

/* Panel und FAB komplett ausschließen - muss NACH body-Regel kommen */
html[data-a11y-color-blindness-red] #a11y-widget-panel-wrapper,
html[data-a11y-color-blindness-green] #a11y-widget-panel-wrapper,
html[data-a11y-color-blindness-blue] #a11y-widget-panel-wrapper,
html[data-a11y-color-blindness-grayscale] #a11y-widget-panel-wrapper,
html[data-a11y-color-blindness-red] #a11y-widget-panel-wrapper *,
html[data-a11y-color-blindness-green] #a11y-widget-panel-wrapper *,
html[data-a11y-color-blindness-blue] #a11y-widget-panel-wrapper *,
html[data-a11y-color-blindness-grayscale] #a11y-widget-panel-wrapper *,
html[data-a11y-color-blindness-red] #a11y-widget-fab,
html[data-a11y-color-blindness-green] #a11y-widget-fab,
html[data-a11y-color-blindness-blue] #a11y-widget-fab,
html[data-a11y-color-blindness-grayscale] #a11y-widget-fab,
html[data-a11y-color-blindness-red] #a11y-widget-fab *,
html[data-a11y-color-blindness-green] #a11y-widget-fab *,
html[data-a11y-color-blindness-blue] #a11y-widget-fab *,
html[data-a11y-color-blindness-grayscale] #a11y-widget-fab * {
    filter: none !important;
}

/* Stelle sicher, dass Panel-Wrapper komplett ausgeschlossen ist */
html[data-a11y-color-blindness-red] #a11y-widget-panel-wrapper,
html[data-a11y-color-blindness-green] #a11y-widget-panel-wrapper,
html[data-a11y-color-blindness-blue] #a11y-widget-panel-wrapper,
html[data-a11y-color-blindness-grayscale] #a11y-widget-panel-wrapper,
html[data-a11y-color-blindness-red] #a11y-widget-panel-wrapper *,
html[data-a11y-color-blindness-green] #a11y-widget-panel-wrapper *,
html[data-a11y-color-blindness-blue] #a11y-widget-panel-wrapper *,
html[data-a11y-color-blindness-grayscale] #a11y-widget-panel-wrapper * {
    filter: none !important;
}

/* Panel-Wrapper und FAB komplett ausschließen - GLOBAL */
#a11y-widget-panel-wrapper,
#a11y-widget-panel-wrapper *,
.a11y-widget__panel,
.a11y-widget__panel * {
    filter: none !important;
}

/* FAB muss immer klickbar sein */
#a11y-widget-fab,
#a11y-widget-fab * {
    filter: none !important;
    pointer-events: auto !important;
}

/* Panel und FAB müssen fixed bleiben, auch wenn Filter angewendet werden */
.a11y-widget__panel {
    position: fixed !important;
}

#a11y-widget-fab {
    position: fixed !important;
}

/* Mauszeiger vergrößern - wird über JavaScript gesteuert */
/* WICHTIG: Navigationselemente und interaktive Elemente ausschließen */
html[data-a11y-cursor-size] * {
    cursor: var(--a11y-custom-cursor, auto) !important;
}

/* Navigationselemente und interaktive Elemente behalten ihren normalen Cursor */
html[data-a11y-cursor-size] nav,
html[data-a11y-cursor-size] nav * {
    cursor: default !important;
}

html[data-a11y-cursor-size] a,
html[data-a11y-cursor-size] button,
html[data-a11y-cursor-size] [role="button"],
html[data-a11y-cursor-size] [role="link"],
html[data-a11y-cursor-size] [role="menuitem"],
html[data-a11y-cursor-size] [role="tab"],
html[data-a11y-cursor-size] [role="option"],
html[data-a11y-cursor-size] [onclick] {
    cursor: pointer !important;
}

html[data-a11y-cursor-size] input[type="text"],
html[data-a11y-cursor-size] input[type="email"],
html[data-a11y-cursor-size] input[type="password"],
html[data-a11y-cursor-size] input[type="search"],
html[data-a11y-cursor-size] input[type="url"],
html[data-a11y-cursor-size] input[type="tel"],
html[data-a11y-cursor-size] textarea {
    cursor: text !important;
}

html[data-a11y-cursor-size] input[type="button"],
html[data-a11y-cursor-size] input[type="submit"],
html[data-a11y-cursor-size] input[type="reset"],
html[data-a11y-cursor-size] input[type="image"],
html[data-a11y-cursor-size] select {
    cursor: pointer !important;
}

html[data-a11y-cursor-size] input[type="checkbox"],
html[data-a11y-cursor-size] input[type="radio"] {
    cursor: pointer !important;
}

/* Widget-Elemente behalten ihren normalen Cursor */
html[data-a11y-cursor-size] .a11y-widget__fab,
html[data-a11y-cursor-size] .a11y-widget__fab *,
html[data-a11y-cursor-size] .a11y-widget__panel,
html[data-a11y-cursor-size] .a11y-widget__panel * {
    cursor: pointer !important;
}

/* Respektiere prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .a11y-widget__fab,
    .a11y-widget__panel,
    .a11y-widget__toggle-slider,
    .a11y-widget__slider::-webkit-slider-thumb,
    .a11y-widget__slider::-moz-range-thumb,
    #a11y-reading-mask-hole {
        transition: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .a11y-widget__fab {
        border: 2px solid currentColor;
    }
    
    .a11y-widget__panel {
        border: 2px solid #000;
    }
    
    .a11y-widget__toggle {
        border: 2px solid #000;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .a11y-widget__profiles {
        grid-template-columns: 1fr;
    }
}
