:root {
  --primary: #4f46e5;
  --secondary: #06b6d4;
  --bg-light: #f8fafc;
  --bg-dark: #0f172a;
  --card-light: #ffffff;
  --card-dark: rgba(255,255,255,0.05);
  --text-light: #0f172a;
  --text-dark: #e5e7eb;
  --glass: blur(14px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 30px;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg-light);
  color: var(--text-light);
  transition: background 0.4s, color 0.4s;
}

body.dark {
  background: linear-gradient(135deg, #020617, #0f172a);
  color: var(--text-dark);
}

/* ===== TITLE ===== */
h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ===== CONTROLS ===== */
input[type="file"],
button {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 6px 4px 20px 0;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  box-shadow: 0 8px 20px rgba(79,70,229,0.35);
}

input[type="file"] {
  background: transparent;
  color: inherit;
  box-shadow: none;
  padding-left: 0;
}

button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(6,182,212,0.5);
}

/* ===== TABLE CARD ===== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-light);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0,0,0,0.12);
  animation: fadeIn 0.6s ease;
}

body.dark table {
  background: var(--card-dark);
  backdrop-filter: var(--glass);
}

/* ===== TABLE HEAD ===== */
th {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 12px;
  font-size: 14px;
  text-align: center;
}

/* ===== TABLE BODY ===== */
td {
  padding: 10px;
  font-size: 14px;
  text-align: center;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: background 0.2s;
}

tbody tr:hover td {
  background: rgba(79,70,229,0.06);
}

body.dark tbody tr:hover td {
  background: rgba(255,255,255,0.06);
}

tbody td {
  contenteditable: true;
}

/* ===== GRADE COLORS ===== */
td.grade-A\+ {
  color: #22c55e;
  font-weight: 700;
}

td.grade-F {
  color: #ef4444;
  font-weight: 700;
}

/* ===== RETAKE COLUMN ===== */
td:last-child {
  font-weight: 600;
}

/* ===== CGPA DISPLAY ===== */
h2 {
  margin-top: 30px;
  padding: 18px 26px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-size: 22px;
  font-weight: 600;
  width: fit-content;
  box-shadow: 0 20px 40px rgba(6,182,212,0.45);
  animation: slideUp 0.6s ease;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* ===== THEME TOGGLE ===== */
#themeToggle {
  float: right;
  background: linear-gradient(135deg, #111827, #1f2933);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

body.dark #themeToggle {
  background: linear-gradient(135deg, #e5e7eb, #cbd5f5);
  color: #020617;
}
/* ===== PDF HEADER ===== */
#pdfHeader {
  display: none;
  text-align: center;
  margin-bottom: 20px;
}

#pdfHeader h1 {
  font-size: 20px;
  margin: 0;
}

#pdfHeader p {
  margin: 2px 0;
  font-size: 13px;
}

.subtitle {
  font-weight: bold;
  margin-top: 8px;
  text-decoration: underline;
}

.student-info {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  font-size: 13px;
}

/* ===== PRINT STYLE ===== */
@media print {
  body {
    background: white !important;
    color: black !important;
    padding: 10px;
  }

  button,
  input,
  #themeToggle {
    display: none !important;
  }

  #pdfHeader {
    display: block;
  }

  table {
    box-shadow: none;
    border-radius: 0;
    width: 100%;
  }

  th {
    background: #1f2937 !important;
    color: white !important;
    font-size: 12px;
  }

  td {
    font-size: 11px;
    border: 1px solid #d1d5db;
  }

  h2 {
    background: none;
    color: black;
    box-shadow: none;
    margin-top: 20px;
    font-size: 16px;
  }

  td.grade-A\+ {
    color: #16a34a !important;
  }

  td.grade-F {
    color: #dc2626 !important;
  }
}
#studentForm {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

#studentForm input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5f5;
  font-size: 13px;
}

/* Hide form in PDF */
@media print {
  #studentForm {
    display: none;
  }
}
#studentForm {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

#studentForm input,
#studentForm select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5f5;
  font-size: 13px;
}

/* Hide form on PDF */
@media print {
  #studentForm {
    display: none;
  }
}
