/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark:  #0a2e6e;
  --blue:       #1a4db8;
  --blue-light: #2e6be6;
  --gold:       #f0b400;
  --gold-light: #fde68a;
  --bg:         #f4f6fb;
  --surface:    #ffffff;
  --border:     #dde3f0;
  --text:       #1a2340;
  --muted:      #6b7799;
  --award-gold:   #b8860b;
  --award-silver: #6b7280;
  --award-bronze: #92400e;
  --radius:     10px;
  --shadow:     0 2px 16px rgba(10,46,110,.10);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, var(--blue-light) 100%);
  color: #fff;
  padding: 2rem 1.5rem;
  box-shadow: 0 4px 20px rgba(10,46,110,.30);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo-mark {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 4px rgba(240,180,0,.30);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-sub {
  font-size: .78rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  opacity: .75;
  margin-bottom: .25rem;
}

header h1 {
  font-size: clamp(1.2rem, 3vw, 1.85rem);
  font-weight: 800;
  line-height: 1.15;
}

.header-meta {
  margin-top: .4rem;
  font-size: .82rem;
  opacity: .7;
}

/* ── Main ── */
main {
  flex: 1;
  max-width: 1100px;
  width: 96%;
  margin: 0 auto;
  padding: 1.75rem 0 2.5rem;
}

/* ── Search bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: .55rem 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  transition: border-color .2s, box-shadow .2s;
}

.search-bar:focus-within {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(46,107,230,.18), var(--shadow);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  background: transparent;
  min-width: 0;
}

#search-input::placeholder { color: var(--muted); }

/* hide browser clear button */
#search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

#school-filter {
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: .88rem;
  color: var(--text);
  cursor: pointer;
  max-width: 200px;
  min-width: 100px;
}

#school-filter option { color: var(--text); background: var(--surface); }

.result-badge {
  font-size: .78rem;
  font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
  background: #e8effe;
  padding: .2rem .65rem;
  border-radius: 50px;
  min-width: 60px;
  text-align: center;
}

/* ── Table wrapper ── */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

/* ── Table head ── */
thead tr {
  background: linear-gradient(90deg, var(--blue-dark), var(--blue));
  color: #fff;
}

th {
  padding: .85rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

/* ── Table body ── */
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f0f4ff; }

td {
  padding: .7rem 1rem;
  vertical-align: middle;
}

/* column widths */
.col-no    { width: 52px; }
.col-id    { width: 200px; font-family: 'Courier New', monospace; font-size: .82rem; color: var(--muted); }
.col-name  { min-width: 160px; font-weight: 600; }
.col-grade { width: 110px; }
.col-school{ min-width: 200px; font-size: .85rem; }
.col-ab    { width: 60px; text-align: center; }
.col-score { width: 80px; text-align: center; font-weight: 700; }
.col-award { width: 130px; }

td.col-no  { color: var(--muted); font-size: .82rem; }
td.col-ab  { color: var(--muted); font-size: .85rem; }
td.col-score { font-size: 1rem; color: var(--blue-dark); }

/* ── Award badges ── */
.award-badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.award-gold          { background: #fef3c7; color: var(--award-gold);   border: 1px solid #fde68a; }
.award-silver        { background: #f3f4f6; color: var(--award-silver); border: 1px solid #d1d5db; }
.award-bronze        { background: #fef2e6; color: var(--award-bronze); border: 1px solid #fcd9a8; }
.award-participation { background: #eff6ff; color: #1d4ed8;             border: 1px solid #bfdbfe; }

/* ── States ── */
.loading-row td,
.no-results {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
  font-size: .95rem;
}

.search-hint {
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  padding: .5rem 0;
}

.hidden { display: none !important; }

/* ── Search highlight ── */
mark {
  background: var(--gold-light);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.pagination button {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: .4rem 1rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--blue);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.pagination button:hover:not(:disabled) {
  background: #e8effe;
  border-color: var(--blue-light);
}

.pagination button:disabled {
  color: var(--muted);
  cursor: default;
  opacity: .5;
}

#page-info {
  font-size: .88rem;
  color: var(--muted);
  min-width: 90px;
  text-align: center;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 1.25rem;
  font-size: .78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .col-id, .col-school { display: none; }
  th, td { padding: .6rem .7rem; }
  .logo-mark { width: 54px; height: 54px; }
}
