:root{
  --bg:#F1F2FB;
  --text:#26274B;
  --btn:#3236FD;
  --border:#dcdff4;
  --danger:#ffdedf;
  --accent:#E2D2FF;
  --accent-2:#474BFF;
  --radius:10px;
}

*{box-sizing:border-box;font-family:Nunito,system-ui,Arial}
body{margin:0;background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased}
.wrap{max-width:1200px;margin:24px auto;padding:18px}
h1{font-size:30px;text-align:center;margin:6px 0 2px;font-weight:800;color:var(--text)}
.subtitle{display:block;text-align:center;color:var(--accent-2);font-weight:700;margin-bottom:8px}
.top-line{height:6px;background:linear-gradient(90deg,var(--accent) 0%, var(--accent-2) 100%);border-radius:6px;margin:8px auto 18px;max-width:420px}

.card{background:#fff;border:1px solid var(--border);border-radius:14px;padding:16px;margin-bottom:14px;box-shadow:0 6px 18px rgba(30,35,90,0.04)}
.section-title{font-size:20px;text-align:center;margin:4px 0 12px;font-weight:700}
.muted{color:#6a6e91}
.center{text-align:center}

/* School & Student Info grid */
.school-grid{display:grid;grid-template-columns:160px 1fr;gap:12px;align-items:start}
.logo-block{display:flex;flex-direction:column;gap:8px}
.logo-preview{width:140px;height:100px;border-radius:8px;border:1px solid var(--border);display:flex;align-items:center;justify-content:center;background:linear-gradient(180deg,#fff,#f7f7ff);color:#666;font-weight:700}
.file-btn{background:var(--btn);color:#fff;padding:8px 10px;border-radius:8px;border:none;cursor:pointer;font-weight:700}
.kv{font-weight:700;color:var(--text);font-size:13px;display:block;margin-bottom:6px}
.input{padding:10px 12px;border-radius:10px;border:1px solid var(--border);height:44px;width:100%}
.input:focus{outline:2px solid rgba(51,54,253,0.12);border-color:var(--btn)}
.info-block{width:100%}
.row-3{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;align-items:center;margin-bottom:10px}
.row-4{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;align-items:center}
.mt-8{margin-top:10px}
.logo-actions{display:flex;gap:8px;align-items:center}

/* Marks table wrapper – enables scroll */
.marks-table-wrap{
  overflow-x:auto;
  overflow-y:auto;
  border:1px solid var(--border);
  border-radius:10px;
}

/* Optional outer wrapper */
.marks-table-scroll{
  width:100%;
}

/* Base marks table */
table.marks{width:100%;border-collapse:collapse;font-size:13px}
table.marks th, table.marks td{border:1px solid #cfcfe6;padding:6px;text-align:center;vertical-align:middle}
table.marks th{background:#f8f9ff;font-weight:800;color:var(--text)}
.term-header{background:#e9f6f6}
.sub-input{width:100%;padding:6px;border:none;background:transparent;text-align:left;font-weight:600}
.num-input{width:76px;padding:6px;border-radius:8px;border:1px solid var(--border);text-align:center}
.num-input.error{border-color:#ff4747;background:#ffefef}
.add-sub{background:transparent;border:2px dashed var(--border);padding:8px;border-radius:8px;cursor:pointer;display:inline-flex;align-items:center;gap:8px;font-weight:700}
.marks-actions{display:flex;justify-content:space-between;align-items:center;margin-top:12px;gap:10px}
.controls{display:flex;gap:10px;flex-wrap:wrap}
.left-actions{display:flex;gap:8px;align-items:center}

/* divider */
.divider{height:12px}

/* sub-cards */
.sub-card{background:#fcfeff;border:1px solid #eef5f5;padding:12px;border-radius:10px;margin-top:8px}
.sub-title{font-weight:700;color:#2c6f6f;margin-bottom:8px}

/* simple manual grade table */
.simple-table{width:100%;border-collapse:collapse;font-size:13px;margin-bottom:8px}
.simple-table th, .simple-table td{border:1px solid #e6eef0;padding:8px;text-align:left}
.simple-table th{background:#f6fbfb;text-align:center}
.manual-grade{width:100%;padding:6px;border-radius:6px;border:1px solid var(--border);height:36px}

/* ============ Grade Section ============ */
.grade-card {
  background: #f9faff;
  border: 1px solid #e0e6ef;
  border-radius: 10px;
  padding: 22px 26px;
  margin-top: 30px;
  font-family: "Nunito", sans-serif;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.grade-card h3 {
  font-size: 20px;
  font-weight: 700;
  color: #1a2b48;
  margin-bottom: 12px;
}

.grade-row {
  margin-bottom: 18px;
}

.grade-row h4 {
  color: #115982;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  border-left: 4px solid #38b6ff;
  padding-left: 10px;
}

.grade-set {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  background: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  border: 1px solid #e3ebf3;
}

.grade-set span {
  font-size: 14px;
  color: #2d3e50;
  display: inline-block;
  white-space: nowrap;
}

.grade-set b {
  color: #1a2b48;
  font-weight: 700;
}

@media (max-width: 768px) {
  .grade-set {
    flex-direction: column;
    gap: 6px;
  }
}

/* Grades table */
.grades-area{padding:8px}
.grades-table{width:100%;border-collapse:collapse}
.grades-table td, .grades-table th{border:1px solid var(--border);padding:10px;text-align:center}
.grades-table td[contenteditable]{background:#fff;border-radius:6px}
.grades-controls{display:flex;gap:10px;justify-content:center;margin-top:12px}
.del-grade{background:#fff;border:1px solid var(--border);padding:6px;border-radius:6px;cursor:pointer}

/* preview */
#preview{padding:16px;border:1px dashed var(--border);border-radius:12px;background:#fff}
.preview-section-title{font-weight:700;margin:8px 0}

/* signs */
.signs{display:flex;gap:20px;justify-content:space-between;margin-top:18px}
.sign-box{flex:1;text-align:center}
.sign-line{height:2px;background:#222;margin:40px auto 8px;width:220px}

/* responsiveness for top section */
@media(max-width:1000px){
  .school-grid{grid-template-columns:1fr;gap:12px}
  .row-3{grid-template-columns:1fr;}
  .row-4{grid-template-columns:1fr 1fr;}
  .logo-preview{width:100%;height:120px}
}
@media(max-width:600px){
  .row-4{grid-template-columns:1fr}
  .num-input{width:60px}
  .legend-grid{grid-template-columns:repeat(2,1fr)}
}

/* top action buttons */
.top-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 22px 0 30px;
  flex-wrap: wrap;
}

/* general button style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s ease;
  border: 1px solid #ccc;
  padding: 6px 14px;
}

.btn.primary {
  background: #3236FD;
  color: #fff;
  border: none;
  padding: 10px 22px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.btn.primary:hover {background:#1e22d0;}

.btn.danger {
  background: #FFE6E6;
  color: #B30000;
  border: 1px solid #ffcccc;
  padding: 10px 22px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.btn.danger:hover {background:#ffcccc;}

.btn svg {margin-right:6px}

/* bottom action buttons layout */
.bottom-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 35px 0;
  flex-wrap: wrap;
}
.bottom-actions .btn.primary {
  background: #3236FD;
  color: #fff;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.bottom-actions .btn.primary:hover {background:#1e22d0;}
.bottom-actions .btn.danger {
  background: #FFE6E6;
  color: #B30000;
  border: 1px solid #ffcccc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.bottom-actions .btn.danger:hover {background:#ffcccc;}

/* Arabic section (not used here but kept) */
#arabicBody td {
  padding: 6px;
  border: 1px solid #cfcfe6;
  text-align: center;
  vertical-align: middle;
}
#arabicBody .sub-input[readonly] {
  background: transparent;
  border: none;
  text-align: left;
  font-weight: 600;
  color: #222;
  width: 100%;
  padding: 6px;
}
#arabicBody .num-input {
  width: 76px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid #dcdff4;
  text-align: center;
  background: #fff;
  font-weight: 600;
  box-sizing: border-box;
  color: #333;
  transition: all 0.2s ease;
}
#arabicBody .grade {
  width: 76px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #dcdff4;
  text-align: center;
  background: #f8f9ff;
  font-weight: 700;
  color: #1a1b40;
  box-sizing: border-box;
}
.arabic-sep td {
  background: #f1edff;
  color: #1a1b40;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  padding: 10px;
  border-top: 2px solid #dcdff4;
  border-bottom: 2px solid #dcdff4;
}
#arabicBody .num-input:focus {
  outline: 2px solid rgba(71, 75, 255, 0.2);
  border-color: var(--btn);
}
#arabicBody tr:hover td {background:#fafaff}

/* Academic Section Buttons */
.academic-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: flex-end;
}
.add-btn {
  background: #eaf7ff;
  color: #0066cc;
  border-color: #b5ddff;
}
.add-btn:hover {background:#d7efff;}
.clear-btn {
  background: #ffeaea;
  color: #d60000;
  border-color: #ffcaca;
}
.clear-btn:hover {background:#ffdede;}

/* Delete Subject Button */
.subject-cell {
  position: relative;
  width: 200px !important;
  min-width: 180px;
  max-width: 220px;
  white-space: normal;
  word-wrap: break-word;
}
.sub-input {
  width: 100%;
  max-width: 200px;
  font-size: 14px;
  padding: 4px 6px;
  text-align: left;
  border-radius: 6px;
}
.del-row-btn {
  position: absolute;
  right: 6px;
  top: 4px;
  background: transparent;
  border: none;
  color: #999;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}
.del-row-btn:hover {
  color: #ff3b3b;
  transform: scale(1.1);
}

/* ========== CCE Info Section Styling ========== */
.cce-info-section {
  background: #f9fbff;
  padding: 40px 30px;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  margin-top: 50px;
  font-family: 'Nunito', sans-serif;
  color: #1A2B48;
}
.cce-container {max-width:900px;margin:0 auto;}
.cce-info-section h2 {
  font-size: 26px;
  color: #115982;
  margin-bottom: 10px;
  text-align: center;
}
.cce-info-section h3 {
  font-size: 20px;
  color: #1A2B48;
  margin-top: 30px;
  border-left: 4px solid #38B6FF;
  padding-left: 10px;
}
.cce-info-section p {font-size:15px;margin-bottom:10px;}
.cce-step {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  background: #fff;
  border-radius: 12px;
  padding: 10px 15px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}
.cce-step:hover {
  transform: translateY(-3px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}
.cce-step .icon {
  font-size: 20px;
  color: #38B6FF;
  margin-right: 10px;
}
.cce-list {list-style:none;padding:0;margin:0;}
.cce-list li {
  margin: 8px 0;
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.cce-list li strong {color:#115982;}
.faq {
  margin-top: 20px;
  border: 1px solid #e0e6ef;
  border-radius: 12px;
  padding: 14px 18px;
  background: #fff;
}
.faq h4 {
  font-size: 16px;
  color: #115982;
  margin-bottom: 5px;
}

@media (max-width: 768px) {
  .cce-info-section {
    padding: 25px 15px;
  }
  .cce-info-section h2 {font-size:22px;}
  .cce-info-section h3 {font-size:18px;}
  .cce-step {
    font-size: 14px;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ====================== FOOTER ====================== */
.footer {
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: #4c4e70;
  padding: 24px 10px 35px;
  background: #f9faff;
  border-top: 1px solid #e4e8f7;
  margin-top: 60px;
  letter-spacing: 0.2px;
}
.footer .heart {
  color: #ff4d6d;
  font-size: 16px;
  display: inline-block;
  transform: scale(1);
  animation: pulse 1.5s infinite ease-in-out;
  vertical-align: middle;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
.footer-name {
  font-weight: 700;
  color: #115982;
  transition: all 0.3s ease;
}
.footer-name:hover {
  color: #38B6FF;
  text-shadow: 0 0 6px rgba(56, 182, 255, 0.5);
  cursor: pointer;
}

/* =========================
   Semester Table – Clean UI
   ========================= */
#semTable {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #dcdcdc;
  font-family: 'Poppins', sans-serif;
  font-size: 13.5px;
  text-align: center;
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
  border-radius: 6px;
  overflow: hidden;
  min-width: 1200px; /* ensures horizontal scroll on small screens */
}

#semTable th, #semTable td {
  border: 1px solid #e5e5e5;
  padding: 6px 8px;
  vertical-align: middle;
}

#semTable th {
  background: #f7f9fc;
  color: #1a2b48;
  font-weight: 600;
  text-transform: capitalize;
}

#semTable tr:nth-child(even) td {
  background: #fafafa;
}

/* Header styling */
#semTable thead th {
  background: #f7f9fc;
  color: #1a2b48;
  font-weight: 600;
  text-align: center;
  padding: 10px 8px;
  border: 1px solid #e5e8ee;
  vertical-align: middle;
}

/* Cell styling */
#semTable td {
  border: 1px solid #e9ecf3;
  padding: 4px 6px;
  text-align: center;
  vertical-align: middle;
  background: #fff;
}

/* Inputs */
#semTable input {
  width: 100%;
  border: 1px solid #dce2eb;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 13px;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
}
#semTable input:focus {
  border-color: #38b6ff;
  box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.15);
  background-color: #f9fcff;
}
#semTable input[readonly] {
  background-color: #f3f5f8;
  color: #555;
}

/* Standardized numeric/grade inputs */
#semTable input.num-input {
  width: 72px !important;
  min-width: 72px;
  max-width: 80px;
  height: 34px !important;
  padding: 6px 8px !important;
  text-align: center !important;
  border: 1px solid #d9dfec !important;
  border-radius: 8px !important;
  background: #fff !important;
  font-weight: 600;
  color: #1a1b40;
  box-sizing: border-box;
}
#semTable input.grade {
  width: 72px !important;
  min-width: 72px;
  max-width: 80px;
  height: 34px !important;
  padding: 6px 8px !important;
  text-align: center !important;
  border: 1px solid #d6dbe8 !important;
  border-radius: 8px !important;
  background: #f5f7ff !important;
  font-weight: 700;
  color: #1a1b40;
  box-sizing: border-box;
}
#semTable input.finalGrade {
  background: #eef4ff !important;
  border-color: #d0dbff !important;
}

/* readonly numeric */
#semTable input[readonly] {
  background: #f7f9fc !important;
  border-color: #e6e9f2 !important;
  color: #233;
  font-weight: 700;
}

/* Student name input */
#semTable input.name-input {
  width: 220px !important;
  min-width: 160px;
  max-width: 360px;
  padding: 6px 10px !important;
  text-align: left !important;
  height: 34px !important;
  border-radius: 8px !important;
  border: 1px solid #e3e7f2 !important;
  box-sizing: border-box;
}

/* Roll number input */
#semTable input.roll {
  width: 64px !important;
  height: 34px !important;
  padding: 6px 8px !important;
  text-align: center !important;
  border-radius: 8px !important;
  border: 1px solid #e6e9f2 !important;
  box-sizing: border-box;
  background:#fff;
  font-weight:600;
}

/* Error styles */
#semTable input.num-input.error,
#semTable input.error {
  border-color: #f44336 !important;
  background: rgba(244,67,54,0.06) !important;
}

/* Hover aid */
#semTable tbody tr:hover td input {
  box-shadow: 0 0 0 3px rgba(56,182,255,0.03);
}

/* keep print-friendly colors */
@media print {
  #semTable, #semTable th, #semTable td { color: #000; border-color:#aaa; }
  #semTable input { border: 1px solid #ccc; background: #fff; color: #000; }
}
.rounded-flash {
  background: #EAF7FF !important;
  box-shadow: 0 0 8px 2px rgba(52, 152, 219, 0.45);
  transition: background 0.9s ease-out, box-shadow 1s ease-out;
}
/* Bottom action buttons FIX — same alignment as top bar */
.main-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 22px 0;
}

/* Buttons inside bottom bar should not overlap */
.main-actions .btn {
  flex: 0 0 auto;
  margin: 0;
}
/* Tray */
.academic-tray {
  background: #ffffff;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

/* Title styling */
.academic-header {
  text-align: center;
  margin-bottom: 20px;
}

.academic-title {
  font-size: 21px;
  font-weight: 800;
  color: #1e3a8a;
  margin: 0;
}

.academic-subtitle {
  font-size: 13.5px;
  color: #555;
  font-weight: 500;
  margin-top: 4px;
}

/* Row layout */
.academic-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.mt-14 {
  margin-top: 14px;
}

/* Field block */
.field-box label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  display: block;
}

/* Inputs */
.input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

.input:read-only {
  background: #f3f6ff;
  font-weight: 600;
}

.select-input {
  cursor: pointer;
}

/* Hover effect */
.input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.18);
}
/* Center alignment for row-2 */
.center-row {
  display: grid;
  grid-template-columns: repeat(3, 280px); /* width of each field */
  justify-content: center;                 /* center whole group */
  gap: 18px;
}
/* === Card / Tray Hover Animation === */
.card {
  transition: all 0.35s ease;
}
.card:hover {
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.09);
  transform: translateY(-2px);
}

