/* ==========================================================================
   SIKEDI — halaman presensi, buku tamu, formulir publik, dan login
   Dimuat setelah site.css. Satu kolom sempit agar nyaman diisi di ponsel.
   ========================================================================== */

/* Mode gelap (dipilih lewat tombol tema di pojok kanan bawah) */
[data-bs-theme="dark"] {
  --paper: #101814;
  --surface: #17221d;
  --ink: #e4ebe7;
  --ink-2: #c3cec8;
  --muted: #8fa198;
  --line: #2a3832;
  --line-soft: #22302a;
  --forest: #5fb08c;
  --forest-deep: #7cc4a3;
  --forest-tint: #1d3329;
  --signal: #f0707c;
  --signal-tint: #3a1d21;
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
}

[data-bs-theme="dark"] .btn-primary,
[data-bs-theme="dark"] .btn-danger {
  --bs-btn-color: #0d1712;
  --bs-btn-hover-color: #0d1712;
  --bs-btn-active-color: #0d1712;
}

/* Netralkan gaya template lama */
body,
body.vh-full {
  min-height: 100vh;
  background: var(--paper) !important;
  color: var(--ink);
  text-shadow: none !important;
  box-shadow: none !important;
  font-family: var(--font);
}

body.d-flex.text-center { text-align: left !important; }

i.bi { font-size: inherit; }

.container { max-width: 1080px; }

/* ---------- Bilah atas ---------- */

.att-bar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.att-bar .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 640px;
  min-height: 60px;
  margin: 0 auto;
  padding: 0 20px;
}

.att-bar.wide .inner { max-width: 1080px; }

.att-bar .brand img { width: 30px; height: 30px; }
.att-bar .brand-name { font-size: 16px; }
.att-bar .brand-sub { font-size: 12px; }

.att-bar a.link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.att-bar a.link:hover { color: var(--ink); }

/* ---------- Kolom isi ---------- */

.att-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 24px;
}

.att-wrap.wide { max-width: 1080px; }

/* Tiket kegiatan */
.ticket {
  margin-bottom: 28px;
}

.ticket .org {
  margin: 0 0 8px;
  color: var(--forest);
  font-size: 14.5px;
  font-weight: 600;
}

.ticket h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.ticket .sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15.5px;
}

.ticket-meta {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 4px 28px;
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}

.ticket-meta dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.ticket-meta dd {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .ticket-meta { grid-template-columns: 1fr 1fr; }
  .ticket-meta > div:last-child { grid-column: 1 / -1; }
}

/* Kartu isian */
.att-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.att-card + .att-card { margin-top: 16px; }

.att-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
}

.att-card .hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14.5px;
}

@media (max-width: 480px) {
  .att-card { padding: 18px; }
}

/* Paksa satu kolom pada form presensi lama */
.att-wrap #action-sign > .row,
.att-wrap .att-cols {
  --bs-gutter-x: 0 !important;
  --bs-gutter-y: 0;
  display: block;
  margin: 0;
}

.att-wrap #action-sign > .row > [class*="col-"],
.att-wrap .att-cols > [class*="col-"] {
  width: 100%;
  max-width: 100%;
  padding: 0;
}

.att-wrap .row.g-3 { --bs-gutter-y: 16px; }

.att-wrap hr { display: none; }

/* Formulir */
.att-wrap .form-label {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
}

.att-wrap .form-control,
.att-wrap .form-select {
  min-height: 46px;
  font-size: 16px; /* cegah zoom otomatis di iOS */
}

.att-wrap .form-control[readonly],
.att-wrap .form-control:disabled {
  background: var(--paper);
  color: var(--ink-2);
}

.att-wrap .form-check {
  margin-bottom: 6px;
  font-size: 15.5px;
}

.form-check-input:checked {
  background-color: var(--forest);
  border-color: var(--forest);
}

.form-check-input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(30, 90, 70, .18);
}

.select2-container--bootstrap-5 .select2-selection {
  min-height: 46px;
  border-color: var(--line);
  border-radius: var(--r-sm);
  font-size: 16px;
}

/* Tanda tangan */
.att-wrap h4 .text-primary,
.sign-title {
  color: var(--ink) !important;
  font-size: 15px;
  font-weight: 700;
}

.att-wrap h4.d-flex {
  margin: 24px 0 8px !important;
}

.js-signature {
  justify-content: center;
  overflow: hidden;
  background: var(--paper) !important;
  border: 1px dashed #b8c2bc;
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0 !important;
}

/* Bitmap canvas 280x200 (batas server); tampilannya diskalakan seragam agar coretan tidak gepeng.
   Posisi kursor dipetakan ke bitmap di custom-script.js. */
.js-signature canvas {
  width: 100% !important;
  max-width: 420px;
  height: auto !important;
  aspect-ratio: 280 / 200;
  background: #fff;
  touch-action: none;
}

.js-signature + img + .d-grid .btn,
.js-signature ~ .d-grid .btn {
  --bs-btn-bg: var(--surface);
  --bs-btn-color: var(--ink-2);
  --bs-btn-border-color: #b8c2bc;
  --bs-btn-hover-bg: var(--paper);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-border-color: #b8c2bc;
  border-style: dashed;
  border-radius: 0 0 var(--r-md) var(--r-md) !important;
  font-size: 14px;
  font-weight: 600;
}

