/* =========================================================
   DEO Panchmahal — Visitor Registration System
   ========================================================= */
:root {
  --ink:        #1f2937;
  --indigo:     #1d2b53;
  --indigo-2:   #2c3f73;
  --saffron:    #d9822b;
  --saffron-dk: #b96a1b;
  --green:      #2e7d4f;
  --paper:      #f5f7fa;
  --line:       #d8dee8;
  --muted:      #5f6b7d;
}

html, body { min-height: 100%; }
body {
  font-family: 'Mukta Vaani', 'Noto Sans Gujarati', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
}
.min-w-0 { min-width: 0; }
.nowrap  { white-space: nowrap; }

/* ---------- Header ---------- */
.tri-strip {
  height: 4px;
  background: linear-gradient(90deg, var(--saffron) 0 33.3%, #fff 33.3% 66.6%, var(--green) 66.6%);
}
.site-header { background: var(--indigo); color: #fff; padding: .85rem 0; }
.site-header .emblem {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  display: grid; place-items: center;
  font-size: 1.35rem; color: var(--saffron); flex-shrink: 0;
}
.site-header .title-gu { font-weight: 700; font-size: 1.15rem; line-height: 1.25; }
.site-header .title-en { font-size: .82rem; opacity: .78; line-height: 1.3; }

/* ---------- Layout ---------- */
.page-wrap   { padding: 1.75rem 0 3rem; }
.narrow      { max-width: 640px; }
.login-wrap  { max-width: 420px; }
.page-intro  { margin-bottom: 1.1rem; }
.page-title  { font-weight: 800; font-size: 1.75rem; color: var(--indigo); line-height: 1.2; margin-bottom: .2rem; }
.page-sub    { color: var(--muted); margin-bottom: 0; }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
}

/* ---------- Form ---------- */
.form-label { font-weight: 600; color: #2b3648; margin-bottom: .3rem; }
.form-label .en { font-weight: 400; color: var(--muted); font-size: .85em; margin-left: .2rem; }
.req { color: #c62828; }
.form-control, .form-select {
  border-radius: 8px; border-color: #c9d2df; padding: .62rem .8rem; font-size: 1rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--indigo-2);
  box-shadow: 0 0 0 .2rem rgba(44,63,115,.16);
}

/* Visitor type selector */
.type-card {
  display: flex; align-items: center; gap: .7rem;
  width: 100%; height: 100%;
  padding: .75rem .9rem;
  border: 2px solid #c9d2df; border-radius: 8px;
  background: #fff; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.type-card i { font-size: 1.45rem; color: var(--muted); }
.type-card span { display: flex; flex-direction: column; line-height: 1.2; }
.type-card small { color: var(--muted); }
.btn-check:checked + .type-card { border-color: var(--indigo); background: #eef2fa; }
.btn-check:checked + .type-card i { color: var(--saffron); }
.btn-check:focus-visible + .type-card { box-shadow: 0 0 0 .2rem rgba(44,63,115,.3); }
.is-invalid-group .type-card { border-color: #dc3545; }

/* Auto-recorded arrival stamp — the signature element */
.arrival-stamp {
  border: 2px dashed var(--saffron);
  border-radius: 8px;
  background: #fffaf3;
  padding: .8rem 1rem .9rem;
  position: relative;
}
.stamp-head { font-weight: 700; color: var(--saffron-dk); margin-bottom: .45rem; }
.stamp-head span { font-weight: 400; color: var(--muted); font-size: .85rem; }
.stamp-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; }
.stamp-label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .1rem; }
.stamp-value {
  width: 100%; border: 0; background: transparent; padding: 0;
  font-weight: 700; font-size: 1.05rem; color: var(--indigo);
  font-variant-numeric: tabular-nums; cursor: default;
}
.stamp-value:focus { outline: none; }

/* Buttons */
.btn-deo { background: var(--indigo); color: #fff; border-radius: 8px; padding: .7rem 1.2rem; font-weight: 600; border: 0; }
.btn-deo:hover, .btn-deo:focus { background: var(--indigo-2); color: #fff; }
.btn-deo:disabled { background: var(--indigo-2); color: #fff; opacity: .8; }
.btn-saffron { background: var(--saffron); color: #fff; border-radius: 8px; font-weight: 600; border: 0; padding: .6rem 1.1rem; }
.btn-saffron:hover, .btn-saffron:focus { background: var(--saffron-dk); color: #fff; }
.btn-outline-deo { border: 2px solid var(--indigo); color: var(--indigo); border-radius: 8px; font-weight: 600; padding: .6rem 1.1rem; }
.btn-outline-deo:hover { background: var(--indigo); color: #fff; }
.link-deo { color: var(--indigo-2); text-decoration: none; }
.link-deo:hover { text-decoration: underline; }
.btn:focus-visible, a:focus-visible { outline: 3px solid rgba(217,130,43,.6); outline-offset: 2px; }

.foot-note { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 1.1rem; }

/* ---------- Success / slip ---------- */
.success-banner {
  display: flex; gap: .8rem; align-items: center;
  background: #e8f4ec; border: 1px solid #b9dcc5; color: #1d5c39;
  border-radius: 10px; padding: .9rem 1rem; margin-bottom: 1rem;
}
.success-banner i { font-size: 1.8rem; color: var(--green); }
.success-banner span { display: block; font-size: .9rem; }

.slip { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.slip-head { background: var(--indigo); color: #fff; text-align: center; padding: 1rem; }
.slip-office { font-weight: 700; font-size: 1.1rem; }
.slip-office-en { font-size: .8rem; opacity: .8; }
.slip-title { margin-top: .5rem; display: inline-block; padding: .15rem .8rem; border: 1px solid rgba(255,255,255,.5); border-radius: 4px; font-weight: 600; }
.slip-no {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .3rem;
  padding: .8rem 1.25rem; border-bottom: 2px dashed var(--saffron); background: #fffaf3;
}
.slip-no span { color: var(--muted); font-size: .88rem; }
.slip-no strong { color: var(--indigo); font-size: 1.15rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.slip-list { display: grid; grid-template-columns: 40% 60%; margin: 0; padding: .6rem 1.25rem; }
.slip-list dt, .slip-list dd { padding: .45rem 0; border-bottom: 1px solid #eef1f5; margin: 0; }
.slip-list dt { color: var(--muted); font-weight: 500; font-size: .9rem; }
.slip-list dd { font-weight: 600; word-break: break-word; }
.slip-sign { display: flex; justify-content: space-between; gap: 1rem; padding: 2.5rem 1.25rem 1rem; text-align: center; font-size: .9rem; }
.slip-sign div { flex: 1; border-top: 1px solid #8a94a6; padding-top: .3rem; }

/* ---------- Admin ---------- */
.tally {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.tally-item { display: flex; align-items: center; gap: .7rem; padding: .9rem 1.1rem; border-right: 1px solid var(--line); }
.tally-item:last-child { border-right: 0; }
.tally-main { background: var(--indigo); color: #fff; }
.tally-main .tally-lbl, .tally-main .tally-lbl small { color: rgba(255,255,255,.85); }
.tally-num { font-size: 2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.tally-lbl { font-size: .88rem; line-height: 1.2; color: var(--ink); }
.tally-lbl small { color: var(--muted); }

.filter-panel { padding: 1rem 1.1rem; }
.quick-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.quick-links a {
  font-size: .82rem; text-decoration: none; color: var(--indigo-2);
  border: 1px solid var(--line); border-radius: 20px; padding: .15rem .7rem; background: #f8fafc;
}
.quick-links a:hover { border-color: var(--indigo-2); }
.result-line { color: var(--muted); font-size: .9rem; margin: 0 0 .5rem .2rem; }

.table-register thead th {
  background: #eef2fa; color: var(--indigo); font-weight: 700; font-size: .88rem;
  border-bottom: 2px solid var(--indigo); white-space: nowrap; line-height: 1.2; padding: .7rem .75rem;
}
.table-register thead th small { font-weight: 400; color: var(--muted); }
.table-register td { font-size: .93rem; padding: .65rem .75rem; vertical-align: top; border-color: #edf0f5; }
.table-register tbody tr:hover td { background: #fafbfd; }
.purpose-cell { max-width: 280px; }

.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: .12rem .55rem; border-radius: 4px; white-space: nowrap; }
.tag-teacher { background: #e3f1e8; color: var(--green); }
.tag-other   { background: #fbecdc; color: var(--saffron-dk); }

.visit-card {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--indigo);
  border-radius: 8px; padding: .85rem .95rem; margin-bottom: .6rem;
}
.visit-meta { display: grid; grid-template-columns: auto 1fr; gap: .15rem .7rem; margin: .55rem 0; font-size: .9rem; }
.visit-meta dt { color: var(--muted); font-weight: 500; }
.visit-meta dd { margin: 0; word-break: break-word; }

.pagination-deo .page-link { color: var(--indigo); }
.pagination-deo .page-item.active .page-link { background: var(--indigo); border-color: var(--indigo); color: #fff; }

/* ---------- Print register page ---------- */
.print-body { background: #e9edf3; }
.print-toolbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: .5rem; justify-content: center;
  background: var(--indigo); padding: .6rem;
}
.register-sheet {
  background: #fff; max-width: 1120px; margin: 1rem auto; padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.reg-head { text-align: center; border-bottom: 2px solid #000; padding-bottom: .6rem; margin-bottom: .8rem; }
.reg-office { font-weight: 800; font-size: 1.3rem; }
.reg-office-en { font-size: .85rem; }
.reg-title { display: inline-block; margin: .45rem 0; font-weight: 700; font-size: 1.05rem; border: 1.5px solid #000; padding: .1rem .9rem; }
.reg-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.4rem; font-size: .82rem; }
.reg-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.reg-table th, .reg-table td { border: 1px solid #000; padding: .3rem .4rem; vertical-align: top; word-break: break-word; }
.reg-table th { background: #eef2fa; text-align: center; line-height: 1.2; font-weight: 700; }
.reg-table td.c { text-align: center; }
.reg-table td.ip { font-size: .72rem; }
.reg-table tr { page-break-inside: avoid; }
.reg-foot { margin-top: .9rem; font-size: .88rem; }
.reg-sign { display: flex; justify-content: space-between; gap: 2rem; margin-top: 2.8rem; text-align: center; }
.reg-sign div { min-width: 220px; border-top: 1px solid #000; padding-top: .3rem; }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .tally { grid-template-columns: 1fr 1fr; }
  .tally-item:nth-child(2) { border-right: 0; }
  .tally-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .tally-num { font-size: 1.6rem; }
  .register-sheet { padding: .8rem; margin: .5rem; overflow-x: auto; }
  .reg-table { min-width: 860px; }
}
@media (max-width: 575.98px) {
  .page-wrap { padding: 1.1rem 0 2rem; }
  .page-title { font-size: 1.45rem; }
  .panel { padding: 1.1rem; }
  .site-header .title-gu { font-size: 1rem; }
  .site-header .title-en { font-size: .74rem; }
  .site-header .emblem { width: 40px; height: 40px; font-size: 1.15rem; }
  .stamp-grid { grid-template-columns: 1fr 1fr; }
  .stamp-grid > div:last-child { grid-column: 1 / -1; }
  .slip-list { grid-template-columns: 1fr; }
  .slip-list dt { border-bottom: 0; padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Print ---------- */
@media print {
  .no-print { display: none !important; }
  body, .print-body { background: #fff !important; }
  .page-wrap { padding: 0; }
  .slip { border: 1px solid #000; }
  .slip-head { background: #fff !important; color: #000; border-bottom: 2px solid #000; }
  .slip-title { border-color: #000; }
  .register-sheet { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  .reg-table { min-width: 0; }
  .reg-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  thead { display: table-header-group; }
}
