/* ================= BODY & LAYOUT ================= */
body {
  font-family: Times New Roman, sans-serif;
  display: flex;
  justify-content: center;   /* center horizontally */
  align-items: flex-start;   /* align from top */
  min-height: 100vh;
  background-color: #f4f2ef;
  padding: 20px;
  background: #f3f4f6;
}


.main-wrapper {
  display: flex;
  flex-direction: column;      /* stack content vertically */
  justify-content: flex-start;  /* top-align content */
  align-items: center;          /* center horizontally */
  gap: 20px;
  padding: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  transition: margin-left 0.3s ease; /* smooth shift */
}


/* ================= QUIZ CONTAINER ================= */
.quiz-container {
  text-align: center;
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 500px;
}

#content {
  width: 100%;
  background-color: #f9f9f9;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 5px;
}

table, th, td {
  border: 1px solid silver;
  border-collapse: collapse;
  padding: 10px;
}

.option-btn {
  display: block;
  width: 80%;
  margin: 10px auto;
  padding: 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: transform 0.2s, background-color 0.2s;
}

.option-btn:hover {
  background-color: silver;
  transform: scale(1.05);
  background-color: silver;
}

.option-btn.correct {
  background-color: #28a745;
  animation: correctPop 0.3s ease-in-out;
}

.option-btn.wrong {
  background-color: #dc3545;
  animation: wrongShake 0.3s ease-in-out;
}

@keyframes correctPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}

#result {
  margin-top: 20px;
  font-size: 1.2em;
}

#user-points {
  display: inline-block;
  margin: 10px;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  background-color: #2b6ea3;
  color: white;
  font-size: .75em;
}

#restart-btn {
  display: none;
  margin: 20px auto;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  background-color: #2b6ea3;
  color: white;
  cursor: pointer;
}

#restart-btn:hover {
  background-color: #218838;
}

#timer {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 20px;
}

#timer-bar {
  height: 20px;
  width: 100%;
  background-color: #4CAF50; /* start green */
  transition: width 1s linear;
  animation: timerColor 10s linear forwards; /* match your timer duration */
}

/* Animation for color change over time */
@keyframes timerColor {
  0%   { background-color: #4CAF50; } /* green */
  50%  { background-color: orange; }  /* half-time */
  75%  { background-color: red; }     /* critical */
  100% { background-color: red; }     /* end */
}


#hearts {
  font-size: 1.2em;
  margin-top: 10px;
}

#question {
  font-size: 2em;
  margin: 30px;
  opacity: 0;
  animation: fadeIn 0.5s forwards;
  @keyframes fadeIn {
  to { opacity: 1; }
}
}

@keyframes fadeIn {
  to { opacity: 1; }
}

#numQuestions {
  margin-bottom: 20px;
}

#start-btn {
  display: block;
  margin: 20px auto;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  background-color: #28a745;
  color: white;
  cursor: pointer;
}

#start-btn:hover {
  background-color: #218838;
}

/* ================= LOGIN & SIGNUP ================= */
#login-form {
  display: block; /* show login form by default */
  margin: 20px auto;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #f9f9f9;
}

#signup-form {
  display: none; /* keep signup hidden initially */
}


#login-form input, #signup-form input {
  display: block;
  margin: 10px auto;
  padding: 10px;
  width: 80%;
  border: 1px solid #ccc;
  border-radius: 5px;
}

#login-form button, #signup-form button {
  display: block;
  margin: 10px auto;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  background-color: #2b6ea3;
  color: white;
  cursor: pointer;
}

#login-form button:hover, #signup-form button:hover {
  background-color: #218838;
}

/* === PASSWORD RESET FORM === */
#password-reset-form {
  display: none;
  background: white;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
  padding: 25px 30px;
  text-align: center;
  width: 300px;
  margin: auto;
  transition: all 0.3s ease-in-out;
}

#password-reset-form h2 {
  margin-bottom: 20px;
  font-size: 1.5em;
  color: #333;
}

#password-reset-form input {
  width: 90%;
  padding: 10px 12px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#password-reset-form input:focus {
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
  outline: none;
}

#password-reset-form button {
  width: 90%;
  padding: 10px;
  margin-top: 10px;
  border: none;
  border-radius: 6px;
  /* background-color: #28a745; */
  background: #2b6ea3;
  color: white;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#logout-btn {
display: block;
  margin: 10px auto;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  background-color: #2b6ea3;
  color: white;
  cursor: pointer;
}

#password-reset-form button:hover {
  background-color: #218838;
}

/* Step visibility */
#reset-step1, #reset-step2 {
  display: none;
}

/* Reset status message */
#reset-msg {
  margin-top: 10px;
  font-size: 0.95em;
  color: #333;
  min-height: 20px;
}

/* Cancel button */
#cancel-reset-btn {
  background-color: #6c757d;
}

