/* ========================================
   Premium Accessibility System
   Prestige VTC - WCAG 2.1 AAA Compliant
   ======================================== */

/* ========================================
   Focus Management Premium
   ======================================== */

/* Focus ring personnalisé premium */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--primary-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
  box-shadow: 
    0 0 0 1px var(--bg-primary),
    0 0 0 4px rgba(184, 134, 11, 0.3);
  transition: all 0.2s ease;
}

/* Focus pour éléments interactifs */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--primary-gold);
  outline-offset: 2px;
  box-shadow: 
    0 0 0 1px var(--bg-primary),
    0 0 0 4px rgba(184, 134, 11, 0.3);
}

/* Focus pour navigation */
.nav-link:focus-visible {
  background: rgba(184, 134, 11, 0.1);
  color: var(--primary-gold);
  transform: translateY(-2px);
}

/* Focus pour breadcrumb */
.breadcrumb a:focus-visible {
  background: rgba(184, 134, 11, 0.2);
  transform: scale(1.05);
}

/* Skip Links Premium */
.skip-link {
  position: absolute;
  top: -9999px;
  left: -9999px;
  z-index: 999999;
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--primary-gold);
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-base);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.skip-link:focus {
  top: var(--spacing-4);
  left: var(--spacing-4);
  transform: scale(1.02);
}

/* ========================================
   Contraste et Lisibilité
   ======================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #666666;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --primary-gold: #000000;
    --primary-bronze: #333333;
  }
  
  .btn-primary {
    background: #000000;
    border: 3px solid #000000;
    color: #ffffff;
  }
  
  .btn-secondary {
    background: transparent;
    border: 3px solid #000000;
    color: #000000;
  }
  
  .nav-link {
    border: 1px solid transparent;
  }
  
  .nav-link:hover,
  .nav-link.active {
    border-color: #000000;
    background: #f0f0f0;
  }
  
  .card-premium {
    border: 2px solid #000000;
  }
  
  /* Remove gradients and shadows */
  * {
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
}

/* Improved color contrast ratios */
.text-contrast-aaa {
  color: #000000;
  background: #ffffff;
}

.text-contrast-aa {
  color: #333333;
  background: #ffffff;
}

.text-on-dark-aaa {
  color: #ffffff;
  background: #000000;
}

/* Enhanced visibility for interactive elements */
.interactive-element {
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.interactive-element:hover {
  background: rgba(184, 134, 11, 0.1);
  transform: scale(1.02);
}

/* ========================================
   Tailles Tactiles (Touch Targets)
   ======================================== */

/* Minimum 44px touch target */
.touch-target {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Padding pour augmenter zone tactile */
.touch-extend {
  position: relative;
}

.touch-extend::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  z-index: -1;
}

/* Boutons tactiles premium */
.btn-touch {
  min-height: 48px;
  min-width: 48px;
  padding: var(--spacing-3) var(--spacing-4);
  font-size: 16px; /* Évite le zoom sur iOS */
}

/* Links tactiles */
.link-touch {
  padding: var(--spacing-2) var(--spacing-1);
  margin: var(--spacing-1);
  border-radius: var(--radius-sm);
  display: inline-block;
  min-height: 44px;
  line-height: calc(44px - var(--spacing-2) * 2);
}

/* ========================================
   Gestion des Animations Réduites
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  /* Désactivation globale des animations */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  /* Préservation des animations essentielles */
  .loading-spinner,
  .progress-bar,
  .focus-ring {
    animation-duration: 0.3s !important;
    transition-duration: 0.2s !important;
  }
  
  /* Focus states sans animation */
  :focus-visible {
    transition: none !important;
    transform: none !important;
  }
  
  /* Hover states simplifiés */
  .hover-lift:hover,
  .hover-glow:hover,
  .hover-rotate:hover {
    transform: none !important;
    animation: none !important;
  }
}

/* ========================================
   Gestion du Zoom et Redimensionnement
   ======================================== */

