/* ============================================================ */
/* ACCESSIBILITY CONTENT ANALYZER - STYLE HARMONISÉ            */
/* ============================================================ */

/* Container principal */
#accessibility-analyzer-container {
    max-width: 1000px;
    margin: 20px 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a2e;
}

/* ============================================================ */
/* HEADER - Accessible                                           */
/* ============================================================ */

.accessibility-header {
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid #e2e8f0;
    margin: -20px -20px 16px -20px;
    padding: 1.25rem 2rem;
}

.accessibility-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.accessibility-header p {
    font-size: 1rem;
    color: #475569;
    margin: 0 0 12px 0;
}

.accessibility-header .ac-stats-bar {
    background: #ffffff;
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 0.9rem;
    color: #475569;
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin: 0;
}

.accessibility-header .ac-stats-bar span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.accessibility-header .ac-stats-bar strong {
    color: #1a1a2e;
    font-weight: 600;
}

/* ============================================================ */
/* OPTIONS - Profil et Format                                    */
/* ============================================================ */

.ac-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    margin-bottom: 12px;
}

.ac-options > div {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ac-options label {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 0.95rem;
}

.ac-options select {
    padding: 6px 12px;
    border: 2px solid #64748b;
    border-radius: 6px;
    font-size: 0.95rem;
    min-height: 44px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease;
    color: #1a1a2e;
}

.ac-options select:hover {
    border-color: #4f46e5;
}

.ac-options select:focus {
    border-color: #4f46e5;
    outline: 3px solid rgba(79, 70, 229, 0.3);
    outline-offset: 2px;
}

/* ============================================================ */
/* TOOLBAR - Accessible                                         */
/* ============================================================ */

.accessibility-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0 16px 0;
}

.accessibility-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* ============================================================ */
/* BOUTONS - Accessibles (WCAG 2.1 AA)                          */
/* ============================================================ */

.accessibility-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    text-decoration: none;
    line-height: 1.2;
}

.accessibility-btn:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 3px;
}

.accessibility-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Primary */
.accessibility-btn-primary {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.accessibility-btn-primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

/* Secondary */
.accessibility-btn-secondary {
    background: #f1f5f9;
    color: #1a1a2e;
    border-color: #64748b;
}

.accessibility-btn-secondary:hover {
    background: #e2e8f0;
    border-color: #475569;
}

/* ============================================================ */
/* STATS - Accessible                                           */
/* ============================================================ */

.accessibility-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.9rem;
    color: #475569;
    padding: 4px 0;
}

.accessibility-stats .stat {
    background: #f8fafc;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

/* ============================================================ */
/* PROGRESS - Accessible                                         */
/* ============================================================ */

#ac-progress {
    margin: 12px 0;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}

.accessibility-progress .progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.accessibility-progress .progress-fill {
    height: 100%;
    background: #4f46e5;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.accessibility-progress .progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: #475569;
    margin-top: 6px;
}

/* ============================================================ */
/* RESULTS - Accessible                                         */
/* ============================================================ */

#ac-results {
    margin-top: 12px;
}

/* Issue category */
.issue-category {
    margin-bottom: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.issue-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a1a2e;
    transition: background 0.2s ease;
    min-height: 44px;
}

.issue-category-header:hover {
    background: #f1f5f9;
}

.issue-category-header:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

.issue-category-header .badge {
    font-size: 0.8rem;
    padding: 2px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.issue-category-header .badge.critical {
    background: #fef2f2;
    color: #991b1b;
}

.issue-category-header .badge.warning {
    background: #fef3c7;
    color: #b45309;
}

.issue-category-header .badge.info {
    background: #dbeafe;
    color: #1e40af;
}

.issue-category-body {
    display: none;
    padding: 12px 16px;
}

.issue-category-body.open {
    display: block;
}

/* Issue item */
.issue-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.issue-item:last-child {
    border-bottom: none;
}

.issue-item .severity {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.issue-item .issue-text {
    flex: 1;
    font-size: 0.9rem;
    color: #1a1a2e;
    line-height: 1.6;
}

.issue-item .issue-text .profile-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 1px 8px;
    border-radius: 10px;
    margin-right: 6px;
    font-weight: 600;
}

.issue-item .issue-text .profile-badge.blind {
    background: #fee2e2;
    color: #991b1b;
}

.issue-item .issue-text .profile-badge.visually_impaired {
    background: #fef3c7;
    color: #b45309;
}

.issue-item .issue-text .profile-badge.dys {
    background: #dbeafe;
    color: #1e40af;
}

.issue-item .issue-text .profile-badge.all {
    background: #e6e6fa;
    color: #4f46e5;
}

.issue-item .issue-text .format-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 1px 8px;
    border-radius: 10px;
    margin-right: 6px;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
}

