@font-face {
    font-family: "nMedium";
    src: url("./assets/PPNikkeiRegular.otf") format("opentype");
}

@font-face {
    font-family: "nLight";
    src: url("./assets/PPNikkeiLight.otf") format("opentype");
}

body {
    font-family: 'nLight', sans-serif;
    margin: 20px;
    text-align: center;
    padding-top: 20px;
    background-color: #e5e5e5;
}

/* Class Switcher */
#class-switcher {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.class-tab {
    font-family: 'nMedium', sans-serif;
    font-size: 1.1em;
    font-weight: bold;
    padding: 10px 24px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    background-color: rgb(247, 244, 244);
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.class-tab:hover {
    background-color: #e0e0e0;
}

.class-tab.active {
    background-color: #1A4D1A;
    color: white;
    border-color: #1A4D1A;
}

.dark-mode .class-tab {
    background-color: #2d2d2d;
    color: #999;
    border-color: #444;
}

.dark-mode .class-tab:hover {
    background-color: #3d3d3d;
}

.dark-mode .class-tab.active {
    background-color: #1A4D1A;
    color: white;
    border-color: #1A4D1A;
}

/* Session slots (dynamic, class-aware) */
.session-slot {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}


#next-session {
    position: relative;
    display: inline-block;
    font-family: 'nMedium', sans-serif;
    font-size: 3em;
    font-weight: bold;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: visible;
}


#next-session::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: lightgreen;
    z-index: -1;
    animation: expandBackground 1s ease-in-out 0.5s forwards;
    border-radius: 10px;
}



#next-session {
    position: relative;
    display: inline-block;
    font-family: 'nMedium', sans-serif;
    font-size: 3em;
    font-weight: bold;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: visible;
}


@keyframes expandBackground {
    0% {
        width: 0;
    }
    100% {
        width: 100%;
    }
}


#next-session.green-glow::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: lightgreen;
    z-index: -1;
    animation: expandBackground 1s ease-in-out 0.5s forwards;
    border-radius: 10px;
}

#next-session.red-glow::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: transparent;
    z-index: -1;
    animation: expandBackground 1s ease-in-out 0.5s forwards;
    border-radius: 10px;
}


table {
    width: 60%;
    border-collapse: collapse;
    margin: 0 auto;
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: rgb(247, 244, 244);
}

th,
td {
    padding: 15px;
    text-align: center;
    background-color: white;
}

th {
    background-color: #cfcfcf;
    font-weight: 900;
    font-family: 'nMedium', sans-serif;
}


th:first-child {
    border-top-left-radius: 15px;
}


th:last-child {
    border-top-right-radius: 15px;
}


tr:last-child td:first-child {
    border-bottom-left-radius: 15px;
}


tr:last-child td:last-child {
    border-bottom-right-radius: 15px;
}


.green-row td {
    background-color: lightgreen;
}

.exam-row td {
    background-color: #ff6b6b;
    color: white;
}

.highlight-row td {
    background-color: rgb(248, 115, 115);
}


.star {
    cursor: pointer;
    color: rgb(0, 0, 0);
    font-weight: bold;
    font-size: 1em;
    margin-left: 5px;
    position: relative;
}


.star::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
}


.star:hover::after {
    opacity: 1;
    visibility: visible;
}


.github-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 2em;
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
}

.github-icon:hover {
    color: #000;
    transform: scale(1.1);
}

#timetable-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr); 
    grid-template-rows: auto repeat(9, 1fr); 
    gap: 10px; 
    padding-top: 50px;
    padding: 20px;
}

.timetable-slot {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}


.timetable-slot[style*="background-color: gray;"] {
    color: black;
}


.mon-slot {
    border-radius: 10px;

}

.tue-slot {
    border-radius: 10px;

}

.thr-slot {
    border-radius: 10px;
}

.fri-slot {
    border-radius: 10px;
}

