/* ============================================================
   Jai Tulunad — Tulu Lipi Class Registration
   Palette: Tulunad red + temple gold on unbleached paper.
   ============================================================ */

:root {
  --red:        #C1121F;
  --red-deep:   #8A0C16;
  --red-wash:   #FBEDEC;
  --gold:       #E8A317;
  --gold-soft:  #F6E2B4;
  --ink:        #221A15;
  --ink-60:     #6A5F57;
  --ink-40:     #9A8F86;
  --paper:      #FDFBF6;
  --card:       #FFFFFF;
  --line:       #E6DED0;
  --green:      #1E7A4B;
  --green-wash: #E8F4EC;

  --radius:     10px;
  --shadow:     0 1px 2px rgba(34,26,21,.06), 0 8px 24px -16px rgba(34,26,21,.28);
  --maxw:       1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Hind', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .4em;
  letter-spacing: -0.01em;
}

a { color: var(--red); }

img { max-width: 100%; height: auto; }

/* ---------- Layout shell ---------- */

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Public: masthead ---------- */

.masthead {
  background: var(--red-deep);
  background-image: linear-gradient(120deg, var(--red-deep), var(--red) 70%);
  color: #fff;
  border-bottom: 4px solid var(--gold);
}

.masthead .shell {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.masthead img {
  height: 52px;
  width: auto;
  background: #fff;
  border-radius: 8px;
  padding: 5px 9px;
}

.masthead-text strong {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.18rem;
  letter-spacing: .01em;
}

.masthead-text span {
  font-size: .86rem;
  color: var(--gold-soft);
}

.masthead-link {
  margin-left: auto;
  color: #fff;
  text-decoration: none;
  font-size: .88rem;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 999px;
  padding: 7px 16px;
}

.masthead-link:hover { background: rgba(255,255,255,.12); }

/* ---------- Public: hero + form grid ---------- */

.page {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 40px;
  padding: 44px 0 72px;
}

.aside { position: sticky; top: 28px; align-self: start; }

.aside h1 {
  font-size: 2.1rem;
  margin-bottom: .35em;
}

.aside p { color: var(--ink-60); }

.aside .rule {
  width: 56px; height: 3px;
  background: var(--gold);
  margin: 18px 0 22px;
}

.facts {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.facts li {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  font-size: .92rem;
}

.facts b {
  color: var(--red);
  font-family: 'Fraunces', serif;
  flex: 0 0 74px;
}

.aside-contact {
  margin-top: 26px;
  font-size: .88rem;
  color: var(--ink-60);
}

/* ---------- Form ---------- */

.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

fieldset {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 26px 30px 30px;
}

fieldset:first-of-type { border-top: 0; }

legend {
  font-family: 'Fraunces', serif;
  font-size: 1.12rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: 4px;
}

.legend-note {
  color: var(--ink-60);
  font-size: .88rem;
  margin: 0 0 20px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}

.grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; }

label {
  font-size: .86rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

label .req { color: var(--red); margin-left: 2px; }

.hint {
  font-size: .78rem;
  color: var(--ink-40);
  margin-top: 5px;
}

input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=password], select, textarea {
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}

textarea { resize: vertical; min-height: 84px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-wash);
}

input.err, select.err, textarea.err { border-color: var(--red); background: var(--red-wash); }

.field-error { color: var(--red); font-size: .78rem; margin-top: 5px; }

/* Radio / choice cards */

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.choice {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 15px;
  cursor: pointer;
  background: #fff;
}

.choice input { position: absolute; opacity: 0; pointer-events: none; }

.choice b { display: block; font-weight: 600; font-size: .95rem; }

.choice span { color: var(--ink-60); font-size: .82rem; }

.choice:has(input:checked),
.choice.on {
  border-color: var(--red);
  background: var(--red-wash);
  box-shadow: inset 3px 0 0 var(--red);
}

.choice:has(input:focus-visible),
.choice.focus { box-shadow: 0 0 0 3px var(--red-wash); }

/* Conditional blocks */

.conditional[hidden] { display: none; }

/* Footer / submit */

