/* Accessibility Styles - WCAG 2.1 AA Compliant */

/* Screen reader only class */
.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;
}

.sr-only:focus,
.sr-only:active {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus visible styles for keyboard navigation */
body.keyboard-navigation *:focus {
    outline: 3px solid #F1C400;
    outline-offset: 2px;
}

body:not(.keyboard-navigation) *:focus {
    outline: none;
}

/* High contrast focus indicator */
@media (prefers-contrast: high) {
    *:focus {
        outline: 3px solid currentColor;
        outline-offset: 3px;
    }
}

/* Ensure sufficient touch targets (44x44px minimum) */
button,
a,
input[type="checkbox"],
input[type="radio"],
select {
    min-height: 44px;
    min-width: 44px;
}

/* 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;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero-card,
    .feature-card,
    .login-card {
        border: 2px solid currentColor;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .hero-card,
    .feature-card,
    .login-card {
        background: #2d2d2d;
        color: #ffffff;
    }
}

/* Skip link styles */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #002B49;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
}

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

/* Form error states */
input:invalid,
textarea:invalid,
select:invalid {
    border-color: #dc2626;
}

input:invalid:focus,
textarea:invalid:focus,
select:invalid:focus {
    outline-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Required field indicator */
.required-indicator {
    color: #dc2626;
    font-weight: bold;
}

/* ARIA live region */
#aria-live-region {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Ensure sufficient color contrast for links */
a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

a:hover,
a:focus {
    text-decoration-thickness: 3px;
}

/* Ensure buttons have visible text */
button:empty::before {
    content: "Button";
    color: #dc2626;
}

/* Print styles for better accessibility */
@media print {
    .no-print {
        display: none !important;
    }
    
    a[href^="http"]::after {
        content: " (" attr(href) ")";
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}

/* Focus trap for modals */
.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

/* Ensure form labels are associated */
input:not([id]),
textarea:not([id]),
select:not([id]) {
    border: 2px dashed #dc2626 !important;
}

/* Accessible table styles */
table {
    border-collapse: collapse;
    width: 100%;
}

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

/* Ensure adequate line height for readability */
body {
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
}

/* Ensure adequate spacing between interactive elements */
button + button,
a + a {
    margin-left: 8px;
}
