:root {
  --primary-color: #6a1b9a; /* Purple */
  --background-color: #f7f9fc;
  --text-color: #333;
  --border-color: #e0e0e0;
  --sunday-color: #ff5252; /* Red */
  --saturday-color: #4fc3f7; /* Light Blue */
  --highlight-color: #ffeb3b; /* Yellow */

  --term1-color: #99cccc;
  --term2-color: #996699;
  --term3-color: #ff9999;
  --term4-color: #ffcc99;
  --term5-color: #336666;
  --term6-color: #9966cc;
  --holiday-color: #666699;
  --summerschool-color: #99ff99;
}

.calendar-container {
  max-width: 1200px;
  margin: 1rem auto;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 2rem;
}

.month {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.month-name {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-weight: 600;
  text-align: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
}

.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  text-align: center;
}

.day {
  padding: 0.75rem 0.25rem;
  border-radius: 5px;
  background-color: #f0f0f0;
  transition: background-color 0.2s ease;
  font-size: 0.9rem;
  color: var(--nsnavy);
  cursor: pointer;
}

.day:hover {
  background-color: #e5e5e5;
}

.day.empty {
  background-color: transparent;
  cursor: default;
}

/* Color-Coded Days */
.day.saturday {
  color: var(--saturday-color);
  font-weight: 600;
}

.day.sunday {
  color: var(--sunday-color);
  font-weight: 600;
}

.day.highlight {
  background-color: var(--highlight-color);
  box-shadow: 0 0 5px rgba(255, 235, 59, 0.5);
  font-weight: bold;
  color: var(--text-color);
}

/* Tablet Styles */
@media (min-width: 768px) {
  .calendar-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2rem;
  }

  .month {
    width: calc(50% - 2rem);
  }
}

.day.term1 {
  background-color: var(--term1-color);
  font-weight: 600;
}

.day.term2 {
  background-color: var(--term2-color);
  font-weight: 600;
}

.day.term3 {
  background-color: var(--term3-color);
  font-weight: 600;
}

.day.term4 {
  background-color: var(--term4-color);
  font-weight: 600;
}

.day.term5 {
  background-color: var(--term5-color);
  font-weight: 600;
}

.day.term6 {
  background-color: var(--term6-color);
  font-weight: 600;
}

.day.summerschool {
  background-color: var(--summerschool-color);
  font-weight: 600;
}

.day.holiday {
  background-color: var(--holiday-color);
  font-weight: 600;
}

/* Optional: Add a subtle border or box-shadow for a more distinct look */
.day.term1,
.day.term2,
.day.term3,
.day.term4,
.day.term5,
.day.term6,
.day.holiday,
.day.summerschool {
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Optional: Make sure the hover effect doesn't interfere with the new colors */
.day.term1:hover,
.day.term2:hover,
.day.term3:hover,
.day.term4:hover,
.day.term5:hover,
.day.term6:hover,
.day.holiday:hover,
.day.summerschool:hover {
  background-color: inherit; /* Prevents the hover color from overriding the new background */
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

.day:hover {
  background-color: #e5e5e5;
}

.day.term1:hover,
.day.term2:hover,
.day.holiday:hover,
.day.term3:hover,
.day.term4:hover,
.day.term5:hover,
.day.term6:hover,
.day.summerschool:hover {
  filter: brightness(1.1);
}

/* Pop-up Styles */

.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  width: 90%;
  max-width: 400px;
  font-family: 'Poppins', sans-serif;
  text-align: left;
}

.popup h2 {
  color: var(--ns-black);
  margin-top: 0;
  font-size: 1.5rem;
}

.popup h3 {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: #555;
}

.popup p {
  margin: 0.5rem 0;
  line-height: 1.4;
}

/* Pop-up Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

/* Tablet Styles */
@media (min-width: 768px) {
  .calendar-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2rem;
  }

  .month {
    width: calc(50% - 2rem);
  }
}
/* Desktop Styles */
@media (min-width: 1024px) {
  .calendar-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2rem;
  }

  .month {
    width: calc(33.33% - 2rem);
  }
}

/* Close Button on Popup */
.close-button {
  position: absolute; /* Allows for precise positioning relative to the pop-up */
  top: 10px; /* Distance from the top of the pop-up */
  right: 15px; /* Distance from the right side */
  background: none; /* No background color */
  border: none; /* Removes the button border */
  font-size: 1.5rem; /* Makes the 'x' large and easy to click */
  font-weight: bold;
  color: #888; /* A subtle gray color */
  cursor: pointer; /* Changes the cursor to a pointer on hover */
  transition: color 0.2s ease-in-out; /* Smooth transition for the hover effect */
}

.close-button:hover {
  color: #333; /* Darkens the color on hover */
}

.calendar-key {
  position: sticky;
  margin-top: 1rem;
  top: 0;
  z-index: 100;
  background-color: #f7f9fc;
  padding: 0.5rem 1rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.calendar-key ul {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0;
}

.calendar-key li {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer; /* Add a pointer cursor to indicate clickability */
  transition:
    transform 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out; /* Smooth transitions */
  padding: 0.5rem 1rem;
  border-radius: 20px;
  background-color: #f0f0f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-key li:hover {
  transform: translateY(-2px); /* Lifts the item slightly */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Creates a more pronounced shadow */
}

.calendar-key li::before {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
}
.calendar-key .term1::before {
  background-color: var(--term1-color);
}
.calendar-key .term2::before {
  background-color: var(--term2-color);
}
.calendar-key .term3::before {
  background-color: var(--term3-color);
}
.calendar-key .term4::before {
  background-color: var(--term4-color);
}
.calendar-key .term5::before {
  background-color: var(--term5-color);
}
.calendar-key .term6::before {
  background-color: var(--term6-color);
}
.calendar-key .holiday::before {
  background-color: var(--holiday-color);
}
.calendar-key .summerschool::before {
  background-color: var(--summerschool-color);
}

.popup p {
  gap: 0.5rem;
}

.popup p {
  padding: 0.5rem;
  color: var(--nsnavy);
  border-radius: 5px;
  text-align: center;
}

.popup .term1 {
  background-color: var(--term1-color);
}
.popup .term2 {
  background-color: var(--term2-color);
  color: white;
}
.popup .term3 {
  background-color: var(--term3-color);
}
.popup .term4 {
  background-color: var(--term4-color);
}
.popup .term5 {
  background-color: var(--term5-color);
  color: white;
}
.popup .term6 {
  background-color: var(--term6-color);
  color: white;
}
.popup .holiday {
  background-color: var(--holiday-color);
  color: white;
}
.popup .summerschool {
  background-color: var(--summerschool-color);
}

@media print {
  body {
    zoom: 0.45;
  }

  .calendar-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2rem;
  }

  .calendar-key {
    position: auto;
  }

  .month {
    width: calc(33.33% - 2rem);
    break-inside: avoid;
  }
}

/* Styling for today's date */
.day.today {
  border: 2px solid #333;
  color: #333;
  font-weight: bold;
}

.day.today::before {
  display: none;
}
