/* Critical Contrast Fixes - Priority Loading */
/* Target: 69%+ WCAG AA compliance across all sites */

/* 1. Fix text-on-image contrast in hero sections */
.hero-section *,
.jumbotron *,
.banner *,
.cover *,
[class*="hero"] *,
[class*="banner"] * {
    /* Text shadow removed - handled by specific elements below */
}

/* White text on any background */
.text-white,
.text-light,
[style*="color: white"],
[style*="color:#fff"],
[style*="color: #fff"],
[style*="color:white"] {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
}

/* 2. Fix secondary button contrast (3.66:1 → 4.5:1) */
.btn-secondary {
    background-color: #6c757d !important;
    border-color: #545b62 !important;
    color: #ffffff !important;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    background-color: #545b62 !important;
    border-color: #4a5056 !important;
    color: #ffffff !important;
}

/* 3. Fix light gray text (#6c757d → #495057) */
.text-muted,
.text-secondary,
[style*="color: #6c757d"],
[style*="color:#6c757d"] {
    color: #495057 !important;
}

/* 4. Fix empty buttons */
.btn:empty::before,
button:empty::before {
    content: "Button" !important;
    color: inherit !important;
}

/* 5. Fix low border visibility */
.btn {
    border-width: 2px !important;
    border-style: solid !important;
}

.btn-primary {
    background-color: #0F75BD !important;
    border-color: #0c5c96 !important;
    color: #ffffff !important;
}

.btn-danger {
    background-color: #DC3545 !important;
    border-color: #b02a37 !important;
    color: #ffffff !important;
}

.btn-success {
    background-color: #198754 !important;
    border-color: #146c43 !important;
    color: #ffffff !important;
}

.btn-warning {
    background-color: #F57C00 !important;
    border-color: #d36a00 !important;
    color: #000000 !important;
}

.btn-info {
    background-color: #0288D1 !important;
    border-color: #026dad !important;
    color: #ffffff !important;
}

.btn-light {
    background-color: #F8F9FA !important;
    border-color: #dee2e6 !important;
    color: #212529 !important;
}

.btn-dark {
    background-color: #212529 !important;
    border-color: #1a1d20 !important;
    color: #ffffff !important;
}

/* 6. Fix form input labels */
label {
    color: #212529 !important;
    font-weight: 500 !important;
}

/* Ensure all inputs have visible borders */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
select,
textarea {
    border: 2px solid #495057 !important;
    background-color: #ffffff !important;
    color: #212529 !important;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: #0F75BD !important;
    box-shadow: 0 0 0 0.2rem rgba(15, 117, 189, 0.25) !important;
}

/* 7. Fix placeholder contrast */
::placeholder,
::-webkit-input-placeholder,
::-moz-placeholder,
:-ms-input-placeholder {
    color: #6c757d !important;
    opacity: 1 !important;
}

/* 8. Fix link contrast */
a:not(.btn) {
    color: #0F75BD !important;
    text-decoration: underline !important;
}

a:not(.btn):hover,
a:not(.btn):focus {
    color: #0c5c96 !important;
    text-decoration: underline !important;
}

/* 9. Navigation contrast fixes */
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

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

.navbar-light .navbar-nav .nav-link {
    color: #212529 !important;
}

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

/* 10. Dropdown contrast */
.dropdown-menu {
    background-color: #ffffff !important;
    border: 2px solid #495057 !important;
}

.dropdown-item {
    color: #212529 !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #e9ecef !important;
    color: #000000 !important;
}

/* 11. Card and panel contrast */
.card {
    border: 2px solid #dee2e6 !important;
}

.card-header {
    background-color: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6 !important;
    color: #212529 !important;
}

/* 12. Badge contrast */
.badge {
    font-weight: 600 !important;
    padding: 0.35em 0.65em !important;
}

.badge-primary,
.bg-primary {
    background-color: #0F75BD !important;
    color: #ffffff !important;
}

.badge-secondary,
.bg-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

/* 13. Alert contrast improvements */
.alert {
    border-width: 2px !important;
}

.alert-primary {
    color: #084298 !important;
    background-color: #cfe2ff !important;
    border-color: #084298 !important;
}

