/* Accessibility Color Contrast Fixes - WCAG 2.1 AA Compliant */

/* Project selector - was 3.98:1, now 4.5:1+ */
.project-selector,
.navbar .nav-link,
.dropdown-toggle {
    color: #e9ecef !important; /* Lighter gray for better contrast on dark nav */
}

/* Current badge - was 3.13:1 */
.badge.bg-info,
.badge-info {
    background-color: #0d6efd !important; /* Bootstrap primary blue */
    color: #ffffff !important;
}

/* Light text on colored backgrounds */
.text-muted {
    color: #6c757d !important; /* Minimum 4.5:1 on white */
}

/* Form placeholder text */
::placeholder {
    color: #6c757d !important;
    opacity: 1;
}

/* Table header text */
.table thead th,
.table-light th {
    color: #212529 !important;
}

/* Card subtitles and secondary text */
.card-subtitle,
.text-secondary {
    color: #5a6268 !important;
}

/* Links - ensure proper contrast */
a:not(.btn) {
    color: #0056b3;
}

a:not(.btn):hover {
    color: #003d82;
}

/* Status badges with proper contrast */
.badge.bg-warning {
    color: #212529 !important; /* Dark text on yellow */
}

.badge.bg-light {
    color: #212529 !important;
    border: 1px solid #dee2e6;
}

/* Button text contrast */
.btn-outline-secondary {
    color: #495057;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: #ffffff;
}

/* Disabled state - still needs 3:1 minimum */
.btn:disabled,
.form-control:disabled {
    color: #6c757d !important;
}

/* Focus indicators - high visibility */
*:focus {
    outline: 2px solid #0d6efd !important;
    outline-offset: 2px !important;
}

/* Skip navigation link */
.skip-link,
.skip-nav {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0d6efd;
    color: #ffffff;
    padding: 8px 16px;
    z-index: 9999;
    text-decoration: none;
    font-weight: bold;
}

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

/* Ensure sufficient contrast for all text */
body {
    color: #212529;
}

/* Fix low-contrast helper text */
.form-text,
.help-text,
small.text-muted {
    color: #5a6268 !important;
}

/* Error messages - red with good contrast */
.text-danger,
.invalid-feedback {
    color: #c92a2a !important; /* Darker red for better contrast */
}

/* Success messages */
.text-success {
    color: #2b8a3e !important; /* Darker green */
}

/* Table striped rows */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Dropdown menu text - ensure contrast */
.dropdown-menu .dropdown-item {
    color: #212529 !important;
}

.dropdown-menu .dropdown-header {
    color: #495057 !important;
}

/* Navbar dropdown links on dark background */
.navbar-dark .nav-link {
    color: #e9ecef !important;
}

.navbar-dark .nav-link:hover,
.navbar-dark .nav-link:focus {
    color: #ffffff !important;
}

/* Badge on Success background */
.badge.bg-success {
    background-color: #198754 !important;
    color: #ffffff !important;
}

/* Dropdown item small text */
.dropdown-item small.text-muted {
    color: #6c757d !important;
}

/* Active dropdown items */
.dropdown-item.active {
    background-color: #0d6efd;
    color: #ffffff !important;
}

.dropdown-item.active small {
    color: #e9ecef !important;
}

/* ===== WCAG 2.1 AA ENHANCED STATUS BADGE CONTRAST ===== */
/* Added Nov 29, 2025 - ADA Compliance Review */

/* Priority badges - ensure color is NOT the only indicator */
.badge.badge-danger,
.badge.bg-danger,
.badge-critical {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    border: 2px solid #a71d2a !important; /* Additional visual indicator */
}

.badge.badge-warning,
.badge.bg-warning,
.badge-high {
    background-color: #fd7e14 !important;
    color: #000000 !important; /* Dark text for contrast */
    border: 2px dashed #c55a00 !important; /* Different border style */
}

.badge.badge-info,
.badge.bg-info,
.badge-medium {
    background-color: #0dcaf0 !important;
    color: #000000 !important;
    border: 2px dotted #087990 !important;
}