/* === Fade + Slide on Load === */
.card {
  opacity: 0;
  transform: translateY(12px);
  animation: trayFadeIn 0.7s ease forwards;
}
@keyframes trayFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Input / Dropdown Hover + Focus === */
.input, select.input {
  transition: all 0.25s ease;
  background: #F6F9FF;
  border: 1px solid #dce5f7;
}
.input:hover,
select.input:hover {
  border-color: #7aa7ff;
  background: #f9fbff;
}
.input:focus,
select.input:focus {
  border-color: #3d7dff;
  box-shadow: 0 0 0 3px rgba(61, 125, 255, 0.26);
  background: #ffffff;
}

/* === Label Smooth Hover === */
label.kv {
  transition: color 0.25s ease;
}
label.kv:hover {
  color: #264bff;
}
/* =============== ACADEMIC INFO TRAY — FINAL VERSION =============== */

/* Container */
.academic-tray {
  max-width: 1180px;
  margin: 20px auto 24px;
  padding: 26px 28px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* Header */
.academic-header {
  text-align: center;
  margin-bottom: 22px;
}
.academic-title {
  font-size: 26px;
  font-weight: 800;
  color: #1e3a8a;
  margin: 0;
}
.academic-subtitle {
  font-size: 14px;
  color: #555;
  margin-top: 6px;
  font-weight: 500;
}

/* Row layout – desktop */
.academic-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
}

