/* ================================
   ACADEMICS PAGE UI (Safe Add-On)
   ================================ */

/* Grid wrapper for levels + grades */
.ac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

/* Level & Grade Cards */
.ac-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: .3s ease;
}

.ac-card:hover {
  transform: translateY(-6px);
  border-color: var(--gold);
}

.ac-card h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.ac-card p {
  font-size: 14px;
  color: var(--muted);
}

/* Books table wrapper */
#book-details {
  margin-top: 30px;
}

/* Back button */
.ac-back {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: #fdf6d9;
  border: 1px solid var(--gold);
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  transition: .3s ease;
}

.ac-back:hover {
  background: var(--gold-light);
}


/* ================================
   Grade Accordion UI
   ================================ */

.ac-grade {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.ac-grade-header {
  padding: 16px 20px;
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: #f9fafb;
}

.ac-grade-header span {
  font-size: 14px;
  color: var(--muted);
}

.ac-grade-body {
  display: none;
  padding: 16px 20px;
}

/* Active accordion */
.ac-grade.active .ac-grade-body {
  display: block;
}

/* Books table enhancement */
.ac-grade table {
  width: 100%;
  border-collapse: collapse;
}

.ac-grade th {
  background: #0f172a;
  color: #fff;
  padding: 12px;
  font-size: 14px;
}

.ac-grade td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.empty-books {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-style: italic;
}

/* ================================
   FIX GRADE ALIGNMENT & SPACING
   ================================ */

.ac-grade {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 18px 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Grade header row */
.ac-grade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

/* View books text */
.ac-grade-header span {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

/* Grade body */
.ac-grade-body {
  padding: 0;
}

/* Table should fill card */
.ac-grade table {
  width: 100%;
  margin: 0;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
}

/* Table header */
.ac-grade thead th {
  background: #0f172a;
  color: #fff;
  padding: 14px 16px;
  text-align: left;
}

/* Table body */
.ac-grade tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

/* Empty message */
.empty-books {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* Responsive fix */
@media (max-width: 768px) {
  .ac-grade-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
