/* ===========================
   ACCESSIBILITY IMPROVEMENTS
   =========================== */

/* 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: white;
  padding: 12px 24px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #06b6d4;
  outline-offset: 2px;
}

/* Enhanced Focus Styles */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #06b6d4;
  outline-offset: 2px;
}

/* Focus visible for keyboard navigation only */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #06b6d4;
  outline-offset: 2px;
}

/* Improve button accessibility */
button {
  cursor: pointer;
  font-size: 1rem;
  min-height: 44px;
  min-width: 44px;
}

/* Code snippet improvements */
.code-snippet {
  position: relative;
}

.code-snippet pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 400px;
}

.code-snippet code {
  font-family: 'Courier New', monospace;
  line-height: 1.6;
  font-size: 0.875rem;
}

/* Enhanced heading hierarchy */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* Improve link contrast and styling */
a {
  text-decoration: underline;
  color: #06b6d4;
  transition: color 0.2s ease;
}

a:hover {
  color: #0891b2;
  text-decoration: none;
}

a:visited {
  color: #8b5cf6;
}

/* Navigation accessibility */
nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav li {
  list-style: none;
}

/* Form improvements */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  padding: 12px;
  border: 2px solid #333;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  min-height: 44px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #06b6d4;
  background-color: rgba(6, 182, 212, 0.05);
}

/* Improve text contrast in dark mode */
body.dark-mode {
  color: #e5e7eb;
  background-color: #0a0a0a;
}

body.dark-mode p {
  color: #d1d5db;
  line-height: 1.6;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  button,
  a,
  input {
    border-width: 2px;
  }
  
  body {
    color: #000;
    background-color: #fff;
  }
}

/* Component card accessibility */
.component-card {
  padding: 1.5rem;
  border: 1px solid #333;
  border-radius: 12px;
  background: #1a1a1a;
  transition: all 0.3s ease;
}

.component-card:focus-within {
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

/* Button styling for better accessibility */
.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

/* Icon accessibility */
.fa-solid[aria-hidden="true"],
.fa-regular[aria-hidden="true"],
.fab[aria-hidden="true"] {
  margin-right: 0.25rem;
}

/* Improve sidebar navigation keyboard access */
.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.sidebar-nav a:hover {
  background-color: rgba(6, 182, 212, 0.1);
  text-decoration: none;
}

.sidebar-nav a:focus-visible {
  outline: 2px solid #06b6d4;
  outline-offset: -2px;
}

/* Improve copy toast accessibility */
.copy-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  background-color: #10b981;
  color: white;
  border-radius: 8px;
  z-index: 1000;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

/* Ensure charts are properly structured */
.chart-card {
  padding: 1.5rem;
  background: #1a1a1a;
  border-radius: 12px;
  border: 1px solid #333;
  margin: 1rem 0;
}

/* SVG improvements for accessibility */
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Video and media accessibility */
@media (prefers-reduced-motion: reduce) {
  svg {
    animation: none !important;
  }
}

/* Print styles for accessibility */
@media print {
  .skip-link,
  .sidebar-backdrop,
  .menu-toggle,
  .theme-toggle,
  .copy-toast,
  .card-actions {
    display: none !important;
  }
  
  .component-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  .code-snippet {
    display: block;
  }
}

/* Mobile/Touch accessibility improvements */
@media (max-width: 768px) {
  button,
  a,
  input {
    min-height: 48px;
    min-width: 48px;
  }
  
  .skip-link {
    padding: 16px 20px;
    top: -50px;
  }
  
  .sidebar {
    max-width: 100%;
    width: 85vw;
  }
}