.issue-item .issue-text .suggestion {
    font-size: 0.85rem;
    color: #4f46e5;
    margin-top: 4px;
    padding: 4px 10px;
    background: #eef2ff;
    border-radius: 4px;
}

.issue-item .issue-text .location {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 2px;
    font-style: italic;
    padding: 2px 8px;
    background: #f8fafc;
    border-radius: 3px;
    display: inline-block;
}

/* ============================================================ */
/* SPINNER - Accessible                                         */
/* ============================================================ */

.accessibility-spinner {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: ac-spin 0.6s linear infinite;
    vertical-align: middle;
}

.accessibility-spinner.active {
    display: inline-block;
}

@keyframes ac-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================ */
/* DEBUG - Accessible (admin only)                              */
/* ============================================================ */

.accessibility-debug {
    margin-top: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 0.85rem;
    font-family: monospace;
    max-height: 150px;
    overflow-y: auto;
}

.accessibility-debug strong {
    color: #475569;
    font-weight: 700;
}

.accessibility-debug .debug-line .time {
    color: #64748b;
    margin-right: 8px;
}

.accessibility-debug .debug-line .success {
    color: #16a34a;
}

.accessibility-debug .debug-line .error {
    color: #991b1b;
}

.accessibility-debug .debug-line .warning {
    color: #b45309;
}

.accessibility-debug .debug-line .info {
    color: #475569;
}

/* ============================================================ */
/* SCROLLBAR - Accessible                                       */
/* ============================================================ */

.accessibility-debug::-webkit-scrollbar,
#ac-results::-webkit-scrollbar {
    width: 8px;
}

.accessibility-debug::-webkit-scrollbar-track,
#ac-results::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.accessibility-debug::-webkit-scrollbar-thumb,
#ac-results::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.accessibility-debug::-webkit-scrollbar-thumb:hover,
#ac-results::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ============================================================ */
/* FOCUS VISIBLE - Accessible                                   */
/* ============================================================ */

*:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

/* ============================================================ */
/* RESPONSIVE - Accessible                                      */
/* ============================================================ */

@media (max-width: 768px) {
    #accessibility-analyzer-container {
        padding: 12px;
    }
    
    .accessibility-header {
        margin: -12px -12px 12px -12px;
        padding: 1rem 1.25rem;
    }
    
    .accessibility-header .ac-stats-bar {
        flex-direction: column;
        gap: 6px;
    }
    
    .accessibility-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .accessibility-actions {
        flex-wrap: wrap;
    }
    
    .accessibility-actions .accessibility-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .ac-options {
        flex-direction: column;
        gap: 8px;
    }
    
    .ac-options select {
        width: 100%;
    }
    
    .issue-category-header {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 0.9rem;
        padding: 10px 14px;
    }
    
    .issue-item {
        flex-direction: column;
        gap: 4px;
        padding: 8px 0;
    }
    
    .issue-item .severity {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    #accessibility-analyzer-container {
        padding: 10px;
    }
    
    .accessibility-header {
        margin: -10px -10px 10px -10px;
        padding: 0.75rem 1rem;
    }
    
    .accessibility-header h3 {
        font-size: 1.1rem;
    }
    
    .accessibility-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .accessibility-actions .accessibility-btn {
        width: 100%;
        justify-content: center;
    }
    
    .accessibility-stats {
        flex-direction: column;
        gap: 4px;
    }
    
    .issue-category-body {
        padding: 8px 12px;
    }
    
    .issue-item .issue-text {
        font-size: 0.85rem;
    }
}

/* ============================================================ */
/* IMPRESSION - Accessible                                      */
/* ============================================================ */

@media print {
    #accessibility-analyzer-container {
        border: 1px solid #000;
        background: #fff;
    }
    
    .accessibility-btn {
        border: 1px solid #000;
        background: #fff !important;
        color: #000 !important;
    }
    
    .accessibility-debug {
        display: none !important;
    }
    
    .issue-category-header {
        background: #f1f5f9 !important;
    }
}

/* ============================================================ */
/* RÉDUCTION DE MOUVEMENT - Accessible                          */
/* ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .accessibility-spinner {
        animation: none;
        border-top-color: #4f46e5;
    }
}

/* ============================================================ */
/* CONTRAST ÉLEVÉ - Accessible                                  */
/* ============================================================ */

@media (prefers-contrast: high) {
    #accessibility-analyzer-container {
        border-width: 2px;
        border-color: #000;
    }
    
    .accessibility-btn {
        border-width: 2px;
    }
    
    .accessibility-btn-primary {
        background: #000;
        color: #fff;
        border-color: #000;
    }
    
    .accessibility-btn-secondary {
        background: #fff;
        color: #000;
        border-color: #000;
    }
    
    .issue-category {
        border-width: 2px;
        border-color: #000;
    }
    
    .issue-category-header {
        background: #f1f5f9;
    }
    
    .issue-category-header .badge {
        border: 1px solid #000;
    }
}