/* =============================
   GÉNÉRAL / COMMUN À TOUTES LES PAGES
   ============================= */

/* Fontes, reset global */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

/* === CENTRAGE FLEX DU CONTENU PRINCIPAL === */

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start; /* On commence en haut */
  padding: 40px 15px; /* un peu d’espace autour */
  min-height: 100dvh;

  background-image: url("images/cabosse.jpg");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #f5f5f5;
}

.container_box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* =============================
   PAGE : index.php
   ============================= */

.navbar {
  width: 100%;
  height: 90px;
  background-color: rgba(255, 255, 255, 0.9);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 20;
}

.navbar-left {
  display: flex;
  align-items: center;
  text-transform: capitalize;
}

.navbar-text {
  font-size: 14px;
}

.navbar-logo {
  height: 75px;
  object-fit: contain;
  margin: 0px 15px;
  width: 150px;
}

.navbar-right .navbar-admin-btn {
  font-size: 14px;
  padding: 8px 15px;
}

.info_box {
  position: absolute;
  width: 800px;
  padding: 20px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0px 4px 8px 0 rgba(0, 0, 0, 0.2),
    0px 6px 20px 0 rgba(0, 0, 0, 0.19);
  transition: all ease 0.3s;
  z-index: 5;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.info_box .info_title {
  height: 50px;
  width: 100%;
  border-bottom: 1px solid lightgray;
  display: flex;
  align-items: center;
  padding: 0 30px;
  font-size: 20px;
  font-weight: 600;
}

.info_box .info_list {
  padding: 15px 35px;
  text-align: center;
}

.info_box .info_list .info {
  margin: 5px 0;
  font-size: 17px;
}

.info_box .info_list .info span {
  font-weight: 600;
  color: #6d071a;
}

.quiz-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
}

