/* ===============================================
   ATYPIKIA - CSS Moderne pour Tests
   Interface inspirée d'index.php avec auto-scroll
   =============================================== */

/* Variables CSS selon charte graphique ATYPIKIA */
:root {
    /* Couleurs principales */
    --bg-primary: #FFFFFF;
    --bg-secondary: #FFF8F0;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    
    /* Couleurs officielles des troubles */
    --color-tdah-adulte: #F97316;
    --color-tdah-enfant: #FB923C;
    --color-tsa: #1E40AF;
    --color-hpi: #10B981;
    --color-bipolaire: #F59E0B;
    --color-psychose: #9333EA;
    --color-troubles-depressifs-adulte: #2E4A7A;
    --color-troubles-anxieux-adulte: #38B2AC;
    --color-aspd: #6B7280;
    
    /* Couleurs d'interface */
    --color-blue-royal: #1E40AF;
    --color-success: #10B981;
    --color-error: #EF4444;
    --color-warning: #F97316;
    
    /* Espacements */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* Bordures et ombres */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);
}

/* Dark mode */
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #1A1A1A;
    --text-primary: #FFFFFF;
    --text-secondary: #FFF8F0;
    --border-color: #333333;
    --color-tsa: #3B82F6;
    --color-psychose: #A855F7;
    --color-troubles-depressifs-adulte: #2E4A7A;
    --color-troubles-anxieux-adulte: #38B2AC;
    --color-aspd: #9CA3AF;
}

/* ===============================================
   CONTAINER DIRECT SANS HERO
   =============================================== */

/* Override pour les pages de test - supprime les marges du main-content */
.test-page .main-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Override pour les sections de test */
.test-page section:first-of-type {
    margin-top: 80px !important;
}

.test-container-direct {
    background: var(--bg-secondary);
    min-height: calc(100vh - 80px);
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.test-container-direct .container {
    padding-top: 0;
}

/* Titre du test complet */
.test-header-info {
    margin-bottom: var(--space-8);
    text-align: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(255, 255, 255, 0.8) 100%);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.test-title-main {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    line-height: 1.2;
}

.test-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    line-height: 1.4;
}

.test-module-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: center;
}

.test-module-info strong {
    color: var(--color-blue-royal);
    font-size: 1.125rem;
    font-weight: 600;
}

.test-module-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-style: italic;
}

@media (max-width: 1024px) {
    .test-title-main {
        font-size: 1.5rem;
    }
    
    .test-subtitle {
        font-size: 1rem;
    }
    
    .test-header-info {
        padding: var(--space-4);
    }
}

.test-progress-simple {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.progress-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-percentage {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--test-color, var(--color-blue-royal));
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill,
.test-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--test-color, var(--color-blue-royal)), rgba(var(--test-color-rgb, 30, 64, 175), 0.7));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.test-progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--test-color, var(--color-blue-royal));
}

/* ===============================================
   HERO SECTION MODERNE POUR TESTS
   =============================================== */

.test-hero-modern {
    position: relative;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    padding: var(--space-12) 0 var(--space-8);
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.test-hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.test-hero-particle {
    position: absolute;
    background: var(--test-color, var(--color-blue-royal));
    border-radius: 50%;
    opacity: 0.1;
    animation: float var(--duration, 8s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.test-hero-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    text-align: center;
}

.test-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    padding: var(--space-2) var(--space-5);
    margin-bottom: var(--space-6);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

[data-theme="dark"] .test-hero-badge {
    background: rgba(26, 26, 26, 0.9);
}

.test-hero-badge-icon {
    width: 20px;
    height: 20px;
    color: var(--test-color, var(--color-blue-royal));
}

.test-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    line-height: 1.1;
}

.test-hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.test-progress-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.test-progress-bar {
    flex: 1;
    max-width: 400px;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.test-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--test-color, var(--color-blue-royal)), rgba(var(--test-color, var(--color-blue-royal)), 0.7));
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
}

.test-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.test-progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===============================================
   CONTENEUR PRINCIPAL DU TEST
   =============================================== */

.test-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

.test-module-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.test-module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--test-color, var(--color-blue-royal)), rgba(var(--test-color, var(--color-blue-royal)), 0.7));
}

