/* Accessibility Improvements for CareGrid */

/* Focus styles for better keyboard navigation */
*:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Custom focus styles for buttons */
.btn:focus,
button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Enhanced focus styles for form elements */
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #007bff;
    outline-offset: 1px;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Focus styles for links */
a:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    text-decoration: underline;
}

/* Skip to main content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #007bff;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

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

/* 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;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid;
    }
    
    .card {
        border: 2px solid;
    }
}

/* 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;
    }
}

/* Focus indicator for custom components */
.clinic-card:focus-within,
.appointment-card:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Better contrast for disabled elements */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

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

/* Success message styling */
.success-message {
    color: #28a745;
    font-weight: 500;
    margin-top: 5px;
}

.success-message::before {
    content: "✓ ";
    font-weight: bold;
}

/* Form field error state */
input.error,
select.error,
textarea.error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

/* Required field indicator */
label.required::after,
.required::after {
    content: " *";
    color: #dc3545;
}

/* Better button spacing for touch targets */
.btn {
    min-height: 44px;
    min-width: 44px;
}

/* Loading state accessibility */
.loading {
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Better color contrast for text */
.text-muted {
    color: #495057 !important;
}

/* Focus trap for modals */
.modal[aria-hidden="false"] {
    display: flex;
}

.modal[aria-hidden="true"] {
    display: none;
}

/* Keyboard navigation indicators */
.keyboard-user *:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
}