#cancel-reset-btn:hover {
  background-color: #5a6268;
}

/* Smooth fade effect when switching between login/signup/reset */
#login-form, #signup-form, #password-reset-form {
  animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ================= LEADERBOARD ================= */
.leaderboard-container {
  position: static; /* removed absolute positioning */
  max-height: 80vh;
  overflow-y: auto;
  background-color: #fff;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  width: 250px;            /* fixed width so names don’t get cut off */

}

.leaderboard-container h3 {
  text-align: center;
  margin-bottom: 12px;
  font-size: 18px;
}


.leaderboard-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  background-color: #f5f5f5;
  font-weight: normal;
  overflow: hidden; /* prevent overflow */
}

.leaderboard-row:nth-child(odd) {
  background-color: #e9ecef;
}

.leaderboard-row.current-user {
  background-color: #d0e7ff;
  font-weight: bold;
  color: #007bff;
  animation: highlightRow 0.5s ease-in-out;
}

@keyframes highlightRow {
  0% { background-color: #d0e7ff; }
  50% { background-color: #a0d4ff; }
  100% { background-color: #d0e7ff; }
}

.rank {
  width: 30px;
  text-align: right;
  flex-shrink: 0; /* keep rank small and fixed */
}

.username {
  flex-grow: 1;         /* take remaining space */
  padding-left: 10px;
  overflow: hidden;     /* hide overflow */
  text-overflow: ellipsis; /* show ... if too long */
  white-space: nowrap;  /* keep on one line */
}

.points {
  width: 70px;          /* fixed width for points */
  text-align: right;
  flex-shrink: 0;       /* don’t shrink */
}

.leaderboard-full-container {
  max-width: 500px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  /* Align to top */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;  /* top-align content */
}

.back-btn {
  display: block;
  margin: 20px auto 0;
  text-align: center;
  padding: 10px 16px;
  background-color: #2b6ea3;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  width: 200px;
}

/* Ensures quiz stays next to it */
.container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
}

/* --- FLASHCARDS --- */
.flashcards-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 20px;
  width: 300px;
  min-height: 250px;
  margin-right: 30px;
  float: left;
  transition: all 0.4s ease;
  opacity: 1;
}

.flashcards-container h2 {
  margin-bottom: 15px;
  color: #333;
}

.flashcard {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 25px 15px;
  font-size: 3em;
  margin-bottom: 15px;
  cursor: pointer;
  min-height: 150px;
  width: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: transform 0.3s, background 0.3s;
}


.flashcard-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.flashcard-controls button {
  padding: 8px 14px;
  font-size: 1em;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background-color: #2b6ea3;
  color: white;
  transition: background 0.2s;
}

.flashcard-controls button:hover {
  background-color: #45a049;
}

.flashcards-container.hidden {
  opacity: 0;
  transform: translateX(-40px);
  pointer-events: none;
}

.flashcard-full-container {
  width: 500px;
  margin: 40px auto;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* ================= STUDY GUIDE ================= */
.study-container {
  text-align: center;
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 300px;
  min-height: 250px;
  transition: all 0.3s ease;

  /* Align to top */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;  /* top-align content */
}

.study-container h2 {
  margin-bottom: 15px;
  color: #333;
}

#study-answer {
  width: 90%;
  max-width: 100%;
  padding: 10px;
  margin: 10px 0;
  border-radius: 5px;
  border: 1px solid #ccc;

}

#study-next-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  background-color: #2b6ea3;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

#study-next-btn:hover {
  background-color: #45a049;
}

#study-feedback {
  font-weight: bold;
  margin-bottom: 10px;
}

#study-hint {
  color: #555;
  font-style: italic;
  margin-bottom: 10px;
}

.study-full-container {
  width: 500px;
  margin: 40px auto;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

#study-question{
text-align: center;
font-size: 3em;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: -220px; /* hidden by default */
  top: 0;
  width: 200px;
  height: 100%;
  background-color: #f4f2ef;;
  padding-top: 60px; /* space for hamburger */
  transition: 0.3s;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.sidebar a {
  padding: 12px 20px;
  text-decoration: none;
  color: gray;
  font-size: 1.2em;
  transition: 0.2s;
}

.sidebar a:hover {
  background-color: #2b6ea3;
}

/* Hamburger button */
.menu-toggle {
  position: fixed;
  top: 15px;
  left: 15px;
  font-size: 30px;
  cursor: pointer;
  color: #2b6ea3;
  z-index: 1100;
  transition: 0.3s;
}

/* Sidebar visible state */
.sidebar.open {
  left: 0;
}

.list-selector {
  margin: 10px 0 20px;
  text-align: center;
}

.list-selector label {
  font-weight: bold;
  margin-right: 10px;
}

.list-selector select {
  padding: 6px 10px;
  font-size: 1em;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: #fff;
  cursor: pointer;
}
