/* ============================================================
   BN ICT Result System — style.css
   Aesthetic: Naval / authoritative / clean editorial
   ============================================================ */

:root {
  --navy:      #0a1628;
  --navy-mid:  #122040;
  --navy-light:#1c3a6e;
  --gold:      #c8a84b;
  --gold-light:#f0d080;
  --cream:     #f7f4ee;
  --white:     #ffffff;
  --text:      #1a1a2e;
  --text-muted:#5a6a8a;
  --border:    #d0d8e8;
  --success:   #1a7a4a;
  --error:     #b03030;
  --row-hover: #eef3fc;
  --row-alt:   #f5f8ff;

  --shadow-sm: 0 2px 8px rgba(10,22,40,0.10);
  --shadow-md: 0 6px 24px rgba(10,22,40,0.15);
  --shadow-lg: 0 16px 48px rgba(10,22,40,0.22);

  --radius: 10px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Sans 3', 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
}

/* ---- HEADER ---- */
.site-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, var(--navy-light) 100%);
  color: var(--white);
  padding: 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.header-logo { display: flex; align-items: center; gap: 16px; }
.logo-emblem {
  font-size: 2.4rem;
  background: var(--gold);
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px rgba(200,168,75,0.3);
  flex-shrink: 0;
}
.header-text h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.header-text p {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(180deg, var(--navy-mid) 0%, var(--navy-light) 100%);
  padding: 48px 28px 40px;
  text-align: center;
  color: var(--white);
}
.hero-inner { max-width: 700px; margin: 0 auto; }
.hero-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--gold-light);
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.hero-sub {
  margin-top: 8px;
  font-size: 1rem;
  color: rgba(255,255,255,0.70);
  font-weight: 300;
}
.search-bar {
  margin-top: 28px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.search-bar select,
.search-bar input {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 2px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s, background 0.2s;
}
.search-bar select { min-width: 260px; cursor: pointer; }
.search-bar input  { width: 160px; }
.search-bar select:focus,
.search-bar input:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.18);
}
.search-bar select option { background: var(--navy); color: var(--white); }
.search-bar input::placeholder { color: rgba(255,255,255,0.45); }

/* ---- BUTTONS ---- */
.btn {
  padding: 11px 22px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.btn-primary:hover { background: var(--gold-light); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}
.btn-outline:hover { background: var(--gold); color: var(--navy); }
.btn-ghost {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border-color: rgba(255,255,255,0.25);
}
.btn-ghost:hover { background: rgba(255,255,255,0.22); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-edit { background: var(--navy-light); color: var(--white); border-color: var(--navy-light); }
.btn-edit:hover { background: var(--navy); }
.btn-print { background: var(--success); color: var(--white); border-color: var(--success); }

/* ---- CONTENT AREA ---- */
.content {
  max-width: 1200px;
  margin: 32px auto 60px;
  padding: 0 20px;
}
.loading-msg {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- CLASS RESULT TABLE ---- */
.result-card {
  background: var(--white);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: fadeUp 0.35s ease;
}
@keyframes fadeUp {
  from { opacity:0; transform: translateY(14px); }
  to   { opacity:1; transform: translateY(0); }
}
.card-header {
  background: var(--navy);
  color: var(--white);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.card-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-light);
}
.card-header p { font-size: 0.82rem; color: rgba(255,255,255,0.6); margin-top: 2px; }
.card-actions { display: flex; gap: 8px; }

.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.90rem;
}
thead tr {
  background: var(--navy-mid);
  color: var(--white);
}
thead th {
  padding: 12px 14px;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 2px solid var(--gold);
}
thead th:nth-child(3) { text-align: left; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover { background: var(--row-hover); }
tbody td {
  padding: 10px 14px;
  text-align: center;
  color: var(--text);
}
tbody td:nth-child(3) { text-align: left; font-weight: 500; }
.total-cell {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.97rem;
}
.comment-cell { color: var(--text-muted); font-style: italic; font-size: 0.85rem; }
.action-cell { white-space: nowrap; }

/* rank / grade badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-gold  { background: #fff3c4; color: #8a6800; }
.badge-blue  { background: #d6eaff; color: #0055aa; }
.badge-green { background: #d4f5e2; color: #146b37; }
.badge-red   { background: #ffe0e0; color: #8b0000; }

/* ---- ADMIN BADGE ---- */
.admin-badge {
  background: var(--gold);
  color: var(--navy);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,0.65);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  width: min(420px, 95vw);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.22s ease;
}
.modal-box.wide { width: min(600px, 95vw); }
@keyframes scaleIn { from { transform: scale(0.92); } to { transform: scale(1); } }
.modal-box h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--navy);
  margin-bottom: 6px;
}
.modal-sub { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 18px; }
.modal-box input[type="text"],
.modal-box input[type="password"],
.modal-box input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-body);
  margin-bottom: 12px;
  outline: none;
  transition: border 0.2s;
}
.modal-box input:focus { border-color: var(--navy-light); }
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  justify-content: flex-end;
}
.modal-actions .btn-ghost { color: var(--text-muted); border-color: var(--border); background: transparent; }
.modal-actions .btn-ghost:hover { background: var(--row-alt); }
.error-msg { color: var(--error); font-size: 0.85rem; margin: 4px 0 8px; }

/* Edit grid */
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  margin: 12px 0 18px;
}
.edit-grid label { display: block; font-size: 0.80rem; color: var(--text-muted); margin-bottom: 3px; font-weight: 600; }
.edit-grid input { margin-bottom: 0 !important; }
.edit-grid .full-width { grid-column: 1 / -1; }

