/* Accessibility Styles */

/* Skip Links */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 6px;
}

/* Focus Styles */
*:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .navbar {
    border: 2px solid;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .wow {
    animation: none !important;
  }
}

/* Screen Reader Only Text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

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

.card-text {
  color: #212529 !important;
}

/* Form Accessibility */
.form-control:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control:invalid {
  border-color: #dc3545;
}

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

/* Button Accessibility */
.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Link Accessibility */
a:focus {
  text-decoration: underline;
}

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

th {
  background-color: #f8f9fa;
  font-weight: bold;
  text-align: left;
  padding: 8px;
  border: 1px solid #dee2e6;
}

td {
  padding: 8px;
  border: 1px solid #dee2e6;
}

/* Image Accessibility */
img {
  max-width: 100%;
  height: auto;
}

/* Landmark Roles */
[role="banner"] {
  /* Header styles */
}

[role="navigation"] {
  /* Navigation styles */
}

[role="main"] {
  /* Main content styles */
}

[role="contentinfo"] {
  /* Footer styles */
}

[role="complementary"] {
  /* Sidebar styles */
}

/* Keyboard Navigation */
.dropdown-menu:focus-within {
  display: block;
}

.nav-link:hover,
.nav-link:focus {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Error Messages */
.error {
  color: #dc3545;
  font-weight: bold;
}

.success {
  color: #28a745;
  font-weight: bold;
}

/* Loading States */
[aria-busy="true"] {
  cursor: wait;
}

/* Expanded/Collapsed States */
[aria-expanded="true"]::before {
  content: "▼ ";
}

[aria-expanded="false"]::before {
  content: "▶ ";
}

/* Required Fields */
.required::after {
  content: " *";
  color: #dc3545;
}

/* Form Labels */
.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #495057;
}

/* Error Messages */
.error-message {
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: block;
}

/* Keyboard Navigation Indicator */
.keyboard-navigation *:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Skip Link Enhancement */
.skip-link:hover,
.skip-link:focus {
  background-color: #007bff;
  color: white;
  text-decoration: none;
}

/* Form Validation States */
.form-control:invalid:not(:placeholder-shown) {
  border-color: #dc3545;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control:valid:not(:placeholder-shown) {
  border-color: #28a745;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .form-control {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }
  
  .form-control:focus {
    background-color: #2d3748;
    border-color: #63b3ed;
    color: #e2e8f0;
  }
  
  .form-label {
    color: #e2e8f0;
  }
}