/**
 * Reduced Motion Support
 * Respects user's motion preferences for accessibility
 */

@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;
  }

  /* Disable specific animations */
  .animate-spin,
  .animate-pulse,
  .animate-bounce,
  .animate-fade-in,
  .animate-slide-up {
    animation: none !important;
  }

  /* Keep essential transitions but make them instant */
  button,
  a,
  input,
  select,
  textarea {
    transition-duration: 0.01ms !important;
  }

  /* Disable transform animations */
  [class*="hover:scale"],
  [class*="hover:rotate"],
  [class*="hover:translate"] {
    transform: none !important;
  }

  /* Keep opacity transitions for visibility but make instant */
  [class*="opacity"],
  [class*="fade"] {
    transition-property: opacity !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  /* Increase border visibility */
  .border,
  [class*="border-"] {
    border-width: 2px !important;
  }

  /* Ensure focus indicators are visible */
  *:focus,
  *:focus-visible {
    outline: 3px solid currentColor !important;
    outline-offset: 2px !important;
  }

  /* Increase text contrast */
  .text-gray-600 {
    color: #374151 !important;
  }

  .dark .text-gray-400 {
    color: #d1d5db !important;
  }
}

/* Focus visible styles for keyboard navigation */
*:focus-visible {
  outline: 2px solid #FF6600;
  outline-offset: 2px;
}

/* Skip link styles */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #FF6600;
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  transition: top 0.2s;
}

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

/* Text overflow utilities */
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Word break for long text */
.break-word {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Minimum touch target size */
.touch-target {
  min-width: 44px;
  min-height: 44px;
}

/* Loading skeleton animation */
@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton-loader > * {
  background: linear-gradient(
    90deg,
    #f0f0f0 0px,
    #e0e0e0 40px,
    #f0f0f0 80px
  );
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

.dark .skeleton-loader > * {
  background: linear-gradient(
    90deg,
    #374151 0px,
    #4b5563 40px,
    #374151 80px
  );
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-loader > * {
    animation: none;
    background: #f0f0f0;
  }
  
  .dark .skeleton-loader > * {
    background: #374151;
  }
}