.att-wrap img.img-fluid.border {
  border-color: var(--line) !important;
  border-radius: var(--r-md) !important;
}

/* Tombol kirim */
.att-wrap .btn-lg {
  --bs-btn-padding-y: 14px;
  --bs-btn-font-size: 16px;
  margin-top: 24px;
}

/* Pemberitahuan */
.att-wrap .alert {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: var(--r-md);
  font-size: 15px;
  text-align: left !important;
}

.att-wrap .alert-warning {
  background: #fdf6e3;
  border-color: #f0dfaa;
  color: #6b5310;
}

.att-wrap .alert-success {
  background: var(--forest-tint);
  border-color: #bcd7c7;
  color: var(--forest-deep);
}

.att-wrap .alert-danger {
  background: var(--signal-tint);
  border-color: #f2c2c7;
  color: #8e1522;
}

[data-bs-theme="dark"] .att-wrap .alert-warning { background: #2e2814; border-color: #4d4220; color: #f0d88a; }
[data-bs-theme="dark"] .att-wrap .alert-success { border-color: #2c4a3b; }
[data-bs-theme="dark"] .att-wrap .alert-danger { border-color: #5a2a30; color: #f5b5bc; }

/* Konfirmasi selesai */
.done {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 18px 20px;
  background: var(--forest-tint);
  border: 1px solid #bcd7c7;
  border-radius: var(--r-lg);
  color: var(--forest-deep);
}

.done i {
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1.2;
}

.done strong {
  display: block;
  color: var(--forest-deep);
  font-size: 16px;
}

.done p { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; }

[data-bs-theme="dark"] .done { border-color: #2c4a3b; }

/* Rekap jawaban (halaman sesudah presensi) */
.answers {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr;
  gap: 10px 20px;
  margin: 0;
  font-size: 15px;
}

.answers dt { color: var(--muted); font-weight: 500; }
.answers dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* Feedback */
.att-wrap .card {
  margin-top: 16px !important;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: none !important;
}

.att-wrap .card-body { padding: 24px; }

.att-wrap .card-title {
  font-size: 17px;
  font-weight: 700;
}

.att-wrap .card-title .bi { display: none; }

.feedback-star { color: #d9a404 !important; }

/* Tabel peserta */
.att-wrap .table { font-size: 14.5px; }
.att-wrap .table-bordered > :not(caption) > * > * { border-width: 0 0 1px; }

/* ---------- Footer ---------- */

.att-foot {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  color: var(--muted);
  font-size: 14px;
}

.att-foot.wide { max-width: 1080px; }

.att-foot .row-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.att-foot a { color: var(--ink-2); font-weight: 600; text-decoration: none; }
.att-foot a:hover { color: var(--ink); text-decoration: underline; }

.att-foot img {
  display: block;
  max-width: 200px;
  margin-top: 16px;
  border-radius: var(--r-sm);
}

/* Tombol tema */
.bd-mode-toggle .btn-bd-primary {
  --bs-btn-bg: var(--surface);
  --bs-btn-color: var(--ink-2);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: var(--paper);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-border-color: var(--line);
  --bs-btn-active-bg: var(--paper);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-border-color: var(--line);
  padding: 6px 10px !important;
  border-radius: 999px;
  font-size: 14px;
}

/* ---------- Login ---------- */

.login-wrap {
  display: grid;
  min-height: calc(100vh - 61px);
  place-items: center;
  padding: 32px 20px 64px;
}

.login-box {
  width: 100%;
  max-width: 380px;
}

.login-box h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.login-box > p {
  margin: 0 0 24px;
  color: var(--muted);
}

.login-box .form-control { min-height: 46px; font-size: 16px; }

.login-box .help {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Halaman tidak ditemukan ---------- */

.notfound {
  padding: 48px 0 24px;
}

.notfound .code {
  margin: 0 0 8px;
  color: var(--forest);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.notfound h1 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.notfound p { color: var(--muted); max-width: 46ch; }

/* Form presensi sebagai satu kartu */
.att-wrap #action-sign {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

@media (max-width: 480px) {
  .att-wrap #action-sign { padding: 18px; }
}

.att-wrap #action-sign .form-head {
  margin: 0 0 18px;
}

.att-wrap #action-sign .form-head h2 {
  margin: 0 0 2px;
  font-size: 17px;
  font-weight: 700;
}

.att-wrap #action-sign .form-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.att-wrap .att-foot { padding-left: 0; padding-right: 0; }

.bd-mode-toggle .btn-bd-primary { box-shadow: 0 4px 14px rgba(23, 38, 31, .12); }

@media (max-width: 480px) {
  .att-wrap .card-body { padding: 18px; }
}

.att-wrap .progress { background: var(--line-soft); border-radius: 999px; }
.att-wrap .progress-bar { background: var(--forest) !important; }
.att-wrap .text-danger { color: var(--signal) !important; }
