/* Modern accessibility improvements */
.sr-only {
    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;
    border: 0 !important;
}

/* Skip link improvements */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: fixed;
    top: 0;
    left: 6px;
    width: auto;
    height: auto;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    text-decoration: none;
    z-index: 999999;
    border-radius: 0 0 4px 4px;
}

/* Focus management */
*:focus {
    outline: 2px solid #ed2a28;
    outline-offset: 2px;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #ed2a28;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #000;
        --color-secondary: #fff;
        --text-color: #000;
        --bg-color: #fff;
    }
}

/* 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;
    }
}

/* Dark mode improvements */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        --color-primary: #ff6b6b;
        --color-secondary: #8b5cf6;
        --text-color: #f8f9fa;
        --bg-color: #1a1a1a;
    }
}

/* Color contrast improvements */
.text-muted {
    color: #6c757d !important;
}

@media (prefers-contrast: high) {
    .text-muted {
        color: #495057 !important;
    }
}

/* Button accessibility */
.btn {
    min-height: 44px; /* Touch target minimum */
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Link improvements */
a:not([class]) {
    text-decoration: underline;
    text-decoration-skip-ink: auto;
}

a:focus {
    outline-offset: 2px;
}

/* Form improvements */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input:invalid,
textarea:invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Table improvements */
table {
    border-collapse: collapse;
    width: 100%;
}

th {
    text-align: left;
    font-weight: 600;
}

/* Image improvements */
img {
    height: auto;
    max-width: 100%;
}

img[width][height] {
    height: auto;
}

/* Loading state */
.loading {
    position: relative;
    color: transparent;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ed2a28;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
