/* Accessibility Enhancements */

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

/* Focus indicators */
*:focus {
    outline: 2px solid var(--accent-color, #007aff);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--accent-color, #007aff);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
        --bg-primary: #ffffff;
        --bg-secondary: #f5f5f5;
        --border-color: #000000;
    }
    
    [data-theme="dark"] {
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --bg-primary: #000000;
        --bg-secondary: #1a1a1a;
        --border-color: #ffffff;
    }
}

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

/* Keyboard navigation improvements */
.btn:focus,
.nav-link:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent-color, #007aff);
    outline-offset: 2px;
}

/* Ensure interactive elements are large enough */
.btn,
.nav-link,
input,
select,
textarea {
    min-height: 44px;
    min-width: 44px;
}

/* Color contrast improvements */
.text-muted {
    color: var(--text-secondary);
}

.bg-muted {
    background-color: var(--bg-secondary);
}

/* Error and success states */
.error {
    color: #d32f2f;
    background-color: #ffebee;
    border: 1px solid #f8bbd9;
}

.success {
    color: #2e7d32;
    background-color: #e8f5e8;
    border: 1px solid #c8e6c9;
}

/* Loading states */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Form validation */
input:invalid {
    border-color: #d32f2f;
}

input:valid {
    border-color: #2e7d32;
}

/* Tooltip accessibility */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 1000;
    border: 1px solid var(--border-color);
}
