/* ==================================
   WCAG 2.1 AA Accessibility Styles
   Globe Packers & Movers
   ================================== */

/* Skip to main content link for keyboard navigation */
.skip-to-main {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 1em;
  background-color: #000;
  color: #fff;
  text-decoration: none;
}

.skip-to-main:focus {
  left: 50%;
  transform: translateX(-50%);
  top: 0;
}

/* Visually hidden class for screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Enhanced focus for dark backgrounds */
.bg-dark a:focus,
.bg-dark button:focus {
  outline-color: #ffd700;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  a:focus,
  button:focus,
  input:focus {
    outline-width: 4px;
  }
}

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

/* Mobile nav toggle - Ensure keyboard accessibility */
.mobile-nav-toggle:focus {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Form error states for accessibility */
input:invalid:focus,
textarea:invalid:focus,
select:invalid:focus {
  border-color: #dc3545;
  outline-color: #dc3545;
}

input:valid:focus,
textarea:valid:focus,
select:valid:focus {
  border-color: #28a745;
}

/* Improve link contrast */
a {
  text-decoration-skip-ink: auto;
}

/* Ensure sufficient color contrast for links */
.text-white a:not(.btn) {
  text-decoration: underline;
}

/* Button focus styles */
.btn:focus,
.get-a-quote:focus,
.cta-btn:focus {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
  box-shadow: 0 0 0 0.2rem rgba(0, 95, 204, 0.25);
}

/* Accordion button accessibility */
.accordion-button:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  outline: 2px solid #005fcc;
}

/* Form labels - ensure they're visible to screen readers */
label {
  display: block;
  margin-bottom: 0.5rem;
}

/* Loading and error message accessibility */
.loading,
.error-message,
.sent-message {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 4px;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.sent-message {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.loading {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Ensure icons don't interfere with text selection */
i {
  pointer-events: none;
}

/* Table accessibility */
table {
  border-collapse: collapse;
}

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

/* Image loading state */
img:not([alt]) {
  border: 3px dashed #dc3545;
}

/* Ensure footer links are accessible */
footer a:focus {
  outline-color: #ffd700;
}

/* WhatsApp and Call buttons - enhance for touch targets */
.whatsapp-float,
.call-float-circle {
  min-width: 44px;
  min-height: 44px;
}

.whatsapp-float:focus,
.call-float-circle:focus {
  outline: 3px solid #ffd700;
  outline-offset: 3px;
}

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

nav a {
  display: block;
  padding: 0.5rem 1rem;
}

/* Breadcrumb accessibility */
.breadcrumbs nav ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Iframe accessibility */
iframe {
  border: 1px solid #dee2e6;
}

/* Print styles for accessibility */
@media print {
  .skip-to-main,
  .mobile-nav-toggle,
  .whatsapp-float,
  .call-float-circle {
    display: none !important;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .error-message {
    background-color: #5a1f1f;
    color: #f8d7da;
  }
  
  .sent-message {
    background-color: #1f4d2b;
    color: #d4edda;
  }
  
  .loading {
    background-color: #1f3840;
    color: #d1ecf1;
  }
}

/* Touch target minimum size (WCAG 2.5.5) */
@media (pointer: coarse) {
  a,
  button,
  input[type="submit"],
  input[type="button"],
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
  }
}