.quiz-code-input {
  padding: 10px;
  width: 100%;
  max-width: 300px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

.start_btn_button {
  font-size: 25px;
  font-weight: 500;
  color: #fff;
  padding: 15px 30px;
  outline: none;
  border: none;
  border-radius: 5px;
  background-color: #6d071a;
  cursor: pointer;
  transition: all ease 0.3s;
}

.start_btn_button:hover {
  background-color: #880921;
}

.info_list .copyright {
  text-align: center;
}

.info_box .buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.info_box .footer_logo {
  max-height: 100px;
  max-width: 100px;
}

/* BACKEND BUTTON */
.backend-access {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.backend-btn {
  background-color: #fff;
  color: #6d071a;
  border: 2px solid #6d071a;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 5px;
  text-decoration: none;
  transition: all ease 0.3s;
}

.backend-btn:hover {
  background-color: #6d071a;
  color: #fff;
}

/* =============================
   PAGE : login.php
   ============================= */

.login-container {
  background: white;
  padding: 40px 30px;
  border-radius: 10px;
  box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-container h2 {
  margin-bottom: 25px;
  color: #800000;
}

.form-group {
  text-align: left;
  margin-bottom: 20px;
}

label {
  font-weight: 500;
  margin-bottom: 5px;
  display: block;
  color: #333;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
}

.btn-primary {
  background-color: #800000;
  color: white;
  padding: 12px 25px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #a90000;
}

.alert {
  background-color: #f8d7da;
  color: #842029;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}

.btn-secondary {
  background-color: #4e4733;

  color: white;
  padding: 12px 25px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary:hover {
  background-color: #6d6347;
}

/* =============================
   PAGE : quiz.php
   ============================= */

.quiz_box {
  position: absolute;
  width: 800px;
  padding: 5px;
  transform: translate(-50%, -50%);
  background-color: white;
  border-radius: 10px;
  box-shadow: 0px 4px 8px 0 rgba(0, 0, 0, 0.2),
    0px 6px 20px 0 rgba(0, 0, 0, 0.19);
  transition: all ease 0.3s;
  z-index: 5;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.quiz_box header {
  position: relative;
  z-index: 99;
  height: 70px;
  padding: 0 30px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 5px 5px 0 0;
  box-shadow: 0px 3px 5px 1px rgba(0, 0, 0, 0.1);
}

.quiz_box header .title {
  font-size: 20px;
  font-weight: 600;
}

.quiz_box header .timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 205px;
  height: 45px;
  background: #ffcccc;
  border: 1px solid #ffb8b8;
  border-radius: 5px;
  padding: 0 8px;
}

.quiz_box header .timer .time_text {
  font-weight: 400;
  font-size: 17px;
  user-select: none;
}

.quiz_box header .timer .timer_sec {
  font-size: 18px;
  font-weight: 500;
  background: #343a40;
  height: 30px;
  width: 45px;
  color: #fff;
  text-align: center;
  line-height: 30px;
  border-radius: 5px;
  border: 1px solider #343a40;
}

.quiz_box header .time_line {
  position: absolute;
  bottom: 0px;
  left: 0px;
  height: 3px;
  background: #6d071a;
}

.time_line {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: #dc3545;
  width: 0%;
  transition: width 0s;
}

/* QUIZ SECTION */

.quiz_box section {
  padding: 25px 30px 20px 30px;
  background: #fff;
}

.quiz_box section .que_text {
  font-size: 25px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* TEXTE CSS */

.quiz_box section .option_list {
  padding: 20px 0;
  display: block;
}

.option_list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px 20px;
  justify-items: center;
  margin-top: 20px;
}

.option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  border: 2px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  width: 90%;
}

.option:hover {
  border-color: #6d071a;
  background-color: #fdf0f0;
}

.option img {
  max-width: 180px;
  height: auto;
  border-radius: 5px;
  margin-top: 10px;
}

section .option_list .option:hover {
  color: #570615;
  background: #ffcccc;
  border-color: #ffb8b8;
}

.option_list .option:last-child {
  margin-bottom: 0px;
}

.option_list .option .icon {
  height: 26px;
  width: 26px;
  border: 2px solid transparent;
  border-radius: 50%;
  text-align: center;
  font-size: 13px;
  line-height: 24px;
  pointer-events: none;
}

.option_list .option .icon.tick {
  border-color: #23903c;
  color: #155724;
  background: #d4edda;
}

.option_list .option .icon.cross {
  border-color: #a42834;
  color: #a42834;
  background: #f8d7da;
}

.option_list .option.correct {
  border-color: #23903c;
  color: #155724;
  background: #d4edda;
}

.option.correct {
  background: #c8e6c9;
  border: 2px solid #2e7d32;
  border-radius: 5px;
}

.option_list .option.incorrect {
  border-color: #a42834;
  color: #a42834;
  background: #f8d7da;
}

.option_list .option.disabled {
  pointer-events: none;
}

/* IMAGE CSS */

.option_list_img {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px 20px;
  justify-items: center;
  margin-top: 20px;
}

section .option_list_img .option_img {
  display: flex;
  cursor: pointer;
  transition: all ease 0.3s;
}

.option_list_img .option_img img {
  max-width: 200px;
  border: 3px solid transparent;
  pointer-events: none;
}

.option_list_img .option_img img.tick {
  border-color: #23903c;
}

.option_list_img .option_img img.cross {
  border-color: #a42834;
}

.option_list .option.correct {
  border-color: #23903c;
}

.option_list .option.incorrect {
  border-color: #a42834;
}

.option_list .option.disabled {
  pointer-events: none;
}

.description_box {
  text-align: center;
  display: none;
}

.description {
  text-align: left;
}

/* QUIZ FOOTER */

.quiz_box footer {
  height: 60px;
  width: 100%;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  justify-content: center;
}

.quiz_box footer .total_que span {
  display: flex;
  user-select: none;
}

label.selected {
  background-color: #e0e0e0;
  border-radius: 5px;
  padding: 5px;
  transition: background 0.3s ease;
}

#next-btn {
  margin-top: 10px;
}

.correct {
  background-color: #d4edda;
  border-left: 5px solid #28a745;
}

.incorrect {
  background-color: #f8d7da;
  border-left: 5px solid #dc3545;
}

.option.correct,
.option.incorrect {
  pointer-events: none;
}

.option.disabled {
  pointer-events: none;
  background-color: #f0f0f0;
  opacity: 0.6;
}

.option:hover {
  background-color: unset !important;
  cursor: default;
}

.next_btn,
.validate_btn {
  background-color: #fff;
  color: #6d071a;
  border: 2px solid #6d071a;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 5px;
  text-decoration: none;
  cursor: pointer;
  transition: all ease 0.3s;
}

.next_btn:hover,
.validate_btn:hover {
  background-color: #6d071a;
  color: #fff;
}

.radio-hide {
  display: none;
}

/* Grille 2x2 pour toutes les questions */
.option_list {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px 20px;
  justify-items: center;
  margin-top: 20px;
}

/* Carte de chaque réponse */
.option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px;
  border: 2px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  width: 90%;
}

.option:hover {
  border-color: #6d071a;
  background-color: #fdf0f0;
  cursor: pointer;
}

/* Image dans une réponse */
.option img {
  max-width: 180px;
  height: auto;
  border-radius: 5px;
  margin-top: 10px;
}

/* Masquer les boutons radio */
.radio-hide {
  display: none;
}

.validate-btn-container {
  text-align: center;
  margin-top: 20px;
}

.validate_btn {
  display: inline-block;
}

.question-image {
  text-align: center;
  margin: 15px 0 25px 0;
}

.question-image img {
  max-width: 200px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

footer .total_que span p {
  font-weight: 500;
  padding: 0 5px;
}

footer .total_que span p:first-child {
  padding-left: 0px;
}

footer .next_btn {
  display: none;
  height: 40px;
  padding: 0 13px;
  font-size: 18px;
  font-weight: 400;
  border: none;
  outline: none;
  color: #fff;
  background: #6d071a;
  border-radius: 5px;
  border: 1px solid #6d071a;
  cursor: pointer;
  transition: all ease 0.3s;
}

footer .next_btn:hover {
  background: #880921;
}

/* =============================
   PAGE : quiz_end.php
   ============================= */

.result_box {
  position: absolute;
  width: 450px;
  padding: 25px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0px 4px 8px 0 rgba(0, 0, 0, 0.2),
    0px 6px 20px 0 rgba(0, 0, 0, 0.19);
  transition: all ease 0.3s;
  z-index: 5;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(0.9);
  text-align: center;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: space-between;
}

.buttons button.restart {
  color: #fff;
  background: #6d071a;
}

.buttons button.restart:hover {
  background: #880921;
}

.buttons button.quit {
  color: #6d071a;
}

.buttons button.quit:hover {
  color: #fff;
  background: #6d071a;
}

.result_box .complete_text {
  font-size: 20px;
  font-weight: 500;
}

.result_box .score_text span {
  display: flex;
  font-size: 16px;
  font-weight: 500;
}

.result_box .score_text span p {
  font-weight: 600;
  padding: 0 4px;
}

.result_box .buttons {
  display: flex;
  margin: 20px 0;
}

.result_box .buttons button {
  margin: 0 10px;
  height: 40px;
  padding: 0 20px;
  border: none;
  outline: none;
  font-size: 18px;
  font-weight: 500;
  border-radius: 5px;
  border: 1px solid #6d071a;
  cursor: pointer;
  transition: all ease 0.3s;
}

.result_box .buttons {
  display: flex;
  flex-direction: row;
}

.result_box .buttons_footer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result_box .footer_logo {
  max-height: 100px;
  max-width: 100px;
}

/* RESPONSIVE */

@media screen and (max-width: 1080px) {
  .start_btn_button {
    font-size: 18px;
    padding: 12px 24px;
  }

  .backend-access {
    top: 10px;
    right: 10px;
  }

  .backend-btn {
    padding: 8px 15px;
    font-size: 14px;
  }

  /* QUIZ */

  .quiz_box header .title {
    font-size: 18px;
  }

  .quiz_box header .timer .time_text {
    font-size: 16px;
  }

  .quiz_box header .timer .timer_sec {
    font-size: 16px;
  }

  .quiz_box section .que_text {
    font-size: 18px;
  }

  .quiz_box section .justification {
    font-size: 14px;
  }

  /* IMAGES OPTIONS */

  .quiz_box .question-image {
    margin: 15px 0 0 0;
  }

  .quiz_box .question-image img {
    max-width: 125px;
  }

  .quiz_box section .option_list {
    padding: 0 0;
  }

  .quiz_box .option_list .option .img-thumbnail {
    max-width: 100px;
  }

  /* QUIZ_END */

  .result_box .score_text span {
    font-size: 15px;
  }
}

@media screen and (max-width: 480px) {
  /* INDEX */
  .navbar-left {
    width: 210px;
    display: flex;
    justify-content: center;
  }

  .navbar-logo {
    height: 25px;
  }

  .navbar-text {
    font-size: 10px;
  }

  .navbar-right .navbar-admin-btn {
    font-size: 7px;
    padding: 5px 8px;
  }

  .info_box {
    max-width: 350px;
  }

  .info_box .info {
    font-size: 16px;
  }

  .start_btn_button {
    font-size: 16px;
    padding: 10px 20px;
  }

  .backend-btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  .copyright {
    font-size: 14px;
  }

  /* QUIZ */

  .quiz_box {
    max-width: 300px;
  }

  .quiz_box section {
    padding: 25px 30px 0px 30px;
  }

  .quiz_box header {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .quiz_box header .title,
  .quiz_box header .timer .time_text,
  .quiz_box header .timer .timer_sec {
    font-size: 14px;
  }

  .quiz_box header .title {
    margin-bottom: 5px;
  }

  .quiz_box header .timer {
    margin-bottom: 10px;
  }

  .quiz_box section .que_text {
    font-size: 14px;
  }

  .quiz_box header .timer .timer_sec {
    height: 20px;
    width: 35px;
    line-height: normal;
    font-size: 12px;
  }

  .quiz_box .option_list {
    grid-template-columns: repeat(1, 1fr);
  }

  .quiz_box .option_list.image-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quiz_box .option_list.image-text-grid {
    grid-template-columns: repeat(2, 1fr); /* Si image + texte */
  }

  .quiz_box .option_list .option {
    padding: 5px 0px;
    font-size: 12px;
  }

  .quiz_box section .timerMessage {
    font-size: 14px;
  }

  .quiz_box section .question-image {
    margin: 15px 0px 0px 0px;
  }

  .quiz_box section .question-image img {
    max-width: 150px;
  }

  .quiz_box section .option_list {
    padding: 0px;
  }

  .quiz_box .validate-btn-container .validate_btn {
    padding: 5px 10px;
    font-size: 14px;
  }
  .quiz_box form .next_btn {
    padding: 5px 10px;
    font-size: 14px;
  }

  .quiz_box section .justification {
    font-size: 10px;
  }

  .quiz_box footer {
    justify-content: center;
  }

  .quiz_box footer .total_que span {
    font-size: 12px;
  }

  /* IMAGES OPTIONS */

  .quiz_box .option_list .option .img-thumbnail {
    max-width: 75px;
  }

  /* QUIZ_END */

  .result_box {
    max-width: 380px;
  }

  .result_box .complete_text {
    font-size: 16px;
  }

  .result_box .feedback {
    font-size: 14px;
  }

  .result_box .score_text span {
    margin-top: 5px;
    font-size: 12px;
  }

  .result_box .feedback {
    margin: 10px 0px;
  }

  .result_box .buttons {
    margin-top: 0px;
    padding-top: 0px;
  }
}
