body {
  font-family: Arial;
  background: #f5f5f5;
  margin: 0;
}

/* HEADER */
header {
  background: #333;
  color: white;
  padding: 12px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 1000;
}

header h1 {
  margin: 5px 0;
  font-size: 20px;
}

header p {
  margin: 0;
  font-size: 12px;
  opacity: 0.8;
}

/* PROGRESS BAR */
#progressContainer {
  position: relative;
  margin-top: 10px;
  height: 45px;
  background:#555555;
  border-radius: 5px;
  margin-right: 16px;
}

#progressBar {
  position: absolute;
  width: 0%;
  background: #4caf50;
  height: 45px;
  border-radius: 5px;
}

#progressBarWrong {
  position: absolute;
  width: 0%;
  background: #f44336;
  height: 45px;
  border-radius: 5px;
}

#progressBarText {
  color: #eeeeee;
  text-align: center;
  font-size: 18px;
  line-height: 48px;
}

/* NAVIGATION */
#navPanel {
  display: flex;
  width: 100%;
  background: #222;
  padding: 10px;
  flex-direction: row;
  overflow-y: hidden;
  overflow-x: auto;
  position: fixed;
  z-index: 2;
  height: 51px;
  line-height: 32px;
}

.navItem {
  min-width: 40px;
  max-height: 30px;
  margin-right: 5px;
  padding: 8px;
  background: #ccc;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: bolder;
}

.navItem:hover {
  filter: brightness(1.18);
}

/* CONTAINER */
.container {
  padding: 10px;
  margin-top: 51px;
}

/* QUESTION */
.question {
  background: white;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
}

/* ANSWERS */
.answers .label {
  display: block;
  margin: 8px 0;
  padding: 10px;
  border-radius: 5px;
  background: #fafafa;
}

.answers input {
  transform: scale(1.2);
  margin-right: 16px;
}

/* FEEDBACK */
.correct-answer {
  background: #c7ffc3 !important;
}

.wrong-answer {
  background: #f7c5c5 !important;
}

button {
  margin-top: 10px;
  padding: 12px;
  width: 100%;
  font-size: 16px;
  border: none;
  border-radius: 5px;
  background: #333;
  color: white;
  cursor: pointer;
}

button:disabled,
button[disabled]{
  opacity: 0.6;
  cursor: not-allowed;
}

.disabled {
  opacity: 0.6;
}

.dead {
  pointer-events: none;
}

.correct {
  margin-top: 16px;
  color: green;
  font-weight: bold;
}

.wrong {
  margin-top: 16px;
  color: red;
  font-weight: bold;
}

.explanation {
  margin-top: 10px;
  padding: 10px;
  background: #eef;
  border-radius: 5px;
  display: none;
}

/* POPUP */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
}

.popup-content {
  background: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  width: 90%;
}

/* DESKTOP */
@media (min-width: 768px) {
  #navPanel {
    position: fixed;
    left: 0;
    top: 150px;
    width: 60px;
    flex-direction: column;
    height: 80%;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .navItem {
    margin-bottom: 5px;
  }

  .container {
    margin-top: 0;
    margin-left: 80px;
    padding: 20px;
  }

  button {
    width: auto;
  }
}

#startButton {
  background: #555;
  cursor: pointer;
}

#startButton:hover {
  background: #747474;
}

/* DROPDOWN */
.dropdown {
  position: absolute;
  background: transparent;
  width: 100px;
  font-family: Arial;
  height: 30px;
  max-height: 30px;
  right: 24px;
  padding: 8px;
  margin-top: 8px;
}

.dropdown-btn {
  border-radius: 5px;
  background: #333;
  padding: 8px;
  cursor: pointer;
}

.dropdown-list {
  display: none;
  position: absolute;
  width: 100%;
  background: #333;
  max-height: 200px;
  overflow-y: auto;
}

.dropdown-list div {
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.dropdown-list div:hover {
  background: #5a5a5a;
}

.flag {
  width: 20px;
  height: 14px;
  margin-right: 10px;
}

#timerDisplay {
  display: none;
}

/* Modal Overlay - Dims the background quiz */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent black */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000; /* Ensures it sits above the sidebar and quiz */
  backdrop-filter: blur(4px); /* Modern touch to match your clean UI */
}

/* The Popup Box */
.login-popup {
  background-color: #ffffff;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: fadeInDown 0.4s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typography & Headers */
.login-header h2 {
  margin: 0 0 10px 0;
  color: #2c3e50;
  font-size: 24px;
}

.login-header {
  margin-bottom: 24px;
}

.login-header p {
  color: #7f8c8d;
  margin-top: -4px;
  margin-bottom: 25px;
  font-size: 14px;
}

/* Form Styling */
.input-group {
  text-align: left;
  margin-bottom: 15px;
}

.input-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #34495e;
  font-size: 14px;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ecf0f1;
  border-radius: 6px;
  box-sizing: border-box; /* Crucial for padding alignment */
  transition: border-color 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #3498db; /* Matches common quiz primary colors */
}

