/* ============================================
   ACCESSIBILITY PANEL STYLES
   ============================================ */

/* Overlay */
.a11y-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.a11y-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Panel */
.a11y-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  background: var(--color-bg);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.a11y-panel.active {
  right: 0;
}

.a11y-panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Header */
.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

.a11y-panel-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

.a11y-panel-title svg {
  color: var(--color-primary);
}

.a11y-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.a11y-panel-close:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.a11y-panel-close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Body */
.a11y-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Section */
.a11y-section {
  margin-bottom: 2rem;
}

.a11y-section:last-child {
  margin-bottom: 0;
}

.a11y-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.a11y-section-title svg {
  color: var(--color-primary);
}

/* Control */
.a11y-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.a11y-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

/* Slider */
.a11y-slider-wrapper {
  width: 100%;
}

.a11y-slider {
  width: 100%;
  height: 6px;
  background: var(--color-bg-tertiary);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.a11y-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.a11y-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.a11y-slider:hover::-webkit-slider-thumb,
.a11y-slider:focus::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 0 0 8px rgba(var(--color-primary-rgb), 0.1);
}

.a11y-slider:hover::-moz-range-thumb,
.a11y-slider:focus::-moz-range-thumb {
  transform: scale(1.1);
  box-shadow: 0 0 0 8px rgba(var(--color-primary-rgb), 0.1);
}

.a11y-slider:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.a11y-slider-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.a11y-slider-value {
  font-weight: 600;
  color: var(--color-primary);
}

/* Toggle */
.a11y-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.a11y-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.a11y-toggle-track {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  background: var(--color-bg-tertiary);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  transition: all 0.2s ease;
  margin-top: 2px;
}

.a11y-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.a11y-toggle input:checked + .a11y-toggle-track {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.a11y-toggle input:checked + .a11y-toggle-track .a11y-toggle-thumb {
  left: 22px;
}

.a11y-toggle input:focus-visible + .a11y-toggle-track {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.a11y-toggle:hover .a11y-toggle-track {
  border-color: var(--color-border-strong);
}

.a11y-toggle-label {
  flex: 1;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Footer */
.a11y-panel-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

.a11y-panel-footer .btn {
  flex: 1;
}

/* ============================================
   ACCESSIBILITY MODES
   ============================================ */

/* High Contrast Mode - Light Theme */
body[data-a11y-contrast="true"] {
  /* Text colors */
  --color-text: #000000;
  --color-text-muted: #1a1a1a;
  --color-text-light: #333333;
  --color-text-inverse: #ffffff;
  --color-text-link: #0052a3;
  --color-text-link-hover: #003d7a;
  
  /* Background colors */
  --color-bg: #ffffff;
  --color-bg-secondary: #f5f5f5;
  --color-bg-tertiary: #e8e8e8;
  --color-bg-card: #ffffff;
  --color-bg-inverse: #000000;
  --color-bg-hover: rgba(0, 0, 0, 0.08);
  --color-bg-active: rgba(0, 0, 0, 0.16);
  
  /* Border colors */
  --color-border: #000000;
  --color-border-strong: #000000;
  --color-border-light: #666666;
  --color-border-focus: #0052a3;
  
  /* Primary colors */
  --color-primary: #0052a3;
  --color-primary-hover: #003d7a;
  --color-primary-active: #002851;
  
  /* Status colors */
  --color-error: #b71c1c;
  --color-warning: #f57c00;
  --color-success: #2e7d32;
  --color-info: #1976d2;
}

body[data-theme="dark"][data-a11y-contrast="true"] {
  /* Text colors */
  --color-text: #ffffff;
  --color-text-muted: #cccccc;
  --color-text-light: #b3b3b3;
  --color-text-inverse: #000000;
  --color-text-link: #00d4ff;
  --color-text-link-hover: #00b8e0;
  
  /* Background colors */
  --color-bg: #000000;
  --color-bg-secondary: #0a0a0a;
  --color-bg-tertiary: #1a1a1a;
  --color-bg-card: #0a0a0a;
  --color-bg-inverse: #ffffff;
  --color-bg-hover: rgba(255, 255, 255, 0.1);
  --color-bg-active: rgba(255, 255, 255, 0.2);
  
  /* Border colors */
  --color-border: #666666;
  --color-border-strong: #999999;
  --color-border-light: #444444;
  --color-border-focus: #00d4ff;
  
  /* Primary colors */
  --color-primary: #00d4ff;
  --color-primary-hover: #00b8e0;
  --color-primary-active: #009cc4;
  --color-primary-glow: rgba(0, 212, 255, 0.4);
  
  /* Secondary colors */
  --color-secondary: #ff00aa;
  --color-secondary-hover: #e0009a;
  --color-secondary-active: #c4008a;
  
  /* Status colors */
  --color-error: #ff6b78;
  --color-warning: #ffb833;
  --color-success: #4ade80;
  --color-info: #60a5fa;
}

/* Reduced Motion */
body[data-a11y-motion="reduced"] *,
body[data-a11y-motion="reduced"] *::before,
body[data-a11y-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Enhanced Focus */
body[data-a11y-focus="enhanced"] *:focus-visible {
  outline: 4px solid var(--color-primary) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 8px rgba(var(--color-primary-rgb), 0.2) !important;
}

/* Dyslexia Font */
body[data-a11y-font="dyslexia"] {
  font-family: 'OpenDyslexic', 'Comic Sans MS', 'Arial', sans-serif;
}

/* Screen Reader Optimizations */
body[data-a11y-screen-reader="true"] .decorative-element {
  display: none !important;
}

/* Hide decorative SVGs and icons, but keep functional ones */
body[data-a11y-screen-reader="true"] svg[aria-hidden="true"] {
  /* Keep them visible but ensure they don't interfere with screen readers */
  /* We don't hide them because they may be part of functional buttons */
}

body[data-a11y-screen-reader="true"] *:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .a11y-panel {
    max-width: 100%;
    right: -100%;
  }
  
  .a11y-panel-header,
  .a11y-panel-body,
  .a11y-panel-footer {
    padding: 1rem;
  }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
  .a11y-panel,
  .a11y-overlay {
    display: none !important;
  }
}
