/* 
 * Barrierefreiheit (Accessibility) CSS
 * WCAG 2.1 Level AA konform
 * Thomas Michael Jobst Website
 */

/* ===== SKIP NAVIGATION ===== */
.skip-link {
    position: absolute;
    top: -60px;
    left: 0;
    background: #1e40af;
    color: white;
    padding: 12px 20px;
    text-decoration: none;
    font-weight: bold;
    z-index: 9999;
    border-radius: 0 0 8px 0;
    transition: top 0.3s ease;
}

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

/* ===== ENHANCED FOCUS STYLES ===== */
/* Verbesserte Tastaturnavigation für alle interaktiven Elemente */

*:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

button:focus, 
a:focus, 
input:focus, 
select:focus, 
textarea:focus {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
}

/* Spezielle Focus-Styles für CTAs */
.bg-blue-600:focus,
.bg-amber-500:focus {
    outline: 4px solid #f59e0b;
    outline-offset: 3px;
}

/* ===== SCREEN READER ONLY ===== */
/* Versteckt Elemente visuell, aber für Screenreader zugänglich */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== HIGH CONTRAST MODE ===== */
/* Unterstützung für Windows High Contrast Mode */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }
    
    button,
    a {
        outline: 2px solid currentColor;
    }
}

/* ===== REDUCED MOTION ===== */
/* Respektiert Nutzer-Präferenz für reduzierte Animationen */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== TOUCH TARGETS ===== */
/* Mindestgröße 44x44px für Touch-Ziele (WCAG 2.5.5) */
button,
a,
input[type="submit"],
input[type="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* ===== FORM ACCESSIBILITY ===== */
/* Fehlerzustände */
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: #dc2626 !important;
    border-width: 2px !important;
}

/* Pflichtfelder visuell hervorheben */
input[required],
select[required],
textarea[required] {
    background-image: linear-gradient(to right, #fee2e2 0%, transparent 10%);
}

/* ===== LINK STYLING ===== */
/* Links müssen sich vom Text unterscheiden */
a:not([class]) {
    color: #2563eb;
    text-decoration: underline;
}

a:not([class]):hover {
    color: #1e40af;
    text-decoration: underline;
}

a:not([class]):visited {
    color: #7c3aed;
}

/* ===== CONTRAST IMPROVEMENTS ===== */
/* Verbesserte Kontraste für bessere Lesbarkeit */
.text-gray-500 {
    color: #6b7280 !important; /* WCAG AA konform */
}

.text-gray-600 {
    color: #4b5563 !important; /* WCAG AA konform */
}

/* ===== KEYBOARD NAVIGATION INDICATORS ===== */
/* Zeigt an, dass ein Element per Tastatur fokussiert ist */
:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.2);
}

/* ===== ARIA LIVE REGIONS ===== */
/* Styling für dynamische Inhalte */
[aria-live="polite"],
[aria-live="assertive"] {
    position: relative;
}

/* ===== MOBILE ACCESSIBILITY ===== */
@media (max-width: 768px) {
    /* Größere Touch-Targets auf Mobile */
    button,
    a {
        min-height: 48px;
        min-width: 48px;
    }
    
    /* Bessere Lesbarkeit auf kleinen Screens */
    body {
        font-size: 16px !important; /* Verhindert Zoom auf iOS */
    }
    
    input,
    select,
    textarea {
        font-size: 16px !important; /* Verhindert Zoom auf iOS */
    }
}

/* ===== PRINT ACCESSIBILITY ===== */
@media print {
    /* Skip-Links nicht drucken */
    .skip-link {
        display: none;
    }
    
    /* Focus-Styles nicht drucken */
    *:focus {
        outline: none !important;
    }
    
    /* Links mit URL anzeigen */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ===== COOKIE BANNER ACCESSIBILITY ===== */
#cookie-banner {
    /* Stellt sicher, dass Banner per Tastatur erreichbar ist */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
}

#cookie-banner:focus-within {
    outline: 3px solid #f59e0b;
    outline-offset: -3px;
}

/* ===== MODAL ACCESSIBILITY ===== */
[role="dialog"],
[aria-modal="true"] {
    /* Modals sollten immer fokussierbar sein */
    outline: none;
}

/* ===== TABLE ACCESSIBILITY ===== */
/* Verbesserte Tabellenlesbarkeit */
table {
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    text-align: left;
}

th {
    font-weight: bold;
    background-color: #f3f4f6;
}

/* Zebrastreifen für bessere Lesbarkeit */
tbody tr:nth-child(odd) {
    background-color: #f9fafb;
}

tbody tr:hover {
    background-color: #e5e7eb;
}

/* ===== DARK MODE ACCESSIBILITY ===== */
@media (prefers-color-scheme: dark) {
    /* Dark Mode würde hier implementiert werden */
    /* Aktuell nicht aktiv, da die Site hell gestaltet ist */
}
