/* ODE Meet Accessibility Styles
 * WCAG 2.1 AA compliant accessibility enhancements
 */

/* ===== Screen Reader Only ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:focus,
.sr-only-focusable:active {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ===== Skip Links ===== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary, #005fcc);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 0.5rem 0.5rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 10000;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-focus, #ffdd00);
  outline-offset: 2px;
}

/* ===== Focus Indicators ===== */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--color-focus, #005fcc);
  outline-offset: 2px;
}

.focus-ring:focus,
[data-focus-visible]:focus {
  outline: 3px solid var(--color-focus, #005fcc);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(0, 95, 204, 0.2);
}

/* Enhanced focus for high contrast mode */
.theme-high-contrast-light :focus-visible,
.theme-high-contrast-dark :focus-visible {
  outline: 4px solid;
  outline-offset: 3px;
}

.theme-high-contrast-light :focus-visible {
  outline-color: #000;
  box-shadow: 0 0 0 8px #fff, 0 0 0 10px #000;
}

.theme-high-contrast-dark :focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 8px #000, 0 0 0 10px #fff;
}

/* ===== High Contrast Mode ===== */
.theme-high-contrast-light {
  --color-bg: #fff;
  --color-text: #000;
  --color-primary: #000;
  --color-secondary: #333;
  --color-border: #000;
  --color-focus: #000;
  --color-link: #0000ee;
  --color-link-visited: #551a8b;
  --color-success: #006400;
  --color-error: #8b0000;
  --color-warning: #8b4513;
}

.theme-high-contrast-dark {
  --color-bg: #000;
  --color-text: #fff;
  --color-primary: #fff;
  --color-secondary: #ccc;
  --color-border: #fff;
  --color-focus: #ffff00;
  --color-link: #00ffff;
  --color-link-visited: #ff00ff;
  --color-success: #00ff00;
  --color-error: #ff0000;
  --color-warning: #ffff00;
}

.theme-high-contrast-light,
.theme-high-contrast-dark {
  font-weight: 500;
}

.theme-high-contrast-light *,
.theme-high-contrast-dark * {
  border-color: var(--color-border) !important;
}

/* ===== Large Click Targets ===== */
.a11y-large-targets button,
.a11y-large-targets [role="button"],
.a11y-large-targets a,
.a11y-large-targets input[type="checkbox"],
.a11y-large-targets input[type="radio"],
.a11y-large-targets select {
  min-width: 48px;
  min-height: 48px;
}

.a11y-extra-large-targets button,
.a11y-extra-large-targets [role="button"],
.a11y-extra-large-targets a {
  min-width: 64px;
  min-height: 64px;
  padding: 1rem 1.5rem;
}

/* ===== Reduced Motion ===== */
@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;
  }
}

.a11y-reduce-motion *,
.a11y-reduce-motion *::before,
.a11y-reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ===== Text Scaling ===== */
.a11y-text-small { font-size: 87.5%; }
.a11y-text-normal { font-size: 100%; }
.a11y-text-large { font-size: 125%; }
.a11y-text-xlarge { font-size: 150%; }
.a11y-text-xxlarge { font-size: 200%; }

/* ===== Zoom Support ===== */
.a11y-zoom-container {
  transform-origin: top left;
  width: 100%;
  height: 100%;
}

/* Ensure content is visible at 200%+ zoom */
@media screen and (min-resolution: 192dpi) {
  body {
    overflow-x: hidden;
  }
}

/* ===== Caption Styles ===== */
.captions-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  z-index: 1000;
  pointer-events: none;
}

.captions-container.position-top { top: 5%; }
.captions-container.position-bottom { bottom: 10%; }
.captions-container.position-top-left { top: 5%; left: 5%; transform: none; }
.captions-container.position-top-right { top: 5%; right: 5%; left: auto; transform: none; }
.captions-container.position-bottom-left { bottom: 10%; left: 5%; transform: none; }
.captions-container.position-bottom-right { bottom: 10%; right: 5%; left: auto; transform: none; }

