/**
 * Accessibility CSS
 * Enhances application accessibility with appropriate styles
 */

/* Skip link - hidden until focused */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: white;
    padding: 8px;
    z-index: 9999;
    transition: top 0.3s ease;
}

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

/* Screen reader only class - visually hidden but accessible to screen readers */
.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;
}

/* High contrast mode */
.high-contrast {
    background-color: black !important;
    color: white !important;
}

.high-contrast a {
    color: yellow !important;
}

.high-contrast button, 
.high-contrast .btn {
    background-color: white !important;
    color: black !important;
    border: 2px solid white !important;
}

/* Larger text mode */
.large-text {
    font-size: 120% !important;
}

.large-text h1 {
    font-size: 2.5em !important;
}

.large-text h2 {
    font-size: 2.2em !important;
}

.large-text h3 {
    font-size: 1.9em !important;
}

.large-text h4, .large-text h5, .large-text h6 {
    font-size: 1.6em !important;
}

.large-text p, .large-text li, .large-text label, .large-text input {
    font-size: 1.2em !important;
}

/* Focus indicators */
:focus {
    outline: 3px solid #4d90fe !important;
    outline-offset: 2px !important;
}

/* Accessibility toolbar */
.accessibility-toolbar {
    position: fixed;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.accessibility-toolbar.collapsed {
    width: 40px;
    height: 40px;
    overflow: hidden;
}

.accessibility-toolbar button {
    margin-bottom: 5px;
    padding: 8px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.accessibility-toolbar button:hover {
    background-color: #0056b3;
}

.accessibility-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.accessibility-toolbar-title {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: bold;
}

/* Voice command indicator */
.voice-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.voice-indicator.active {
    opacity: 1;
}

.voice-indicator-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 50%;
    background-color: red;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }
    
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

/* Improved form accessibility */
input:focus, select:focus, textarea:focus {
    border-color: #4d90fe !important;
    box-shadow: 0 0 0 0.2rem rgba(77, 144, 254, 0.25) !important;
}

[role="alert"],
.alert {
    border: 2px solid transparent;
}

.alert-danger, [role="alert"].error {
    border-color: #dc3545;
}

.alert-success, [role="alert"].success {
    border-color: #28a745;
}

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

table, th, td {
    border: 1px solid #ddd;
}

th {
    background-color: #f2f2f2;
    text-align: left;
    font-weight: bold;
}

th, td {
    padding: 10px;
}

/* Improved contrast for placeholder text */
::placeholder {
    color: #555 !important;
    opacity: 1 !important;
}

/* Reading guide line for dyslexic users */
.reading-guide {
    position: absolute;
    width: 100%;
    height: 30px;
    background-color: rgba(255, 255, 0, 0.2);
    pointer-events: none;
    z-index: 999;
    display: none;
}

.reading-guide-active .reading-guide {
    display: block;
}