/**
 * Accessibility Styles for iHelper
 * These styles enhance accessibility features across the website
 */

/* Skip Link Styles */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0056b3;
  color: white;
  padding: 8px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
  outline: 2px solid #ffffff;
}

/* Focus Styles */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[role="button"]:focus,
[tabindex]:focus {
  outline: 2px solid #0056b3;
  outline-offset: 2px;
}

/* Visually Hidden Elements (accessible to screen readers) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* High Contrast Focus Mode Support */
@media (forced-colors: active) {
  a:focus,
  button:focus,
  input:focus {
    outline: 3px solid currentColor;
  }
}

/* Improved Form Feedback */
input:invalid {
  border-color: #d93025;
}

.error-message {
  color: #d93025;
  font-size: 0.85rem;
  margin-top: 4px;
}

.success-message {
  color: #0f9d58;
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Accessible Mobile Menu */
.mobile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 100;
  width: 250px;
  padding: 1rem;
}

.mobile-menu:not([hidden]) {
  animation: fadeIn 0.3s ease-in-out;
}

.mobile-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav li {
  margin-bottom: 0.75rem;
}

.mobile-nav a {
  display: block;
  padding: 0.5rem;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.mobile-nav a:hover,
.mobile-nav a:focus {
  background-color: var(--accent-color);
  color: white;
  border-radius: 4px;
}

.mobile-nav a.active {
  font-weight: bold;
  color: var(--accent-color);
}

.mobile-nav a.active:hover,
.mobile-nav a.active:focus {
  color: white;
}

/* Accessible FAQ accordion styles */
.faq-question {
  cursor: pointer;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #1e1e1e;
  transition: background-color 0.3s ease;
}

.faq-question:focus {
  background-color: #2a2a2a;
  outline: 2px solid #0056b3;
  outline-offset: -2px;
}

.faq-question:hover {
  background-color: #2a2a2a;
}

.faq-question {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

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

.faq-question h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
}

/* Animation for FAQ panels */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-answer:not([hidden]) {
  max-height: 1000px;
  padding: 15px;
}

.faq-answer {
  padding: 0 1rem 1rem 1rem;
  margin-top: -0.5rem;
}

/* Reduced motion preference support */
@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .faq-answer {
    transition: none;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
