/* Accessibility Styles für bessere Barrierefreiheit */

/* Focus Indicators */
*:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

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

*:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }
    
    .card {
        border-width: 2px;
    }
    
    .table th,
    .table td {
        border-width: 2px;
    }
    
    .badge {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion Support */
@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;
    }
}

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

.sr-only-focusable:focus,
.visually-hidden-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* Skip Links */
.skip-links {
    position: absolute;
    top: -100px;
    left: 0;
    z-index: 9999;
    padding: 10px;
    background: #fff;
    border: 2px solid #0d6efd;
    border-radius: 0 0 8px 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.skip-links:focus-within {
    position: static;
    top: auto;
    left: auto;
}

/* Form Accessibility */
.form-label {
    font-weight: 600;
}

.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.invalid-feedback {
    display: block;
    font-weight: 500;
}

.is-invalid {
    border-color: #dc3545;
}

.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Button Accessibility */
.btn {
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Table Accessibility */
.table th {
    font-weight: 600;
    background-color: #f8f9fa;
}

.table th[role="columnheader"] {
    cursor: pointer;
}

.table th[role="columnheader"]:hover {
    background-color: #e9ecef;
}

.table th[role="columnheader"]:focus {
    background-color: #e9ecef;
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

/* Navigation Accessibility */
.navbar-nav .nav-link {
    font-weight: 500;
}

.navbar-nav .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.dropdown-menu .dropdown-item:focus {
    background-color: #0d6efd;
    color: #fff;
}

/* Alert Accessibility */
.alert {
    border-left: 4px solid;
}

.alert-success {
    border-left-color: #198754;
}

.alert-danger {
    border-left-color: #dc3545;
}

.alert-warning {
    border-left-color: #ffc107;
}

.alert-info {
    border-left-color: #0dcaf0;
}

/* Card Accessibility */
.card {
    transition: box-shadow 0.15s ease-in-out;
}

.card:focus-within {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Badge Accessibility */
.badge {
    font-weight: 500;
}

/* Pagination Accessibility */
.pagination .page-link {
    font-weight: 500;
}

.pagination .page-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* Loading States */
.btn[data-loading] {
    position: relative;
}

.btn[data-loading]::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print Styles */
@media print {
    .skip-links,
    .btn,
    .navbar,
    .sidebar,
    .breadcrumb,
    .alert,
    .pagination {
        display: none !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .skip-links {
        background: #212529;
        color: #fff;
        border-color: #0d6efd;
    }
    
    .table th {
        background-color: #343a40;
        color: #fff;
    }
}

/* Large Text Support */
@media (prefers-font-size: large) {
    body {
        font-size: 1.125rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1.125rem;
    }
    
    .form-control {
        padding: 0.75rem;
        font-size: 1.125rem;
    }
}

/* Custom Focus Styles for Interactive Elements */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Ensure sufficient color contrast */
.text-muted {
    color: #6c757d !important;
}

/* Status indicators with better contrast */
.badge.bg-success {
    background-color: #198754 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.badge.bg-info {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}