.test-module-header {
    text-align: center;
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.test-module-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.test-module-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.test-module-meta {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-4);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.test-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.test-meta-icon {
    color: var(--test-color, var(--color-blue-royal));
}

/* ===============================================
   QUESTIONS ET RÉPONSES MODERNES
   =============================================== */

.test-questions-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.test-question-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    margin-bottom: var(--space-4);
}

.test-question-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--test-color, var(--color-blue-royal));
}

.test-question-card.focused {
    border-color: var(--test-color, var(--color-blue-royal));
    background: rgba(var(--test-color-rgb, 30, 64, 175), 0.05);
    box-shadow: 0 0 0 3px rgba(var(--test-color-rgb, 30, 64, 175), 0.15);
}

.test-question-card.answered {
    border-color: var(--test-color, var(--color-blue-royal));
    background: rgba(var(--test-color-rgb, 30, 64, 175), 0.02);
}

.test-question-card.answered::before {
    content: '';
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 24px;
    height: 24px;
    background: var(--test-color, var(--color-blue-royal));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-question-card.answered::after {
    content: '✓';
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 24px;
    height: 24px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.test-question-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.test-question-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: var(--test-color, var(--color-blue-royal));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.test-question-text {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.6;
}

.test-answers-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.test-answer-option {
    position: relative;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 56px;
    box-shadow: var(--shadow-sm);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.test-answer-option:hover {
    border-color: var(--test-color, var(--color-blue-royal));
    background: rgba(var(--test-color-rgb, 30, 64, 175), 0.1);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.test-answer-option.selected {
    border-color: var(--test-color, var(--color-blue-royal));
    background: var(--test-color, var(--color-blue-royal));
    color: white;
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}

.test-answer-option.selected .test-answer-text {
    color: white;
    font-weight: 600;
}

/* Icône de validation pour les réponses sélectionnées */
.test-answer-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    right: var(--space-4);
    transform: translateY(-50%);
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    opacity: 0.9;
}

.test-answer-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    transition: all 0.3s ease;
    flex: 1;
    pointer-events: none;
}

/* Style spécial pour "Je ne sais pas" */
.test-answer-option[data-value="dont_know"] {
    border-style: dashed;
    border-color: var(--text-secondary);
    background: rgba(var(--text-secondary-rgb, 107, 114, 128), 0.05);
}

.test-answer-option[data-value="dont_know"] .test-answer-text {
    color: var(--text-secondary);
    font-style: italic;
}

.test-answer-option[data-value="dont_know"]:hover {
    border-color: var(--text-secondary);
    background: rgba(var(--text-secondary-rgb, 107, 114, 128), 0.1);
}

.test-answer-option[data-value="dont_know"].selected {
    border-color: var(--text-secondary);
    background: var(--text-secondary);
    color: white;
}

/* ===============================================
   NAVIGATION DU TEST
   =============================================== */

.test-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-color);
}

.test-nav-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.test-nav-button:hover {
    border-color: var(--test-color, var(--color-blue-royal));
    background: rgba(var(--test-color-rgb, 30, 64, 175), 0.05);
    transform: translateY(-1px);
}

.test-nav-button.primary {
    background: var(--test-color, var(--color-blue-royal));
    border-color: var(--test-color, var(--color-blue-royal));
    color: white;
}

.test-nav-button.primary:hover {
    background: rgba(var(--test-color-rgb, 30, 64, 175), 0.9);
    transform: translateY(-1px);
}

.test-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.test-nav-button:disabled:hover {
    border-color: var(--border-color);
    background: var(--bg-primary);
    transform: none;
}

/* ===============================================
   MESSAGES ET ALERTES
   =============================================== */

.test-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    font-size: 0.875rem;
    line-height: 1.5;
}

.test-alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.test-alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--color-error);
}

.test-alert-warning {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
    color: var(--color-warning);
}

.test-alert-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* ===============================================
   ANIMATIONS ET TRANSITIONS
   =============================================== */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.test-animate-in {
    animation: slideInUp 0.6s ease-out;
}

.test-fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* ===============================================
   SCROLL AUTO ET SMOOTH
   =============================================== */