.alert-danger {
    color: #842029 !important;
    background-color: #f8d7da !important;
    border-color: #842029 !important;
}

.alert-warning {
    color: #664d03 !important;
    background-color: #fff3cd !important;
    border-color: #664d03 !important;
}

.alert-success {
    color: #0f5132 !important;
    background-color: #d1e7dd !important;
    border-color: #0f5132 !important;
}

/* 14. Focus indicators */
*:focus {
    outline: 3px solid #0F75BD !important;
    outline-offset: 2px !important;
}

/* Keep focus for keyboard nav, remove for mouse */
*:focus:not(:focus-visible) {
    outline: none !important;
}

*:focus-visible {
    outline: 3px solid #0F75BD !important;
    outline-offset: 2px !important;
}

/* 15. Ensure minimum font sizes */
body {
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: #212529 !important;
}

small,
.small {
    font-size: 14px !important;
}

/* 16. Table contrast */
.table {
    color: #212529 !important;
}

.table th {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    font-weight: 600 !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

/* 17. Modal contrast */
.modal-content {
    border: 2px solid #495057 !important;
}

.modal-header {
    border-bottom: 2px solid #dee2e6 !important;
}

.modal-footer {
    border-top: 2px solid #dee2e6 !important;
}

/* 18. Pagination contrast */
.page-link {
    color: #0F75BD !important;
    border: 1px solid #dee2e6 !important;
}

.page-link:hover {
    color: #0c5c96 !important;
    background-color: #e9ecef !important;
}

.page-item.active .page-link {
    background-color: #0F75BD !important;
    border-color: #0F75BD !important;
    color: #ffffff !important;
}

/* 19. Custom form controls */
.form-check-input {
    border: 2px solid #495057 !important;
}

.form-check-input:checked {
    background-color: #0F75BD !important;
    border-color: #0F75BD !important;
}

/* 20. Progress bars */
.progress {
    background-color: #e9ecef !important;
    border: 1px solid #dee2e6 !important;
}

.progress-bar {
    background-color: #0F75BD !important;
    color: #ffffff !important;
}

/* Force override any inline styles */
[style*="color"] {
    color: inherit !important;
}

/* Specific overrides for problem areas */
.text-white[style*="color"] {
    color: #ffffff !important;
}

.text-dark[style*="color"] {
    color: #212529 !important;
}
/* Fix for empty buttons - add text content */
.btn:empty::after,
button:empty::after {
    content: attr(aria-label, "Button");
}

/* Ensure all buttons have minimum content */
.btn:not(:empty),
button:not(:empty) {
    min-width: 64px;
    min-height: 36px;
}

/* Fix button visibility */
.btn {
    border: 2px solid currentColor !important;
    position: relative;
}

.btn::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-radius: inherit;
    transition: border-color 0.2s;
}

.btn:focus::before {
    border-color: #0F75BD;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0F75BD;
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    z-index: 10000;
    font-weight: 600;
}

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

/* Ensure skip link has good contrast */
.skip-link:hover,
.skip-link:focus {
    background: #0c5c96;
    color: #ffffff;
    text-decoration: none;
}

/* Enhanced text shadows for hero sections */
.hero-section h1,
.hero-section h2,
.hero-section h3,
.hero-section p,
.hero-section .lead,
.jumbotron h1,
.jumbotron h2,
.jumbotron h3,
.jumbotron p,
.jumbotron .lead,
[style*="background-image"] h1,
[style*="background-image"] h2,
[style*="background-image"] h3,
[style*="background-image"] p,
[style*="background-image"] .lead {
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(0, 0, 0, 0.6) !important;
}

/* White text needs extra shadow */
.text-white,
.text-light,
[style*="color: white"],
[style*="color:#fff"],
[style*="color: #fff"] {
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.95),
        0 0 15px rgba(0, 0, 0, 0.9) !important;
}

/* Overlay for better contrast */
.hero-section::before,
.jumbotron::before,
[style*="background-image"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 1;
}

.hero-section > *,
.jumbotron > *,
[style*="background-image"] > * {
    position: relative;
    z-index: 2;
}
