/* Accessibility Improvements - WCAG 2.1 AA Compliance */

/* ===== FOCUS INDICATORS ===== */
/* Ensure all interactive elements have visible focus indicators */
*:focus {
    outline: 3px solid #1D63BE !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

/* Custom focus styles for specific elements */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 3px solid #1D63BE !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #1D63BE !important;
}

/* Focus styles for navigation elements */
.nav-links a:focus,
.dropdown-toggle:focus,
.language-toggle:focus {
    outline: 3px solid #E8AF00 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #E8AF00 !important;
    background-color: rgba(232, 175, 0, 0.1) !important;
}

/* Focus styles for buttons */
.btn:focus {
    outline: 3px solid #1D63BE !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #1D63BE !important;
    transform: translateY(-1px);
}

/* Focus styles for form elements */
input:focus,
textarea:focus,
select:focus {
    border-color: #1D63BE !important;
    box-shadow: 0 0 0 2px rgba(29, 99, 190, 0.2) !important;
}

/* ===== COLOR CONTRAST IMPROVEMENTS ===== */
/* Ensure sufficient color contrast for text readability */
body {
    color: #2C2C2C; /* Darker text for better contrast */
}

/* Improve contrast for navigation links */
.nav-links a {
    color: #E8AF00;
    font-weight: 600; /* Slightly bolder for better visibility */
}

.nav-links a:hover,
.nav-links a:focus {
    color: #FBC114;
    background-color: rgba(232, 175, 0, 0.1);
}

/* Improve contrast for headings */
h1, h2, h3, h4, h5, h6 {
    color: #1A1A1A; /* Darker headings for better contrast */
    font-weight: 600;
}

/* Improve contrast for links */
a {
    color: #0056B3; /* Darker blue for better contrast */
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover,
a:focus {
    color: #003D82;
    text-decoration-thickness: 2px;
}

/* Improve contrast for buttons */
.btn {
    font-weight: 600;
    text-decoration: none;
}

.btn-primary {
    background-color: #0056B3;
    color: #FFFFFF;
    border: 2px solid #0056B3;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #003D82;
    border-color: #003D82;
    color: #FFFFFF;
}

.btn-secondary {
    background-color: #6C757D;
    color: #FFFFFF;
    border: 2px solid #6C757D;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #545B62;
    border-color: #545B62;
    color: #FFFFFF;
}

/* ===== KEYBOARD NAVIGATION ===== */
/* Ensure all interactive elements are keyboard accessible */
button,
a,
input,
select,
textarea,
[tabindex] {
    cursor: pointer;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #1D63BE;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* ===== ARIA LABELS AND ROLES ===== */
/* Ensure proper ARIA attributes are supported */
[aria-hidden="true"] {
    display: none !important;
}

[aria-expanded] {
    cursor: pointer;
}

/* ===== SCREEN READER SUPPORT ===== */
/* Hide content visually but keep it available to screen readers */
.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;
}

/* ===== FORM ACCESSIBILITY ===== */
/* Improve form field accessibility */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2C2C2C;
}

input,
textarea,
select {
    padding: 0.75rem;
    border: 2px solid #CCCCCC;
    border-radius: 4px;
    font-size: 16px; /* Prevent zoom on mobile */
    line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #1D63BE;
    box-shadow: 0 0 0 2px rgba(29, 99, 190, 0.2);
}

/* Required field indicators */
.required::after {
    content: " *";
    color: #DC3545;
    font-weight: bold;
}

/* Error states */
.error {
    border-color: #DC3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2) !important;
}

.error-message {
    color: #DC3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 600;
}

/* Success states */
.success {
    border-color: #28A745 !important;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2) !important;
}

/* ===== DROPDOWN ACCESSIBILITY ===== */
/* Improve dropdown menu accessibility */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
}

