/* ========================================
   OPTIMISATIONS ACCESSIBILITÉ (WCAG 2.1)
   ======================================== */

/* =====================================
   CONTRASTES ET COULEURS
   ===================================== */

/* Amélioration des contrastes pour respecter WCAG AA */
.high-contrast-text {
    color: #1a1a1a;
    background: #ffffff;
    border: 1px solid #d1d5db;
}

.high-contrast-button {
    background: #1a2239;
    color: #ffffff;
    border: 2px solid #1a2239;
    min-height: 44px;
    min-width: 44px;
}

.high-contrast-button:hover {
    background: #0f1419;
    border-color: #0f1419;
}

.high-contrast-button:focus {
    outline: 3px solid #1194e2;
    outline-offset: 2px;
}

/* Indicateurs de focus améliorés */
.focus-indicator {
    outline: none;
    box-shadow: 0 0 0 3px rgba(17, 148, 226, 0.5);
    border-radius: 4px;
}

.focus-indicator:focus-visible {
    outline: 3px solid #1194e2;
    outline-offset: 2px;
}

/* =====================================
   NAVIGATION CLAVIER
   ===================================== */

/* Skip links améliorés */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #1194e2;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    transition: top 0.3s ease;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* Focus visible pour tous les éléments interactifs */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #1194e2;
    outline-offset: 2px;
}

/* Navigation clavier améliorée */
.keyboard-navigation *:focus {
    outline: 3px solid #1194e2;
    outline-offset: 2px;
}

/* =====================================
   LECTEURS D'ÉCRAN
   ===================================== */

/* Masquage visuel mais accessible aux lecteurs d'écran */
.sr-only {
    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;
}

/* Affichage uniquement pour les lecteurs d'écran */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* =====================================
   TAILLES DE POLICES ET ESPACEMENT
   ===================================== */

/* Tailles de police accessibles */
.accessible-text {
    font-size: 1rem;
    line-height: 1.5;
    letter-spacing: 0.025em;
}

.accessible-text-large {
    font-size: 1.125rem;
    line-height: 1.6;
    letter-spacing: 0.025em;
}

/* Espacement pour les éléments interactifs */
.accessible-spacing {
    padding: 12px 16px;
    margin: 8px 0;
    min-height: 44px;
    min-width: 44px;
}

/* =====================================
   FORMULAIRES ACCESSIBLES
   ===================================== */

/* Labels et inputs associés */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    font-size: 1rem;
    background: #ffffff;
    color: #1a1a1a;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #1194e2;
    box-shadow: 0 0 0 3px rgba(17, 148, 226, 0.1);
}

.form-input[aria-invalid="true"] {
    border-color: #dc2626;
}

.form-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* =====================================
   ÉTATS ET NOTIFICATIONS
   ===================================== */

/* Messages d'erreur accessibles */
.error-message {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 8px 0;
    display: flex;
    align-items: center;
}

.error-message::before {
    content: "⚠️";
    margin-right: 8px;
    font-size: 1.2em;
}

/* Messages de succès accessibles */
.success-message {
    color: #065f46;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 8px 0;
    display: flex;
    align-items: center;
}

.success-message::before {
    content: "✅";
    margin-right: 8px;
    font-size: 1.2em;
}

/* Messages d'information accessibles */
.info-message {
    color: #1e40af;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 8px 0;
    display: flex;
    align-items: center;
}

.info-message::before {
    content: "ℹ️";
    margin-right: 8px;
    font-size: 1.2em;
}

/* =====================================
   PRÉFÉRENCES UTILISATEUR
   ===================================== */

/* Préférence pour les mouvements réduits */
@media (prefers-reduced-motion: reduce) {
    .accessible-animation {
        animation: none !important;
        transition: none !important;
    }
    
    .accessible-animation:hover {
        transform: none !important;
    }
}

/* Préférence pour les contrastes élevés */
@media (prefers-contrast: high) {
    .accessible-contrast {
        background: #ffffff;
        color: #000000;
        border: 2px solid #000000;
    }
    
    .accessible-contrast:hover {
        background: #000000;
        color: #ffffff;
    }
}

/* Préférence pour les couleurs réduites */
@media (prefers-color-scheme: dark) {
    .accessible-dark {
        background: #1a1a1a;
        color: #ffffff;
        border-color: #404040;
    }
    
    .accessible-dark .form-input {
        background: #2d2d2d;
        color: #ffffff;
        border-color: #404040;
    }
}

