/* Accessibility Improvements */

/* Screen reader only class for hidden labels */
.visually-hidden {
    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;
}

/* Focus indicators for keyboard navigation */
*:focus {
    outline: 2px solid #4169e1;
    outline-offset: 2px;
}

/* Enhanced focus for interactive elements */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #4169e1;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(65, 105, 225, 0.2);
}

/* Skip link for keyboard users */
.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;
}

.sr-only:focus {
    position: absolute;
    z-index: 10000;
    top: 10px;
    left: 10px;
    width: auto;
    height: auto;
    padding: 10px 15px;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: #000;
    color: #fff;
    font-size: 16px;
    text-decoration: none;
    border-radius: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid;
    }
    
    .option {
        border: 2px solid #333;
    }
    
    .option:hover {
        border-color: #000;
    }
}

/* Reduced motion preferences */
@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;
    }
}

/* Color blind friendly indicators */
.correct-option::before {
    content: "✓ ";
    font-weight: bold;
    color: #28a745;
    margin-right: 4px;
}

.incorrect-option::before {
    content: "✗ ";
    font-weight: bold;
    color: #dc3545;
    margin-right: 4px;
}

/* Improved button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled:focus {
    outline: 2px solid #6c757d;
    box-shadow: 0 0 0 4px rgba(108, 117, 125, 0.2);
}

/* Form field improvements */
input:required:invalid {
    border-color: #dc3545;
}

input:required:valid {
    border-color: #28a745;
}

/* Error message styling */
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
}

.error-message::before {
    content: "⚠ ";
    font-weight: bold;
}

/* Loading states accessibility */
.btn-spinner[style*="display: none"] {
    display: none !important;
}

.btn[aria-busy="true"] {
    pointer-events: none;
}

/* Mobile accessibility improvements */
@media (max-width: 768px) {
    /* Ensure touch targets are at least 44px */
    .btn,
    .nav-btn,
    .option input,
    .mobile-menu-toggle {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Increase font size for readability */
    .option-text {
        font-size: 16px;
        line-height: 1.4;
    }
    
    /* Improve spacing for touch */
    .option {
        margin-bottom: 12px;
        padding: 12px;
    }
}

/* Print accessibility */
@media print {
    .visually-hidden {
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }
    
    /* Ensure alt text is visible in print */
    img::after {
        content: " (Image: " attr(alt) ")";
        font-size: 12px;
        font-style: italic;
    }
}