/* Support jusqu'à 200% de zoom */
@media (min-resolution: 1.5dppx) {
  .zoom-friendly {
    font-size: calc(var(--text-base) * 1.1);
    line-height: calc(var(--leading-normal) * 1.1);
  }
  
  .btn-premium {
    min-height: 48px;
    padding: var(--spacing-4) var(--spacing-6);
  }
  
  .touch-target {
    min-height: 48px;
    min-width: 48px;
  }
}

/* Texte redimensionnable sans perte de fonctionnalité */
.scalable-text {
  font-size: max(16px, 1rem);
  line-height: 1.5;
}

.scalable-small {
  font-size: max(14px, 0.875rem);
}

.scalable-large {
  font-size: max(20px, 1.25rem);
}

/* ========================================
   Support des Lecteurs d'Écran
   ======================================== */

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

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: var(--spacing-2);
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: var(--primary-gold);
  color: white;
  font-weight: 600;
  border-radius: var(--radius-sm);
  z-index: 999999;
}

/* Descriptions pour screen readers */
.sr-description {
  font-size: 0;
  line-height: 0;
  position: absolute;
  left: -9999px;
}

/* Labels visuellement cachés mais accessibles */
.visually-hidden {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
}

/* ========================================
   États d'Accessibilité Premium
   ======================================== */

/* État désactivé accessible */
.disabled,
[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}

.disabled::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: inherit;
  pointer-events: none;
}

/* État de chargement accessible */
.loading-accessible {
  position: relative;
  color: transparent;
}

.loading-accessible::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(184, 134, 11, 0.3);
  border-top-color: var(--primary-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* États d'erreur accessibles */
.error-accessible {
  border: 2px solid #ef4444;
  background: rgba(239, 68, 68, 0.05);
  position: relative;
}

.error-accessible::before {
  content: '⚠';
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  color: #ef4444;
  font-size: 1.2em;
}

/* États de succès accessibles */
.success-accessible {
  border: 2px solid #22c55e;
  background: rgba(34, 197, 94, 0.05);
  position: relative;
}

.success-accessible::before {
  content: '✓';
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  color: #22c55e;
  font-size: 1.2em;
  font-weight: bold;
}

/* ========================================
   Navigation au Clavier
   ======================================== */

/* Ordre de tabulation logique */
.tab-order-1 { order: 1; }
.tab-order-2 { order: 2; }
.tab-order-3 { order: 3; }
.tab-order-4 { order: 4; }
.tab-order-5 { order: 5; }

/* Focus trap pour modales */
.focus-trap {
  position: relative;
}

.focus-trap::before,
.focus-trap::after {
  content: '';
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Indicateurs de navigation clavier */
.keyboard-user *:focus {
  outline: 3px solid var(--primary-gold) !important;
  outline-offset: 2px !important;
}

/* ========================================
   Gestion des Couleurs et Thèmes
   ======================================== */

/* Mode sombre accessible */
[data-theme="dark"] {
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.87);
  --text-muted: rgba(255, 255, 255, 0.6);
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
}

/* Mode clair accessible */
[data-theme="light"] {
  --text-primary: #000000;
  --text-secondary: rgba(0, 0, 0, 0.87);
  --text-muted: rgba(0, 0, 0, 0.6);
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
}

/* Support des préférences système */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.87);
    --text-muted: rgba(255, 255, 255, 0.6);
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --text-primary: #000000;
    --text-secondary: rgba(0, 0, 0, 0.87);
    --text-muted: rgba(0, 0, 0, 0.6);
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
  }
}

/* ========================================
   Formulaires Accessibles
   ======================================== */

/* Labels obligatoires */
.required::after {
  content: ' *';
  color: #ef4444;
  font-weight: bold;
  margin-left: 2px;
}

/* Messages d'erreur de formulaire */
.form-error {
  color: #ef4444;
  font-size: var(--text-sm);
  margin-top: var(--spacing-1);
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
}

