/* PrismaOS Accessibility Enhancements */

/* High Contrast Mode */
.high-contrast {
  background-color: var(--high-contrast-bg) !important;
  color: var(--high-contrast-text) !important;
}

.high-contrast .navbar,
.high-contrast .bg-primary,
.high-contrast .bg-dark {
  background-color: var(--high-contrast-bg) !important;
  border-color: var(--high-contrast-text) !important;
}

.high-contrast .navbar-brand,
.high-contrast .nav-link,
.high-contrast h1,
.high-contrast h2,
.high-contrast h3,
.high-contrast h4,
.high-contrast h5,
.high-contrast h6 {
  color: var(--high-contrast-text) !important;
}

.high-contrast .btn-primary {
  background-color: var(--high-contrast-primary) !important;
  border-color: var(--high-contrast-primary) !important;
  color: var(--high-contrast-bg) !important;
}

.high-contrast .btn-outline-primary {
  border-color: var(--high-contrast-primary) !important;
  color: var(--high-contrast-primary) !important;
}

.high-contrast .btn-outline-primary:hover {
  background-color: var(--high-contrast-primary) !important;
  color: var(--high-contrast-bg) !important;
}

.high-contrast .card,
.high-contrast .border {
  border-color: var(--high-contrast-text) !important;
  background-color: var(--high-contrast-bg) !important;
}

.high-contrast .text-muted {
  color: var(--high-contrast-secondary) !important;
}

.high-contrast .bg-light {
  background-color: #333333 !important;
}

.high-contrast .form-control,
.high-contrast .form-select {
  background-color: var(--high-contrast-bg) !important;
  border-color: var(--high-contrast-text) !important;
  color: var(--high-contrast-text) !important;
}

.high-contrast .form-control:focus,
.high-contrast .form-select:focus {
  border-color: var(--high-contrast-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 0, 0.25) !important;
}

/* Large Text Mode */
.large-text {
  font-size: 1.25rem !important;
}

.large-text h1 {
  font-size: 3rem !important;
}

.large-text h2 {
  font-size: 2.5rem !important;
}

.large-text h3 {
  font-size: 2rem !important;
}

.large-text h4 {
  font-size: 1.75rem !important;
}

.large-text h5 {
  font-size: 1.5rem !important;
}

.large-text h6 {
  font-size: 1.25rem !important;
}

.large-text .btn {
  font-size: 1.25rem !important;
  padding: 1rem 2rem !important;
}

.large-text .navbar-brand {
  font-size: 2rem !important;
}

.large-text .nav-link {
  font-size: 1.25rem !important;
}

/* Extra Large Text Mode */
.xl-text {
  font-size: 1.5rem !important;
}

.xl-text h1 {
  font-size: 4rem !important;
}

.xl-text h2 {
  font-size: 3.5rem !important;
}

.xl-text h3 {
  font-size: 3rem !important;
}

.xl-text h4 {
  font-size: 2.5rem !important;
}

.xl-text h5 {
  font-size: 2rem !important;
}

.xl-text h6 {
  font-size: 1.75rem !important;
}

.xl-text .btn {
  font-size: 1.5rem !important;
  padding: 1.25rem 2.5rem !important;
}

.xl-text .navbar-brand {
  font-size: 2.5rem !important;
}

.xl-text .nav-link {
  font-size: 1.5rem !important;
}

/* Reduced Motion */
.reduce-motion * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Enhanced Focus Indicators */
.enhanced-focus *:focus {
  outline: 3px solid var(--primary-color) !important;
  outline-offset: 3px !important;
  border-radius: var(--border-radius) !important;
}

.enhanced-focus .btn:focus {
  outline: 3px solid #ffffff !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 6px var(--primary-color) !important;
}

/* Screen Reader Only Content */
.sr-only {
  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:active,
.sr-only-focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* Keyboard Navigation Enhancements */
.keyboard-nav {
  position: relative;
}

.keyboard-nav:focus-within::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border: 2px solid var(--primary-color);
  border-radius: calc(var(--border-radius) + 3px);
  pointer-events: none;
}

/* Touch Target Enhancements */
.touch-friendly .btn,
.touch-friendly .nav-link,
.touch-friendly .form-control,
.touch-friendly .form-select {
  min-height: 44px !important;
  min-width: 44px !important;
}

/* Link Styling for Better Accessibility */
a:not(.btn):not(.nav-link) {
  color: var(--primary-color);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 2px;
}

a:not(.btn):not(.nav-link):hover,
a:not(.btn):not(.nav-link):focus {
  color: #0056b3;
  text-decoration-thickness: 3px;
}

a:not(.btn):not(.nav-link):focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Skip to Content Enhancements */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--border-radius);
  z-index: 1000;
  font-weight: bold;
}

.skip-to-content:focus {
  top: 6px;
}

/* Form Error Enhancements */
.form-control.is-invalid {
  border-color: var(--danger-color) !important;
  border-width: 2px !important;
}

