/**
 * STYLES D'ACCESSIBILITÉ
 * 
 * Styles pour le widget d'accessibilité et les modes spéciaux
 * 
 * @package L'Envol des Gamers
 * @author Kiro AI Assistant
 */

/* ============================================
   WIDGET D'ACCESSIBILITÉ
   ============================================ */

#accessibility-widget {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

/* Bouton d'ouverture */
.accessibility-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accessibility-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.accessibility-btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

.accessibility-btn .icon {
    display: block;
    line-height: 1;
}

/* Mini menu rapide */
.accessibility-mini-menu {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
}

.accessibility-mini-menu.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
}

.mini-menu-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.mini-menu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mini-menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mini-menu-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    padding: 1.25rem;
}

.mini-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem 0.75rem;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    color: #1f2937;
    min-height: 85px;
}

.mini-item:hover {
    background: #e5e7eb;
    border-color: #667eea;
    transform: translateY(-2px);
}

.mini-item:active {
    transform: translateY(0);
}

.mini-item:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.mini-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.mini-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    line-height: 1.2;
}

/* Indicateur d'état actif sur les mini items */
.mini-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.mini-item.active .mini-icon {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Panel d'options complet */
.accessibility-panel {
    position: absolute;
    top: 70px;
    right: 0;
    width: 350px;
    max-height: 80vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
}

.accessibility-panel.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
}