/* Links & Actions */
.login-actions {
  margin-top: 20px;
  display:flex;
  text-align: right;
}

.login-actions > div {
  flex: 1;
}

.login-actions > div:first-child {
  text-align: left;
}

.login-actions > div:nth-child(2) {
  text-align: right;
}

.logout_bt {
  display: inline-block;
  margin-top: -4px;
  width: 24px;
  height: 24px;
  background: url('../images/logout.svg') no-repeat center center;
  background-size: contain;
  border: none;
  cursor: pointer;
}

.logout_bt:hover {
  scale: 1.25;
  background-color: transparent;
}

#langToggler {
  margin-top: 1px;
  display: inline-block;
}

.register-link,
.recovery-link {
  font-size: 13px;
  color: #3498db;
  text-decoration: none;
}

.register-link:hover,
.recovery-link:hover {
  text-decoration: underline;
  color: #2980b9;
}

/* Login Button - Styled like your Quiz Submit buttons */
.btn-login-submit {
  width: 100%;
  padding: 12px;
  background-color: #2c3e50; /* Matches your theme's dark elements */
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-login-submit:hover {
  background-color: #34495e;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #333;
  padding: 1rem 1rem;
  color: white;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.nav-links a.active {
  color: #2980b9;
}

.nav-links a:hover {
  color: #2563eb;
  scale: 1.25;
}

/* Submenu Hidden by default (Desktop) */
.submenu {
    display: none; 
    position: absolute; /* Floats over content so it doesn't break the navbar height */
    background-color: #444;
    list-style: none;
    padding: 10px;
    min-width: 150px;
    right: 0; /* Adjust as needed to align with the parent link */
    z-index: 100;
}

.submenu li {
    padding: 5px 0;
}

/* Desktop Hover Logic */
.has-submenu:hover .submenu {
    display: block;
}

.hamburger {
  display: none; /* Hidden on Desktop */
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}

.bar {
  width: 25px;
  height: 3px;
  background-color: white;
  transition: 0.3s;
}

/* The Overlay Logic */
.overlay {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.overlay.active {
  display: block;
  height: 100vh;
}

/* Back to top button */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #333;
  color: white;
  font-size: 18px;
  cursor: pointer;

  opacity: 0.5;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Optional: slightly enlarge on tap */
#backToTop:active {
  transform: scale(0.95);
}

#backToTop img {
  width: 24px;
  height: 24px;
  margin-left: -2px;
}

/* Calculator button */
#toggleCalculator {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #333;
  color: white;
  font-size: 18px;
  cursor: pointer;

  opacity: 0.5;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Optional: slightly enlarge on tap */
#toggleCalculator:active {
  transform: scale(0.95);
}

#toggleCalculator img {
  width: 24px;
  height: 24px;
  margin-left: -2px;
}

/* --- Mobile Styles (The "Side Drawer" Logic) --- */
@media (max-width: 768px) {
  .hamburger {
    display: flex; /* Show hamburger on mobile */
    z-index: 1001; /* Stay above everything */
  }

  .nav-links {
    position: fixed;
    left: -100%; /* Move menu completely off-screen to the left */
    top: 0;
    flex-direction: column;
    background-color: #222;
    width: 250px; /* Width of the side drawer */
    height: 100vh;
    padding-top: 80px;
    padding-left: 20px;
    transition: 0.4s ease; /* Smooth sliding effect */
    z-index: 1000;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
  }

  /* When the menu is "active", slide it into view */
  .nav-links.active {
    left: 0;
  }

  /* Reset Submenu for Mobile */
  .submenu {
      position: static; /* Submenu stays inside the flow, pushing items down */
      display: none;   /* Hidden until clicked */
      background-color: #333;
      padding-left: 20px;
  }

  /* Class to show submenu when clicked on Mobile */
  .submenu.open {
      display: block;
  }

  /* Hamburger Animation (Turns into an 'X') */
  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
}

/* Hide on desktop */
@media (min-width: 768px) {
  #backToTop {
    display: none;
  }
}

#calculator {
  z-index: 1000; /* Ensure it appears above the overlay */
}

#loginPopup {

}

#login-overlay,
#registerPopup,
#registerDonePopup,
#passwordRecoveryPopup,
#loginPopup,
#examResultPopup {
  display: none;
}