/* Print form */
.print-form { margin: 14px 0 18px; }
.print-form label { display: block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.print-form input { width: 100%; padding: 11px 14px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 0.95rem; outline: none; }
.print-form input:focus { border-color: var(--navy-light); }

/* ---- PRINT STYLES ---- */
.print-only { display: none; }

@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }

  .print-only { display: block; }
  .print-page {
    padding: 24px 30px;
    font-family: 'Source Sans 3', Arial, sans-serif;
    font-size: 11pt;
    page-break-after: always;
  }
  .print-header { text-align: center; margin-bottom: 18px; border-bottom: 2px solid #000; padding-bottom: 12px; }
  .print-header h2 { font-size: 14pt; font-weight: bold; }
  .print-header p  { font-size: 10pt; margin-top: 3px; }
  .print-meta { display: flex; gap: 40px; margin-top: 8px; justify-content: center; font-size: 10pt; }
  .print-meta span { font-weight: bold; }

  .print-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 10pt; }
  .print-table th, .print-table td { border: 1px solid #333; padding: 6px 8px; text-align: center; }
  .print-table th { background: #e0e8f0; font-weight: bold; }
  .print-table td:nth-child(3) { text-align: left; }
}

/* ---- PRINT MODAL ENHANCEMENTS ---- */
.exam-input-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.exam-input-group select,
.exam-input-group input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.95rem;
}
.exam-input-group select {
  cursor: pointer;
}

.col-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.col-check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-input, #1e2535);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.15s;
}
.col-check-label:hover {
  background: var(--bg-hover, #252d40);
}
.col-check-label input[type="checkbox"] {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.radio-group {
  display: flex;
  gap: 20px;
  margin-top: 6px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 0.92rem;
}
.radio-label input[type="radio"] {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
  cursor: pointer;
}



/* ---- UTILITIES ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 700px) {
  .header-text h1 { font-size: 0.95rem; }
  .hero-title { font-size: 1.6rem; }
  .search-bar select { min-width: 100%; }
  .search-bar input  { width: 100%; }
  .edit-grid { grid-template-columns: 1fr; }
}

/* No data / empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 1rem; }

/* Logout link */
.logout-link {
  cursor: pointer;
  color: var(--gold-light);
  text-decoration: underline;
  font-size: 0.82rem;
  margin-left: 8px;
}

/* ---- STUDENT RESULT CARD ---- */
.student-card {
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
}
.sc-header {
  background: linear-gradient(135deg, #0f1f45 0%, #1a3a6b 100%);
  color: #fff;
  padding: 24px 24px 18px;
  text-align: center;
}
.sc-anchor { font-size: 2rem; margin-bottom: 6px; }
.sc-school { font-size: 1.05rem; font-weight: 700; }
.sc-subtitle { font-size: 0.72rem; color: #c9a84c; margin-top: 5px; letter-spacing: 2px; text-transform: uppercase; }
.sc-divider { width: 50px; height: 2px; background: #c9a84c; margin: 10px auto; border-radius: 2px; }
.sc-meta-row { display: flex; justify-content: center; gap: 20px; font-size: 0.78rem; color: #b8c8e8; flex-wrap: wrap; }
.sc-student-info { padding: 16px 24px; background: #f7f9ff; border-bottom: 1px solid #e8ecf8; }
.sc-name-row { display: flex; justify-content: space-between; align-items: center; }
.sc-name { font-size: 1.15rem; font-weight: 700; color: #0f1f45; }
.sc-roll { font-size: 0.82rem; color: #666; margin-top: 3px; }
.sc-score-circle {
  width: 68px; height: 68px; border-radius: 50%;
  background: linear-gradient(135deg, #0f1f45, #1a3a6b);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  box-shadow: 0 3px 12px rgba(15,31,69,0.25);
}
.sc-circle-inner { text-align: center; }
.sc-circle-num { display: block; font-size: 1.3rem; font-weight: 700; color: #c9a84c; line-height: 1; }
.sc-circle-den { display: block; font-size: 0.65rem; color: #aac; line-height: 1.4; }
.sc-table { width: 100%; border-collapse: collapse; }
.sc-table th { background: #f0f2f8; padding: 9px 18px; font-size: 0.78rem; text-align: left; color: #444; border-bottom: 2px solid #c9a84c; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.sc-table td { padding: 10px 18px; font-size: 0.88rem; border-bottom: 1px solid #f0f2f8; }
.sc-label { color: #333; width: 60%; }
.sc-value { text-align: right; }
.sc-mark { font-weight: 700; font-size: 1rem; color: #0f1f45; }
.sc-max { color: #999; font-size: 0.8rem; }
.sc-pending { color: #bbb; font-style: italic; font-size: 0.8rem; background: #f8f8f8; padding: 2px 8px; border-radius: 10px; }
.sc-total-row td { background: linear-gradient(135deg, #0f1f45, #1a3a6b); color: #fff; font-size: 0.92rem; padding: 12px 18px; }
.sc-total-row td b { color: #c9a84c; font-size: 1.05rem; }
.sc-comment { padding: 10px 18px; font-size: 0.82rem; color: #555; background: #fffbf0; border-top: 1px solid #f0e8c8; }
.sc-footer { display: flex; justify-content: space-between; padding: 18px 32px 16px; border-top: 1px solid #eee; }
.sc-footer-left, .sc-footer-right { text-align: center; }
.sc-sig-line { width: 110px; border-bottom: 1.5px solid #999; margin-bottom: 5px; }
.sc-sig-label { font-size: 0.75rem; color: #888; }
