/**
 * Accessibility Enhancements for UnitedSets Tennis
 * WCAG 2.1 AA Compliance
 */

/* ================================
   SKIP NAVIGATION LINK
   ================================ */
.skip-link {
  position: absolute;
  top: -50px;
  left: 0;
  background: #0a5566;
  color: #ffffff;
  padding: 12px 24px;
  text-decoration: none;
  z-index: 100000;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  font-size: 14px;
  transition: top 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

.skip-link:hover {
  background: #0d6b7a;
}

/* ================================
   FOCUS INDICATORS
   ================================ */

/* Enhanced focus styles for all interactive elements */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
  outline: 2px solid #0a5566;
  outline-offset: 2px;
}

/* High contrast focus for dark backgrounds */
.glass-nav a:focus,
.footer a:focus,
footer a:focus,
.hero a:focus,
.cta a:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Focus visible - only show on keyboard navigation */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #0a5566;
  outline-offset: 2px;
}

/* Remove outline:none from inputs - CRITICAL for accessibility */
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #0a5566 !important;
  outline-offset: 2px !important;
}

/* Form input focus with box-shadow fallback for older browsers */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #0a5566;
  box-shadow: 0 0 0 3px rgba(10, 85, 102, 0.2);
}

/* ================================
   SCREEN READER ONLY CONTENT
   ================================ */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Show on focus for skip links */
.sr-only-focusable:focus,
.visually-hidden-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ================================
   FORM ACCESSIBILITY
   ================================ */

/* Required field indicator */
.required,
.form-required {
  color: #dc3545;
  font-weight: bold;
}

/* Error messages for screen readers */
.error-message,
.form-error {
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Success messages for screen readers */
.success-message,
.form-success {
  color: #28a745;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Live region styling */
[role="alert"],
[role="status"],
[aria-live="polite"],
[aria-live="assertive"] {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 10px 0;
}

[role="alert"] {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

[role="status"] {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

/* ================================
   COLOR CONTRAST IMPROVEMENTS
   ================================ */

/* Ensure placeholder text has sufficient contrast */
::placeholder {
  color: #6c757d;
  opacity: 1;
}

/* Link styling for accessibility */
a {
  text-decoration: underline;
  text-decoration-skip-ink: auto;
}

/* Navigation links can have no underline but must be clearly interactive */
nav a,
.nav-menu a,
.footer-links a {
  text-decoration: none;
}

nav a:hover,
.nav-menu a:hover,
.footer-links a:hover {
  text-decoration: underline;
}

/* ================================
   MOTION PREFERENCES
   ================================ */

/* Respect user's reduced motion preference */
@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
   ================================ */

@media (prefers-contrast: high) {
  a:focus,
  button:focus,
  input:focus,
  select:focus,
  textarea:focus {
    outline: 3px solid currentColor;
    outline-offset: 3px;
  }
  
  .btn,
  button {
    border: 2px solid currentColor;
  }
}

/* ================================
   TOUCH TARGET SIZES
   ================================ */

/* Ensure minimum touch target size of 44x44px for mobile */
@media (max-width: 768px) {
  button,
  [role="button"],
  a.btn,
  .btn,
  input[type="submit"],
  input[type="button"],
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Checkbox and radio sizing */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
  }
}

/* ================================
   ICON BUTTONS ACCESSIBILITY
   ================================ */

/* Ensure icon-only buttons are accessible */
button[aria-label],
a[aria-label] {
  position: relative;
}

/* Icon hidden from screen readers */
button i[aria-hidden="true"],
a i[aria-hidden="true"],
.icon-button i {
  pointer-events: none;
}

/* ================================
   TABLE ACCESSIBILITY
   ================================ */

table {
  border-collapse: collapse;
  width: 100%;
}

table caption {
  text-align: left;
  font-weight: bold;
  padding: 10px 0;
}

th {
  text-align: left;
  font-weight: bold;
}

th, td {
  padding: 12px;
  border: 1px solid #dee2e6;
}

/* ================================
   IMAGE ACCESSIBILITY
   ================================ */

/* Ensure images don't break layout */
img {
  max-width: 100%;
  height: auto;
}

/* Decorative images */
img[alt=""],
img[role="presentation"] {
  border: 0;
}