@media screen and (max-width: 768px) {
  #timetable-container {
    width: 95% !important; 
    margin: 0 auto;
    height: auto !important;
    min-height: 400px;
    gap: 5px;
    padding: 10px;
  }
  
  .mon-slot, .tue-slot, .thr-slot, .fri-slot, .timetable-slot, .session-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    height: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .day-label {
    font-size: 0.9em;
    padding: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .day-label span {
    display: none;
  }
  
  .day-label[data-short-name]::before {
    content: attr(data-short-name);
    display: inline;
    font-size: 1em;
    font-weight: bold;
  }
  
 
  .mon-slot div, .tue-slot div, .thr-slot div, .fri-slot div, .timetable-slot div, .session-slot div {
    padding: 3px !important;
  }
 
  .mon-slot div div, .tue-slot div div, .thr-slot div div, .fri-slot div div, .timetable-slot div div, .session-slot div div {
    font-size: 1.0em !important;
    line-height: 1.3 !important;
  }
}

@media screen and (max-width: 480px) {
  .day-label {
    font-size: 0.8em;
    padding: 3px;
  }
  
  .day-label[data-short-name]::before {
    font-size: 1.1em;
  }
  
  #timetable-container {
    gap: 3px;
    padding: 5px;
  }
  
 
  .mon-slot div div, .tue-slot div div, .thr-slot div div, .fri-slot div div, .timetable-slot div div, .session-slot div div {
    font-size: 0.9em !important;
  }
}

.header {
    padding: 20px;
    transition: background-color 0.3s ease;
}

.day-label {
    font-family: 'nMedium', sans-serif;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    background-color: rgb(247, 244, 244);
    border-radius: 10px;
    margin-bottom: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #333;
    border: 1px solid #e0e0e0;
}


#week-navigation button {
  background-color: rgb(247, 244, 244);
  border: 1px solid #e0e0e0;
  padding: 10px 15px;
  border-radius: 10px;
  font-family: 'nMedium', sans-serif;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 0 5px;
}

#week-navigation button:hover {
  background-color: #e0e0e0;
}

#week-display {
  font-family: 'nMedium', sans-serif;
  font-size: 1.2em;
  margin-top: 10px;
}


#dark-mode-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: rgb(247, 244, 244);
  border: 1px solid #e0e0e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: all 0.3s ease;
  color: #333;
}

#dark-mode-toggle:hover {
  background-color: #e0e0e0;
}


.dark-mode {
  background-color: #121212;
  color: #e0e0e0;
}

.dark-mode #next-session {
  color: #f0f0f0;
}

.dark-mode .day-label {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border-color: #444;
}

.dark-mode table {
  background-color: #1e1e1e;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.dark-mode th {
  background-color: #333;
  color: #f0f0f0;
}

.dark-mode td {
  background-color: #242424;
  color: #e0e0e0;
}


.dark-mode .green-row td {
  background-color: #1a4d1a;
  color: #e0e0e0;
}

.dark-mode .exam-row td {
  background-color: #c0392b;
  color: white;
}

.dark-mode .red-row td {
  background-color: #3d3d3d;
  color: #e0e0e0;
}

.dark-mode .highlight-row td {
  background-color: #5e2727;
  color: #e0e0e0;
}


.dark-mode .timetable-slot {
  background-color: #333 !important;
  color: #e0e0e0;
}

.dark-mode .session-slot {
  background-color: #333 !important;
  color: #e0e0e0;
}

.dark-mode .mon-slot,
.dark-mode .tue-slot,
.dark-mode .thr-slot,
.dark-mode .fri-slot {
  background-color: #333 !important;
  color: #e0e0e0;
}


.dark-mode .mon-slot[style*="background-color: rgb(132, 204, 132)"],
.dark-mode .tue-slot[style*="background-color: rgb(132, 204, 132)"],
.dark-mode .thr-slot[style*="background-color: rgb(132, 204, 132)"],
.dark-mode .fri-slot[style*="background-color: rgb(132, 204, 132)"],
.dark-mode .timetable-slot[style*="background-color: rgb(132, 204, 132)"],
.dark-mode .session-slot[style*="background-color: rgb(132, 204, 132)"] {
  background-color: #1a4d1a !important;
}

/* Red background for exam sessions in timetable - both light and dark mode */
.mon-slot[style*="background-color: rgb(255, 107, 107)"],
.tue-slot[style*="background-color: rgb(255, 107, 107)"],
.thr-slot[style*="background-color: rgb(255, 107, 107)"],
.fri-slot[style*="background-color: rgb(255, 107, 107)"],
.timetable-slot[style*="background-color: rgb(255, 107, 107)"],
.session-slot[style*="background-color: rgb(255, 107, 107)"] {
  background-color: #ff6b6b !important;
  color: white !important;
}