/* =====================================
   TABLEAUX ACCESSIBLES
   ===================================== */

.accessible-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.accessible-table th,
.accessible-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #d1d5db;
}

.accessible-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #1a1a1a;
}

.accessible-table tr:hover {
    background: #f9fafb;
}

/* =====================================
   LISTES ACCESSIBLES
   ===================================== */

.accessible-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.accessible-list-item {
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.accessible-list-item:last-child {
    border-bottom: none;
}

.accessible-list-item:focus {
    outline: 2px solid #1194e2;
    outline-offset: 2px;
}

/* =====================================
   IMAGES ACCESSIBLES
   ===================================== */

.accessible-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.accessible-image[alt=""] {
    /* Images décoratives */
    display: block;
}

.accessible-image:not([alt]) {
    /* Images sans alt - ajouter une bordure rouge en dev */
    border: 2px solid red;
}

/* =====================================
   VIDÉOS ACCESSIBLES
   ===================================== */

.accessible-video {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.video-controls-accessible {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
}

.video-control-accessible {
    background: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    min-width: 44px;
    min-height: 44px;
}

.video-control-accessible:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-control-accessible:focus {
    outline: 3px solid #1194e2;
    outline-offset: 2px;
}

/* =====================================
   NAVIGATION ACCESSIBLE
   ===================================== */

.accessible-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.accessible-nav-item {
    display: block;
}

.accessible-nav-link {
    display: block;
    padding: 8px 16px;
    color: #1a1a1a;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.accessible-nav-link:hover {
    background: #f3f4f6;
    color: #1194e2;
}

.accessible-nav-link:focus {
    outline: 3px solid #1194e2;
    outline-offset: 2px;
}

.accessible-nav-link[aria-current="page"] {
    background: #1194e2;
    color: #ffffff;
}

/* =====================================
   BOUTONS ACCESSIBLES
   ===================================== */

.accessible-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #1194e2;
    color: #ffffff;
    border: 2px solid #1194e2;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    min-width: 44px;
}

.accessible-button:hover {
    background: #0f7cb3;
    border-color: #0f7cb3;
}

.accessible-button:focus {
    outline: 3px solid #1194e2;
    outline-offset: 2px;
}

.accessible-button:disabled {
    background: #d1d5db;
    border-color: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
}

.accessible-button-secondary {
    background: transparent;
    color: #1194e2;
    border: 2px solid #1194e2;
}

.accessible-button-secondary:hover {
    background: #1194e2;
    color: #ffffff;
}

/* =====================================
   MODALES ACCESSIBLES
   ===================================== */

.accessible-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.accessible-modal-content {
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.accessible-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accessible-modal-close:hover {
    background: #f3f4f6;
    border-radius: 4px;
}

.accessible-modal-close:focus {
    outline: 3px solid #1194e2;
    outline-offset: 2px;
}

/* =====================================
   TOOLTIPS ACCESSIBLES
   ===================================== */

.accessible-tooltip {
    position: relative;
    display: inline-block;
}

.accessible-tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.accessible-tooltip:hover .accessible-tooltip-content,
.accessible-tooltip:focus .accessible-tooltip-content {
    opacity: 1;
    visibility: visible;
}

.accessible-tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1a1a1a;
}

/* =====================================
   RÉGLAGES POUR DYSLEXIE
   ===================================== */

.dyslexia-friendly {
    font-family: 'OpenDyslexic', Arial, sans-serif;
    letter-spacing: 0.12em;
    word-spacing: 0.16em;
    line-height: 1.8;
}

.dyslexia-friendly h1,
.dyslexia-friendly h2,
.dyslexia-friendly h3 {
    font-weight: 600;
    margin-bottom: 1em;
}

.dyslexia-friendly p {
    margin-bottom: 1.5em;
    text-align: left;
}

/* =====================================
   UTILITAIRES DEBUG ACCESSIBILITÉ
   ===================================== */

/* Marquer les éléments sans labels appropriés */
input:not([aria-label]):not([aria-labelledby]):not([title]):not([id]) {
    outline: 2px solid red !important;
}

/* Marquer les images sans alt */
img:not([alt]) {
    outline: 2px solid red !important;
}

/* Marquer les boutons sans texte accessible */
button:empty:not([aria-label]):not([aria-labelledby]):not([title]) {
    outline: 2px solid red !important;
}

/* Marquer les liens sans texte accessible */
a:empty:not([aria-label]):not([aria-labelledby]):not([title]) {
    outline: 2px solid red !important;
} 