
/* Accessibility Styles for WCAG 2.2 AA/AAA Compliance */

/* Screen Reader Only Content */
.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:focus,
.focus\:not-sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* High Contrast Focus Indicators */
*:focus {
  outline: 2px solid #6631FF;
  outline-offset: 2px;
}

/* Enhanced Focus for Interactive Elements */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #6631FF;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(102, 49, 255, 0.3);
}

/* Skip Link Styles */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #6631FF;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
  border-radius: 4px;
}

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

/* Improved Color Contrast for Links */
a {
  color: #5A28CC; /* Higher contrast version of purple */
}

a:hover,
a:focus {
  color: #4A1FAA;
  text-decoration: underline;
}

/* Button Accessibility */
button,
.btn {
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
}

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

/* Form Accessibility */
input,
textarea,
select {
  min-height: 44px;
}

input:invalid,
textarea:invalid,
select:invalid {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Error Message Styles */
.error-message {
  color: #DC2626;
  font-size: 14px;
  margin-top: 4px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  * {
    border-color: currentColor !important;
  }
  
  .bg-purple-600 {
    background-color: #000080 !important;
  }
  
  .text-gray-700 {
    color: #000000 !important;
  }
  
  .text-white {
    color: #FFFFFF !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;
  }
}

/* Dark Mode Support for Better Accessibility */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #FFFFFF;
    --text-secondary: #E5E5E5;
    --bg-primary: #1A1A1A;
    --bg-secondary: #2D2D2D;
    --accent: #8B5CF6;
  }
}

/* Touch Target Sizes (WCAG 2.2 AA) */
@media (pointer: coarse) {
  a,
  button,
  input,
  select,
  textarea,
  [role="button"],
  [role="link"] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Text Spacing (WCAG 2.1 AA) */
.enhanced-text-spacing {
  line-height: 1.5 !important;
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
  margin-bottom: 2em !important;
}

/* Language Direction Support */
[dir="rtl"] {
  text-align: right;
}

[dir="ltr"] {
  text-align: left;
}

/* Keyboard Navigation Enhancement */
.keyboard-nav:focus-within {
  outline: 3px solid #6631FF;
  outline-offset: 2px;
}

/* Status Messages */
.status-message {
  padding: 12px;
  border-radius: 4px;
  margin: 16px 0;
}

.status-success {
  background-color: #10B981;
  color: white;
  border: 2px solid #059669;
}

.status-error {
  background-color: #EF4444;
  color: white;
  border: 2px solid #DC2626;
}

.status-warning {
  background-color: #F59E0B;
  color: white;
  border: 2px solid #D97706;
}

.status-info {
  background-color: #3B82F6;
  color: white;
  border: 2px solid #2563EB;
}

/* Accessible Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  margin-bottom: 0.5em;
}

p {
  line-height: 1.6;
  margin-bottom: 1em;
}

/* List Accessibility */
ul, ol {
  padding-left: 2em;
}

li {
  margin-bottom: 0.5em;
}

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

th, td {
  border: 1px solid #D1D5DB;
  padding: 12px;
  text-align: left;
}

th {
  background-color: #F3F4F6;
  font-weight: bold;
}

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

/* Responsive Text Scaling */
@media (max-width: 768px) {
  body {
    font-size: 18px;
    line-height: 1.6;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  h3 {
    font-size: 1.5rem;
  }
}
