/* Accessibility & Mobile Enhancements */

/* Skip to main content link for screen readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0063a9;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
  color: white;
}

/* Focus visible improvements */
*:focus-visible {
  outline: 3px solid rgba(0, 149, 255, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {
  .item,
  .main-nickname,
  .gen-btn,
  .quick-links a,
  .nav-links a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  .rank_green,
  .rank_red {
    min-height: 36px;
    min-width: 36px;
    padding: 0.5rem;
  }
}

/* Reduced motion support */
@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;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .item {
    border-width: 3px;
  }
  
  .block-header {
    border: 2px solid white;
  }
  
  .main-nickname {
    font-weight: 700;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  /* Can be enabled if needed */
}

/* Print styles */
@media print {
  nav,
  .sidebar-right,
  .adsbygoogle,
  .burger,
  .dropdown {
    display: none !important;
  }
  
  .main {
    width: 100% !important;
  }
  
  .item {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 3px solid #e1e8ed;
  border-top-color: #0063a9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 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;
}

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

/* Improved button states */
button:disabled,
.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Better link contrast */
a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Improved form elements */
input[type="text"],
input[type="search"],
textarea {
  font-size: 16px; /* Prevents zoom on iOS */
}

/* Better mobile scrolling */
@media (max-width: 768px) {
  body {
    -webkit-overflow-scrolling: touch;
  }
  
  .block-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Improved spacing for readability */
@media (min-width: 1200px) {
  .content {
    max-width: 1400px;
  }
  
  .main {
    max-width: 980px;
  }
}

/* Better text selection */
::selection {
  background: rgba(0, 149, 255, 0.2);
  color: inherit;
}

::-moz-selection {
  background: rgba(0, 149, 255, 0.2);
  color: inherit;
}

/* Improved image loading */
img {
  max-width: 100%;
  height: auto;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Better error states */
.error-message {
  background: #fee;
  border: 2px solid #fcc;
  border-radius: 8px;
  color: #c33;
  padding: 1rem;
  margin: 1rem 0;
}

.success-message {
  background: #efe;
  border: 2px solid #cfc;
  border-radius: 8px;
  color: #3c3;
  padding: 1rem;
  margin: 1rem 0;
}

/* Improved keyboard navigation */
.keyboard-user *:focus {
  outline: 3px solid rgba(0, 149, 255, 0.5);
  outline-offset: 2px;
}

.mouse-user *:focus {
  outline: none;
}

/* Better mobile menu */
@media (max-width: 1152px) {
  .nav-links {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  }
  
  .nav-links::-webkit-scrollbar {
    width: 6px;
  }
  
  .nav-links::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .nav-links::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
  }
  
  .nav-links::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
  }
}

/* Improved language dropdown */
.Language ul {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 #f7fafc;
}

.Language ul::-webkit-scrollbar {
  width: 8px;
}

.Language ul::-webkit-scrollbar-track {
  background: #f7fafc;
  border-radius: 4px;
}

.Language ul::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

.Language ul::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

