.question {
  display: flex;
  flex-direction: column;
  padding: .5rem .5rem 1rem .5rem;
  border-bottom: 1px solid #ccc;  
  border: 1px solid transparent;
  border-radius: .5rem;

  &.hidden {display: none;}

  &.selected {
    background-color: #f5f5f5;
    border: 1px solid #a8a8a8;
    box-shadow: #9ca4b3 0 2px 4px;
  }

  .question-introduction {
    font-style: italic;
    color: #4a5568; 
    margin-bottom: 0.6em;
    background-color: #e2e8f0; 
    padding: 0.4em 0.6em;
    border-radius: 4px;
    white-space: pre-wrap; 
    font-size: 0.95em;
  }
  .question-container {
    display: flex;
    flex-direction: row;

    .question-number {
      width: 2.2rem;
      font-weight: bold;
    }

    .question-content { 
      display: flex;
      flex-direction: column;
      margin-left: 0rem;
      width: auto;
      flex: 1 1 0;

      .question-text {
        font-weight: bold;
      }

      .question-options {
        display: flex;
        flex-direction: column;
        list-style-type: none;
        margin: 0;
        padding: 0;
        cursor: pointer;

        .question-option {
          border: 2px solid transparent;
          padding: .2rem .5rem;
          border-radius: .2rem;

          &.correct {
            background-color: rgb(229, 255, 229);
            border-color: darkgreen;
          }

          &.incorrect {
            background-color: rgb(255, 234, 234);
            border-color: red;
          }
        }

        .question-option:hover {
          border: 2px solid black;
        }
        
      }
    }
  }
}

.row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: .5rem;
  /* margin-bottom: 1rem; */
}

.column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.tests-container {
  display: block;
  position: relative;

  border: 1px solid black;
  border-radius: .5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: .5rem 1rem;
  margin-bottom: 1rem;

  .tests-header {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    padding-right: 2rem; /* Espacio para el botón */
  }

  .tests-title0 {
    font-size: .8rem;
    font-weight: 600;
    margin-right: 1rem;
  }

  .tests-header h4 {
    flex-grow: 1;
    margin: 0;
  }

  .toggle-button {
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 10px;
    height: 10px;
    border: solid #333;
    border-width: 0 2px 2px 0;
    transform: translateY(-50%) rotate(45deg); /* Flecha hacia abajo */
    transition: transform 0.3s ease-in-out;
  }

  .tests-body {
    display: none;
    transition: all 0.4s ease-in-out;
  }

  &.is-open .toggle-button {
    transform: translateY(-50%) rotate(-135deg); /* Flecha hacia arriba */
  }

  &.is-open .tests-body {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 1rem;

      transition: all 0.4s ease-in-out;
  }

  .tests-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scroll-behavior: smooth;
  }

  .tests-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;    
    column-gap: 2rem;
  }

  .tests-statistics { 
    flex: 1 1 0;
    display: flex;  
    flex-direction: row;
    gap: 1rem;
    justify-content: space-between;
    background-color: palegoldenrod;
    border: 2px solid rgb(209, 203, 131);
    border-radius: .5rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);

    &.hidden {display: none;}
  }
}

.stat-card {
    border: 1px solid #e0e0e0;
    border-radius: .5rem;
    padding: .5rem 1rem;
    text-align: center;
    width: 49%;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}
.stat-card h4 { margin: 0 0 0.5rem 0; font-size: .7rem; color: #555; font-weight: bold; text-transform: uppercase; }
.stat-card p { margin: 0; font-size: 1.5rem; font-weight: bold; color: #333; }
.stats-correct { color: darkgreen; }
.stats-incorrect { color: red; }

/* Responsive styles for mobile */
@media screen and (max-width: 600px) {
  .tests-container .tests-statistics {
    flex-direction: column;
  }

  .tests-container .stat-card {
    width: 100%;
  }
}