.mt-14 {
  margin-top: 16px;
}

/* Row 2 (subject + teachers) */
.center-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Field box */
.field-box label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 5px;
  display: block;
}

/* Inputs & selects inside tray */
.academic-tray .input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #f6f9ff;
  line-height: 1.3;
  min-height: 44px;
  box-sizing: border-box;
  appearance: none;
}

.academic-tray .input:read-only {
  background: #eff4ff;
  font-weight: 600;
}

.academic-tray .select-input {
  cursor: pointer;
}

/* Focus & hover */
.academic-tray .input:hover,
.academic-tray .select-input:hover {
  border-color: #7aa7ff;
  background: #f9fbff;
}
.academic-tray .input:focus,
.academic-tray .select-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.18);
  background: #ffffff;
}

/* ---------- RESPONSIVE LAYOUT ---------- */

/* Medium screens (tablet landscape / small laptop) */
@media (max-width: 1100px) {
  .academic-tray {
    padding: 22px 20px;
  }
  .academic-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .center-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Small tablets */
@media (max-width: 800px) {
  .academic-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .center-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */
@media (max-width: 600px) {
  .academic-tray {
    padding: 18px 14px;
    border-radius: 16px;
  }
  .academic-header {
    margin-bottom: 16px;
  }
  .academic-title {
    font-size: 22px;
  }
  .academic-subtitle {
    font-size: 13px;
  }
  .academic-row,
  .center-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