.dark-mode .mon-slot[style*="background-color: rgb(255, 107, 107)"],
.dark-mode .tue-slot[style*="background-color: rgb(255, 107, 107)"],
.dark-mode .thr-slot[style*="background-color: rgb(255, 107, 107)"],
.dark-mode .fri-slot[style*="background-color: rgb(255, 107, 107)"],
.dark-mode .timetable-slot[style*="background-color: rgb(255, 107, 107)"],
.dark-mode .session-slot[style*="background-color: rgb(255, 107, 107)"] {
  background-color: #c0392b !important;
  color: white !important;
}

/* Additional fallback for exam sessions */
.dark-mode .mon-slot[style*="background-color: #ff6b6b"],
.dark-mode .tue-slot[style*="background-color: #ff6b6b"],
.dark-mode .thr-slot[style*="background-color: #ff6b6b"],
.dark-mode .fri-slot[style*="background-color: #ff6b6b"],
.dark-mode .timetable-slot[style*="background-color: #ff6b6b"],
.dark-mode .session-slot[style*="background-color: #ff6b6b"] {
  background-color: #c0392b !important;
  color: white !important;
}


.dark-mode .mon-slot[style*="background-color: white"],
.dark-mode .tue-slot[style*="background-color: white"],
.dark-mode .thr-slot[style*="background-color: white"],
.dark-mode .fri-slot[style*="background-color: white"],
.dark-mode .timetable-slot[style*="background-color: white"],
.dark-mode .session-slot[style*="background-color: white"] {
  background-color: #666666 !important;
  color: white !important;
}


.dark-mode td[style*="background-color: white"] {
  background-color: #666666 !important;
  color: white !important;
}


.dark-mode .red-row td {
  background-color: #666666;
  color: white;
}

.dark-mode .star::after {
  background-color: #555;
  color: #fff;
}


.dark-mode #week-navigation button {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border-color: #444;
}

.dark-mode #week-navigation button:hover {
  background-color: #3d3d3d;
}

.dark-mode #dark-mode-toggle {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border-color: #444;
}

.dark-mode #dark-mode-toggle:hover {
  background-color: #3d3d3d;
}


.mon-slot[style*="background-color: white"],
.tue-slot[style*="background-color: white"],
.thr-slot[style*="background-color: white"],
.fri-slot[style*="background-color: white"],
.timetable-slot[style*="background-color: white"],
.session-slot[style*="background-color: white"] {
  color: white !important;
}


td[style*="background-color: white"] {
  color: white !important;
}


#stats-button {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: rgb(247, 244, 244);
  border: 1px solid #e0e0e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: all 0.3s ease;
  color: #333;
}

#stats-button:hover {
  background-color: #e0e0e0;
}

#calendar-button {
  position: fixed;
  top: 120px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: rgb(247, 244, 244);
  border: 1px solid #e0e0e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: all 0.3s ease;
  color: #333;
}

#calendar-button:hover {
  background-color: #e0e0e0;
}

.dark-mode #stats-button {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border-color: #444;
}

.dark-mode #stats-button:hover {
  background-color: #3d3d3d;
}

.dark-mode #calendar-button {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border-color: #444;
}

.dark-mode #calendar-button:hover {
  background-color: #3d3d3d;
}

.stats-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 600px;
  background-color: rgb(247, 244, 244);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 2000;
  padding: 20px;
  text-align: left;
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #aaa #f0f0f0;
}

.dark-mode .stats-popup {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border: 1px solid #444;
  scrollbar-color: #666 #333;
}

.stats-popup h2 {
  font-family: 'nMedium', sans-serif;
  margin-top: 0;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.dark-mode .stats-popup h2 {
  border-bottom: 1px solid #444;
}

.stats-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  padding: 8px;
  border-radius: 5px;
}

.stats-row:nth-child(even) {
  background-color: rgba(0,0,0,0.05);
}

.dark-mode .stats-row:nth-child(even) {
  background-color: rgba(255,255,255,0.05);
}

