/*****************************************************************************/
/* 1. ESTILS GENERALS I RESET */
/*****************************************************************************/
/* Apliquem box-sizing a tots els elements per simplificar el disseny */
*,
::after,
::before {
  margin: 0;
  box-sizing: border-box;
}

/* Estils base del cos del document */
body {
  font-family: "Gentium Book Plus", serif;
  min-height: 100vh;
  background-image: url(/img/fondo.jpg);
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  flex-direction: column;
}

input {
  font: inherit;
}

/* Estils per al contenidor del perfil */
#perfil-container {
  position: fixed; /* Fixem la posició a la pantalla */
  top: 80px; /* Separació de 80px del top per quedar sota el menú */
  right: 20px; /* Un petit marge a la dreta */
  margin-top: 0;
  margin-left: auto;
  margin-right: 0;
  width: min(450px, 90%);
  z-index: 200; /* Assegura que es mostri per sobre de tot */
}

/* Utilitzem el main-container per donar-li el format de caixa */
#perfil-container .main-container {
  padding: 2rem;
  background-color: white;
  width: 100%;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}
/*****************************************************************************/
/* 2. ESTILS DE NAVEGACIÓ (TOP-MENU) */
/*****************************************************************************/
.top-menu {
  width: 100%;
  background-color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}

.menu-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-logo {
  width: 40px;
  height: 40px;
}

.app-name {
  font-size: 1.5rem;
  font-weight: bold;
  color: #0f41e1;
}

.menu-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-button,
.logout-button {
  padding: 10px 15px;
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.logout-button {
  background-color: #f44336;
}

.logout-button:hover {
  background-color: #d32f2f;
  transform: scale(1.1);
}

.menu-button {
  background-color: #0f41e1;
}

.menu-button:hover {
  background-color: #567aea;
  transform: scale(1.1);
}

/*****************************************************************************/
/* 3. ESTILS DE FORMULARIS D'AUTENTICACIÓ I PERFIL */
/*****************************************************************************/
#auth-forms-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5); /* Valor corregido */
  z-index: 150;
}

/* Centrem el contenidor amb la classe `main-container` que ja utilitzes */
#auth-forms-container .main-container {
  margin: auto;
}

#registro-form,
#login-form {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  padding: 2rem;
  max-width: 450px;
  width: 100%;
  margin: auto;
  margin-top: 10vh;
}

.form_title {
  font-size: 2rem;
  text-shadow: 2px 2px 4px #686666;
}

.form_inputs {
  margin: 2rem 0 1.5rem;
  display: grid;
  gap: 1.5rem;
  color: #6b6b6b;
}

.form_label {
  width: 100%;
  display: grid;
  grid-template-areas: "input";
}

.form_input {
  grid-area: input;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #d7d0d0;
  padding: 0.7rem 1.5rem;
}

.form_text {
  grid-area: input;
  z-index: 100;
  width: max-content;
  height: 100%;
  margin-left: 1rem;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  transform-origin: left center;
  transition: transform 0.3s;
}

.form_input:is(:focus, :not(:placeholder-shown)) + .form_text {
  background-color: white;
  transform: translateY(-50%) scale(0.7);
}

.form_submit {
  display: inline-block;
  border-radius: 10px;
  background-color: #0f41e1;
  padding: 1rem 2rem;
  color: white;
  border: none;
  margin-bottom: 20px;
}

.form_submit:hover {
  background-color: #567aea;
  cursor: pointer;
}

.form-image-container {
  text-align: center;
  margin-top: 1.5rem;
  width: 150px;
  height: 150px;
  margin-left: auto;
  margin-right: auto;
}

.form-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-button:hover {
  color: #f44336;
}

.perfil-photo-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 2rem;
}

.perfil-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #0f41e1;
}

.photo-upload-label {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 40px;
  height: 40px;
  background-color: #0f41e1;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease-in-out;
}

.photo-upload-label:hover {
  transform: scale(1.1);
}

/*****************************************************************************/
/* 4. ESTILS D'ALERTES */
/*****************************************************************************/
#alerta {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  padding: 15px 25px;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: opacity 0.5s ease-in-out;
  opacity: 0;
}

#alerta.mostrar {
  display: block;
  opacity: 1;
}

#alerta.exito {
  background-color: #4caf50;
}

#alerta.error {
  background-color: #f44336;
}

