/* ==========================================
   BARRIEREFREIHEIT / ACCESSIBILITY
   ========================================== */

/* Skip-Link für Tastaturnavigation */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--text-dark);
    padding: 1rem 2rem;
    border-radius: 0 0 10px 10px;
    font-weight: 600;
    z-index: 10000;
    text-decoration: none;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Fokus-Styles für Tastaturnavigation */
*:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* ==========================================
   ACCESSIBILITY CONTROL PANEL
   ========================================== */

/* Page Wrapper für Filter (verhindert dass fixed Elemente brechen) */
.page-wrapper {
    min-height: 100%;
}

/* Quick Reset Button für Farbfilter - erscheint oben */
.a11y-color-reset-btn {
    position: fixed !important;
    top: 80px !important;
    right: 20px !important;
    padding: 0.75rem 1.25rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 10000 !important;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
    transition: background 0.2s, transform 0.2s;
    font-family: inherit;
}

.a11y-color-reset-btn:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

.a11y-panel-toggle {
    position: fixed !important;
    bottom: 20px !important;
    left: 20px !important;
    width: 56px;
    height: 56px;
    background: var(--secondary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease, transform 0.3s ease;
}

.a11y-panel-toggle:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.a11y-panel-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.a11y-panel-toggle:hover svg {
    fill: var(--text-dark);
}

/* Panel */
.a11y-panel {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 320px;
    max-height: 80vh;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.a11y-panel.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.a11y-panel-header {
    background: var(--secondary);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.a11y-panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.a11y-panel-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.a11y-panel-close:hover {
    background: rgba(255,255,255,0.2);
}

.a11y-panel-body {
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.a11y-section {
    margin-bottom: 1.25rem;
}

.a11y-section:last-child {
    margin-bottom: 0;
}

.a11y-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

/* Toggle Switches */
.a11y-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
}

.a11y-option:hover {
    background: var(--bg-subtle);
}

.a11y-option-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.a11y-option-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Toggle Switch */
.a11y-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.a11y-toggle.active {
    background: var(--primary);
}

.a11y-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.3s;
}

.a11y-toggle.active::after {
    transform: translateX(22px);
}

/* Slider für Schriftgröße */
.a11y-slider-container {
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 10px;
}

.a11y-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.a11y-slider-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.a11y-slider-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-dark);
    background: var(--bg-white);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.a11y-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.a11y-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.a11y-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Reset Button */
.a11y-reset {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-light);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.a11y-reset:hover {
    background: var(--bg-white);
    border-color: var(--primary);
    color: var(--text-dark);
}

/* ==========================================
   BARRIEREFREIHEITS-MODI
   ========================================== */

/* Hoher Kontrast */
body.a11y-high-contrast {
    --bg-white: #000000;
    --bg-light: #1a1a1a;
    --bg-subtle: #2a2a2a;
    --bg-card: #1a1a1a;
    --text-dark: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --border: #444444;
    --primary: #FFD700;
    --primary-dark: #FFC000;
}

body.a11y-high-contrast a {
    color: #FFD700 !important;
    text-decoration: underline !important;
}

body.a11y-high-contrast img {
    filter: contrast(1.2);
}

body.a11y-high-contrast .navbar,
body.a11y-high-contrast footer {
    background: #000 !important;
    border-bottom: 2px solid #FFD700;
}

/* Große Schrift */
body.a11y-large-text {
    font-size: 120%;
}

body.a11y-larger-text {
    font-size: 140%;
}

body.a11y-largest-text {
    font-size: 160%;
}

/* Dyslexie-freundlich */
body.a11y-dyslexia {
    font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
    letter-spacing: 0.1em;
    word-spacing: 0.2em;
    line-height: 1.8;
}

body.a11y-dyslexia * {
    font-family: inherit !important;
}

/* Reduzierte Bewegung */
body.a11y-reduced-motion,
body.a11y-reduced-motion * {
    animation: none !important;
    transition: none !important;
}

body.a11y-reduced-motion .hero-visual,
body.a11y-reduced-motion .pacman-animation {
    display: none !important;
}

/* Links hervorheben */
body.a11y-highlight-links a {
    background: linear-gradient(to bottom, transparent 60%, rgba(249, 168, 37, 0.4) 60%) !important;
    text-decoration: underline !important;
    font-weight: 600;
}

body.a11y-highlight-links a:hover {
    background: rgba(249, 168, 37, 0.6) !important;
}

/* Großer Cursor */
body.a11y-large-cursor,
body.a11y-large-cursor * {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23000" stroke="%23fff" stroke-width="1" d="M5.5 3.21V20.8l5.63-5.63h7.38L5.5 3.21z"/></svg>') 4 4, auto !important;
}

/* Lesestreifen/Lesehilfe */
body.a11y-reading-guide .reading-guide {
    display: block;
}

.reading-guide {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(249, 168, 37, 0.2);
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    pointer-events: none;
    z-index: 9997;
    transition: top 0.05s linear;
}

/* Text-zu-Sprache Indikator */
body.a11y-text-to-speech .tts-active {
    outline: 3px dashed var(--primary);
    background: rgba(249, 168, 37, 0.1);
}

/* Sättigung reduzieren */
body.a11y-low-saturation .page-wrapper {
    filter: saturate(0.5);
}

body.a11y-grayscale .page-wrapper {
    filter: grayscale(1);
}

/* Negative Farben */
body.a11y-invert .page-wrapper {
    filter: invert(1) hue-rotate(180deg);
}

body.a11y-invert .page-wrapper img,
body.a11y-invert .page-wrapper video {
    filter: invert(1) hue-rotate(180deg);
}

/* Zeilenabstand erhöhen */
body.a11y-line-height {
    line-height: 2 !important;
}

body.a11y-line-height p,
body.a11y-line-height li,
body.a11y-line-height span {
    line-height: 2 !important;
}

/* Wortabstand erhöhen */
body.a11y-word-spacing {
    word-spacing: 0.3em;
}

/* ==========================================
   RESPONSIVE ACCESSIBILITY PANEL
   ========================================== */

@media (max-width: 768px) {
    .a11y-panel {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 80px;
        max-height: 70vh;
    }

    .a11y-panel-toggle {
        bottom: 15px;
        left: 15px;
        width: 50px;
        height: 50px;
    }

    .a11y-panel-toggle svg {
        width: 24px;
        height: 24px;
    }
}

/* Print: Panel ausblenden */
@media print {
    .a11y-panel-toggle,
    .a11y-panel,
    .reading-guide,
    .skip-link {
        display: none !important;
    }
}