.caption-line {
  display: block;
  padding: 0.5rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 4px;
  text-align: center;
}

.caption-speaker {
  font-weight: 600;
  margin-right: 0.5rem;
}

/* Default caption style */
.caption-line {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 24px;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.75);
}

/* High contrast captions */
.captions-high-contrast .caption-line {
  font-size: 28px;
  font-weight: 700;
  color: #ffff00;
  background-color: #000;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

/* ===== Sign Language Window ===== */
.sign-language-window {
  position: fixed;
  z-index: 999;
  border: 2px solid var(--color-border, #333);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  resize: both;
}

.sign-language-window.position-top-left { top: 1rem; left: 1rem; }
.sign-language-window.position-top-right { top: 1rem; right: 1rem; }
.sign-language-window.position-bottom-left { bottom: 1rem; left: 1rem; }
.sign-language-window.position-bottom-right { bottom: 1rem; right: 1rem; }

.sign-language-window.size-small { width: 15%; aspect-ratio: 16/9; }
.sign-language-window.size-medium { width: 25%; aspect-ratio: 16/9; }
.sign-language-window.size-large { width: 35%; aspect-ratio: 16/9; }

.sign-language-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
}

/* ===== Visual Alerts ===== */
.visual-alert-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
}

.visual-alert-overlay.active {
  animation: flash-alert 0.2s ease-in-out;
}

@keyframes flash-alert {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.3; }
}

