/* ─── Spectator Accessibility Styles ─────────────────────── */

/* ─── Skip Navigation ────────────────────────────────────── */
.skip-nav-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent-color, #3b82f6);
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  font-weight: 600;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  transition: top 0.2s ease;
}

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

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

/* ─── Focus Indicators ───────────────────────────────────── */
/* Only show focus outlines for keyboard navigation */
.using-mouse *:focus {
  outline: none;
}

.using-keyboard *:focus {
  outline: 3px solid var(--focus-color, #3b82f6);
  outline-offset: 2px;
  border-radius: 4px;
}

.using-keyboard [role="tab"]:focus {
  outline: 3px solid var(--focus-color, #3b82f6);
  outline-offset: -1px;
  background: rgba(59, 130, 246, 0.1);
}

/* ─── Tab Skeleton Loading ───────────────────────────────── */
.tab-skeleton {
  padding: 20px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-line {
  height: 16px;
  background: var(--skeleton-bg, #e5e7eb);
  border-radius: 4px;
  margin-bottom: 12px;
}

.skeleton-line-long { width: 100%; }
.skeleton-line-medium { width: 75%; }
.skeleton-line-short { width: 50%; }

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.skeleton-card {
  height: 120px;
  background: var(--skeleton-bg, #e5e7eb);
  border-radius: 8px;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Reduced Motion ─────────────────────────────────────── */
.reduced-motion * {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

.reduced-motion .skeleton-line,
.reduced-motion .skeleton-card {
  animation: none;
  opacity: 0.6;
}

.reduced-motion .milestone-toast,
.reduced-motion .comeback-alert,
.reduced-motion .notification-bell {
  animation: none !important;
}

/* ─── High Contrast Mode ─────────────────────────────────── */
.high-contrast {
  --bg-primary: #000000;
  --bg-secondary: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --border-color: #ffffff;
  --accent-color: #ffff00;
  --focus-color: #ffff00;
  --success-color: #00ff00;
  --warning-color: #ffff00;
  --error-color: #ff0000;
  --skeleton-bg: #333333;
}

.high-contrast body {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.high-contrast [role="tab"] {
  border: 2px solid var(--border-color);
}

.high-contrast [role="tab"][aria-selected="true"] {
  background: var(--accent-color);
  color: #000000;
  font-weight: 700;
}

.high-contrast .card,
.high-contrast .panel,
.high-contrast [role="tabpanel"] {
  border: 2px solid var(--border-color);
}

.high-contrast a {
  color: var(--accent-color);
  text-decoration: underline;
}

.high-contrast button {
  border: 2px solid var(--border-color);
}

/* ─── Dark Mode Skeleton ─────────────────────────────────── */
.dark .skeleton-line,
.dark .skeleton-card {
  background: #374151;
}

/* ─── Touch Target Sizes (mobile a11y) ───────────────────── */
@media (pointer: coarse) {
  [role="tab"],
  button,
  a,
  .clickable {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ─── Accessibility Toggle Buttons ───────────────────────── */
.a11y-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #d1d5db);
  background: var(--bg-secondary, #f3f4f6);
  color: var(--text-primary, #111827);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s, border-color 0.2s;
}

.a11y-toggle:hover {
  background: var(--accent-color, #3b82f6);
  color: white;
}

.a11y-toggle.active {
  background: var(--accent-color, #3b82f6);
  color: white;
  border-color: var(--accent-color, #3b82f6);
}

/* ─── Print Styles ───────────────────────────────────────── */
@media print {
  .skip-nav-link,
  .a11y-toggle,
  .notification-bell,
  .tab-skeleton {
    display: none;
  }
}