/*****************************************************************************/
/* 5. ESTILS DEL DISSENY DE PANTALLA DIVIDIDA */
/*****************************************************************************/
.contenedor-pantalla-dividida {
  display: flex;
  flex: 1;
  padding-top: 80px;
}

/* Classes per a les columnes */
.lessons-container,
.quiz-main-container,
.sidebar {
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

.lessons-container {
  flex: 1;
  background-color: rgba(230, 230, 230, 0.9);
  border-right: 1px solid #ccc;
}

.quiz-main-container {
  flex: 2;
  background-color: rgba(255, 255, 255, 0.9);
}

.sidebar {
  flex: 1;
  background-color: rgba(240, 240, 240, 0.9);
  border-left: 1px solid #ccc;
}

.close-button {
  position: fixed; /* Posicionamiento absoluto dentro del sidebar */
  top: 80px;
  right: 40px;
  z-index: 1000;
  font-size: 35px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #333;
}

.close-button-lessons {
  position: fixed; /* Posicionamiento absoluto dentro del sidebar */
  top: 40px;
  left: 150px;
  z-index: 1000;
  font-size: 35px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #333;
}

/* Estils de contingut */
#lessons-list,
#quiz-content,
#progress-container {
  flex-grow: 1;
}

/*****************************************************************************/
/* 6. ESTILS PER AL QÜESTIONARI I MÒDULS */
/*****************************************************************************/
/* Agrupem els estils comuns per a la selecció de mòduls i el qüestionari */
#module-selection,
#quiz-container,
#results-container {
  width: 100%;
  max-width: 600px;
  padding: 2rem;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  margin: 0 auto;
  padding: 1rem;
}

#quiz-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

#question {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

#options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.option-button {
  width: 100%;
  padding: 1rem;
  border: 2px solid #0f41e1;
  border-radius: 8px;
  background-color: white;
  color: #0f41e1;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.option-button:hover {
  background-color: #0f41e1;
  color: white;
}

.option-button.correct {
  background-color: #4caf50;
  color: white;
  border-color: #4caf50;
}

.option-button.incorrect {
  background-color: #f44336;
  color: white;
  border-color: #f44336;
}

#next-button,
#restart-button,
.exit-quiz-button {
  padding: 1rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-top: 1.5rem;
  color: white;
  width: 100%;
  white-space: normal;
  box-sizing: border-box;
}

#next-button,
#restart-button {
  background-color: #0f41e1;
}

#next-button:hover,
#restart-button:hover {
  background-color: #567aea;
}

.exit-quiz-button {
  background-color: #f44336;
}

.exit-quiz-button:hover {
  background-color: #d32f2f;
}

#feedback {
  margin-top: 1rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.fa-solid {
  margin-right: 10px;
}

.menu-button .fa-solid,
.logout-button .fa-solid {
  margin-left: 10px;
  margin-right: 0;
}

/*****************************************************************************/
/* Pantallas menores de 750 */
/*****************************************************************************/
@media (max-width: 750px) {
  .top-menu {
    flex-direction: column; /* Apila los elementos verticalmente */
    align-items: flex-start; /* Alinea los elementos a la izquierda */
  }

  .menu-left {
    width: 100%; /* Asegura que ocupe todo el ancho disponible */
  }

  .menu-right {
    width: 100%; /* Asegura que ocupe todo el ancho disponible */
    flex-wrap: wrap;
    justify-content: space-between; /* Distribuye los botones equitativamente en la fila */
    gap: 10px;
    margin-top: 1rem; /* Añade un espacio entre las dos filas */
  }
  .menu-right .menu-button,
  .menu-right .logout-button {
    /* Define un ancho fijo o un porcentaje para que quepan en las filas */
    width: 48%; /* Esto creará 2 botones por fila */
    margin-bottom: 5px; /* Espacio entre las filas */
  }


  .contenedor-pantalla-dividida {
    flex-direction: column;
    margin-top: 20px;
    width: 100%; /* Asegura que ocupe todo el ancho */
  }
  .lessons-container,
  .quiz-main-container,
  .sidebar {
    width: 100%;
  }

  .exit-quiz-button {
    /* Puedes ajustar más específicamente aquí */
    padding: 0.8rem; /* Un poco menos de padding para dejar más espacio al texto */
    font-size: 0.85rem; /* Fuente un poco más pequeña si es necesario */
  }

 
  .lessons-container {
    display: none;
  }
}