.visual-alert-overlay.alert-info { background-color: #005fcc; }
.visual-alert-overlay.alert-success { background-color: #22c55e; }
.visual-alert-overlay.alert-warning { background-color: #f59e0b; }
.visual-alert-overlay.alert-error { background-color: #ef4444; }

.visual-alert-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  background: var(--color-bg-elevated, #1e1e2e);
  color: var(--color-text, #fff);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 10000;
  animation: slide-in-toast 0.3s ease-out;
}

@keyframes slide-in-toast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.visual-alert-toast .alert-icon {
  font-size: 1.5rem;
}

/* ===== Keyboard Shortcuts Panel ===== */
.keyboard-shortcuts-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--color-bg-elevated, #1e1e2e);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 10001;
  padding: 1.5rem;
}

.shortcuts-category {
  margin-bottom: 1.5rem;
}

.shortcuts-category h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #888);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border, #333);
  padding-bottom: 0.5rem;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.shortcut-description {
  color: var(--color-text, #fff);
}

.shortcut-keys {
  display: flex;
  gap: 0.25rem;
}

.shortcut-key {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--color-bg, #111);
  border: 1px solid var(--color-border, #333);
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.875rem;
  min-width: 1.5rem;
  text-align: center;
}

/* ===== Simple Mode ===== */
.a11y-simple-mode .panel-secondary,
.a11y-simple-mode .feature-advanced,
.a11y-simple-mode .toolbar-secondary,
.a11y-simple-mode .decoration {
  display: none !important;
}

.a11y-simple-mode .toolbar-primary {
  justify-content: center;
  gap: 2rem;
}

.a11y-simple-mode .btn {
  min-width: 80px;
  font-size: 1.125rem;
}

.a11y-simple-mode .btn-icon {
  font-size: 1.5rem;
}

/* ===== Voice Command Indicator ===== */
.voice-command-indicator {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: var(--color-primary, #005fcc);
  color: #fff;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.voice-command-indicator .mic-icon {
  animation: pulse-mic 1s ease-in-out infinite;
}

@keyframes pulse-mic {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.voice-command-transcript {
  font-style: italic;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Switch Control Highlight ===== */
.switch-control-highlight {
  outline: 4px solid var(--color-focus, #005fcc) !important;
  outline-offset: 4px;
  box-shadow: 0 0 0 8px rgba(0, 95, 204, 0.3);
}

.switch-control-group-highlight {
  background: rgba(0, 95, 204, 0.1);
  border-radius: 8px;
}

/* ===== Live Regions ===== */
.a11y-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ===== Focus Trap Overlay ===== */
.focus-trap-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
}

/* ===== Transcript Panel ===== */
.transcript-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 350px;
  background: var(--color-bg-elevated, #1e1e2e);
  border-left: 1px solid var(--color-border, #333);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.transcript-header {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border, #333);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.transcript-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.transcript-entry {
  margin-bottom: 1rem;
}

.transcript-speaker {
  font-weight: 600;
  color: var(--color-primary, #005fcc);
}

.transcript-timestamp {
  font-size: 0.75rem;
  color: var(--color-text-muted, #888);
  margin-left: 0.5rem;
}

.transcript-text {
  margin-top: 0.25rem;
  line-height: 1.5;
}

/* ===== Progress Indicators ===== */
.a11y-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.a11y-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--color-bg, #333);
  border-radius: 4px;
  overflow: hidden;
}

.a11y-progress-fill {
  height: 100%;
  background: var(--color-primary, #005fcc);
  transition: width 0.3s ease;
}

.a11y-progress-label {
  min-width: 3rem;
  text-align: right;
  font-weight: 600;
}

/* ===== Spacious UI Density ===== */
.a11y-density-spacious .panel {
  padding: 1.5rem;
}

.a11y-density-spacious .btn {
  padding: 1rem 2rem;
}

.a11y-density-spacious .form-field {
  margin-bottom: 1.5rem;
}

.a11y-density-spacious .list-item {
  padding: 1rem;
  margin-bottom: 0.5rem;
}

/* ===== Compact UI Density ===== */
.a11y-density-compact .panel {
  padding: 0.5rem;
}

.a11y-density-compact .btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
}

.a11y-density-compact .form-field {
  margin-bottom: 0.5rem;
}

/* ===== Color Blind Friendly ===== */
.a11y-colorblind .status-success {
  background: #005fcc;
  border-left: 4px solid #005fcc;
}

.a11y-colorblind .status-error {
  background: #8b4513;
  border-left: 4px solid #8b4513;
}

.a11y-colorblind .status-warning {
  background: #4b0082;
  border-left: 4px solid #4b0082;
}

/* Add patterns for differentiation */
.a11y-colorblind .chart-series-1 { background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect fill="%23005fcc" width="4" height="4"/></svg>'); }
.a11y-colorblind .chart-series-2 { background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><path d="M0,0 L4,4 M4,0 L0,4" stroke="%238b4513" stroke-width="1"/></svg>'); }
.a11y-colorblind .chart-series-3 { background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><circle cx="2" cy="2" r="1" fill="%234b0082"/></svg>'); }

/* ===== Inverted Colors ===== */
.theme-inverted {
  filter: invert(1) hue-rotate(180deg);
}

.theme-inverted img,
.theme-inverted video,
.theme-inverted canvas {
  filter: invert(1) hue-rotate(180deg);
}

/* ===== Hand Raise Queue ===== */
.hand-raise-queue {
  position: fixed;
  top: 80px;
  right: 1rem;
  background: var(--color-bg-elevated, #1e1e2e);
  border-radius: 8px;
  padding: 1rem;
  min-width: 200px;
  z-index: 100;
}

.hand-raise-queue h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hand-raise-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 4px;
}

.hand-raise-item:hover {
  background: var(--color-bg-hover, #2a2a3e);
}

.hand-raise-position {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 600;
  color: var(--color-text-muted, #888);
}

/* ===== Print Styles for Transcript ===== */
@media print {
  .transcript-panel {
    position: static;
    width: 100%;
    border: none;
  }

  .meeting-room,
  .controls,
  .video-grid {
    display: none;
  }

  .transcript-entry {
    page-break-inside: avoid;
  }
}
