/* Accessibility Improvements */

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #6366f1;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* Focus indicators */
*:focus {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
}

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

/* Remove focus outline from footer navigation items */
.bottom-nav .nav-item:focus,
.bottom-nav .nav-item:focus-visible,
.bottom-nav .nav-item-form button:focus,
.bottom-nav .nav-item-form button:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Screen reader only text */
.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 support */
@media (prefers-contrast: high) {
    .item-card,
    .card-modern,
    .stat-card {
        border: 2px solid currentColor;
    }
    
    .btn {
        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;
    }
}

/* Keyboard navigation improvements */
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* Modal keyboard navigation */
.modal:focus {
    outline: none;
}

.modal .btn-close:focus {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
}

/* Form labels association */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-control:focus + .invalid-feedback,
.form-control:focus + .valid-feedback {
    display: block;
}

/* ARIA live regions */
[aria-live] {
    position: relative;
}

[aria-live="polite"] {
    /* Polite announcements don't interrupt */
}

[aria-live="assertive"] {
    /* Assertive announcements interrupt */
}

/* Loading states for screen readers */
[aria-busy="true"]::before {
    content: "Loading...";
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Error states */
.is-invalid {
    border-color: #dc3545;
}

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

/* Success states */
.is-valid {
    border-color: #198754;
}

.is-valid:focus {
    border-color: #198754;
    box-shadow: 0 0 0 4px rgba(25, 135, 84, 0.2);
}

/* Button states */
.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Link states */
a[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

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

th {
    font-weight: 700;
    text-align: left;
}

/* Image alt text fallback */
img:not([alt]) {
    border: 2px dashed #dc3545;
}

/* Landmark regions */
main {
    outline: none;
}

nav {
    outline: none;
}

/* Focus trap for modals */
.modal[aria-modal="true"] {
    /* Focus trap handled by Bootstrap */
}

/* Error messages */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #198754;
}

