/* WCAG 2.1 AA Accessibility Styles */

/* Badge font size — WCAG 2.1 AA requires minimum 14px for normal text at 4.5:1 contrast */
.k-badge {
    font-size: 0.875rem !important; /* 14px */
    font-weight: 600;
}

/* Skip Links for Keyboard Navigation */
.skip-links {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
}

.skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.3s;
    z-index: 10000;
}

.skip-link:focus {
    position: absolute;
    left: 6px;
    top: 6px;
    width: auto;
    height: auto;
    overflow: visible;
    color: #fff;
    text-decoration: underline;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.skip-link:focus:hover {
    background: #333;
    color: #fff;
}

/* Enhanced Focus Indicators - WCAG 2.1 AA Compliant */
*:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* High contrast focus for interactive elements */
.btn:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.5);
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* Remove default focus for mouse users but keep for keyboard */
.js-focus-visible *:focus:not(.focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Screen Reader Only Content */
.sr-only {
    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;
}

.sr-only-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* High Contrast Text - WCAG AA Color Contrast Ratios */
.text-high-contrast {
    color: #000000;
    background-color: #ffffff;
}

.text-muted {
    color: #666666 !important; /* 4.5:1 contrast ratio on white background */
}

/* Error and Success Messages with Proper Contrast */
.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24; /* High contrast red */
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724; /* High contrast green */
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404; /* High contrast orange */
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460; /* High contrast blue */
}

/* Form Validation Styles */
.field-validation-error {
    color: #dc3545;
    font-weight: 500;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.input-validation-error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.input-validation-error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    outline: 3px solid #dc3545;
}

/* Required Field Indicators */
.required::after {
    content: " *";
    color: var(--kendo-color-error-active, #d61400);
    font-weight: bold;
    margin-left: 2px;
}

.required-asterisk {
    color: var(--kendo-color-error-active, #d61400);
}

/* Enhanced Link Styles for Better Accessibility */
a {
    color: #0056b3; /* High contrast blue */
    text-decoration: underline;
}

a:hover {
    color: #004085;
    text-decoration: underline;
}

a:visited {
    color: #6f42c1; /* Accessible purple for visited links */
}

/* Button States for Screen Readers */
.btn[aria-expanded="true"]::after {
    content: " (expanded)";
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.btn[aria-expanded="false"]::after {
    content: " (collapsed)";
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Loading and Status Indicators */
.loading {
    position: relative;
}

.loading::after {
    content: "Loading...";
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Improved Table Accessibility */
.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Modal Dialog Accessibility */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.75);
}

.modal-dialog {
    margin: 1.75rem auto;
}

.modal-header .btn-close {
    padding: 0.5rem 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    background: transparent;
    border: 0;
    border-radius: 0.25rem;
    opacity: 0.8;
}

.modal-header .btn-close:focus {
    opacity: 1;
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* Breadcrumb Navigation */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: #6c757d;
    margin: 0 0.5rem;
}

/* Progress Indicators */
.progress {
    height: 1.5rem;
    font-size: 0.875rem;
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    background-color: #0d6efd;
    transition: width 0.6s ease;
}

/* Card Component Enhancements */
.card {
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.375rem;
}

.card-header {
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    padding: 0.75rem 1.25rem;
}

/* List Group Accessibility */
.list-group-item {
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.list-group-item:focus {
    z-index: 1;
    color: #495057;
    text-decoration: none;
    background-color: #f8f9fa;
    border-color: #007bff;
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* Form Control Enhancements */
.form-control {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Pagination Accessibility */
.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #007bff;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #dee2e6;
}

.page-link:focus {
    z-index: 3;
    color: #0056b3;
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #adb5bd;
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

/* Tooltip and Popover Accessibility */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    max-width: 200px;
    padding: 0.25rem 0.5rem;
    color: #fff;
    text-align: center;
    background-color: #000;
    border-radius: 0.375rem;
}

/* Print Styles for Accessibility */
@media print {
    .skip-links,
    .navbar,
    .btn,
    .form-control {
        display: none !important;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
    }
    
    .sr-only {
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        overflow: visible !important;
        clip: auto !important;
    }
}

/* Responsive Text for Mobile Accessibility */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .btn {
        min-height: 44px; /* Minimum touch target size */
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn,
    .form-control,
    .card {
        border-width: 2px;
    }
    
    .text-muted {
        color: #000000 !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;
        scroll-behavior: auto !important;
    }
    
    .skip-link {
        transition: none;
    }
}