html {
    scroll-behavior: smooth;
}

.scroll-target {
    scroll-margin-top: 100px;
}

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

@media (max-width: 1024px) {
    .test-hero-title {
        font-size: 2rem;
    }
    
    .test-hero-subtitle {
        font-size: 1.125rem;
    }
    
    .test-container {
        padding: var(--space-6) var(--space-4);
    }
    
    .test-module-card {
        padding: var(--space-6);
    }
    
    .test-progress-container {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .test-progress-bar {
        max-width: 100%;
    }
    
    .test-navigation {
        flex-direction: column;
        gap: var(--space-4);
    }
    
    .test-nav-button {
        width: 100%;
        justify-content: center;
    }
    
    .test-question-header {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .test-question-number {
        align-self: flex-start;
    }
    
    .test-module-meta {
        flex-direction: column;
        gap: var(--space-3);
    }
}

/* ===============================================
   COULEURS SPÉCIFIQUES PAR TROUBLE
   =============================================== */

/* TDAH Adulte */
.test-tdah-adulte {
    --test-color: var(--color-tdah-adulte);
    --test-color-rgb: 249, 115, 22;
}

/* TDAH Enfant */
.test-tdah-enfant {
    --test-color: var(--color-tdah-enfant);
    --test-color-rgb: 251, 146, 60;
}

/* TSA */
.test-tsa-adulte {
    --test-color: var(--color-tsa);
    --test-color-rgb: 30, 64, 175;
}

[data-theme="dark"] .test-tsa-adulte {
    --test-color: #3B82F6;
    --test-color-rgb: 59, 130, 246;
}

/* HPI */
.test-hpi-adulte {
    --test-color: var(--color-hpi);
    --test-color-rgb: 16, 185, 129;
}

/* Bipolaire */
.test-bipolaire-adulte {
    --test-color: var(--color-bipolaire);
    --test-color-rgb: 245, 158, 11;
}

/* Psychose */
.test-psychose-adulte {
    --test-color: var(--color-psychose);
    --test-color-rgb: 147, 51, 234;
}

[data-theme="dark"] .test-psychose-adulte {
    --test-color: #A855F7;
    --test-color-rgb: 168, 85, 247;
}

/* ASPD */
.test-aspd-adulte {
    --test-color: var(--color-aspd);
    --test-color-rgb: 107, 114, 128;
}

[data-theme="dark"] .test-aspd-adulte {
    --test-color: #9CA3AF;
    --test-color-rgb: 156, 163, 175;
}
/* Styles spécifiques troubles-depressifs adulte */
.test-troubles-depressifs-adulte {
    --primary-color: var(--color-troubles-depressifs-adulte);
}

.result-troubles-depressifs-adulte {
    --primary-color: var(--color-troubles-depressifs-adulte);
}

.analyzing-troubles-depressifs-adulte {
    --primary-color: var(--color-troubles-depressifs-adulte);
}

/* Styles spécifiques troubles-depressifs adulte */
.test-troubles-depressifs-adulte {
    --primary-color: var(--color-troubles-depressifs-adulte);
}

.result-troubles-depressifs-adulte {
    --primary-color: var(--color-troubles-depressifs-adulte);
}

.analyzing-troubles-depressifs-adulte {
    --primary-color: var(--color-troubles-depressifs-adulte);
}

/* Styles spécifiques troubles-anxieux adulte */
.test-troubles-anxieux-adulte {
    --primary-color: var(--color-troubles-anxieux-adulte);
}

.result-troubles-anxieux-adulte {
    --primary-color: var(--color-troubles-anxieux-adulte);
}

.analyzing-troubles-anxieux-adulte {
    --primary-color: var(--color-troubles-anxieux-adulte);
}

/* Styles spécifiques troubles-anxieux adulte */
.test-troubles-anxieux-adulte {
    --primary-color: var(--color-troubles-anxieux-adulte);
}

.result-troubles-anxieux-adulte {
    --primary-color: var(--color-troubles-anxieux-adulte);
}

.analyzing-troubles-anxieux-adulte {
    --primary-color: var(--color-troubles-anxieux-adulte);
}
