/* Accessibility CSS Enhancements */

/* Screen reader only text */
.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;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Screen reader only text that becomes visible on focus */
.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: 0.5rem 1rem !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    border: 2px solid #005fcc !important;
    background: #000 !important;
    color: #fff !important;
    text-decoration: none !important;
    z-index: 1000 !important;
}

/* Enhanced focus indicators */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #005fcc !important;
    outline-offset: 2px !important;
}

/* High contrast focus for better visibility */
.tab-button:focus {
    outline: 2px solid #005fcc !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.3) !important;
}

/* Ensure mobile menu toggle button is properly styled */
.mobile-menu-slide-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-slide-toggle:focus {
    outline: 2px solid #005fcc !important;
    outline-offset: 2px !important;
}

/* Ensure proper spacing for form error messages - only override when actually invalid */
.form-condensed-invalid-feedback .form-group .invalid-feedback {
    /* Keep the original theme positioning */
    position: absolute;
    top: -2px;
    right: 0;
    text-align: right;
    display: none; /* Hidden by default */
    width: auto;
    margin-top: 0;
    font-size: 0.875em;
    color: #dc3545;
}

/* Show error messages only when form is validated and field is invalid */
.was-validated.form-condensed-invalid-feedback
    .form-control:invalid
    ~ .invalid-feedback {
    display: inline-block;
    padding: 2px;
}

/* Better contrast for error states */
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Tab navigation improvements */
.tab-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.tab-button:hover,
.tab-button.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.tab-button:focus {
    outline: 2px solid #005fcc !important;
    outline-offset: 2px !important;
    z-index: 1;
}

/* Tab content panels */
.tab-content {
    display: none;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}

.tab-content.active {
    display: block;
}

.tab-content:focus {
    outline: 1px dotted #212529;
    outline-offset: -1px;
}

/* Form field focus improvements */
.form-control:focus {
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Checkbox and radio focus improvements */
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Button focus improvements */
.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    outline: none !important;
}

/* Live region for screen readers */
#validation-messages {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
