/* WCAG 2.2 Accessibility Enhancements */

/* Skip Navigation */
.skip-navigation {
    position: absolute;
    top: -100px;
    left: 10px;
    background: #0c2074;
    color: #fff;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 0 0 5px 5px;
    z-index: 10000;
    font-weight: bold;
    transition: top 0.3s ease;
}

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

/* Enhanced Focus Indicators */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 3px solid #0c2074;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #fff;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000 !important;
        border-color: #000 !important;
        color: #fff !important;
    }
    
    .btn-outline-secondary {
        border-color: #000 !important;
        color: #000 !important;
    }
    
    .text-muted {
        color: #000 !important;
    }
    
    .bg-light {
        background: #fff !important;
    }
}

/* Reduced Motion */
@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;
    }
    
    .carousel {
        animation: none;
    }
}

/* Enhanced Link Indicators */
a:not(.btn):not(.navbar-brand) {
    text-decoration: underline;
    text-underline-offset: 3px;
}

a:not(.btn):not(.navbar-brand):hover {
    text-decoration-thickness: 2px;
}

/* Better Color Contrast */
.text-muted {
    color: #495057 !important; /* Better contrast than Bootstrap default */
}

/* Screen Reader Only Content */
.sr-only,
.visually-hidden {
    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;
}

/* Enhanced Form Labels */
label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-control:invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control:valid {
    border-color: #28a745;
}

/* Enhanced Error Messages */
.invalid-feedback {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Better Button States */
.btn:disabled,
.btn.disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Enhanced Table Accessibility */
table {
    border-collapse: collapse;
}

th {
    text-align: left;
    font-weight: 600;
}

/* Better List Styling for Screen Readers */
ul[role="list"],
ol[role="list"] {
    list-style: none;
    padding: 0;
}

/* Enhanced Modal Accessibility */
.modal {
    overflow-y: auto;
}

.modal-dialog {
    margin: 1.75rem auto;
}

/* Better Carousel Accessibility */
.carousel-control-prev,
.carousel-control-next {
    width: 15%;
}

.carousel-indicators button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

/* Enhanced Dropdown Accessibility */
.dropdown-menu {
    border: 2px solid #dee2e6;
}

.dropdown-item:focus {
    background-color: #0c2074;
    color: #fff;
}

/* Better Mobile Touch Targets */
@media (max-width: 768px) {
    .btn,
    .form-control,
    .dropdown-toggle {
        min-height: 44px; /* WCAG minimum touch target */
        padding: 0.75rem 1rem;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Print Styles */
@media print {
    .skip-navigation,
    .navbar,
    .btn,
    .footer {
        display: none !important;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
    
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #121212;
        --bs-body-color: #e0e0e0;
        --bs-primary: #4dabf7;
    }
    
    body {
        background-color: var(--bs-body-bg);
        color: var(--bs-body-color);
    }
    
    .bg-light {
        background-color: #1e1e1e !important;
    }
    
    .text-dark {
        color: #e0e0e0 !important;
    }
    
    .border {
        border-color: #333 !important;
    }
    
    .form-control {
        background-color: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .form-control:focus {
        background-color: #2d2d2d;
        border-color: #4dabf7;
        color: #e0e0e0;
    }
}