.dropdown-toggle[aria-expanded="true"] {
    background-color: rgba(232, 175, 0, 0.1);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #CCCCCC;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: #2C2C2C;
    text-decoration: none;
    border-bottom: 1px solid #EEEEEE;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus {
    background-color: #F8F9FA;
    color: #1D63BE;
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

/* ===== LANGUAGE SWITCHER ACCESSIBILITY ===== */
/* Improve language switcher accessibility */
.language-switcher {
    position: relative;
}

.language-toggle {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.language-toggle:hover,
.language-toggle:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

.language-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white !important;
    border: 1px solid #CCCCCC;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.language-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #15635E !important;
    text-decoration: none;
    border-bottom: 1px solid #EEEEEE;
    transition: background-color 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

/* Force dark text for language options */
.language-option,
.language-option a,
.language-option span {
    color: #15635E !important;
    font-weight: 600 !important;
}

/* Ensure selected language text in collapsed state is always white */
.language-toggle .current-lang,
.language-toggle .current-lang .lang-code,
.language-toggle .current-lang .lang-name {
    color: white !important;
    font-weight: 600 !important;
}

/* Language names in small caps */
.lang-name {
    text-transform: lowercase !important;
    font-variant: small-caps !important;
}

/* Ensure language names in dropdown options also use small caps */
.language-option .lang-name {
    text-transform: lowercase !important;
    font-variant: small-caps !important;
}

/* Ensure language names in mobile selector also use small caps */
.language-select-dropdown option,
.language-select .lang-name {
    text-transform: lowercase !important;
    font-variant: small-caps !important;
}

/* More specific rules to override any conflicting styles */
.language-switcher .language-dropdown .language-toggle .current-lang,
.language-switcher .language-dropdown .language-toggle .current-lang .lang-code,
.language-switcher .language-dropdown .language-toggle .current-lang .lang-name {
    color: white !important;
    font-weight: 600 !important;
}

/* Ensure the button text itself is white */
.language-toggle {
    color: white !important;
}

.language-toggle * {
    color: white !important;
}

/* Maximum specificity to override any green color */
.language-switcher .language-dropdown .language-toggle .current-lang,
.language-switcher .language-dropdown .language-toggle .current-lang .lang-code,
.language-switcher .language-dropdown .language-toggle .current-lang .lang-name,
.language-switcher .language-dropdown .language-toggle .current-lang span,
.language-switcher .language-dropdown .language-toggle .current-lang .lang-code span,
.language-switcher .language-dropdown .language-toggle .current-lang .lang-name span {
    color: white !important;
    font-weight: 600 !important;
}

/* Override any green color that might be applied */
.language-toggle .current-lang,
.language-toggle .current-lang .lang-code,
.language-toggle .current-lang .lang-name,
.language-toggle .current-lang span,
.language-toggle .current-lang .lang-code span,
.language-toggle .current-lang .lang-name span {
    color: white !important;
    font-weight: 600 !important;
}

/* Use :not() to ensure we only target the toggle button, not dropdown options */
.language-toggle:not(.language-option) .current-lang,
.language-toggle:not(.language-option) .current-lang .lang-code,
.language-toggle:not(.language-option) .current-lang .lang-name,
.language-toggle:not(.language-option) .current-lang span,
.language-toggle:not(.language-option) .current-lang .lang-code span,
.language-toggle:not(.language-option) .current-lang .lang-name span {
    color: white !important;
    font-weight: 600 !important;
}

/* Final override - target the button specifically */
button.language-toggle,
button.language-toggle .current-lang,
button.language-toggle .current-lang .lang-code,
button.language-toggle .current-lang .lang-name,
button.language-toggle .current-lang span,
button.language-toggle .current-lang .lang-code span,
button.language-toggle .current-lang .lang-name span {
    color: white !important;
    font-weight: 600 !important;
}

.language-option:hover,
.language-option:focus {
    background-color: #f0f8f7;
    color: #0F4C46 !important;
}

.language-option:last-child {
    border-bottom: none;
}

/* Mobile language select */
.language-select-dropdown {
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: transparent;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.language-select-dropdown:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
}

/* ===== IMAGE ACCESSIBILITY ===== */
/* Ensure images have proper alt text styling */
img {
    max-width: 100%;
    height: auto;
}

/* Decorative images should have empty alt text */
img[alt=""] {
    border: 1px dashed #CCCCCC;
}

/* ===== VIDEO ACCESSIBILITY ===== */
/* Improve video player accessibility */
video {
    max-width: 100%;
    height: auto;
}

video:focus {
    outline: 3px solid #1D63BE;
    outline-offset: 2px;
}

/* ===== TABLES ===== */
/* Improve table accessibility */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #CCCCCC;
}

th {
    background-color: #F8F9FA;
    font-weight: 600;
    color: #2C2C2C;
}

/* ===== RESPONSIVE ACCESSIBILITY ===== */
/* Ensure accessibility on mobile devices */
@media (max-width: 768px) {
    /* Increase touch targets on mobile */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve mobile navigation */
    .hamburger {
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }
    
    /* Ensure dropdowns are accessible on mobile */
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: transparent;
    }
    
    .dropdown-menu a {
        padding: 1rem;
        border-bottom: 1px solid #EEEEEE;
    }
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
    * {
        border-color: #000000 !important;
    }
    
    .btn {
        border: 2px solid #000000 !important;
    }
    
    input,
    textarea,
    select {
        border: 2px solid #000000 !important;
    }
}

/* ===== 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;
    }
    
    .dropdown-menu,
    .language-menu {
        transition: none !important;
    }
}

/* ===== PRINT ACCESSIBILITY ===== */
@media print {
    .skip-link,
    .language-switcher,
    .hamburger {
        display: none !important;
    }
    
    a {
        color: #000000 !important;
        text-decoration: underline !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666666;
    }
}

/* ===== LANGUAGE SWITCHER FORCE STYLES ===== */
/* Ensure language switcher text is always visible */
.language-menu,
.language-menu *,
.language-menu a,
.language-menu span,
.language-menu div {
    color: #15635E !important;
    background: white !important;
}

.language-option,
.language-option *,
.language-option a,
.language-option span,
.language-option div {
    color: #15635E !important;
    font-weight: 600 !important;
    background: white !important;
}

.language-option:hover,
.language-option:hover *,
.language-option:hover a,
.language-option:hover span,
.language-option:hover div {
    color: #0F4C46 !important;
    background-color: #f0f8f7 !important;
}

/* Force language toggle button text to be visible */
.language-toggle,
.language-toggle *,
.language-toggle a,
.language-toggle span,
.language-toggle div {
    color: #15635E !important;
    font-weight: 600 !important;
}
