/**
 * Accessibility Widget Styles - EAA Compliant
 */

/* 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-width: 0;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100000;
  font-weight: bold;
}

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

/* Accessibility Widget */
.a11y-widget {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.a11y-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  padding: 0;
}

.a11y-toggle:hover {
  transform: scale(1.08);
}

.a11y-toggle:focus {
  outline: 3px solid #fbbf24;
  outline-offset: 3px;
}

.a11y-toggle-inner {
  width: 40px;
  height: 40px;
  background: #2563eb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.25s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

.a11y-toggle:hover .a11y-toggle-inner {
  background: #1d4ed8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.a11y-toggle-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.a11y-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 320px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 20px;
  max-height: 500px;
  overflow-y: auto;
}

.a11y-panel[hidden] {
  display: none;
}

.a11y-panel h2 {
  margin: 0 0 20px 0;
  font-size: 1.25rem;
  color: #1f2937;
  font-weight: 600;
}

.a11y-control {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.a11y-control:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.a11y-control > label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #374151;
}

.a11y-control input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.a11y-font-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.a11y-font-controls button {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.a11y-font-controls button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.a11y-font-controls button:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.a11y-font-size {
  min-width: 50px;
  text-align: center;
  font-weight: 600;
  color: #1f2937;
}

.a11y-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  border-radius: 4px;
  transition: all 0.2s;
}

.a11y-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.a11y-close:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Accessibility Preferences Applied */

/* High Contrast Mode */
body.a11y-high-contrast {
  background: #000 !important;
  color: #fff !important;
}

body.a11y-high-contrast * {
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

body.a11y-high-contrast a {
  color: #ffff00 !important;
  text-decoration: underline !important;
}

body.a11y-high-contrast button,
body.a11y-high-contrast input,
body.a11y-high-contrast select,
body.a11y-high-contrast textarea {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
}

body.a11y-high-contrast .a11y-widget,
body.a11y-high-contrast .a11y-panel,
body.a11y-high-contrast .cookie-banner,
body.a11y-high-contrast .cookie-modal-content {
  background: #000 !important;
  color: #fff !important;
}

/* Highlight Links */
body.a11y-highlight-links a {
  background: #ffff00 !important;
  color: #000 !important;
  padding: 2px 4px !important;
  border-radius: 2px !important;
  font-weight: bold !important;
}

/* Readable Font */
body.a11y-readable-font,
body.a11y-readable-font * {
  font-family: Arial, Helvetica, sans-serif !important;
}

/* Text Spacing */
body.a11y-text-spacing * {
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}

/* Line Height */
body.a11y-line-height * {
  line-height: 2 !important;
}

/* Keyboard Navigation Highlights */
body.a11y-keyboard-nav *:focus {
  outline: 3px solid #fbbf24 !important;
  outline-offset: 3px !important;
}

body.a11y-keyboard-nav a:focus,
body.a11y-keyboard-nav button:focus,
body.a11y-keyboard-nav input:focus,
body.a11y-keyboard-nav select:focus,
body.a11y-keyboard-nav textarea:focus {
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.5) !important;
}

/* Focus visible for keyboard users only */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Ensure sufficient color contrast */
@media (prefers-contrast: high) {
  body {
    background: #000;
    color: #fff;
  }
  
  a {
    color: #ffff00;
  }
}

/* Respect reduced motion preferences */
@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;
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .a11y-widget {
    bottom: 70px;
    right: 10px;
  }
  
  .a11y-panel {
    width: calc(100vw - 40px);
    right: -10px;
  }
  
  .a11y-toggle {
    width: 48px;
    height: 48px;
  }
}
