/* ============================================
   AUTO-ÉVALUATION TDAH - Styles
   @le.neuropsy
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --blue: #5B8FB9;
    --blue-light: #B6D0E2;
    --blue-pale: #E8F1F8;
    --mint: #7EC8A9;
    --mint-light: #D4F0E7;
    --gray-50: #FAFBFC;
    --gray-100: #F5F6F8;
    --gray-200: #E8ECF0;
    --gray-300: #D1D8E0;
    --gray-400: #B0BEC5;
    --gray-500: #8494A0;
    --gray-600: #607080;
    --gray-700: #455A64;
    --gray-800: #2C3E50;
    --cream: #FFFDF7;
    --white: #FFFFFF;
    --green: #27AE60;
    --green-light: #E8F8F0;
    --yellow: #F1C40F;
    --yellow-light: #FEF9E7;
    --orange: #E67E22;
    --orange-light: #FDF2E9;
    --red: #E74C3C;
    --red-light: #FDEDEC;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
    --max-width: 720px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    height: 36px;
    width: auto;
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-800);
}

.header-nav {
    display: flex;
    gap: 4px;
}

.nav-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.nav-btn:hover {
    background: var(--gray-100);
    color: var(--blue);
}

.nav-btn.active {
    color: var(--blue);
    background: var(--blue-pale);
}

/* --- Progress Bar --- */
.progress-container {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 8px 20px;
    position: sticky;
    top: 61px;
    z-index: 99;
}

.progress-bar {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--mint));
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-text {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 4px;
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
}

/* --- Main Content --- */
.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 20px 40px;
    min-height: calc(100vh - 200px);
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    margin-bottom: 20px;
}

/* --- Welcome Page --- */
.welcome-card {
    text-align: center;
}

.welcome-hero {
    margin: -28px -24px 20px;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}

.welcome-hero-img {
    width: 100%;
    height: auto;
    display: block;
}

.welcome-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
    line-height: 1.3;
}

.welcome-subtitle {
    color: var(--gray-500);
    font-size: 1rem;
    margin-bottom: 28px;
}

/* Rubrique preview grid */
.welcome-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 6px;
    text-align: center;
}

.welcome-section-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

.welcome-rubriques-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.welcome-rubrique-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    border-left: 3px solid var(--gray-300);
    text-align: left;
}

.welcome-rubrique-item img {
    width: 48px;
    height: auto;
    border-radius: 6px;
    flex-shrink: 0;
}

.welcome-rubrique-item span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-700);
    line-height: 1.3;
}

/* Guide card on welcome page */
.welcome-guide-card {
    background: linear-gradient(135deg, var(--blue-pale), var(--mint-light));
}

.welcome-guide-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
}

.welcome-guide-img {
    width: 100px;
    height: auto;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.welcome-guide-inner h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.welcome-guide-inner p {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin-bottom: 12px;
}

/* Sources card */
.welcome-sources-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.sources-text {
    font-size: 0.72rem;
    color: var(--gray-400);
    line-height: 1.6;
    text-align: left;
}

.sources-text i {
    font-style: italic;
}

.info-box {
    text-align: left;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.info-box p {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: 4px;
    line-height: 1.5;
}

.info-box strong {
    font-size: 0.9rem;
    color: var(--gray-800);
}

.info-disclaimer {
    background: var(--orange-light);
    border: 1px solid #F5CBA7;
}

.info-privacy {
    background: var(--green-light);
    border: 1px solid #A9DFBF;
}

.info-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.welcome-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 24px 0;
    align-items: center;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: #4A7FA9;
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--blue-pale);
    color: var(--blue);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--blue-light);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-500);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-danger {
    background: var(--red-light);
    color: var(--red);
}

