/* ============================================
   KMS Barrierefreiheits-Widget
   WCAG 2.1 AA Konform
   ============================================ */

/* Widget Container */
.a11y-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Toggle Button */
.a11y-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #003366 0%, #004488 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 51, 102, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.a11y-btn:hover {
    transform: scale(1.1);
}

.a11y-btn:focus {
    outline: 3px solid #ffcc00;
    outline-offset: 3px;
}

.a11y-btn.active {
    background: linear-gradient(135deg, #228B22 0%, #2E8B57 100%);
}

.a11y-btn svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.a11y-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc2626;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
}

.a11y-btn .badge.show {
    display: flex;
}

/* Panel */
.a11y-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 300px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    overflow: hidden;
}

.a11y-panel.open {
    display: block;
}

.a11y-header {
    background: linear-gradient(135deg, #003366 0%, #004488 100%);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.a11y-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.a11y-reset {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.a11y-reset:hover {
    background: rgba(255,255,255,0.3);
}

.a11y-body {
    padding: 12px;
    max-height: 350px;
    overflow-y: auto;
}

.a11y-group {
    margin-bottom: 12px;
}

.a11y-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 600;
}

/* Option Row */
.a11y-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.a11y-option:hover {
    background: #f0f4f8;
}

.a11y-option.active {
    background: #e8f4f8;
    border-color: #003366;
}

.a11y-option span {
    font-size: 0.85rem;
    color: #1f2937;
}

/* Toggle Switch */
.a11y-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: #d1d5db;
    border-radius: 11px;
    transition: background 0.3s;
    flex-shrink: 0;
}

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

.a11y-option.active .a11y-switch {
    background: #003366;
}

.a11y-option.active .a11y-switch::after {
    transform: translateX(18px);
}

/* Footer */
.a11y-footer {
    padding: 10px 12px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.a11y-footer a {
    font-size: 0.75rem;
    color: #003366;
}

/* ============================================
   ACCESSIBILITY MODES
   ============================================ */

/* High Contrast */
body.a11y-contrast,
body.a11y-contrast .section,
body.a11y-contrast .card,
body.a11y-contrast .navbar,
body.a11y-contrast footer {
    background: #ffffff !important;
    color: #000000 !important;
}

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

body.a11y-contrast .btn,
body.a11y-contrast button:not(.a11y-btn):not(.a11y-reset):not(.a11y-option) {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #000000 !important;
}

body.a11y-contrast .page-header,
body.a11y-contrast .cta,
body.a11y-contrast .top-bar,
body.a11y-contrast .a11y-header {
    background: #000000 !important;
}

body.a11y-contrast .page-header *,
body.a11y-contrast .cta *,
body.a11y-contrast .top-bar * {
    color: #ffffff !important;
}

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

/* Large Text */
body.a11y-large-text {
    font-size: 125% !important;
}

body.a11y-large-text .a11y-widget,
body.a11y-large-text .a11y-widget * {
    font-size: initial !important;
}

body.a11y-large-text h1 { font-size: 2.8rem !important; }
body.a11y-large-text h2 { font-size: 2.3rem !important; }
body.a11y-large-text h3 { font-size: 1.8rem !important; }
body.a11y-large-text h4 { font-size: 1.4rem !important; }

body.a11y-large-text p,
body.a11y-large-text li,
body.a11y-large-text td,
body.a11y-large-text span:not(.a11y-switch):not(.badge),
body.a11y-large-text a:not(.a11y-btn):not(.a11y-option),
body.a11y-large-text label,
body.a11y-large-text input,
body.a11y-large-text button:not(.a11y-btn):not(.a11y-reset) {
    font-size: 1.25rem !important;
    line-height: 1.8 !important;
}

/* Highlight Links */
body.a11y-links a:not(.btn):not(.a11y-btn):not(.a11y-option):not(.a11y-reset) {
    background: #ffff00 !important;
    color: #000000 !important;
    padding: 2px 4px !important;
    text-decoration: underline !important;
}

/* Stop Animations */
body.a11y-no-anim *,
body.a11y-no-anim *::before,
body.a11y-no-anim *::after {
    animation: none !important;
    transition: none !important;
}

body.a11y-no-anim .snowflake,
body.a11y-no-anim .santa-sleigh {
    display: none !important;
}

/* Large Cursor */
body.a11y-cursor,
body.a11y-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M5.5 3.21V20.8l5.25-5.26h7.97L5.5 3.21z'/%3E%3C/svg%3E") 0 0, auto !important;
}

/* Text Spacing */
body.a11y-spacing {
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}

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

/* Grayscale */
body.a11y-grayscale {
    filter: grayscale(100%);
}

/* Reading Guide */
.a11y-reading-line {
    position: fixed;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(255, 255, 0, 0.2);
    border-top: 2px solid #003366;
    border-bottom: 2px solid #003366;
    pointer-events: none;
    z-index: 99998;
    display: none;
}

body.a11y-reading .a11y-reading-line {
    display: block;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 10px;
    background: #003366;
    color: #ffffff;
    padding: 12px 20px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
    z-index: 100000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #ffcc00;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Print */
@media print {
    .a11y-widget,
    .a11y-reading-line,
    .skip-link {
        display: none !important;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .a11y-panel {
        width: calc(100vw - 40px);
        right: -10px;
    }
    
    .a11y-btn {
        width: 46px;
        height: 46px;
    }
}
