body {
  font-family: Arial, sans-serif;
  margin: 0;
  background-color: #f2f7ff;
  display: flex;
}

.progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background-color: #ddd;
  z-index: 1000;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background-color: #007bff;
  transition: width 0.3s ease-in-out;
}

.sidebar {
  width: 200px;
  background: #f4f4f4;
  padding: 20px;
  border-right: 1px solid #ddd;
  height: 100vh;
  overflow-y: auto;
  margin-top: 8px; /* Adjust for progress bar */
}

.sidebar h3 {
  color: #333;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  padding-bottom: 80px; /*fixing by adding space at the bottom so last item is fully visible*/
}

.sidebar ul li {
  margin: 10px 0;
}

.sidebar ul li a {
  text-decoration: none;
  color: #333;
}
.sidebar a:hover {
  color: #007bff;
}
.sidebar a.active {
  font-weight: bold;
  color: red;
}
.main {
  flex-grow: 1;
  padding: 20px;
  margin-top: 8px; /*Adjust for progress bar*/
}

.quiz {
  margin-top: 40px;
}

.quiz-question {
  margin-bottom: 20px;
}

.quiz-feedback {
  margin-top: 20px;
  padding: 10px;
  border-radius: 5px;
}

.quiz-feedback.correct {
  background-color: #d4edda;
  color: #155724;
}

.quiz-feedback.incorrect {
  background-color: #f8d7da;
  color: #721c24;
}

.attempt-history {
  margin-top: 30px;
}

.attempt-history h4 {
  margin-bottom: 10px;
}

.attempt-item {
  margin-bottom: 8px;
}

.loader {
  display: none;
  border: 6px solid #f3f3f3;
  border-top: 6px solid red;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.lesson-video {
  width: 100%;
  max-height: 400px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.complete-btn {
  background-color: #2e7d32;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 20px;
}

.complete-btn:hover {
  background-color: #1b5e20;
}
/* Quiz progress bar */
#quiz-meta {
  margin-bottom: 1em;
}

#quiz-progress {
  width: 100%;
  height: 20px;
  border: none;
  border-radius: 12px;
  margin-top: 5px;
  appearance: none;
}

#quiz-status {
  margin: 0.5em 0 0;
  font-weight: bold;
}
.back-button {
  margin: 2em;
  text-decoration: none;
}

/* Sidebar toggle for mobile */
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 8px; /* Adjust for progress bar */
    left: -220px;
    width: 200px;
    height: calc(100vh - 8px);
    background-color: #f4f4f4;
    z-index: 1100;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .main {
    margin-left: 0;
    padding: 20px;
  }

  .sidebar-toggle {
    display: block;
    position: fixed;
    top: 12px;
    left: 10px;
    z-index: 1200;
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
  }
  /*.back-button {
    position: relative;
  }*/
}

@media (min-width: 769px) {
  .sidebar-toggle {
    display: none;
  }
}

#downloadCertificateBtn {
  display: none; /* initially hidden */
  padding: 12px 24px;
  background-color: #4caf50; /* green, positive color */
  color: white;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  margin-top: 20px;
}

#downloadCertificateBtn:hover {
  background-color: #45a049;
  transform: scale(1.05);
}
#downloadCertificateBtn {
  display: none;
  margin: 30px auto 0 auto;
  display: block;
  text-align: center;
}
/*fixed sidebar*/
@media (min-width: 769px) {
  .sidebar {
    position: fixed;
    top: 8px; /* below progress bar*/
    left: 0;
    height: calc(100vh - 8px); /* fill full height minus progress bar*/
    overflow-y: auto;
  }

  .main {
    margin-left: 225px;
  }
}
.sidebar::-webkit-scrollbar {
  width: 0px;
}
.sidebar {
  scrollbar-width: none; /*firefox*/
  -ms-overflow-style: none; /*IE/Edge*/
}
.sidebar::-webkit-scrollbar-thumb {
  background: transparent;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
/*custom modal popup*/
/* Popup modal styling */
.popup-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
}

.popup-content {
  background: #fff;
  padding: 20px 30px;
  border-radius: 12px;
  text-align: center;
  width: 300px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.3s ease-in-out;
}

.popup-content p {
  font-size: 16px;
  margin-bottom: 15px;
  color: #333;
}

#popupOkBtn {
  padding: 8px 20px;
  border: none;
  background: #4caf50;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s;
}

#popupOkBtn:hover {
  background: #45a049;
}

@keyframes fadeIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
/*Keep the Ads Non-intrusive*/
/*Ads shouldn't push content around they should stay inside allocated box scale for mobile users*/
/* Container for back button & Ads */
.back-and-ads {
  display: flex;
  flex-direction: column;
  position: relative;
  left: 15px;
  /*align-items: center;
  justify-content: center;*/
  max-width: 400px; /* Prevents ads to be wider than button*/
  width: 100%;
}
.back-and-ads .back-button {
  position: sticky;
  top: 0;
  z-index: 99;
  display: block;
  width: 100%;
  max-width: 280px;
  text-align: center;
  padding: 12px 20px;
  background-color: #ff4d4d;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  margin-bottom: 15px;
  font-weight: bold;
  transition: background 0.3s ease;
}
.back-and-ads .back-button:hover {
  background-color: #e63939;
}
/* Ad block styling */
.back-and-ads .ads {
  display: block;
  width: 100%;
  max-width: 280px; /* Matches button width */
  min-height: 80px;
  text-align: center;
  border: 1px solid #ccc;
  padding: 5px;
  margin-left: 10px;
  border-radius: 6px;
  overflow: hidden;
  background-color: #fff;
}
/* Make ads responsive */
.back-and-ads .ads ins.adsbygoogle {
  display: block !important;
  margin: 0 auto;
  width: 100% !important;
}
/* Mobile responsiveness */
@media (max-width: 768px) {
  .back-and-ads {
    max-width: 95%;
    padding: 0 10px; /* optional: center it with some side padding on very narrow screens */
  }
  .back-and-ads .back-button,
  .back-and-ads .ads {
    max-width: 100%;
  }
  /* Make ad container full-width rectangle on mobile */
  .back-and-ads .ads {
    max-width: 100%; /* Let it span the full width of its parent */
    height: 110px; /* give it a taller rectangle shape */
    margin-left: 0; /* remove side margine so it centers */
    border-radius: 0; /* optional: squared corners on mobile */
  }
}
/* hide the top and bottom (mobile) by default */
.ads-mobile {
  display: none;
}
@media (max-width: 768px) {
  .ads-mobile {
    display: block;
    margin: 15px 0;
    width: 100%;
    max-width: 100%;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    text-align: center;
    overflow: hidden;
  }
  #ads {
    display: none;
  }
}