.form-error::before {
  content: '⚠';
  font-size: 1.1em;
}

/* Messages d'aide */
.form-help {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: var(--spacing-1);
}

/* Champs avec focus amélioré */
.form-field {
  position: relative;
  margin-bottom: var(--spacing-4);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--primary-gold);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.1);
  outline: none;
}

/* ========================================
   Images et Médias Accessibles
   ======================================== */

/* Images avec alt vide décoratives */
img[alt=""] {
  user-select: none;
  pointer-events: none;
}

/* Images informatives avec focus */
img[alt]:not([alt=""]) {
  border-radius: var(--radius-sm);
  transition: transform 0.2s ease;
}

img[alt]:not([alt=""]):focus {
  outline: 3px solid var(--primary-gold);
  outline-offset: 2px;
  transform: scale(1.02);
}

/* Vidéos accessibles */
video {
  outline: none;
}

video:focus-visible {
  outline: 3px solid var(--primary-gold);
  outline-offset: 2px;
}

/* ========================================
   Tableaux Accessibles
   ======================================== */

/* Headers de tableau visibles */
th {
  background: rgba(184, 134, 11, 0.1);
  font-weight: 600;
  text-align: left;
  padding: var(--spacing-3);
  border-bottom: 2px solid var(--primary-gold);
}

/* Cellules avec focus */
td:focus,
th:focus {
  outline: 2px solid var(--primary-gold);
  outline-offset: -2px;
  background: rgba(184, 134, 11, 0.05);
}

/* Tableaux avec caption */
caption {
  font-weight: 600;
  margin-bottom: var(--spacing-2);
  text-align: left;
  color: var(--text-primary);
}

/* ========================================
   Print Accessibility
   ======================================== */

@media print {
  /* URLs visibles en impression */
  a[href]:not([href^="#"])::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
  
  /* Focus visible en impression */
  :focus,
  :focus-visible {
    outline: 2px solid black !important;
    box-shadow: none !important;
  }
  
  /* Contrastes optimisés pour impression */
  * {
    color: black !important;
    background: white !important;
    box-shadow: none !important;
  }
  
  .btn-primary,
  .btn-secondary {
    border: 2px solid black !important;
    background: white !important;
    color: black !important;
  }
}

/* ========================================
   Debugage Accessibilité
   ======================================== */

/* Mode debug pour l'accessibilité */
.accessibility-debug * {
  outline: 1px solid red !important;
}

.accessibility-debug img:not([alt]),
.accessibility-debug img[alt=""] {
  border: 3px solid red !important;
}

.accessibility-debug [tabindex]:not([tabindex="0"]):not([tabindex="-1"]) {
  background: yellow !important;
}

.accessibility-debug ::before {
  content: attr(class);
  position: absolute;
  top: 0;
  left: 0;
  font-size: 10px;
  background: red;
  color: white;
  padding: 2px;
  z-index: 9999;
}

/* ========================================
   Utilités d'Accessibilité
   ======================================== */

/* Masquer visuellement mais garder accessible */
.invisible-accessible {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Annonces pour lecteurs d'écran */
.aria-live-polite {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.aria-live-assertive {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* États ARIA visuels */
[aria-expanded="true"] .expand-icon {
  transform: rotate(180deg);
}

[aria-selected="true"] {
  background: rgba(184, 134, 11, 0.1);
  border-left: 4px solid var(--primary-gold);
}

[aria-current="page"] {
  background: rgba(184, 134, 11, 0.15);
  font-weight: 600;
  position: relative;
}

[aria-current="page"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary-gold);
}

/* ========================================
   Performance et Accessibilité
   ======================================== */

/* Optimisations pour technologies d'assistance */
.optimize-at {
  contain: layout style;
  will-change: auto;
}

/* Préchargement des polices pour éviter les flash */
@font-face {
  font-family: 'Inter';
  font-display: swap;
  src: local('Inter');
}

/* Smooth scroll accessible */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Animation keyframes pour accessibility */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}