/* Accessibility Enhancements for Superion */

/* Screen reader only text - hide visually but keep for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip to main content link - visible only when focused */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #009688;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 4px 0;
  font-weight: 600;
}

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

/* Enhanced focus indicators - visible and clear */
*:focus {
  outline: 3px solid #FF5722;
  outline-offset: 2px;
}

/* Focus indicators for buttons */
button:focus,
.btn:focus,
a.btn:focus {
  outline: 3px solid #FF5722;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255, 87, 34, 0.2);
}

/* Focus indicators for form inputs */
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid #009688;
  outline-offset: 2px;
  border-color: #009688;
  box-shadow: 0 0 0 4px rgba(0, 150, 136, 0.1);
}

/* Focus indicators for links */
a:focus {
  outline: 3px solid #FF5722;
  outline-offset: 2px;
  text-decoration: underline;
}

/* Ensure buttons have proper alignment and spacing */
button,
.btn,
a.btn,
input[type="submit"],
input[type="button"] {
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Larger touch targets for mobile */
@media (max-width: 768px) {
  button,
  .btn,
  a.btn {
    padding: 12px 20px;
  }
}

/* Error messages - ensure they're announced */
.alert-error,
.error-message,
[role="alert"] {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 4px;
  background-color: #FFEBEE;
  color: #C62828;
  border-left: 4px solid #C62828;
  font-weight: 500;
}

/* Success messages */
.alert-success,
.success-message,
[role="status"] {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 4px;
  background-color: #E8F5E9;
  color: #2E7D32;
  border-left: 4px solid #2E7D32;
  font-weight: 500;
}

/* Loading indicators - ensure they're announced */
.loading,
[aria-busy="true"] {
  position: relative;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  * {
    border-color: currentColor !important;
  }
  
  button,
  .btn {
    border: 2px solid currentColor !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;
    scroll-behavior: auto !important;
  }
}

/* Ensure sufficient color contrast for text */
.text-muted,
.secondary-text {
  color: #666 !important; /* Meets WCAG AA for normal text */
}

/* Form labels - ensure they're always visible */
label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #333;
}

/* Required field indicator */
.required::after,
[required] + label::after,
label.required::after {
  content: " *";
  color: #C62828;
  font-weight: bold;
}

/* Help text styling */
.help-text,
.form-help,
[role="note"] {
  font-size: 0.9em;
  color: #666;
  margin-top: 4px;
}

/* Disabled state - ensure it's clear */
button:disabled,
.btn:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f5f5f5 !important;
}

/* Icon-only buttons - ensure they have accessible labels */
button[aria-label],
.btn[aria-label] {
  /* Icons should have aria-hidden="true" */
}

/* Ensure decorative icons are hidden from screen readers */
.fa-solid[aria-hidden="true"],
.fa-regular[aria-hidden="true"],
i[aria-hidden="true"] {
  /* Already hidden from screen readers */
}

/* Focus visible polyfill for better keyboard navigation */
.js-focus-visible :focus:not(.focus-visible) {
  outline: none;
}

.js-focus-visible .focus-visible {
  outline: 3px solid #FF5722;
  outline-offset: 2px;
}

/* Ensure tables are accessible */
table {
  border-collapse: collapse;
  width: 100%;
}

th {
  text-align: left;
  font-weight: 600;
  background-color: #f5f5f5;
  padding: 12px;
}

td {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
}

/* Ensure headings have proper hierarchy */
h1 {
  font-size: 2em;
  margin-bottom: 0.5em;
}

h2 {
  font-size: 1.5em;
  margin-bottom: 0.5em;
}

h3 {
  font-size: 1.25em;
  margin-bottom: 0.5em;
}

/* Ensure links are distinguishable */
a {
  color: #009688;
  text-decoration: underline;
}

a:hover {
  color: #00796B;
}

a:visited {
  color: #7B1FA2;
}

/* Button links should look like buttons */
a.btn {
  text-decoration: none;
}

/* Ensure form validation messages are accessible */
input:invalid,
textarea:invalid,
select:invalid {
  border-color: #C62828;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: #C62828;
  background-color: #FFEBEE;
}

/* Loading spinner accessibility */
.spinner,
.loading-spinner {
  /* Should have aria-label or aria-labelledby */
}

/* Modal/dialog accessibility */
[role="dialog"],
.modal {
  /* Should have aria-labelledby and aria-describedby */
}

/* Ensure proper spacing for readability */
p {
  line-height: 1.6;
  margin-bottom: 1em;
}

/* Ensure lists are properly structured */
ul, ol {
  margin-left: 1.5em;
  margin-bottom: 1em;
}

li {
  margin-bottom: 0.5em;
}
