import 'package:flutter/material.dart';
import '../colors/app_colors.dart';
import '../strings/quiz_strings.dart';
import '../strings/quiz_ui_strings.dart';

import 'quiz_checklist_screen.dart';
import 'quiz_question_screen.dart';
import 'quiz_result.dart';
import 'quiz_video_guide.dart';

/// Recorta/zoom numa zona específica de uma foto de rosto (ex.: só a zona
/// dos olhos), também sem precisar de um novo ficheiro de imagem.
Widget _zoomCrop(
  String path, {
  Alignment alignment = Alignment.center,
  double scale = 2.0,
  // Alinhamento do próprio Image.asset ao aplicar o BoxFit.cover — separado
  // do alignment do Transform.scale acima, porque o cover já decide (antes
  // do zoom) que fatia vertical/horizontal da foto original mostrar; se essa
  // fatia inicial não incluir a zona pretendida (ex.: queixo cortado fora),
  // nenhum scale/alignment do Transform consegue "recuperar" esses pixels.
  Alignment imageAlignment = Alignment.center,
}) {
  return ClipRect(
    child: Transform.scale(
      scale: scale,
      alignment: alignment,
      child: Image.asset(path, fit: BoxFit.cover, alignment: imageAlignment),
    ),
  );
}

/// Transição entre perguntas do quiz — fade + leve deslize para cima, no
/// mesmo estilo do [FadeSlideIn] já usado dentro de cada ecrã, em vez do
/// slide-from-right abrupto padrão do Material ao navegar entre perguntas.
Route<void> quizPageRoute({required WidgetBuilder builder}) {
  return PageRouteBuilder<void>(
    transitionDuration: const Duration(milliseconds: 320),
    reverseTransitionDuration: const Duration(milliseconds: 220),
    pageBuilder: (context, animation, secondaryAnimation) =>
        builder(context),
    transitionsBuilder: (context, animation, secondaryAnimation, child) {
      final fade = CurvedAnimation(parent: animation, curve: Curves.easeOut);
      final slide = Tween<Offset>(
        begin: const Offset(0, 0.04),
        end: Offset.zero,
      ).animate(CurvedAnimation(parent: animation, curve: Curves.easeOutCubic));
      return FadeTransition(
        opacity: fade,
        child: SlideTransition(position: slide, child: child),
      );
    },
  );
}

/// Rota inicial do quiz: mostra primeiro o ecrã de checklist explicativo,
/// só depois a pergunta 1 — usada em todos os pontos de entrada do quiz
/// em vez de navegar diretamente para [Quiz1Screen].
Route<void> quizStartRoute({String? scopeId}) {
  return quizPageRoute(
    builder: (_) => QuizChecklistScreen(
      heading: QuizStrings.checklistHeading,
      items: const [
        QuizStrings.checklistItem1,
        QuizStrings.checklistItem2,
        QuizStrings.checklistItem3,
      ],
      onAdvance: (context) => Navigator.of(context).pushReplacement(
        quizPageRoute(builder: (_) => Quiz1Screen(scopeId: scopeId)),
      ),
    ),
  );
}

// Quiz 1: Problemas respiratórios (Yes/No)
class Quiz1Screen extends StatelessWidget {
  const Quiz1Screen({
    super.key,
    this.currentScore = const QuizScore(),
    this.scopeId,
  });

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(1, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q1Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q1YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q1NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 6,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz2Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: false,
    );
  }
}

