/**
 * Accessibility CSS for Keyboard-Accessible Navigation
 * Ensures proper focus indicators and button styling
 */

/* ============================================
   Dropdown Toggle Button Styling
   ============================================ */

/* Style buttons to look like Bootstrap nav links */
.dropdown-toggle {
    background: none;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    padding: 15px;
    cursor: pointer;
    text-align: left;
    display: block;
    width: 100%;
    text-decoration: none;
}

/* Remove default button styles */
.dropdown-toggle::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/* Hover state */
.dropdown-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: inherit;
}

/* Active/Open state */
.dropdown.open > .dropdown-toggle {
    background-color: rgba(0, 0, 0, 0.1);
}


/* ============================================
   Focus Indicators (WCAG 2.1 Compliant)
   ============================================ */

/* Focus style for dropdown toggles */
.dropdown-toggle:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    background-color: rgba(0, 95, 204, 0.1);
    position: relative;
    z-index: 1;
}

/* Focus style for dropdown menu items */
.dropdown-menu a:focus {
    outline: 2px solid #005fcc;
    outline-offset: -2px;
    background-color: #e7f3ff;
    text-decoration: none;
}

/* Focus style for navigation links */
.navbar-nav > li > a:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    background-color: rgba(0, 95, 204, 0.1);
}

/* Focus style for search button */
.submitBtn:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* Focus style for mobile toggle button */
.navbar-toggle:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    background-color: rgba(0, 95, 204, 0.1);
}

/* Focus style for close button in mobile menu */
.closeBtn:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* Focus style for search input */
#header-search:focus {
    outline: 2px solid #005fcc;
    outline-offset: 0;
    border-color: #005fcc;
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.2);
}

/* Focus style for form submit button */
.header-search .btn:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.2);
}


/* ============================================
   High Contrast Mode Support
   ============================================ */

/* Support for Windows High Contrast Mode */
@media (prefers-contrast: high) {
    .dropdown-toggle:focus,
    .dropdown-menu a:focus,
    .navbar-nav > li > a:focus,
    .submitBtn:focus,
    .navbar-toggle:focus {
        outline: 3px solid;
        outline-offset: 2px;
    }
}


/* ============================================
   Mobile Menu Specific Styles
   ============================================ */

/* Mobile menu dropdown toggles */
#mobileMenu .dropdown-toggle {
    width: 100%;
    text-align: left;
    padding: 10px 15px;
}

#mobileMenu .dropdown-toggle:focus {
    outline: 2px solid #005fcc;
    outline-offset: -2px;
    background-color: rgba(0, 95, 204, 0.1);
}

#mobileMenu .dropdown-menu a:focus {
    outline: 2px solid #005fcc;
    outline-offset: -2px;
    background-color: #e7f3ff;
}

/* Ensure mobile menu is keyboard accessible */
#mobileMenu .modal-menu-content:focus {
    outline: none;
}


/* ============================================
   Skip to Content Link (Optional but Recommended)
   ============================================ */

/* Add this if you want a skip link for keyboard users */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #005fcc;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
}

.skip-to-content:focus {
    top: 0;
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}


/* ============================================
   Reduce Motion for Users with Vestibular Disorders
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .dropdown-menu,
    .collapse,
    .modal,
    * {
        transition: none !important;
        animation: none !important;
    }
}


/* ============================================
   Screen Reader Only Text
   ============================================ */

/* Ensure sr-only text is properly hidden but still accessible */
.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;
}

/* Allow sr-only text to be focusable for keyboard testing */
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}


/* ============================================
   Visible Focus Indicator Utilities
   ============================================ */

/* Remove default outline for mouse users, keep for keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}


/* ============================================
   Color Adjustments for Better Accessibility
   ============================================ */

/* Ensure dropdown menu has sufficient contrast */
.dropdown-menu {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
}

.dropdown-menu > li > a {
    color: #333333;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
    color: #262626;
    background-color: #f5f5f5;
}


/* ============================================
   Print Styles
   ============================================ */

@media print {
    /* Hide navigation for print */
    .navbar,
    .submitBtn,
    .navbar-toggle,
    #mobileMenu,
    .translate-btn {
        display: none !important;
    }
}