/* Accessibility Styles */

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Focus Indicators */
*:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !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;
    }
}

/* Screen Reader Only */
.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-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Keyboard Navigation Indicators */
.keyboard-nav *:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Form Accessibility */
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input[required] + label::after,
.form-group label[for][required]::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Error Messages */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.error-message[role="alert"] {
    font-weight: 500;
}

/* Success Messages */
.success-message {
    color: #155724;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* ARIA Live Regions */
[role="status"],
[role="alert"] {
    display: block;
}

/* Button Accessibility */
button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Link Accessibility */
a:not([href]) {
    cursor: default;
}

/* Table Accessibility */
table {
    border-collapse: collapse;
}

th {
    font-weight: 600;
}

/* Color Contrast - Ensure minimum 4.5:1 for normal text */
body {
    color: #333;
    background-color: #fff;
}

/* Ensure interactive elements are keyboard accessible */
button,
a,
input,
select,
textarea {
    min-height: 44px; /* Minimum touch target size */
}

/* Accessibility Toolbar */
.accessibility-toolbar {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 9999;
    font-family: Arial, sans-serif;
    display: block !important;
    visibility: visible !important;
}

.a11y-toggle {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 12px 8px;
    border-radius: 4px 0 0 4px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: -2px 0 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    display: block !important;
    visibility: visible !important;
    min-width: 50px;
    min-height: 50px;
}

.a11y-toggle:hover,
.a11y-toggle:focus {
    background: #0056b3;
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.a11y-panel {
    position: absolute;
    right: 0;
    top: 0;
    background: #fff;
    border: 2px solid #007bff;
    border-radius: 4px 0 0 4px;
    padding: 1.5rem;
    min-width: 280px;
    max-width: 320px;
    box-shadow: -2px 0 12px rgba(0,0,0,0.15);
    display: none;
}

.a11y-panel h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: #333;
}

.a11y-group {
    margin-bottom: 1.25rem;
}

.a11y-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.a11y-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.a11y-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    background: #fff;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    min-height: 44px;
}

.a11y-btn:hover,
.a11y-btn:focus {
    border-color: #007bff;
    outline: none;
}

.a11y-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.a11y-group input[type="checkbox"] {
    margin-right: 0.5rem;
    width: auto;
    min-height: auto;
}

.a11y-reset {
    width: 100%;
    padding: 0.75rem;
    background: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 1rem;
    min-height: 44px;
}

.a11y-reset:hover,
.a11y-reset:focus {
    background: #5a6268;
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Font Size Classes */
body.font-small {
    font-size: 0.875rem;
}

body.font-normal {
    font-size: 1rem;
}

body.font-large {
    font-size: 1.25rem;
}

body.font-xlarge {
    font-size: 1.5rem;
}

/* Contrast Classes */
body.contrast-high {
    background: #fff !important;
    color: #000 !important;
}

body.contrast-high * {
    background: #fff !important;
    color: #000 !important;
    border-color: #000 !important;
}

body.contrast-high a {
    color: #0000ff !important;
    text-decoration: underline !important;
}

body.contrast-dark {
    background: #000 !important;
    color: #fff !important;
}

body.contrast-dark * {
    background: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

body.contrast-dark a {
    color: #00ffff !important;
    text-decoration: underline !important;
}

/* Underline Links */
body.underline-links a {
    text-decoration: underline !important;
}

/* Readable Font */
body.readable-font {
    font-family: 'Arial', 'Helvetica', sans-serif !important;
}

body.readable-font * {
    font-family: 'Arial', 'Helvetica', sans-serif !important;
}

@media (max-width: 768px) {
    .accessibility-toolbar {
        top: auto;
        bottom: 80px;
        transform: none;
    }
    
    .a11y-panel {
        bottom: 0;
        top: auto;
        border-radius: 4px 4px 0 0;
    }
}

/* Ensure toolbar is always visible */
#accessibility-toolbar {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#a11y-toggle {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Accessibility Panel Header with Close Button */
.a11y-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #ddd;
}

.a11y-panel-header h3 {
    margin: 0;
    flex: 1;
}

.a11y-close {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-height: 44px;
    min-width: 44px;
}

.a11y-close:hover,
.a11y-close:focus {
    background: #f0f0f0;
    color: #000;
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Cookie Settings Button */
.cookie-settings-button {
    position: fixed;
    top: 60%;
    right: 0;
    transform: translateY(-50%);
    z-index: 9998;
    background: #28a745;
    color: #fff;
    border: none;
    padding: 12px 8px;
    border-radius: 4px 0 0 4px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: -2px 0 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 50px;
    min-height: 50px;
}

.cookie-settings-button:hover,
.cookie-settings-button:focus {
    background: #218838;
    outline: 2px solid #fff;
    outline-offset: -2px;
}

@media (max-width: 768px) {
    .cookie-settings-button {
        top: auto;
        bottom: 140px;
        transform: none;
    }
    
    .accessibility-toolbar {
        bottom: 80px;
    }
}

