/* assets/css/ttd-consent.css — Persetujuan Konsumen + tanda tangan (Opsi B, 24-11-2026).
   CSS sendiri (bukan kelas Tailwind) karena tailwind.css VPro sudah ter-compile:
   kelas baru tidak otomatis tersedia. Warna mengikuti VPro (amber #d97706). */

.ttd-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- tombol ---------- */
.ttd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; font-weight: 700; font-size: 14px; line-height: 1.2; cursor: pointer; border: 1px solid transparent; min-height: 44px; padding: 10px 14px; font-family: inherit; }
.ttd-btn-utama { background: #d97706; color: #fff; width: 100%; }
.ttd-btn-utama:hover { background: #b45309; }
.ttd-btn-utama[aria-disabled="true"] { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; }
.ttd-btn-kecil { min-height: 36px; padding: 6px 12px; font-size: 13px; font-weight: 600; background: #fff; color: #374151; border-color: #d1d5db; }
.ttd-btn-kecil:hover { background: #f9fafb; }
.ttd-btn:focus-visible, .ttd-alat:focus-visible, .ttd-zoom:focus-visible, .ttd-thumb:focus-visible, .ttd-x:focus-visible { outline: 2px solid #d97706; outline-offset: 2px; }

/* ---------- kartu di form ---------- */
.ttd-kartu { border: 1px solid #fcd34d; background: #fffbeb; border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.ttd-kartu.is-selesai { border-color: #86efac; background: #f0fdf4; }
.ttd-kartu.is-tinjau { border-color: #fcd34d; background: #fffbeb; }
.ttd-kartu-kepala { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #1f2937; }
.ttd-kartu.is-belum .ttd-kartu-kepala i { color: #b45309; }
.ttd-kartu.is-selesai .ttd-kartu-kepala { color: #166534; }
.ttd-kartu.is-selesai .ttd-kartu-kepala i { color: #16a34a; }
.ttd-kartu.is-tinjau .ttd-kartu-kepala i { color: #d97706; }
.ttd-kartu-sub { font-size: 13px; color: #4b5563; line-height: 1.5; margin: 0; }
.ttd-kartu-isi { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ttd-thumb { flex: none; width: 112px; height: 52px; border: 1px solid #bbf7d0; border-radius: 8px; background: #fff; padding: 3px; cursor: zoom-in; display: grid; place-items: center; }
.ttd-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ttd-kartu-meta { display: grid; min-width: 0; font-size: 13px; color: #374151; }
.ttd-kartu-meta b { font-size: 14px; color: #111827; overflow-wrap: anywhere; }
.ttd-kartu-meta span { color: #6b7280; font-size: 12px; }
.ttd-kartu-catatan { margin: 0; font-size: 12px; color: #92400e; }
.ttd-kartu-aksi { display: flex; flex-wrap: wrap; gap: 8px; }
.ttd-besar { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px; }
.ttd-besar img { display: block; width: 100%; max-height: 220px; object-fit: contain; }
#consent-dokumen-box.border-red-500 .ttd-kartu { border-color: #ef4444; }

/* ---------- lembar konsumen ---------- */
html.ttd-terbuka, html.ttd-terbuka body { overflow: hidden; }
.ttd-sheet { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: flex-end; justify-content: center; }
.ttd-sheet[hidden] { display: none !important; }
.ttd-overlay { position: absolute; inset: 0; background: rgba(17, 24, 39, .5); }
.ttd-panel { position: relative; width: 100%; max-width: 520px; max-height: calc(100% - 16px - env(safe-area-inset-top, 0px)); background: #fff; color: #1f2937; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; outline: none; box-shadow: 0 -8px 30px rgba(0,0,0,.18); font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
@media (min-width: 560px) { .ttd-sheet { align-items: center; } .ttd-panel { border-radius: 18px; max-height: calc(100% - 32px); } }
.ttd-grab { width: 40px; height: 4px; border-radius: 4px; background: #d1d5db; margin: 8px auto 0; flex: none; }
.ttd-kepala { display: flex; align-items: center; gap: 10px; padding: 10px 16px 8px; flex: none; }
.ttd-kepala h2 { font-size: 17px; font-weight: 800; margin: 0; flex: 1; }
.ttd-chip { font-size: 11px; font-weight: 700; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.ttd-x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: #f3f4f6; color: #4b5563; display: grid; place-items: center; cursor: pointer; flex: none; }
/* flex kolom + anak flex:none: isi tidak pernah dijepit; yang di-scroll lembarnya. */
.ttd-isi { overflow-y: auto; padding: 0 16px 12px; display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ttd-isi > * { flex: none; min-width: 0; }
.ttd-identitas { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid #e5e7eb; }
.ttd-ava { width: 40px; height: 40px; border-radius: 50%; background: #fef3c7; color: #92400e; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.ttd-identitas b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.ttd-identitas span { font-size: 12px; color: #6b7280; }
/* Kartu pernyataan: teks utuh + baris centang menyatu di bawahnya */
.ttd-pernyataan { border: 1px solid #fde68a; background: #fffbeb; border-radius: 14px; overflow: hidden; }
.ttd-pernyataan-kepala { display: flex; align-items: center; gap: 8px; padding: 12px 14px 0; color: #92400e; font-size: 13px; }
.ttd-pernyataan-kepala b { flex: 1; }
.ttd-versi { font-size: 11px; font-weight: 600; color: #a16207; background: #fef3c7; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.ttd-pernyataan-teks { margin: 0; padding: 8px 14px 14px; font-size: 14px; line-height: 1.65; color: #374151; text-align: left; hyphens: auto; overflow-wrap: break-word; }
.ttd-pernyataan-teks strong { color: #111827; }
.ttd-cek { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: #fff; border-top: 1px solid #fde68a; cursor: pointer; min-height: 56px; -webkit-tap-highlight-color: transparent; transition: background .15s; }
.ttd-cek input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ttd-cek-kotak { flex: none; width: 26px; height: 26px; border: 2px solid #9ca3af; border-radius: 8px; background: #fff; display: grid; place-items: center; color: transparent; font-size: 14px; margin-top: 1px; transition: background .15s, border-color .15s; }
.ttd-cek-teks { font-size: 15px; font-weight: 600; line-height: 1.45; color: #1f2937; }
.ttd-cek input:checked + .ttd-cek-kotak { background: #d97706; border-color: #d97706; color: #fff; }
.ttd-cek input:focus-visible + .ttd-cek-kotak { outline: 2px solid #d97706; outline-offset: 2px; }
.ttd-cek:has(input:checked) { background: #f0fdf4; }
.ttd-pernyataan:has(input:checked) { border-color: #86efac; }
.ttd-pernyataan:has(input:checked) .ttd-cek { border-top-color: #bbf7d0; }
.ttd-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.ttd-label .ttd-ops { font-weight: 400; color: #6b7280; }
.ttd-input { width: 100%; border: 1px solid #d1d5db; border-radius: 10px; padding: 10px 12px; font-size: 15px; font-family: inherit; color: #111827; background: #fff; }
.ttd-bantu { margin: 4px 0 0; font-size: 12px; color: #6b7280; }
.ttd-input:focus { outline: none; border-color: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, .2); }

.ttd-pad { position: relative; width: 100%; aspect-ratio: 5 / 2; border: 2px dashed #cbd5e1; border-radius: 12px; background: #fff; }
.ttd-pad.is-kunci { background: #f3f4f6; border-color: #e5e7eb; }
.ttd-pad.is-err { border-color: #ef4444; }
.ttd-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; border-radius: 10px; cursor: crosshair; }
.ttd-pad.is-kunci canvas { cursor: not-allowed; }
.ttd-dasar { position: absolute; left: 6%; right: 6%; bottom: 24%; border-bottom: 1px solid #d1d5db; pointer-events: none; }
.ttd-silang { position: absolute; left: 6%; bottom: calc(24% + 2px); color: #9ca3af; font-weight: 700; font-size: 16px; pointer-events: none; }
.ttd-petunjuk { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 0 16px 8%; font-size: 13px; color: #9ca3af; pointer-events: none; }
.ttd-pad.is-kunci .ttd-petunjuk { color: #6b7280; }
.ttd-pad.is-kunci .ttd-dasar, .ttd-pad.is-kunci .ttd-silang { opacity: .4; }
/* Aksi di dalam bidang: [Hapus] [Perbesar] di pojok kanan atas, di atas kanvas */
.ttd-pad-aksi { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 6px; align-items: center; }
.ttd-pad.is-kunci .ttd-pad-aksi { display: none; }
.ttd-zoom { width: 36px; height: 36px; border-radius: 10px; border: 1px solid #e5e7eb; background: #fff; color: #6b7280; display: grid; place-items: center; cursor: pointer; }
.ttd-pad-btn { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid #fecaca; background: #fff; color: #b91c1c; font-size: 13px; font-weight: 600; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ttd-pad-btn[hidden] { display: none; }
.ttd-pad-btn:hover { background: #fef2f2; }
.ttd-pad-btn:focus-visible { outline: 2px solid #d97706; outline-offset: 2px; }
.ttd-wajib { color: #dc2626; font-weight: 700; }

/* Urungkan & Hapus: dua tombol sama lebar & tinggi tepat di bawah bidang */
.ttd-alat-grup { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ttd-alat { min-height: 44px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: #374151; font-size: 14px; font-weight: 600; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.ttd-alat:hover:not([aria-disabled="true"]) { background: #f9fafb; }
.ttd-alat[aria-disabled="true"] { opacity: .42; cursor: not-allowed; }

.ttd-err { margin: 0; font-size: 13px; color: #dc2626; }
.ttd-catatan { margin: 0; font-size: 12px; color: #6b7280; }
.ttd-kaki { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid #e5e7eb; flex: none; background: #fff; border-radius: 0 0 18px 18px; }

.ttd-konfirm { position: absolute; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); background: #111827; color: #fff; border-radius: 12px; padding: 12px; display: grid; gap: 10px; font-size: 14px; z-index: 3; }
.ttd-konfirm[hidden], .ttd-toast[hidden] { display: none !important; }
.ttd-konfirm-aksi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ttd-konfirm .ttd-btn { min-height: 40px; font-size: 13px; }
.ttd-konfirm .ttd-btn-terang { background: #fff; color: #111827; }
.ttd-konfirm .ttd-btn-bahaya { background: transparent; color: #fca5a5; border-color: #4b5563; }
.ttd-toast { position: absolute; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); background: #111827; color: #fff; border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; z-index: 3; }
.ttd-toast button { background: none; border: 0; color: #fcd34d; font-weight: 700; font-size: 13px; cursor: pointer; padding: 6px 4px; font-family: inherit; }

/* ---------- perbesar (lanskap) ---------- */
.ttd-zoom-kepala { display: none; }
.ttd-sheet.is-zoom .ttd-panel { max-width: none; height: 100%; max-height: none; border-radius: 0; }
.ttd-sheet.is-zoom .ttd-grab, .ttd-sheet.is-zoom .ttd-kepala, .ttd-sheet.is-zoom .ttd-kaki,
.ttd-sheet.is-zoom .ttd-isi > :not(.ttd-padblok) { display: none; }
.ttd-sheet.is-zoom .ttd-zoom-kepala { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; border-bottom: 1px solid #e5e7eb; flex: none; }
.ttd-sheet.is-zoom .ttd-zoom-kepala b { font-size: 15px; }
.ttd-sheet.is-zoom .ttd-zoom-kepala .ttd-btn { width: auto; min-height: 40px; padding: 8px 18px; }
.ttd-sheet.is-zoom .ttd-isi { align-content: center; justify-items: center; padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.ttd-sheet.is-zoom .ttd-padblok { width: min(100%, calc((100vh - 140px) * 2.5)); width: min(100%, calc((100dvh - 140px) * 2.5)); }
.ttd-sheet.is-zoom #ttd-label-pad { display: none; }
/* HP tegak: seluruh panel mode lebar diputar 90° (searah jarum jam) supaya bidang tanda
   tangan memakai sisi panjang layar. Konsumen cukup memiringkan HP. Pemetaan sentuhan
   ada di ttd-consent.js (diputar()). Mode normal tidak terpengaruh. */
@media (orientation: portrait) {
  .ttd-sheet.is-zoom .ttd-panel { position: fixed; top: 0; left: 0; width: 100vh; width: 100dvh; height: 100vw; max-width: none; max-height: none; border-radius: 0; transform-origin: top left; transform: translateX(100vw) rotate(90deg); animation: none; }
  .ttd-sheet.is-zoom .ttd-padblok { width: min(100%, calc((100vw - 140px) * 2.5)); }
  .ttd-sheet.is-zoom .ttd-zoom-kepala { padding-top: 10px; }
}
.ttd-sheet.is-zoom .ttd-zoom { display: none; }
.ttd-sheet.is-zoom .ttd-pad-aksi { top: 10px; right: 10px; }
.ttd-padblok { display: grid; gap: 10px; }

@media (prefers-reduced-motion: no-preference) {
  .ttd-panel { animation: ttd-naik .2s ease-out; }
  @keyframes ttd-naik { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
