/**
 * MindClick Consulting Platform - Accessibility Styles
 * WCAG 2.2 Level AAA Compliance
 * 2026 Web and Mobile Accessibility Standards
 */

/* ===================================
   FOCUS MANAGEMENT
   =================================== */

/* Enhanced focus indicators for keyboard navigation */
*:focus {
  outline: 3px solid #0066cc;
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 3px solid #0066cc;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.2);
}

/* High contrast focus for interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #0066cc;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(0, 102, 204, 0.25);
  position: relative;
  z-index: 100;
}

/* ===================================
   SKIP LINKS
   =================================== */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  font-weight: 600;
  border-radius: 0 0 4px 0;
}

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

/* ===================================
   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-width: 0;
}

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

/* ===================================
   TOUCH TARGET SIZES (MOBILE)
   =================================== */

/* Minimum 44x44px touch targets per WCAG 2.2 */
button,
a,
input[type="button"],
input[type="submit"],
input[type="reset"],
[role="button"],
[role="link"],
.btn,
.button {
  min-height: 44px;
  min-width: 44px;
  padding: 12px 20px;
}

/* Touch target spacing for mobile */
@media (max-width: 768px) {
  button,
  a,
  .btn,
  [role="button"] {
    margin: 4px;
  }
  
  /* Increase touch area for small icons */
  .icon-button,
  .icon-link {
    padding: 12px;
    min-height: 44px;
    min-width: 44px;
  }
}

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

/* Default text colors - keeping original design */
body {
  color: #1a1a1a;
  background: #ffffff;
}

/* Links - original blue */
a {
  color: #0066cc;
  text-decoration: underline;
}

a:hover,
a:focus {
  color: #0052a3;
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* Button contrast - original design */
button,
.btn {
  background: #0066cc;
  color: #ffffff;
  border: 2px solid #0066cc;
}

button:hover,
.btn:hover {
  background: #0052a3;
  border-color: #0052a3;
}

button:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Keep Tailwind's default colors working */
.text-primary {
  color: #1e40af;
}

.bg-primary {
  background: #1e40af;
}

.hover\:bg-blue-700:hover {
  background: #1d4ed8;
}

/* ===================================
   DARK MODE SUPPORT
   =================================== */

@media (prefers-color-scheme: dark) {
  body {
    background: #1a1a1a;
    color: #e0e0e0;
  }
  
  a {
    color: #4da6ff;
  }
  
  a:hover,
  a:focus {
    color: #80c0ff;
  }
  
  button,
  .btn {
    background: #0066cc;
    color: #ffffff;
  }
  
  input,
  select,
  textarea {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #444;
  }
  
  *:focus-visible {
    outline-color: #4da6ff;
    box-shadow: 0 0 0 4px rgba(77, 166, 255, 0.3);
  }
}

/* ===================================
   REDUCED MOTION
   =================================== */

@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) {
  * {
    border-width: 2px !important;
  }
  
  button,
  .btn,
  a {
    border: 3px solid currentColor !important;
  }
  
  *:focus-visible {
    outline-width: 4px !important;
    outline-offset: 4px !important;
  }
}

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

/* Clear label association */
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #1a1a1a;
}

/* Required field indicator */
.required::after,
[required] + label::after {
  content: " *";
  color: #d32f2f;
  font-weight: bold;
}

/* Error states */
input:invalid,
select:invalid,
textarea:invalid,
.error {
  border-color: #d32f2f;
  border-width: 2px;
}

input:invalid:focus,
select:invalid:focus,
textarea:invalid:focus,
.error:focus {
  outline-color: #d32f2f;
  box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.2);
}

/* Error message styling */
.error-message,
[role="alert"] {
  color: #d32f2f;
  font-weight: 600;
  margin-top: 4px;
  padding: 8px;
  background: #ffebee;
  border-left: 4px solid #d32f2f;
  border-radius: 4px;
}

/* Success message */
.success-message {
  color: #2e7d32;
  font-weight: 600;
  margin-top: 4px;
  padding: 8px;
  background: #e8f5e9;
  border-left: 4px solid #2e7d32;
  border-radius: 4px;
}

/* ===================================
   RESPONSIVE TEXT SIZING
   =================================== */

/* Respect user font size preferences */
html {
  font-size: 100%;
}

/* Minimum font sizes for readability */
body {
  font-size: 1rem;
  line-height: 1.6;
}

h1 {
  font-size: 2.5rem;
  line-height: 1.2;
}

h2 {
  font-size: 2rem;
  line-height: 1.3;
}

h3 {
  font-size: 1.75rem;
  line-height: 1.4;
}

small,
.text-small {
  font-size: 0.875rem;
}

/* Never go below 14px (0.875rem) for body text */
@media (max-width: 768px) {
  body {
    font-size: 1rem;
  }
}

/* ===================================
   LOADING & PROGRESS INDICATORS
   =================================== */

/* Loading spinner with accessible label */
.loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #0066cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .loading::after {
    animation: none;
    border-top-color: transparent;
  }
}

/* Progress bar */
progress {
  width: 100%;
  height: 20px;
  border-radius: 4px;
}

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

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

th {
  text-align: left;
  font-weight: 600;
  background: #f5f5f5;
  padding: 12px;
  border: 1px solid #ddd;
}

td {
  padding: 12px;
  border: 1px solid #ddd;
}

/* Zebra striping for better readability */
tbody tr:nth-child(even) {
  background: #f9f9f9;
}

/* ===================================
   MODAL & DIALOG ACCESSIBILITY
   =================================== */

/* Modal backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9998;
}

/* Modal container */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  padding: 24px;
}

/* Modal close button - large touch target */
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  min-width: 44px;
  min-height: 44px;
  padding: 12px;
  background: transparent;
  border: 2px solid #666;
  border-radius: 50%;
  cursor: pointer;
}

/* ===================================
   NOTIFICATION ANNOUNCEMENTS
   =================================== */

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 300px;
  max-width: 500px;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .notification {
    animation: none;
  }
}

.notification-success {
  background: #e8f5e9;
  border-left: 4px solid #2e7d32;
  color: #1b5e20;
}

.notification-error {
  background: #ffebee;
  border-left: 4px solid #d32f2f;
  color: #b71c1c;
}

.notification-info {
  background: #e3f2fd;
  border-left: 4px solid #1976d2;
  color: #0d47a1;
}

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

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
  .no-print,
  nav,
  .sidebar,
  button,
  .modal-backdrop {
    display: none !important;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
  }
  
  body {
    color: #000;
    background: #fff;
  }
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.uppercase {
  text-transform: uppercase;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mt-4 {
  margin-top: 1rem;
}

.p-4 {
  padding: 1rem;
}

/* ===================================
   ACCESSIBLE HIDING
   =================================== */

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

/* Show for screen readers only */
.show-for-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