// Quiz 2: Respira pela boca (Yes/No)
class Quiz2Screen extends StatelessWidget {
  const Quiz2Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(2, 29),
      fallbackColor: AppColors.teal,
      question: QuizStrings.q2Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q2YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q2NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 10,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz3Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 3: Ressonar (Yes/No)
class Quiz3Screen extends StatelessWidget {
  const Quiz3Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(3, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q3Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q3YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q3NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 8,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz4Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 4: Nariz tapado (Yes/No)
class Quiz4Screen extends StatelessWidget {
  const Quiz4Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(4, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q4Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q4YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q4NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 1,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz5Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 5: Interrupções respiração (Yes/No)
class Quiz5Screen extends StatelessWidget {
  const Quiz5Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(5, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q5Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q5YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q5NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 7,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz6Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 6: Range os dentes (Yes/No)
class Quiz6Screen extends StatelessWidget {
  const Quiz6Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(6, 29),
      fallbackColor: AppColors.teal,
      question: QuizStrings.q6Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q6YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q6NoDescription,
          weight: 1,
          value: 'nao',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz7Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 7: Alergias sazonais (Yes/No)
class Quiz7Screen extends StatelessWidget {
  const Quiz7Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(7, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q7Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q7YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q7NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 2,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz8Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 8: Saliva seca (Yes/No)
class Quiz8Screen extends StatelessWidget {
  const Quiz8Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(8, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q8Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q8YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q8NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 9,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz9Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 9: Otites (Yes/No)
class Quiz9Screen extends StatelessWidget {
  const Quiz9Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(9, 29),
      fallbackColor: AppColors.teal,
      question: QuizStrings.q9Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q9YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q9NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 3,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz10Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 10: Amigdalites (Yes/No)
class Quiz10Screen extends StatelessWidget {
  const Quiz10Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(10, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q10Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q10YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q10NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 4,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz11Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 11: Bronquiolites (Yes/No)
class Quiz11Screen extends StatelessWidget {
  const Quiz11Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(11, 29),
      fallbackColor: AppColors.teal,
      question: QuizStrings.q11Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q11YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q11NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 5,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz12Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 12: Dificuldades a mastigar (Yes/No)
class Quiz12Screen extends StatelessWidget {
  const Quiz12Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(12, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q12Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q12YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q12NoDescription,
          weight: 1,
          value: 'nao',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz13Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 13: Lento a comer (Yes/No)
class Quiz13Screen extends StatelessWidget {
  const Quiz13Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(13, 29),
      fallbackColor: AppColors.teal,
      question: QuizStrings.q13Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q13YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q13NoDescription,
          weight: 1,
          value: 'nao',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz14Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 14: Prefere alimentos moles (Yes/No)
class Quiz14Screen extends StatelessWidget {
  const Quiz14Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(14, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q14Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q14YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q14NoDescription,
          weight: 1,
          value: 'nao',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz15Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 15: Alimentado por biberão (Yes/No)
class Quiz15Screen extends StatelessWidget {
  const Quiz15Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(15, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q15Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q15YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q15NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 11,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz16Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 16: Chupeta (Yes/No)
class Quiz16Screen extends StatelessWidget {
  const Quiz16Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(16, 29),
      fallbackColor: AppColors.teal,
      question: QuizStrings.q16Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q16YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q16NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 12,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz17Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 17: Chucha o dedo (Yes/No)
class Quiz17Screen extends StatelessWidget {
  const Quiz17Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(17, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q17Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.yes,
          description: QuizStrings.q17YesDescription,
          weight: 2,
          value: 'sim',
        ),
        QuizAnswer(
          title: QuizStrings.no,
          description: QuizStrings.q17NoDescription,
          weight: 1,
          value: 'nao',
        ),
        QuizAnswer(
          title: QuizStrings.dontKnow,
          description: QuizStrings.dontKnowDescription,
          weight: 1,
          value: 'nao_sei',
          helpVideoId: 13,
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => QuizVideoGuideScreen(
          youtubeId: 'W2BcK9nSyt0',
          onAdvance: (ctx) => Navigator.of(ctx).pushReplacement(
            quizPageRoute(
              builder: (_) =>
                  Quiz18Screen(currentScore: nextScore, scopeId: scopeId),
            ),
          ),
        ),
      ),
      answerType: QuizAnswerType.yesNo,
      showBackButton: true,
    );
  }
}

// Quiz 18: Postura (Image-choice)
class Quiz18Screen extends StatelessWidget {
  const Quiz18Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(18, 29),
      fallbackColor: AppColors.pink,
      answerImageAspectRatio: 1.5,
      question: QuizStrings.q18Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.q18Answer1Title,
          description: QuizStrings.q18Answer1Description,
          weight: 2,
          hideTitle: true,
          value: 'postura_inadequada',
          imagePath: 'assets/mockup_images/0.1.png',
        ),
        QuizAnswer(
          title: QuizStrings.q18Answer2Title,
          description: QuizStrings.q18Answer2Description,
          weight: 1,
          hideTitle: true,
          value: 'postura_correta',
          imagePath: 'assets/mockup_images/0.png',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz19Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 19: Perfil (Image-choice)
class Quiz19Screen extends StatelessWidget {
  const Quiz19Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(19, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q19Question,
      answers: [
        QuizAnswer(
          title: QuizStrings.q19Answer1Title,
          description: QuizStrings.q19Answer1Description,
          weight: 2,
          hideTitle: true,
          value: 'perfil_convexo',
          imageBuilder: (context) => _zoomCrop(
            'assets/mockup_images/1.jpeg',
            alignment: const Alignment(0.1, 0.7),
            scale: 1.05,
          ),
        ),
        QuizAnswer(
          title: QuizStrings.q19Answer2Title,
          description: QuizStrings.q19Answer2Description,
          weight: 1,
          hideTitle: true,
          value: 'perfil_reto',
          imageBuilder: (context) => _zoomCrop(
            'assets/mockup_images/2.jpeg',
            alignment: const Alignment(0.1, 0.7),
            scale: 1.05,
          ),
        ),
        QuizAnswer(
          title: QuizStrings.q19Answer3Title,
          description: QuizStrings.q19Answer3Description,
          weight: 2,
          hideTitle: true,
          value: 'perfil_concavo',
          imageBuilder: (context) => _zoomCrop(
            'assets/mockup_images/3.jpeg',
            alignment: const Alignment(0.1, 0.7),
            scale: 1.05,
          ),
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz20Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 20: Boca habitual (Image-choice)
class Quiz20Screen extends StatelessWidget {
  const Quiz20Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(20, 29),
      fallbackColor: AppColors.teal,
      question: QuizStrings.q20Question,
      answers: [
        const QuizAnswer(
          title: QuizStrings.q20Answer1Title,
          description: QuizStrings.q20Answer1Description,
          weight: 1,
          hideTitle: true,
          value: 'boca_fechada',
          imagePath: 'assets/mockup_images/7.png',
        ),
        QuizAnswer(
          title: QuizStrings.q20Answer2Title,
          description: QuizStrings.q20Answer2Description,
          weight: 2,
          hideTitle: true,
          value: 'boca_entreaberta',
          imageBuilder: (context) => _zoomCrop(
            'assets/mockup_images/4.jpeg',
            alignment: const Alignment(0, 0.45),
            scale: 1.8,
          ),
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz21Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 21: Zona abaixo dos olhos (Image-choice)
class Quiz21Screen extends StatelessWidget {
  const Quiz21Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(21, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q21Question,
      answers: [
        QuizAnswer(
          title: QuizStrings.q21Answer1Title,
          description: QuizStrings.q21Answer1Description,
          weight: 1,
          hideTitle: true,
          value: 'sem_olheiras',
          imageBuilder: (context) => _zoomCrop(
            'assets/mockup_images/9.png',
            alignment: const Alignment(0, -0.55),
            scale: 2.3,
          ),
        ),
        QuizAnswer(
          title: QuizStrings.q21Answer2Title,
          description: QuizStrings.q21Answer2Description,
          weight: 2,
          hideTitle: true,
          value: 'com_olheiras',
          imageBuilder: (context) => _zoomCrop(
            'assets/mockup_images/8.jpeg',
            alignment: const Alignment(0, -0.55),
            scale: 2.3,
          ),
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz22Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 22: Queixo com a boca fechada (Image-choice)
class Quiz22Screen extends StatelessWidget {
  const Quiz22Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(22, 29),
      fallbackColor: AppColors.pink,
      isSignQuestion: true,
      question: QuizStrings.q22Question,
      answers: [
        QuizAnswer(
          title: QuizStrings.q22Answer1Title,
          description: QuizStrings.q22Answer1Description,
          weight: 1,
          hideTitle: true,
          value: 'queixo_correto',
          imageBuilder: (context) => _zoomCrop(
            'assets/mockup_images/5.png',
            imageAlignment: const Alignment(0, 1),
            alignment: const Alignment(0, 1),
            scale: 1.8,
          ),
        ),
        const QuizAnswer(
          title: QuizStrings.q22Answer2Title,
          description: QuizStrings.q22Answer2Description,
          weight: 2,
          hideTitle: true,
          value: 'queixo_tenso',
          imagePath: 'assets/mockup_images/6.jpeg',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => QuizVideoGuideScreen(
          youtubeId: 'msKYr7nPxcw',
          onAdvance: (ctx) => Navigator.of(ctx).pushReplacement(
            quizPageRoute(
              builder: (_) =>
                  Quiz23Screen(currentScore: nextScore, scopeId: scopeId),
            ),
          ),
        ),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 23: Boca / dentição (Image-choice)
class Quiz23Screen extends StatelessWidget {
  const Quiz23Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(23, 29),
      fallbackColor: AppColors.teal,
      isSignQuestion: true,
      question: QuizStrings.q23Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.q23Answer1Title,
          description: QuizStrings.q23Answer1Description,
          weight: 2,
          hideTitle: true,
          value: 'dentes_sobrepostos',
          imagePath: 'assets/mockup_images/10.png',
        ),
        QuizAnswer(
          title: QuizStrings.q23Answer2Title,
          description: QuizStrings.q23Answer2Description,
          weight: 1,
          hideTitle: true,
          value: 'dentes_alinhados',
          imagePath: 'assets/mockup_images/11.png',
        ),
        QuizAnswer(
          title: QuizStrings.q23Answer3Title,
          description: QuizStrings.q23Answer3Description,
          weight: 2,
          hideTitle: true,
          value: 'dentes_desalinhados',
          imagePath: 'assets/mockup_images/13.png',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz24Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 24: Apinhamento visto de perto (Image-choice)
class Quiz24Screen extends StatelessWidget {
  const Quiz24Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(24, 29),
      fallbackColor: AppColors.teal,
      isSignQuestion: true,
      question: QuizStrings.q24Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.q24Answer1Title,
          description: QuizStrings.q24Answer1Description,
          weight: 2,
          hideTitle: true,
          value: 'apinhamento_moderado',
          imagePath: 'assets/mockup_images/16.png',
        ),
        QuizAnswer(
          title: QuizStrings.q24Answer2Title,
          description: QuizStrings.q24Answer2Description,
          weight: 1,
          hideTitle: true,
          value: 'apinhamento_leve',
          imagePath: 'assets/mockup_images/15.png',
        ),
        QuizAnswer(
          title: QuizStrings.q24Answer3Title,
          description: QuizStrings.q24Answer3Description,
          weight: 2,
          hideTitle: true,
          value: 'apinhamento_acentuado',
          imagePath: 'assets/mockup_images/14.jpeg',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz25Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 25: Freio labial (Image-choice)
class Quiz25Screen extends StatelessWidget {
  const Quiz25Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(25, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q25Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.q25Answer1Title,
          description: QuizStrings.q25Answer1Description,
          weight: 1,
          hideTitle: true,
          value: 'freio_labial_correto',
          imagePath: 'assets/mockup_images/20.png',
        ),
        QuizAnswer(
          title: QuizStrings.q25Answer2Title,
          description: QuizStrings.q25Answer2Description,
          weight: 2,
          hideTitle: true,
          value: 'freio_labial_inadequado',
          imagePath: 'assets/mockup_images/19.jpeg',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz26Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 26: Freio lingual (Image-choice)
class Quiz26Screen extends StatelessWidget {
  const Quiz26Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(26, 29),
      fallbackColor: AppColors.pink,
      question: QuizStrings.q26Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.q26Answer1Title,
          description: QuizStrings.q26Answer1Description,
          weight: 2,
          hideTitle: true,
          value: 'freio_lingual_inadequado',
          imagePath: 'assets/mockup_images/17.png',
        ),
        QuizAnswer(
          title: QuizStrings.q26Answer2Title,
          description: QuizStrings.q26Answer2Description,
          weight: 1,
          hideTitle: true,
          value: 'freio_lingual_correto',
          imagePath: 'assets/mockup_images/18.jpeg',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz27Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 27: Boca / dentição (Image-choice)
class Quiz27Screen extends StatelessWidget {
  const Quiz27Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(27, 29),
      fallbackColor: AppColors.teal,
      isSignQuestion: true,
      question: QuizStrings.q27Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.q27Answer1Title,
          description: QuizStrings.q27Answer1Description,
          weight: 2,
          hideTitle: true,
          value: 'dentes_desalinhados_3',
          imagePath: 'assets/mockup_images/23.JPEG',
        ),
        QuizAnswer(
          title: QuizStrings.q27Answer2Title,
          description: QuizStrings.q27Answer2Description,
          weight: 2,
          hideTitle: true,
          value: 'dentes_sobrepostos_3',
          imagePath: 'assets/mockup_images/24.png',
        ),
        QuizAnswer(
          title: QuizStrings.q27Answer3Title,
          description: QuizStrings.q27Answer3Description,
          weight: 1,
          hideTitle: true,
          value: 'dentes_alinhados_3',
          imagePath: 'assets/mockup_images/25.jpg',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz28Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 28: Boca / dentição 2 (Image-choice)
class Quiz28Screen extends StatelessWidget {
  const Quiz28Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(28, 29),
      fallbackColor: AppColors.teal,
      isSignQuestion: true,
      question: QuizStrings.q28Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.q28Answer1Title,
          description: QuizStrings.q28Answer1Description,
          weight: 1,
          hideTitle: true,
          value: 'dentes_alinhados_2',
          imagePath: 'assets/mockup_images/29.jpeg',
        ),
        QuizAnswer(
          title: QuizStrings.q28Answer2Title,
          description: QuizStrings.q28Answer2Description,
          weight: 2,
          hideTitle: true,
          value: 'dentes_desalinhados_2',
          imagePath: 'assets/mockup_images/28.jpeg',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => Quiz29Screen(currentScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      showBackButton: true,
    );
  }
}

// Quiz 29: Céu da boca (Image-choice, final)
class Quiz29Screen extends StatelessWidget {
  const Quiz29Screen({super.key, required this.currentScore, this.scopeId});

  final QuizScore currentScore;
  final String? scopeId;

  @override
  Widget build(BuildContext context) {
    return QuizQuestionScreen(
      title: QuizUiStrings.quizProgress(29, 29),
      fallbackColor: AppColors.pink,
      isSignQuestion: true,
      correctBadgeLabel: QuizStrings.q29CorrectBadgeLabel,
      question: QuizStrings.q29Question,
      answers: const [
        QuizAnswer(
          title: QuizStrings.q29Answer1Title,
          description: QuizStrings.q29Answer1Description,
          weight: 2,
          hideTitle: true,
          value: 'palato_v',
          imagePath: 'assets/mockup_images/26.png',
        ),
        QuizAnswer(
          title: QuizStrings.q29Answer2Title,
          description: QuizStrings.q29Answer2Description,
          weight: 1,
          hideTitle: true,
          value: 'palato_u',
          imagePath: 'assets/mockup_images/27.png',
        ),
      ],
      currentScore: currentScore,
      nextRoute: (context, nextScore) => quizPageRoute(
        builder: (_) => QuizResultScreen(finalScore: nextScore, scopeId: scopeId),
      ),
      answerType: QuizAnswerType.image,
      isFinal: true,
      showBackButton: true,
    );
  }
}