.btn-danger:hover:not(:disabled) {
    background: #F5B7B1;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.resume-banner {
    background: var(--blue-pale);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.resume-banner p {
    font-size: 0.9rem;
    color: var(--gray-700);
    font-weight: 500;
}

.link-pro {
    display: inline-block;
    margin-top: 20px;
    color: var(--blue);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.link-pro:hover {
    color: #4A7FA9;
    text-decoration: underline;
}

/* --- Questionnaire --- */
.questionnaire-card {
    padding: 24px 20px;
}

.section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-100);
}

.section-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--blue-pale);
    color: var(--blue);
    margin-bottom: 8px;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.section-desc {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* --- Question Item --- */
.question-item {
    padding: 18px 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.question-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 12px;
    line-height: 1.5;
}

.question-number {
    color: var(--blue);
    font-weight: 600;
    margin-right: 6px;
}

.question-text b {
    font-weight: 600;
}

.question-detail {
    display: block;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--gray-500);
    font-weight: 400;
    margin-top: 4px;
    line-height: 1.4;
}

.options-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.option-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-family: var(--font);
    font-size: 0.78rem;
    color: var(--gray-600);
    line-height: 1.3;
}

.option-btn:hover {
    border-color: var(--blue-light);
    background: var(--blue-pale);
}

.option-btn.selected {
    border-color: var(--blue);
    background: var(--blue-pale);
    color: var(--blue);
    font-weight: 600;
}

.option-btn .option-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

/* --- Navigation Buttons --- */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

/* --- Transition Page --- */
.transition-card {
    text-align: center;
    padding: 40px 24px;
}

.transition-icon {
    margin-bottom: 20px;
}

.transition-card h2 {
    font-size: 1.3rem;
    color: var(--gray-800);
    margin-bottom: 16px;
}

.transition-text {
    font-size: 0.95rem;
    color: var(--gray-600);
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto 28px;
}

/* --- Results --- */
.results-intro-card {
    text-align: center;
    background: linear-gradient(135deg, var(--blue-pale), var(--mint-light));
}

.results-intro-card h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.results-reminder {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.6;
    max-width: 540px;
    margin: 0 auto;
}

.results-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 20px;
}

