/* ===================================
   Accessibility Styles for Bitmessa API Documentation
   WCAG 2.1 AA Compliant
   =================================== */

/* Skip Link - Hidden until focused */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  z-index: 1000;
  transition: top 0.3s ease;
  border-radius: 0 0 var(--radius-md) 0;
  text-decoration: none;
  font-weight: var(--font-medium);
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--accent-color);
}

/* Keyboard Focus Styles */
.keyboard-user :focus {
  outline: 3px solid var(--accent-color) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5) !important;
}

/* High Contrast Mode */
.high-contrast {
  --primary-color: #0052cc;
  --primary-dark: #003d99;
  --primary-light: #e6f0ff;
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-muted: #555555;
  --text-inverse: #ffffff;
  --bg-primary: #ffffff;
  --bg-secondary: #f0f0f0;
  --bg-tertiary: #e0e0e0;
  --border-light: #000000;
  --border-medium: #333333;
  --border-dark: #555555;
  --success-color: #006600;
  --warning-color: #cc6600;
  --error-color: #cc0000;
  --info-color: #0052cc;
}

[data-theme="dark"].high-contrast {
  --primary-color: #4d9fff;
  --primary-dark: #80bfff;
  --primary-light: #003d99;
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted: #c0c0c0;
  --text-inverse: #000000;
  --bg-primary: #000000;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #333333;
  --border-light: #ffffff;
  --border-medium: #e0e0e0;
  --border-dark: #c0c0c0;
  --success-color: #00cc00;
  --warning-color: #ffaa00;
  --error-color: #ff4444;
  --info-color: #4d9fff;
}

/* Language Selector Styles */
.language-selector {
  position: relative;
  margin-right: 16px;
}

.lang-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.lang-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  min-width: 150px;
  z-index: 100;
  display: none;
  margin-top: 4px;
}

.lang-dropdown.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

.lang-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-option:hover {
  background: var(--bg-tertiary);
}

.lang-option.active {
  background: var(--primary-light);
  color: var(--primary-color);
  font-weight: var(--font-medium);
}

/* RTL Support */
[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

[dir="rtl"] .lang-option {
  text-align: right;
}

/* Contrast Toggle */
.contrast-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.contrast-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Accessible Animations */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 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 for Interactive Elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
}

/* Improved Form Controls for Accessibility */
input, select, textarea {
  font-size: 16px; /* Prevents zoom on iOS */
}

/* Accessible Table Styles */
table {
  border-collapse: collapse;
  width: 100%;
}

th {
  text-align: left;
}

[dir="rtl"] th {
  text-align: right;
}

th, td {
  padding: 12px;
}

/* Accessible Color Combinations */
.method-get {
  background: #0070f3 !important; /* Higher contrast blue */
  color: white !important;
}

.method-post {
  background: #0ca678 !important; /* Higher contrast green */
  color: white !important;
}

.method-put {
  background: #f59f00 !important; /* Higher contrast yellow */
  color: black !important;
}

.method-delete {
  background: #e03131 !important; /* Higher contrast red */
  color: white !important;
}

.method-patch {
  background: #7048e8 !important; /* Higher contrast purple */
  color: white !important;
}

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

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive Font Size for Better Readability */
@media (max-width: 768px) {
  :root {
    --text-base: 1.05rem;
  }
}
