.token-form {
  margin: 2rem 0;
}

.form-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Add spacing between consecutive form groups */
.form-group + .form-group {
  margin-top: 1.5rem;
}

.form-group label {
  font-weight: bold;
  min-width: 200px;
}

.form-group input {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.form-group button {
  padding: 0.5rem 1rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.form-group button:hover {
  background-color: #0056b3;
}

/* Status pill */
.status {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 0.5rem 1.5rem;
  border-radius: 50px;
  text-align: center;
  transition: all 0.3s ease-in-out;
  box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
  font-weight: 500;
  font-size: 0.9rem;
  max-width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(100%);
}

.status.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status.loading {
  background-color: #e6f7ff;
  color: #0366d6;
  border: 1px solid #b3e0ff;
}

/* Spinner animation */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid rgb(0 0 0 / 10%);
  border-left-color: #007bff;
  border-radius: 50%;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.grades-container {
  margin-top: 2rem;
  padding: 1rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background-color: #f8f9fa;
}

.filter-controls {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background-color: #f0f0f0;
  border-radius: 4px;
}

.program-grade-select {
  flex: 1;
  min-width: 300px;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
}

.program-grade-select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgb(0 123 255 / 25%);
}

.program-grade-select option {
  padding: 0.5rem;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  color: #6c757d;
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

.help-icon:hover {
  color: #007bff;
}

.help-icon svg {
  vertical-align: middle;
}

.students-container {
  margin-top: 2rem;
  overflow-x: auto;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  position: relative;
  left: 0;
  right: 0;
  box-sizing: border-box;
}

.students-table {
  width: 98%;
  margin: 0 auto;
  border-collapse: collapse;
  background-color: white;
  box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
}

.students-table th,
.students-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.students-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #495057;
  padding: 0.75rem 0.5rem;
  font-size: 0.9rem;
  word-break: break-all;
  max-width: 120px;
  vertical-align: bottom;
  text-align: center;
}

.students-table tbody tr:hover {
  background-color: #f8f9fa;
}

/* Class list styling */
.students-table td div {
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.students-table td div:last-child {
  margin-bottom: 0;
}

/* Style for term grades */
.students-table td div strong {
  display: inline-block;
  min-width: 40px;
  padding: 0.15rem 0.3rem;
  background-color: #f8f9fa;
  border-radius: 3px;
  text-align: center;
  font-weight: 600;
}

/* Style for term grades display */
.students-table td {
  text-align: center;
  position: relative;
  padding: 0.75rem 0.25rem;
}

.students-table td:first-child {
  text-align: left; /* Keep student names left-aligned */
}

/* Grade indicators */
.high-grade {
  background-color: #d4edda;
  color: #155724;
  font-weight: bold;
}

.low-grade {
  background-color: #f8d7da;
  color: #721c24;
  font-weight: bold;
}

.no-grade {
  color: #6c757d;
  font-style: italic;
}

/* Style for diagonally rotated class headers */
.students-table th.class-header {
  height: 300px;
  white-space: nowrap;
  position: relative;
  vertical-align: bottom;
  padding: 0;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid #dee2e6;
  overflow: visible;

  /* Ensure column width is appropriate */
  min-width: 50px;
  max-width: 80px;
}

.students-table th.class-header > div {
  transform:
    translate(25px, 0)
    rotate(315deg);
  width: 30px;
  position: absolute;
  bottom: 20px;
  left: 0;
  text-align: left;
  transform-origin: bottom left;
  padding-left: 5px;
  overflow: visible;
  z-index: 2;

  /* Add background to prevent text from being cut off by cell borders */
  background: transparent;

  /* Add some width to ensure the text has enough space */
  min-width: 120px;
}

/* Ensure the first 3 columns (Name, DOB, Homeroom) aren't rotated */
.students-table th:nth-child(-n+3) {
  height: auto;
  white-space: normal;
  position: static;
  vertical-align: bottom;
  padding: 0.75rem 0.5rem;
}

/* Make Homeroom Attendance column wider */
.students-table th:nth-child(3),
.students-table td:nth-child(3) {
  min-width: 150px;
  width: 150px;
  word-break: auto-phrase;
}

/* Alternating background colors for grade columns */
.students-table th:nth-child(even):nth-child(n+4),
.students-table td:nth-child(even):nth-child(n+4) {
  background-color: #fffde7; /* Very light yellow */
}

/* Attendance styling */
.attendance-cell {
  font-size: 0.85rem;
  line-height: 1.4;
}

.attendance-present {
  color: #155724;
}

.attendance-absent {
  color: #721c24;
}

.attendance-late {
  color: #856404;
}
