/* SL24 Report - Accessibility CSS */
/* WCAG 2.1 AA compliant styles for Django SL24 Report application */

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

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Skip links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-weight: bold;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Focus indicators - WCAG 2.1 AA compliant */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 95, 204, 0.3);
}

/* High contrast focus for better visibility */
@media (prefers-contrast: high) {
    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus,
    [tabindex]:focus {
        outline: 3px solid #000;
        outline-offset: 2px;
        background: #ffff00;
        color: #000;
    }
}

/* Color contrast improvements */
.text-muted {
    color: #6c757d !important; /* WCAG AA compliant */
}

.text-secondary {
    color: #495057 !important; /* WCAG AA compliant */
}

/* Button accessibility */
button,
.btn {
    min-height: 44px; /* Touch target size */
    min-width: 44px;
    padding: 12px 16px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Link accessibility */
a {
    color: #0056b3; /* WCAG AA compliant */
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: #004085;
    text-decoration: underline;
}

a:visited {
    color: #6f42c1;
}

/* Form accessibility */
label {
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

input,
select,
textarea {
    min-height: 44px;
    padding: 12px;
    border: 2px solid #ced4da;
    border-radius: 4px;
    font-size: 16px; /* Prevents zoom on iOS */
    transition: border-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #005fcc;
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.25);
}

input:invalid,
select:invalid,
textarea:invalid {
    border-color: #dc3545;
}

/* Error states */
.error,
.invalid {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #dc3545;
}

.error-message {
    color: #721c24;
    font-size: 14px;
    margin-top: 4px;
    display: block;
}

/* Success states */
.success {
    color: #155724;
    background-color: #d4edda;
    border-color: #28a745;
}

/* Table accessibility */
table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    padding: 12px 8px;
    text-align: left;
    border: 1px solid #dee2e6;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

/* Striped tables for better readability */
tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

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

/* Navigation accessibility */
nav[role="navigation"] {
    position: relative;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
}

nav a:hover,
nav a:focus {
    background-color: rgba(0, 95, 204, 0.1);
    text-decoration: none;
}

nav a[aria-current="page"] {
    background-color: #005fcc;
    color: #fff;
    font-weight: 600;
}

/* Alert accessibility */
.alert {
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    position: relative;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Modal accessibility */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

.modal-dialog {
    position: relative;
    margin: 50px auto;
    max-width: 500px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card,
    .alert,
    .modal-dialog {
        border: 2px solid #000;
    }
    
    button,
    .btn {
        border: 2px solid #000;
    }
    
    input,
    select,
    textarea {
        border: 2px solid #000;
    }
}

/* Dark mode accessibility */
@media (prefers-color-scheme: dark) {
    .skip-link {
        background: #fff;
        color: #000;
    }
    
    a {
        color: #66b3ff;
    }
    
    a:visited {
        color: #b19cd9;
    }
    
    .text-muted {
        color: #adb5bd !important;
    }
    
    .text-secondary {
        color: #ced4da !important;
    }
}

/* Print accessibility */
@media print {
    .skip-link,
    .mobile-toggle,
    .btn,
    nav {
        display: none !important;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    
    .alert {
        border: 2px solid #000;
        background: #fff !important;
        color: #000 !important;
    }
}