.stats-bar {
  height: 20px;
  background: linear-gradient(to right, #1a4d1a, #666666);
  border-radius: 10px;
  margin-top: 5px;
  position: relative;
}

.stats-bar-label {
  position: absolute;
  top: 0;
  width: 100%;
  text-align: center;
  color: white;
  font-size: 0.8em;
  line-height: 20px;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(0,0,0,0.7);
}

.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.5);
  z-index: 1500;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}


.stats-popup::-webkit-scrollbar {
  width: 8px;
}

.stats-popup::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.stats-popup::-webkit-scrollbar-thumb {
  background-color: #aaa;
  border-radius: 4px;
  border: 1px solid #f0f0f0;
}

.stats-popup::-webkit-scrollbar-thumb:hover {
  background-color: #888;
}


.dark-mode .stats-popup::-webkit-scrollbar-track {
  background: #333;
}

.dark-mode .stats-popup::-webkit-scrollbar-thumb {
  background-color: #666;
  border: 1px solid #333;
}

.dark-mode .stats-popup::-webkit-scrollbar-thumb:hover {
  background-color: #888;
}


.dark-mode #next-session.green-glow {
  color: #1a4d1a;
}

.dark-mode #next-session.green-text {
  color: #f0f0f0;
  background-color: #1a4d1a !important;
}


.dark-mode #next-session.green-glow::before {
  background-color: #1a4d1a !important;
}


.popup-overlay, #stats-overlay {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}


body.no-scroll {
  overflow: hidden;
}

.calendar-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 700px;
  background-color: rgb(247, 244, 244);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 2000;
  padding: 20px;
  text-align: left;
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #aaa #f0f0f0;
}

.dark-mode .calendar-popup {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border: 1px solid #444;
  scrollbar-color: #666 #333;
}

.calendar-popup h2 {
  font-family: 'nMedium', sans-serif;
  margin-top: 0;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.dark-mode .calendar-popup h2 {
  border-bottom: 1px solid #444;
}

.calendar-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.calendar-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calendar-nav-button {
  background-color: rgb(247, 244, 244);
  border: 1px solid #e0e0e0;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'nMedium', sans-serif;
  font-size: 14px;
  transition: all 0.3s ease;
}

.calendar-nav-button:hover {
  background-color: #e0e0e0;
}

.dark-mode .calendar-nav-button {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border-color: #444;
}

.dark-mode .calendar-nav-button:hover {
  background-color: #3d3d3d;
}

.calendar-month-year {
  font-family: 'nMedium', sans-serif;
  font-size: 1.4em;
  font-weight: bold;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: 10px;
}

.calendar-header {
  text-align: center;
  font-weight: bold;
  padding: 10px 5px;
  background-color: #cfcfcf;
  font-family: 'nMedium', sans-serif;
}

.dark-mode .calendar-header {
  background-color: #333;
  color: #f0f0f0;
}

.calendar-day {
  text-align: center;
  padding: 8px 4px;
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 4px;
  position: relative;
}

.calendar-day.other-month {
  color: #ccc;
}

.dark-mode .calendar-day.other-month {
  color: #666;
}

.calendar-day.weekend {
  background-color: #f0f0f0;
}

.dark-mode .calendar-day.weekend {
  background-color: #1a1a1a;
}

.calendar-day.session-opl-dsl {
  background-color: #84cc84;
  color: white;
  font-weight: bold;
}

.dark-mode .calendar-day.session-opl-dsl {
  background-color: #1a4d1a;
}

.calendar-day.session-exam {
  background-color: #ff6b6b;
  color: white;
  font-weight: bold;
}

.dark-mode .calendar-day.session-exam {
  background-color: #c0392b;
}

.calendar-day.session-ppl {
  background-color: #666666;
  color: white;
  font-weight: bold;
}

.calendar-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.legend-color {
  width: 15px;
  height: 15px;
  border-radius: 3px;
}

/* Tooltip styles for session types */
.session-type-tooltip {
  position: relative;
  cursor: default;
  border-bottom: 1px dotted currentColor;
}

.session-type-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85em;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
  pointer-events: none;
}

.session-type-tooltip::before {
  content: "";
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
  pointer-events: none;
}

.session-type-tooltip:hover::after,
.session-type-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

.dark-mode .session-type-tooltip::after {
  background-color: #555;
  color: #fff;
}

.dark-mode .session-type-tooltip::before {
  border-color: #555 transparent transparent transparent;
}