.form-foot {
  background: #FBF6EC;
  border-top: 1px solid var(--line);
  padding: 22px 30px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.form-foot p { margin: 0; font-size: .84rem; color: var(--ink-60); flex: 1 1 260px; }

.btn {
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  border: 0;
  border-radius: 8px;
  padding: 12px 26px;
  cursor: pointer;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  display: inline-block;
  transition: background .12s;
}

.btn:hover { background: var(--red-deep); }

.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover { background: #fff; border-color: var(--ink-40); }

.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #d0910f; }

.btn-sm { padding: 8px 15px; font-size: .86rem; }

/* Alerts */

.alert {
  border-radius: 8px;
  padding: 13px 16px;
  margin-bottom: 20px;
  font-size: .92rem;
  border: 1px solid;
}

.alert-error { background: var(--red-wash); border-color: #EFC4C2; color: var(--red-deep); }
.alert-ok    { background: var(--green-wash); border-color: #BFE0CD; color: var(--green); }
.alert ul { margin: 8px 0 0; padding-left: 18px; }

/* Honeypot */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Success page ---------- */

.done {
  max-width: 620px;
  margin: 70px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 5px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 40px;
  text-align: center;
}

.regno {
  font-family: 'Fraunces', serif;
  font-size: 1.9rem;
  color: var(--red);
  background: var(--red-wash);
  border-radius: 8px;
  padding: 14px;
  margin: 22px 0;
  letter-spacing: .02em;
}

/* ============================================================
   Admin
   ============================================================ */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--red-deep), #5C0810);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 30px 60px -24px rgba(0,0,0,.55);
  padding: 38px 36px;
  width: 100%;
  max-width: 400px;
}

.login-card img { height: 56px; display: block; margin: 0 auto 18px; }
.login-card h1 { font-size: 1.4rem; text-align: center; }
.login-card > p { text-align: center; color: var(--ink-60); font-size: .88rem; margin: 0 0 24px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; }

.topbar {
  background: var(--ink);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}

.topbar .shell {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.topbar .brand {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar .brand img { height: 34px; background: #fff; border-radius: 6px; padding: 3px 6px; }

.topnav { display: flex; gap: 4px; margin-left: auto; align-items: center; }

.topnav a {
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .9rem;
  padding: 7px 13px;
  border-radius: 6px;
}

.topnav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.topnav a.on { background: var(--red); color: #fff; }
.topnav .who { color: var(--ink-40); font-size: .84rem; padding-left: 8px; }

.admin-body { padding: 32px 0 60px; }

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-head h1 { font-size: 1.7rem; margin: 0; }
.page-head p { margin: 0; color: var(--ink-60); font-size: .9rem; }
.page-head .spacer { flex: 1; }

/* Stat tiles */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.stat:first-child { border-left-color: var(--red); }

.stat .n {
  font-family: 'Fraunces', serif;
  font-size: 2.1rem;
  line-height: 1.1;
  display: block;
}

.stat .k { color: var(--ink-60); font-size: .86rem; }

/* Filters */

.filters {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
}

.filters label { font-size: .78rem; color: var(--ink-60); }

/* Table */

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

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

thead th {
  text-align: left;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-60);
  background: #FBF6EC;
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  white-space: nowrap;
}

tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FDFBF6; }

td .sub { display: block; color: var(--ink-40); font-size: .8rem; }

.mono { font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block;
  font-size: .74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.tag-lipi { background: var(--gold-soft); color: #7A5306; }
.tag-language { background: var(--red-wash); color: var(--red-deep); }
.tag-both { background: #E7E9F5; color: #2E3A7A; }
.tag-online { background: var(--green-wash); color: var(--green); }
.tag-offline { background: #F0EBE2; color: var(--ink-60); }

.empty { padding: 52px 20px; text-align: center; color: var(--ink-60); }
.empty h3 { color: var(--ink); }

/* Pagination */

.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 18px; font-size: .88rem; }
.pager a, .pager span {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
}
.pager .on { background: var(--red); border-color: var(--red); color: #fff; }
.pager .muted { color: var(--ink-40); border: 0; background: none; }

/* Detail view */

.detail {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-head {
  background: #FBF6EC;
  border-bottom: 1px solid var(--line);
  padding: 22px 26px;
}

.detail-head h2 { margin: 0 0 4px; font-size: 1.45rem; }
.detail-head .rn { font-family: 'Fraunces', serif; color: var(--red); font-size: 1rem; }

.dl { margin: 0; padding: 8px 26px 26px; }

.dl-row {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.dl-row:last-child { border-bottom: 0; }
.dl-row dt { color: var(--ink-60); font-size: .88rem; }
.dl-row dd { margin: 0; }

.section-title {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  padding: 22px 0 6px;
  color: var(--red-deep);
  border-bottom: 2px solid var(--gold);
  margin-bottom: 4px;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .page { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
  .aside { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .grid, .choices { grid-template-columns: 1fr; }
  fieldset { padding: 22px 18px 24px; }
  .form-foot { padding: 18px; }
  .stats, .filters { grid-template-columns: 1fr; }
  .masthead-link { display: none; }
  .dl-row { grid-template-columns: 1fr; gap: 2px; }
  .topnav a { padding: 6px 9px; font-size: .84rem; }
  .topnav .who { display: none; }
}

@media print {
  .topbar, .page-head .btn, .pager { display: none; }
  body { background: #fff; }
  .detail { border: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
