/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ==========================================================================
   WCAG 2.1 AA Accessibility Styles
   ========================================================================== */

/* Skip Links - Hidden until focused for keyboard navigation */
.skip-links {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9999;
}

.skip-links a {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  background: #0D3B66;
  color: #fff;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 0.25rem 0.25rem;
}

.skip-links a:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  outline: 3px solid #ffc107;
  outline-offset: 2px;
}

/* Focus indicators for keyboard users - WCAG 2.4.7 Focus Visible */
:focus {
  outline: 2px solid #0D3B66;
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid #0D3B66;
  outline-offset: 2px;
}

/* Enhanced focus for buttons and interactive elements */
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
a:focus-visible {
  outline: 3px solid #ffc107;
  outline-offset: 2px;
  box-shadow: none;
}

/* Form element focus states */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: #0D3B66;
  box-shadow: 0 0 0 0.25rem rgba(13, 59, 102, 0.25);
  outline: none;
}

/* High contrast focus for dark backgrounds */
.navbar-dark .nav-link:focus-visible,
.navbar-dark .dropdown-item:focus-visible,
.btn-primary:focus-visible,
.btn-success:focus-visible,
.btn-danger:focus-visible,
.btn-info:focus-visible,
.btn-warning:focus-visible {
  outline-color: #ffc107;
}

/* Improved contrast for text - WCAG 1.4.3 Contrast (Minimum) */
.text-muted {
  color: #5a6268 !important; /* Darker gray meets 4.5:1 ratio on white background */
}

.form-text {
  color: #5a6268; /* Darker helper text for better contrast */
}

/* Ensure link text has sufficient contrast */
a {
  color: #0d6efd; /* Bootstrap primary - meets contrast requirements */
}

a:visited {
  color: #0b5ed7;
}

/* Ensure badge text is readable */
.badge.bg-warning {
  color: #000 !important; /* Dark text on yellow background */
}

.badge.bg-info {
  color: #000 !important; /* Dark text on cyan background */
}

/* Table header contrast improvements */
.table-light th,
.table-light td {
  color: #212529;
}

/* ==========================================================================
   Screen Reader Only Utility
   ========================================================================== */
.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;
}

.sr-only-focusable:focus,
.sr-only-focusable:active {
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* ==========================================================================
   Motion Accessibility - WCAG 2.3.3 Animation from Interactions
   ========================================================================== */
@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;
  }
}

/* ==========================================================================
   Modal Accessibility Improvements
   ========================================================================== */
.modal-dialog {
  margin: 1.75rem auto;
}

.modal-content:focus {
  outline: none;
}

/* Ensure modal close buttons are easily clickable */
.modal .btn-close {
  padding: 1rem;
  margin: -0.5rem -0.5rem -0.5rem auto;
}

/* ==========================================================================
   Button Minimum Touch Target Size - WCAG 2.5.5 Target Size
   ========================================================================== */
.btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1rem;
}

.btn-sm {
  min-height: 38px;
  min-width: 38px;
}

.btn-lg {
  min-height: 48px;
}

/* Clickable table rows for better interaction */
.table-hover tbody tr {
  cursor: pointer;
}

/* ==========================================================================
   Error State Accessibility
   ========================================================================== */
.is-invalid {
  border-color: #dc3545;
}

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

.invalid-feedback {
  color: #842029;
  font-weight: 500;
}

/* Ensure error messages are associated with form fields */
.form-control.is-invalid + .invalid-feedback,
.form-select.is-invalid + .invalid-feedback {
  display: block;
}

/* ==========================================================================
   Dropdown Menu Accessibility
   ========================================================================== */
.dropdown-menu {
  padding: 0.5rem 0;
}

.dropdown-item {
  padding: 0.5rem 1rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.dropdown-item:focus {
  background-color: #e9ecef;
  outline: 2px solid #0D3B66;
  outline-offset: -2px;
}

/* ==========================================================================
   Card Accessibility
   ========================================================================== */
.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
  margin-bottom: 0;
}