.scores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.score-block {
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.score-block-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.score-block-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.score-block-max {
    font-size: 0.8rem;
    opacity: 0.7;
}

.score-block-level {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
}

.chart-container {
    position: relative;
    margin: 16px 0;
    max-height: 300px;
}

.chart-radar-container {
    max-height: 380px;
}

/* Rubrique scores */
.rubrique-scores {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* New card-based rubrique display */
.rubrique-card {
    border-radius: var(--radius-sm);
    background: var(--white);
    border-left: 4px solid var(--gray-300);
    padding: 12px 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.rubrique-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.rubrique-img {
    width: 72px;
    height: auto;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
}

.rubrique-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rubrique-card-score {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rubrique-name {
    font-size: 0.88rem;
    font-weight: 600;
    min-width: 0;
}

.rubrique-chapter-label {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    align-self: flex-start;
}

.rubrique-bar-container {
    flex: 1;
    height: 10px;
    background: var(--gray-200);
    border-radius: 5px;
    overflow: hidden;
}

.rubrique-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

.rubrique-score-text {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

.rubrique-level {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.rubrique-chapter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Color classes */
.level-low { background: var(--green-light); color: var(--green); }
.level-moderate { background: var(--yellow-light); color: #D4AC0D; }
.level-high { background: var(--orange-light); color: var(--orange); }
.level-very-high { background: var(--red-light); color: var(--red); }

.bar-low { background: var(--green); }
.bar-moderate { background: var(--yellow); }
.bar-high { background: var(--orange); }
.bar-very-high { background: var(--red); }

/* Wellbeing */
.wellbeing-container {
    text-align: center;
}

.wellbeing-gauge {
    position: relative;
    width: 180px;
    height: 100px;
    margin: 0 auto 16px;
}

.wellbeing-score {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.wellbeing-label {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 14px;
    display: inline-block;
}

.wellbeing-img {
    width: 120px;
    height: auto;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.wellbeing-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 8px;
}

/* Total score */
#total-score-container {
    text-align: center;
    padding: 16px 0;
}

.total-score-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--blue);
}

.total-score-max {
    font-size: 1rem;
    color: var(--gray-400);
}

.total-score-bar {
    max-width: 400px;
    margin: 16px auto;
    height: 12px;
    background: var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
}

.total-score-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s ease;
}

/* Priorities */
.priorities-intro {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 16px;
}

.priority-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 4px solid var(--gray-300);
}

.priority-img {
    width: 64px;
    height: auto;
    border-radius: 8px;
    flex-shrink: 0;
}

.priority-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.priority-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--gray-800);
}

.priority-score {
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Buy button in priorities */
.btn-buy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    margin-top: 6px;
    white-space: nowrap;
}

.btn-buy:hover {
    opacity: 0.85;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Guide CTA at bottom of results */
.guide-cta {
    text-align: center;
    padding: 8px 0;
}

.guide-cta-img {
    width: 160px;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.guide-cta-text h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.guide-cta-text p {
    font-size: 0.9rem;
    color: var(--gray-500);
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto 20px;
}

.guide-cta .btn {
    display: inline-flex;
}

/* Results actions */
.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.results-disclaimer {
    text-align: center;
}

.results-disclaimer p {
    font-size: 0.8rem;
}

/* --- History --- */
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    margin-bottom: 8px;
    transition: var(--transition);
}

.history-item:hover {
    background: var(--blue-pale);
}

.history-date {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.history-scores {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.history-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.history-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: var(--font);
    transition: var(--transition);
}

.history-btn-view {
    background: var(--blue-pale);
    color: var(--blue);
}

.history-btn-view:hover {
    background: var(--blue-light);
}

.history-btn-delete {
    background: var(--gray-100);
    color: var(--gray-500);
}

.history-btn-delete:hover {
    background: var(--red-light);
    color: var(--red);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}

.empty-state p {
    margin: 12px 0 20px;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-800);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    z-index: 1000;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
    font-size: 0.85rem;
    color: var(--gray-500);
}

.footer p {
    margin-bottom: 4px;
}

.footer a {
    color: var(--blue);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .main-content {
        padding: 16px 12px 32px;
    }

    .card {
        padding: 20px 16px;
    }

    .welcome-card h1 {
        font-size: 1.25rem;
    }

    .welcome-hero {
        margin: -20px -16px 16px;
    }

    .welcome-rubriques-grid {
        grid-template-columns: 1fr;
    }

    .welcome-rubrique-item img {
        width: 40px;
    }

    .welcome-guide-inner {
        flex-direction: column;
        text-align: center;
    }

    .welcome-guide-img {
        width: 80px;
    }

    .scores-grid {
        grid-template-columns: 1fr;
    }

    .options-group {
        gap: 4px;
    }

    .option-btn {
        padding: 8px 4px;
        font-size: 0.72rem;
    }

    .option-btn .option-value {
        font-size: 0.95rem;
    }

    .rubrique-card-header {
        gap: 8px;
    }

    .rubrique-img {
        width: 56px;
    }

    .rubrique-chapter-label {
        font-size: 0.62rem;
        white-space: normal;
    }

    .rubrique-card-score {
        flex-wrap: wrap;
    }

    .rubrique-bar-container {
        flex: 1 0 60%;
    }

    .priority-img {
        width: 48px;
    }

    .guide-cta-img {
        width: 120px;
    }

    .results-actions {
        flex-direction: column;
    }

    .results-actions .btn {
        width: 100%;
    }

    .history-item {
        flex-wrap: wrap;
    }

    .history-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .nav-buttons {
        gap: 8px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* --- Accessibility --- */
.option-btn:focus-visible,
.btn:focus-visible,
.nav-btn:focus-visible,
.history-btn:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

/* Keyboard navigation visible styles */
*:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles for PDF */
@media print {
    .header, .footer, .nav-buttons, .results-actions, .progress-container {
        display: none !important;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }

    body {
        background: white;
    }
}
