/* Exam system styles */
#exam-system {
  font-family: 'Arial', sans-serif;
  background-color: #f4f7fc;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* Container for exam system */
#exam-system .container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 800px;
  padding: 20px;
}

/* Exam login container */
#exam-system #login-container {
  background-color: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

#exam-system #login-container h1 {
  margin-bottom: 20px;
  font-size: 28px;
  color: #333;
}

#exam-system #login-container input {
  width: 100%;
  padding: 12px;
  margin: 15px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
}

#exam-system #login-container button {
  width: 100%;
  padding: 12px;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

#exam-system #login-container button:hover {
  background-color: #0056b3;
}

/* Exam container */
#exam-system #exam-container {
  background-color: #fff;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 600px;
  display: none;
}

#exam-system .exam-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

#exam-system .exam-header h1 {
  font-size: 22px;
  color: #333;
}

#exam-system .exam-header #timer {
  font-size: 18px;
  color: #ff0000;
  font-weight: bold;
}

#exam-system #question-container {
  margin-bottom: 30px;
}

/* Question Text Styling */
#exam-system #question-container h2 {
  font-size: 1.5rem;  /* Default size */
  color: #333;
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: left;
}

/* Adjust font size for smaller screens */
@media screen and (max-width: 768px) {
  #exam-system #question-container h2 {
    font-size: 1.2rem;  /* Smaller font size for mobile devices */
  }
}

@media screen and (max-width: 480px) {
  #exam-system #question-container h2 {
    font-size: 1rem;  /* Even smaller font size for very small screens */
  }
}

/* Options styling */
#exam-system .question-option {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  font-size: 16px;
}

#exam-system .question-option input {
  margin-right: 10px;
}

/* Navigation buttons */
#exam-system .navigation-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

#exam-system button {
  padding: 12px 20px;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}

#exam-system button:hover {
  background-color: #0056b3;
}

#exam-system #previous-btn {
  background-color: #28a745;
}

#exam-system #previous-btn:hover {
  background-color: #218838;
}

#exam-system #submit-btn {
  background-color: #f44336;
}

#exam-system #submit-btn:hover {
  background-color: #d32f2f;
}

/* Results page styles */
#exam-system #results-container {
  background-color: #fff;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 800px;
  display: none;
}

#exam-system #results-container h2 {
  margin-bottom: 20px;
  font-size: 28px;
  color: #333;
}

#exam-system #score {
  font-size: 22px;
  font-weight: bold;
  color: #28a745;
}

#exam-system .table-wrapper {
  overflow-x: auto;
  margin-top: 20px;
}

#exam-system #result-table {
  width: 100%;
  border-collapse: collapse;
}

#exam-system #result-table th, #exam-system #result-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

#exam-system #result-table th {
  background-color: #007BFF;
  color: white;
}

#exam-system #result-table td {
  background-color: #f9f9f9;
}

/* Explanation column styling */
#exam-system #result-table th:nth-child(4),
#exam-system #result-table td:nth-child(4) {
  width: 30%; /* Adjust column width to accommodate explanations */
  text-align: left;
  white-space: normal; /* Allow wrapping of text */
}

#exam-system .result-navigation {
  margin-top: 20px;
  text-align: center;
}

/* Add styling for question navigation */
#exam-system #question-navigation {
  margin-top: 20px;
  text-align: center;
  display: flex;
  justify-content: center; /* Ensures buttons are centered */
}

#exam-system .nav-btn {
  margin: 5px;
  padding: 10px 15px;
  border: none;
  border-radius: 5px;
  background-color: #ddd;
  cursor: pointer;
}

#exam-system .nav-btn.active {
  background-color: grey; /* Set the background color to grey for the active question */
  color: white; /* Ensure text is readable with white color */
  font-weight: bold; /* Optional: to make the active question bold */
}

#exam-system .nav-btn:hover {
  background-color: #0056b3;
  color: white;
}

/* Media Queries for responsiveness */
@media screen and (max-width: 768px) {
  #exam-system .container {
    padding: 15px;
  }

  #exam-system #login-container, #exam-system #exam-container, #exam-system #results-container {
    width: 90%;
    max-width: 500px;
  }

  #exam-system .exam-header h1, #exam-system .exam-header #timer {
    font-size: 20px;
  }

  #exam-system #question-container h2 {
    font-size: 16px;
  }

  #exam-system .question-option {
    font-size: 14px;
  }

  #exam-system button {
    padding: 10px 15px;
    font-size: 14px;
  }

  #exam-system #question-navigation {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center; /* Ensures buttons are centered */
  }

  #exam-system .nav-btn {
    margin: 5px;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    background-color: #ddd;
    cursor: pointer;
    display: inline-block; /* Ensures the button is inline on mobile */
  }

  #exam-system .nav-btn.active {
    background-color: grey;
    color: white;
    font-weight: bold;
  }

  #exam-system .nav-btn:hover {
    background-color: #0056b3;
    color: white;
  }

}

@media screen and (max-width: 480px) {
  #exam-system .container {
    padding: 10px;
  }

  #exam-system #login-container, #exam-system #exam-container, #exam-system #results-container {
    width: 100%;
    max-width: 400px;
  }

  #exam-system .exam-header h1, #exam-system .exam-header #timer {
    font-size: 18px;
  }

  #exam-system #question-container h2 {
    font-size: 14px;
  }

  #exam-system .question-option {
    font-size: 12px;
  }

  #exam-system button {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Adjusting button size for mobile view */
  #exam-system .nav-btn {
    font-size: 12px;
    padding: 8px 12px;
  }

  /* Navigation Button Styles */
  #exam-system .nav-btn {
    margin: 5px;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    background-color: #ddd;  /* Default color */
    cursor: pointer;
    display: inline-block; /* Ensures the button is inline on mobile */
  }

  #exam-system .nav-btn.answered {
    background-color: #28a745;  /* Green for answered */
    color: white;
  }

  #exam-system .nav-btn.unanswered {
    background-color: #f44336;  /* Red for unanswered */
    color: white;
  }

  /* Hover and Active States */
  #exam-system .nav-btn:hover {
    background-color: #0056b3;
    color: white;
  }

  #exam-system .nav-btn.active {
    background-color: grey;
    color: white;
    font-weight: bold;
  }

  #exam-system .nav-btn.answered:hover {
    background-color: #218838; /* Darker green for answered on hover */
  }

  #exam-system .nav-btn.unanswered:hover {
    background-color: #d32f2f; /* Darker red for unanswered on hover */
  }
}
