/**
 * Accessibility Styles for Wild Apricot Theme
 * These styles enhance the accessibility of the theme
 */

/* Skip link styles */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    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;
}

.visually-hidden-focusable:focus,
.visually-hidden-focusable:focus-within {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    width: auto;
    height: auto;
    padding: 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background-color: #fff;
    border: 2px solid #0073aa;
    color: #000;
    font-weight: 700;
    line-height: normal;
    text-decoration: none;
    display: block;
}

/* Enhanced focus styles for keyboard users */
.user-is-tabbing *:focus {
    outline: 3px solid #0073aa !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3) !important;
}

/* Ensure sufficient color contrast */
.text-muted {
    color: #6c757d !important; /* WCAG AA compliant */
}

.btn-primary {
    background-color: #0073aa;
    border-color: #0073aa;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #005f8b;
    border-color: #005f8b;
}

.btn-outline-primary {
    color: #0073aa;
    border-color: #0073aa;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: #0073aa;
    border-color: #0073aa;
}

/* Ensure form elements have sufficient contrast */
.form-control:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 0.25rem rgba(0, 115, 170, 0.25);
}

/* Ensure buttons and interactive elements have sufficient size */

/* Ensure dropdown menus are accessible */
.dropdown-menu {
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item:focus {
    background-color: #0073aa;
    color: #fff;
}

/* Ensure form labels are visible */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Ensure required fields are clearly marked */
.required {
    color: #dc3545;
}

/* Ensure error messages are clearly visible */
.invalid-feedback {
    color: #dc3545;
    font-weight: 500;
}

/* Ensure alerts are clearly visible */
.alert {
    border-width: 2px;
}

/* Ensure tables are accessible */
table {
    border-collapse: collapse;
    width: 100%;
}

th {
    text-align: left;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

td, th {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

/* Ensure images have max-width for responsiveness */
img {
    max-width: 100%;
    height: auto;
}

/* Ensure code blocks are accessible */
pre, code {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.2rem 0.4rem;
}

pre {
    padding: 1rem;
    overflow-x: auto;
}

/* Ensure blockquotes are accessible */
blockquote {
    border-left: 4px solid #0073aa;
    padding-left: 1rem;
    margin-left: 0;
    color: #495057;
}

/* Ensure headings have sufficient spacing */
h1, h2, h3, h4, h5, h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

/* Ensure lists have sufficient spacing */
ul, ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

/* Ensure form elements have sufficient spacing */
.form-group {
    margin-bottom: 1rem;
}

/* Ensure buttons have sufficient spacing */

/* Ensure cards have sufficient spacing */
.card {
    margin-bottom: 1.5rem;
}

/* Ensure pagination is accessible */
.pagination .page-link {
    color: #0073aa;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination .page-item.active .page-link {
    background-color: #0073aa;
    border-color: #0073aa;
}

/* Ensure screen reader text is properly hidden */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* High contrast mode support */
@media (forced-colors: active) {

    
    .card {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