.form-control.is-invalid:focus {
  border-color: var(--danger-color) !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.invalid-feedback {
  display: block !important;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Loading State Accessibility */
.loading[aria-busy="true"] {
  position: relative;
}

.loading[aria-busy="true"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 10;
}

.loading[aria-busy="true"]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid var(--primary-color);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  z-index: 11;
}

/* Alert Enhancements */
.alert {
  border-width: 2px !important;
  font-weight: 500;
}

.alert-success {
  border-left: 5px solid var(--success-color) !important;
}

.alert-warning {
  border-left: 5px solid var(--warning-color) !important;
}

.alert-danger {
  border-left: 5px solid var(--danger-color) !important;
}

.alert-info {
  border-left: 5px solid var(--info-color) !important;
}

/* Table Accessibility */
.table th {
  font-weight: 600 !important;
  background-color: var(--light-color) !important;
}

.table-responsive {
  border: 1px solid #dee2e6;
  border-radius: var(--border-radius);
}

/* Modal Accessibility */
.modal-header {
  border-bottom: 2px solid #dee2e6 !important;
}

.modal-footer {
  border-top: 2px solid #dee2e6 !important;
}

/* Carousel Accessibility */
.carousel-control-prev,
.carousel-control-next {
  width: 5% !important;
  background-color: rgba(0, 0, 0, 0.3) !important;
  border-radius: var(--border-radius) !important;
}

.carousel-control-prev:focus,
.carousel-control-next:focus {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: 2px !important;
}

/* Progress Bar Accessibility */
.progress {
  height: 1.5rem !important;
  border-radius: var(--border-radius) !important;
  background-color: #e9ecef !important;
  border: 1px solid #dee2e6 !important;
}

.progress-bar {
  font-weight: 600 !important;
  text-align: center !important;
  line-height: 1.3rem !important;
}

/* Tooltip Enhancements */
.tooltip {
  font-size: 0.875rem !important;
  font-weight: 500 !important;
}

/* Badge Accessibility */
.badge {
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  padding: 0.35em 0.65em !important;
}

/* List Group Accessibility */
.list-group-item {
  border-width: 1px !important;
  padding: 1rem !important;
}

.list-group-item:focus {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: -2px !important;
}

/* Card Accessibility */
.card {
  border-width: 1px !important;
}

.card-header {
  font-weight: 600 !important;
  background-color: var(--light-color) !important;
  border-bottom: 1px solid #dee2e6 !important;
}

/* Responsive Text Sizing for Accessibility */
@media (max-width: 576px) {
  .mobile-text-adjust {
    font-size: 1.1rem !important;
  }
  
  .mobile-text-adjust h1 {
    font-size: 2rem !important;
  }
  
  .mobile-text-adjust h2 {
    font-size: 1.75rem !important;
  }
  
  .mobile-text-adjust h3 {
    font-size: 1.5rem !important;
  }
  
  .mobile-text-adjust h4 {
    font-size: 1.25rem !important;
  }
  
  .mobile-text-adjust .btn {
    padding: 0.75rem 1.5rem !important;
    font-size: 1rem !important;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .auto-dark-mode {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
  }
  
  .auto-dark-mode .bg-light {
    background-color: #2d2d2d !important;
  }
  
  .auto-dark-mode .card,
  .auto-dark-mode .border {
    background-color: #2d2d2d !important;
    border-color: #404040 !important;
  }
  
  .auto-dark-mode .text-muted {
    color: #cccccc !important;
  }
}

/* Print Accessibility */
@media print {
  /* Ensure sufficient contrast for printing */
  .text-primary {
    color: #000000 !important;
  }
  
  .bg-primary {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
  }
  
  /* Show URLs for links */
  a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666666;
  }
  
  a[href^="#"]::after {
    content: none;
  }
  
  /* Ensure page breaks don't split important content */
  .card,
  .timeline-item,
  .feature-card {
    page-break-inside: avoid;
  }
}

/* Windows High Contrast Mode Support */
@media screen and (-ms-high-contrast: active) {
  .btn {
    border: 2px solid !important;
  }
  
  .card,
  .border {
    border: 2px solid !important;
  }
  
  .form-control,
  .form-select {
    border: 2px solid !important;
  }
}

/* Animation Control for Vestibular Sensitivity */
@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 {
    transition: none !important;
  }
  
  .fade {
    transition: none !important;
  }
  
  .collapse {
    transition: none !important;
  }
}

/* Contrast Adjustment for Color Blindness */
.deuteranopia-friendly .text-success {
  color: #0066cc !important;
}

.deuteranopia-friendly .text-danger {
  color: #cc0000 !important;
}

.deuteranopia-friendly .bg-success {
  background-color: #0066cc !important;
}

.deuteranopia-friendly .bg-danger {
  background-color: #cc0000 !important;
}

.protanopia-friendly .text-success {
  color: #0099cc !important;
}

.protanopia-friendly .text-danger {
  color: #990000 !important;
}

.protanopia-friendly .bg-success {
  background-color: #0099cc !important;
}

.protanopia-friendly .bg-danger {
  background-color: #990000 !important;
}