/* Header du panel */
.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.close-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Contenu du panel */
.panel-content {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.panel-content::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

/* Groupes d'options */
.option-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.option-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.option-label .icon {
    font-size: 1.25rem;
}

/* Boutons de groupe */
.button-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.option-btn {
    flex: 1;
    padding: 0.75rem;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:hover {
    background: #e5e7eb;
    border-color: #667eea;
}

.option-btn:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.current-value {
    display: block;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Toggle switch */
.option-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.option-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: #d1d5db;
    border-radius: 24px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.option-toggle input[type="checkbox"]:checked + .toggle-slider {
    background: #667eea;
}

.option-toggle input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.option-toggle input[type="checkbox"]:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Select */
.option-select {
    width: 100%;
    padding: 0.75rem;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-select:hover {
    border-color: #667eea;
}

.option-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Bouton de réinitialisation */
.reset-btn {
    width: 100%;
    padding: 0.75rem;
    background: #ef4444;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: #dc2626;
}

.reset-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Footer du panel */
.panel-footer {
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.panel-footer details {
    cursor: pointer;
}

.panel-footer summary {
    font-weight: 600;
    color: #1f2937;
    padding: 0.5rem 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-footer summary::-webkit-details-marker {
    display: none;
}

.shortcuts-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
}

.shortcuts-list li {
    padding: 0.5rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.shortcuts-list kbd {
    background: #e5e7eb;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1f2937;
}

/* Texte d'aide */
.option-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
}

/* ============================================
   MODES D'ACCESSIBILITÉ
   ============================================ */

/* Mode sombre */
body.dark-mode {
    --bg: #1a1a1a;
    --bg-card: #2d2d2d;
    --text: #ffffff;
    --text-muted: #a0a0a0;
    --border: #404040;
    --primary: #8b9aff;
    --accent: #9b7bc2;
}

body.dark-mode {
    background-color: var(--bg);
    color: var(--text);
}

body.dark-mode .accessibility-mini-menu {
    background: #2d2d2d;
}

body.dark-mode .mini-item {
    background: #3d3d3d;
    color: white;
}

body.dark-mode .mini-item:hover {
    background: #4d4d4d;
}

body.dark-mode .accessibility-panel {
    background: #2d2d2d;
    color: white;
}

body.dark-mode .option-label,
body.dark-mode .panel-footer summary {
    color: white;
}

body.dark-mode .option-btn,
body.dark-mode .option-select {
    background: #3d3d3d;
    border-color: #505050;
    color: white;
}

body.dark-mode .option-btn:hover,
body.dark-mode .option-select:hover {
    background: #4d4d4d;
}

body.dark-mode .panel-footer {
    background: #252525;
    border-top-color: #404040;
}

body.dark-mode .shortcuts-list li {
    color: #a0a0a0;
}

body.dark-mode .shortcuts-list kbd {
    background: #404040;
    color: white;
}

/* Contraste élevé */
body.high-contrast {
    --bg: #ffffff;
    --bg-card: #ffffff;
    --text: #000000;
    --text-muted: #000000;
    --border: #000000;
    --primary: #0000ff;
    --accent: #0000ff;
}

body.high-contrast * {
    border-color: #000000 !important;
}

body.high-contrast a {
    color: #0000ff !important;
    text-decoration: underline !important;
    font-weight: bold !important;
}

body.high-contrast button {
    border: 3px solid #000000 !important;
    font-weight: bold !important;
}

/* Animations réduites */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Mode lecteur d'écran */
body.screen-reader-mode {
    line-height: 1.8;
}

body.screen-reader-mode * {
    font-family: Arial, sans-serif !important;
}

body.screen-reader-mode img:not([alt]) {
    outline: 3px solid red;
}

/* Police dyslexie */
body.dyslexia-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', Arial, sans-serif !important;
    letter-spacing: 0.05em;
    word-spacing: 0.1em;
    line-height: 1.8;
}

/* Surligner les liens */
body.link-highlight a {
    background: #ffff00;
    padding: 2px 4px;
    border-radius: 3px;
    text-decoration: underline;
    font-weight: 600;
}

body.link-highlight a:hover {
    background: #ffcc00;
}

/* Taille du curseur */
body.cursor-large * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M2 2 L2 28 L12 20 L16 28 L20 26 L16 18 L26 18 Z" fill="black" stroke="white" stroke-width="2"/></svg>'), auto !important;
}

body.cursor-extra-large * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M3 3 L3 42 L18 30 L24 42 L30 39 L24 27 L39 27 Z" fill="black" stroke="white" stroke-width="3"/></svg>'), auto !important;
}

/* ============================================
   MODES DALTONIENS
   ============================================ */

/* 
   Protanopie (Daltonisme rouge)
   Difficulté à percevoir le rouge
   8% des hommes, 0.5% des femmes
*/
body.color-blind-protanopia {
    --primary: #0066cc;      /* Bleu au lieu de violet */
    --accent: #0099ff;       /* Bleu clair */
    --success: #0088cc;      /* Bleu au lieu de vert */
    --warning: #ff9900;      /* Orange vif */
    --danger: #cc6600;       /* Orange foncé au lieu de rouge */
    --info: #0066cc;         /* Bleu */
}

body.color-blind-protanopia .live-dot,
body.color-blind-protanopia .status-live {
    background: #0088cc !important;  /* Bleu au lieu de rouge/vert */
}

body.color-blind-protanopia .btn-primary,
body.color-blind-protanopia .btn-success {
    background: linear-gradient(135deg, #0066cc, #0099ff) !important;
}

body.color-blind-protanopia .btn-danger,
body.color-blind-protanopia .btn-warning {
    background: linear-gradient(135deg, #ff9900, #cc6600) !important;
}

/* 
   Deutéranopie (Daltonisme vert)
   Difficulté à percevoir le vert
   Le plus commun : 6% des hommes
*/
body.color-blind-deuteranopia {
    --primary: #0066cc;      /* Bleu */
    --accent: #9966ff;       /* Violet */
    --success: #0088cc;      /* Bleu au lieu de vert */
    --warning: #ffaa00;      /* Orange */
    --danger: #cc3300;       /* Rouge-orange */
    --info: #0066cc;         /* Bleu */
}

body.color-blind-deuteranopia .live-dot,
body.color-blind-deuteranopia .status-live {
    background: #0088cc !important;  /* Bleu au lieu de vert */
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px #0088cc;
}

body.color-blind-deuteranopia .btn-success {
    background: linear-gradient(135deg, #0066cc, #0099ff) !important;
}

body.color-blind-deuteranopia .alert-success {
    background: rgba(0, 102, 204, 0.1) !important;
    border-color: rgba(0, 102, 204, 0.3) !important;
    color: #0066cc !important;
}

/* 
   Tritanopie (Daltonisme bleu)
   Difficulté à percevoir le bleu
   Rare : 0.01% de la population
*/
body.color-blind-tritanopia {
    --primary: #cc0066;      /* Rose/magenta au lieu de bleu */
    --accent: #ff3399;       /* Rose vif */
    --success: #00cc66;      /* Vert */
    --warning: #ff6600;      /* Orange */
    --danger: #cc0000;       /* Rouge */
    --info: #cc0066;         /* Rose */
}

body.color-blind-tritanopia .btn-primary {
    background: linear-gradient(135deg, #cc0066, #ff3399) !important;
}

body.color-blind-tritanopia a {
    color: #cc0066 !important;
}

/* 
   Achromatopsie (Daltonisme total)
   Vision en noir et blanc uniquement
   Très rare : 0.003% de la population
*/
body.color-blind-achromatopsia {
    filter: grayscale(100%);
}

body.color-blind-achromatopsia * {
    /* Forcer le noir et blanc sur tous les éléments */
    filter: grayscale(100%) !important;
}

/* Améliorer les contrastes en noir et blanc */
body.color-blind-achromatopsia .btn-primary,
body.color-blind-achromatopsia .btn-success {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

body.color-blind-achromatopsia .btn-secondary {
    background: #666666 !important;
    color: #ffffff !important;
}

body.color-blind-achromatopsia .btn-danger,
body.color-blind-achromatopsia .btn-warning {
    background: #333333 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

body.color-blind-achromatopsia .live-dot {
    background: #000000 !important;
    border: 3px solid #ffffff !important;
    animation: pulse-bw 2s infinite;
}

@keyframes pulse-bw {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
    }
}

/* Améliorer la distinction des éléments interactifs */
body.color-blind-achromatopsia a {
    text-decoration: underline !important;
    font-weight: bold !important;
}

body.color-blind-achromatopsia button,
body.color-blind-achromatopsia .btn {
    border: 3px solid #000000 !important;
    font-weight: bold !important;
}

/* ============================================
   AMÉLIORATIONS COMMUNES POUR DALTONIENS
   ============================================ */

/* Ajouter des motifs/textures pour différencier les éléments */
body[class*="color-blind-"] .status-indicator {
    position: relative;
}

body[class*="color-blind-"] .status-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.3;
}

/* Motif pour "en ligne" */
body[class*="color-blind-"] .status-live::before {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        currentColor 2px,
        currentColor 4px
    );
}

/* Motif pour "hors ligne" */
body[class*="color-blind-"] .status-offline::before {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 2px,
        currentColor 2px,
        currentColor 4px
    );
}

/* Améliorer les bordures et contrastes */
body[class*="color-blind-"] .card,
body[class*="color-blind-"] .btn,
body[class*="color-blind-"] input,
body[class*="color-blind-"] select {
    border-width: 2px !important;
}

/* Ajouter des icônes pour renforcer le sens */
body[class*="color-blind-"] .alert-success::before {
    content: '✓ ';
    font-weight: bold;
}

body[class*="color-blind-"] .alert-error::before,
body[class*="color-blind-"] .alert-danger::before {
    content: '✕ ';
    font-weight: bold;
}

body[class*="color-blind-"] .alert-warning::before {
    content: '⚠ ';
    font-weight: bold;
}

body[class*="color-blind-"] .alert-info::before {
    content: 'ℹ ';
    font-weight: bold;
}

/* ============================================
   CLASSES UTILITAIRES
   ============================================ */

/* Screen reader only */
.sr-only {
    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:active,
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus visible */
*:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

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

.skip-link:focus {
    top: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    #accessibility-widget {
        top: 10px;
        right: 10px;
    }
    
    .accessibility-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .accessibility-mini-menu {
        width: calc(100vw - 40px);
        max-width: 360px;
        top: 60px;
        right: 10px;
    }
    
    .mini-menu-items {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.6rem;
        padding: 1rem;
    }
    
    .mini-item {
        padding: 0.75rem 0.5rem;
        min-height: 75px;
    }
    
    .mini-icon {
        font-size: 1.5rem;
    }
    
    .mini-label {
        font-size: 0.7rem;
    }
    
    .accessibility-panel {
        width: calc(100vw - 20px);
        max-width: 350px;
        top: 60px;
    }
}

@media (max-width: 480px) {
    .accessibility-mini-menu {
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }
    
    .mini-menu-items {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        padding: 0.875rem;
    }
    
    .mini-item {
        padding: 0.625rem 0.375rem;
        min-height: 70px;
    }
    
    .mini-icon {
        font-size: 1.4rem;
    }
    
    .mini-label {
        font-size: 0.65rem;
    }
    
    .mini-icon {
        font-size: 1.25rem;
    }
    
    .mini-label {
        font-size: 0.65rem;
    }
    
    .accessibility-panel {
        right: -10px;
        width: calc(100vw - 10px);
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accessibility-panel:not(.hidden) {
    animation: fadeIn 0.3s ease;
}

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

@media print {
    #accessibility-widget {
        display: none !important;
    }
}