.badge.badge-success,
.badge.bg-success,
.badge-low {
    background-color: #198754 !important;
    color: #ffffff !important;
}

/* Status-specific styling with text prefixes for color-blind users */
.bg-open-subtle,
[class*="bg-open"] {
    background-color: #e9ecef !important;
    color: #212529 !important;
}

.bg-in_progress-subtle,
[class*="bg-in_progress"],
.bg-in-progress-subtle {
    background-color: #cfe2ff !important;
    color: #052c65 !important;
}

.bg-completed-subtle,
[class*="bg-completed"] {
    background-color: #d1e7dd !important;
    color: #0a3622 !important;
}

.bg-approved-subtle,
[class*="bg-approved"] {
    background-color: #198754 !important;
    color: #ffffff !important;
}

.bg-rejected-subtle,
[class*="bg-rejected"] {
    background-color: #f8d7da !important;
    color: #58151c !important;
}

.bg-pending-subtle,
[class*="bg-pending"] {
    background-color: #fff3cd !important;
    color: #664d03 !important;
}

/* Text colors with good contrast */
.text-open { color: #495057 !important; }
.text-in_progress, .text-in-progress { color: #052c65 !important; }
.text-completed { color: #0a3622 !important; }
.text-approved { color: #ffffff !important; }
.text-rejected { color: #58151c !important; }
.text-pending { color: #664d03 !important; }

/* Days remaining indicators */
.text-warning {
    color: #997404 !important; /* Darker yellow for contrast */
}

.text-danger {
    color: #b02a37 !important; /* Darker red for contrast */
}

/* Ensure all links are underlined for non-color identification */
.table a:not(.btn) {
    text-decoration: underline;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    .badge {
        border: 2px solid currentColor !important;
        font-weight: bold !important;
    }
    
    button, .btn {
        border: 2px solid currentColor !important;
    }
    
    a:not(.btn) {
        text-decoration: underline !important;
        text-decoration-thickness: 2px !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;
    }
    
    .fade {
        transition: none !important;
    }
}

/* Print accessibility */
@media print {
    .skip-nav, .skip-link {
        display: none !important;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
    
    .badge {
        border: 1px solid #000 !important;
    }
}

/* Ensure visible focus on all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #0d6efd !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25) !important;
}

/* ARIA live regions for screen readers */
[aria-live] {
    position: relative;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden,
.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;
}

/* Ensure pagination has good touch targets */
.pagination .page-link {
    min-width: 44px !important;
    min-height: 44px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
}

/* Active pagination state */
.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* ===== GLOBAL TOUCH TARGET SIZES ===== */
/* WCAG 2.5.5 - All touch targets must be at least 44x44px */

/* Global button minimum sizing */
.btn,
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
a.btn {
    min-height: 44px !important;
    min-width: 44px !important;
}

/* Small buttons still need touch target compliance */
.btn-sm {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0.375rem 0.75rem;
}

/* Dropdown toggles */
.dropdown-toggle {
    min-height: 44px !important;
}

/* Dropdown items need proper touch targets */
.dropdown-item {
    min-height: 44px !important;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
}

/* Navbar items */
.nav-link {
    min-height: 44px !important;
    display: flex;
    align-items: center;
}

/* Button groups maintain touch targets */
.btn-group .btn {
    min-height: 44px !important;
}

/* Card action buttons */
.card .btn,
.card-footer .btn {
    min-height: 44px !important;
}

/* Form control buttons */
.input-group .btn {
    min-height: 44px !important;
}

/* Mobile enhancement - even larger for gloved hands */
@media (max-width: 768px) {
    .btn,
    button,
    .dropdown-item {
        min-height: 48px;
    }
    
    /* Main action buttons on mobile */
    .btn-primary,
    .btn-success,
    .btn-danger {
        min-height: 52px;
    }
}

/* Ensure close buttons are accessible */
.btn-close {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0.5rem;
}

/* Modal buttons */
.modal-footer .btn {
    min-height: 44px !important;
}

/* Alert dismiss buttons */
.alert .btn-close {
    min-width: 44px !important;
    min-height: 44px !important;
}
