/* Template Voucher — memakai token dari style.css. Komponen VoucherCard = design system "Patch Panel". */

/* ---------- Template cetak: kartu voucher (VoucherCard) ---------- */
/* Dasar bersama semua template: ukuran, garis potong, warna kertas (token print-*). */
.vc-sheet {
  --vc-cols: 3; --vc-h: 35mm; --vc-pad: 3mm; --vc-code: 15pt; --vc-name: 8.5pt; --vc-small: 6.5pt; --vc-stub: 14mm;
  display: grid; grid-template-columns: repeat(var(--vc-cols), minmax(0, 1fr)); width: 190mm;
  background: var(--print-paper); color: var(--print-ink);
}
.vc-sheet[data-size="s"] { --vc-cols: 4; --vc-h: 28mm; --vc-pad: 2.4mm; --vc-code: 12pt; --vc-name: 7.5pt; --vc-small: 5.8pt; --vc-stub: 11mm; }
.vc-sheet[data-size="l"] { --vc-cols: 2; --vc-h: 46mm; --vc-pad: 4.4mm; --vc-code: 20pt; --vc-name: 10.5pt; --vc-small: 8pt; --vc-stub: 19mm; }
.vc {
  position: relative; box-sizing: border-box; display: grid; grid-template-rows: auto 1fr auto; gap: 1mm;
  height: var(--vc-h); padding: var(--vc-pad); overflow: hidden;
  border: 1px dashed var(--print-rule); background: var(--print-paper); color: var(--print-ink);
  break-inside: avoid; page-break-inside: avoid;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
/* bagian yang dipakai bersama */
.vc-head { display: flex; align-items: center; justify-content: space-between; gap: 2mm; min-width: 0; }
.vc-brand { display: flex; align-items: center; gap: 1.6mm; min-width: 0; }
.vc-logo { flex: none; width: calc(var(--vc-name) * 2); height: calc(var(--vc-name) * 2); object-fit: contain; }
.vc-name { overflow: hidden; font-family: var(--sans); font-size: var(--vc-name); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; text-overflow: ellipsis; }
.vc-price { flex: none; font-family: var(--mono); font-size: var(--vc-name); font-weight: 700; font-variant-numeric: tabular-nums; }
.vc-body { align-self: center; min-width: 0; }
.vc-label { display: block; color: var(--print-ink-2); font-family: var(--mono); font-size: calc(var(--vc-small) * .85); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.vc-code { display: block; overflow: hidden; font-family: var(--mono); font-size: var(--vc-code); font-weight: 700; letter-spacing: .08em; line-height: 1.15; white-space: nowrap; text-overflow: ellipsis; }
.vc-pass { display: block; margin-top: .3mm; font-family: var(--mono); font-size: calc(var(--vc-small) * 1.15); }
.vc-pass b { font-weight: 700; letter-spacing: .06em; }
.vc-foot { display: flex; justify-content: space-between; gap: 2mm; min-width: 0; padding-top: .9mm; border-top: 1px solid var(--print-rule); color: var(--print-ink-2); font-size: var(--vc-small); line-height: 1.3; }
.vc-foot span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vc-no { flex: none; font-family: var(--mono); font-weight: 700; }

/* --- template 1: Patch Panel — strip warna serat di atas --- */
.vt-panel { padding-top: calc(var(--vc-pad) + 1.4mm); }
.vt-panel::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 1.6mm; background: var(--c, var(--accent)); }

/* --- template 2: Tiket — karcis dengan potongan harga di kanan --- */
.vt-tiket { grid-template-columns: minmax(0, 1fr) var(--vc-stub); grid-template-rows: minmax(0, 1fr); gap: 0; padding: 0; }
.vt-tiket .vt-main { display: grid; grid-template-rows: auto 1fr auto; gap: 1mm; min-width: 0; padding: var(--vc-pad); }
/* potongan tidak boleh menambah tinggi kartu: teks vertikal dibatasi tinggi kartu */
.vt-tiket .vt-stub { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; border-left: 1px dashed var(--print-rule); }
.vt-tiket .vt-stub::before, .vt-tiket .vt-stub::after { content: ""; position: absolute; left: -1.7mm; width: 3.4mm; height: 3.4mm; border: 1px solid var(--print-rule); border-radius: 50%; background: var(--print-paper); }
.vt-tiket .vt-stub::before { top: -1.7mm; }
.vt-tiket .vt-stub::after { bottom: -1.7mm; }
.vt-tiket .vt-stub-text { display: flex; align-items: center; gap: 1.4mm; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.vt-tiket .vt-stub-cur { font-family: var(--mono); font-size: var(--vc-small); font-weight: 600; }
.vt-tiket .vt-stub-price { font-family: var(--mono); font-size: calc(var(--vc-name) * 1.2); font-weight: 700; }
.vt-tiket .vt-stub-plan { padding-left: 1.2mm; border-left: 1.2mm solid var(--c, var(--accent)); font-family: var(--mono); font-size: var(--vc-small); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* --- template 3: Hemat Tinta — tanpa blok warna, isi di tengah --- */
.vt-hemat { text-align: center; }
.vt-hemat .vc-head { justify-content: center; }
.vt-hemat .vc-name { font-family: var(--mono); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.vt-hemat .vc-foot { justify-content: center; border-top-style: dotted; }
.vt-hemat .vc-no { position: absolute; top: calc(var(--vc-pad) * .7); right: calc(var(--vc-pad) * .8); color: var(--print-ink-2); font-size: var(--vc-small); }

/* --- template 4: Blok Kontras — panel hitam berisi harga di kiri --- */
.vt-blok { grid-template-columns: calc(var(--vc-stub) * 1.75) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0; padding: 0; }
.vt-blok .vt-side { display: flex; flex-direction: column; justify-content: center; gap: .8mm; min-width: 0; padding: var(--vc-pad); border-right: 1.4mm solid var(--c, var(--accent)); background: var(--print-ink); color: var(--print-paper); }
.vt-blok .vt-side-cur { font-family: var(--mono); font-size: var(--vc-small); font-weight: 600; letter-spacing: .08em; }
.vt-blok .vt-side-price { font-family: var(--mono); font-size: calc(var(--vc-name) * 1.2); font-weight: 700; line-height: 1.1; white-space: nowrap; }
.vt-blok .vt-side-plan { font-family: var(--mono); font-size: var(--vc-small); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.vt-blok .vt-main { display: grid; grid-template-rows: auto 1fr auto; gap: 1mm; min-width: 0; padding: var(--vc-pad); }

/* ---------- halaman ---------- */
.vc-guide { margin-bottom: 18px; border-top-color: var(--f-orange); }
.vc-guide .flow { margin: 0; }
.vc-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.vc-layout > .panel { margin: 0; }
.vc-form-panel { border-top: 3px solid var(--f-orange); }
.vc-form-panel textarea { width: 100%; font-family: var(--mono); font-size: 12.5px; }
.vc-count { margin: 6px 0 0; }
.vc-preview-panel { position: sticky; top: 20px; }
.vc-stage { overflow: auto; max-height: 76vh; padding: 14px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sunken); }
.vc-pages { display: grid; gap: 14px; justify-content: start; }
/* satu lembar A4: 210 × 297 mm, margin cetak 8 mm × 10 mm */
.vc-page { box-sizing: border-box; width: 210mm; min-height: 297mm; padding: 8mm 10mm; background: var(--print-paper); box-shadow: var(--shadow); }
.vc-empty { margin: 0; padding: 40px 10px; color: var(--ink-3); font-size: 13.5px; text-align: center; }
/* galeri pilihan template */
.vc-tpls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.vc-tpl { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.vc-tpl:hover { border-color: var(--ink-3); }
.vc-tpl[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.vc-tpl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vc-tpl-prev { display: flex; justify-content: center; overflow: hidden; border-radius: var(--r-xs); background: var(--print-paper); }
.vc-tpl-prev .vc-sheet { width: 63.3mm; grid-template-columns: 1fr; zoom: .62; }
.vc-tpl strong { font-size: 13px; }
.vc-tpl small { color: var(--ink-3); font-size: 12px; line-height: 1.4; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-text); font: inherit; text-decoration: underline; cursor: pointer; }

@media (max-width: 1180px) {
  .vc-layout { grid-template-columns: 1fr; }
  .vc-preview-panel { position: relative; top: 0; }
}

/* ---------- cetak: hanya lembar voucher ---------- */
@page { size: A4; margin: 0; }
@media print {
  html, body { background: var(--print-paper) !important; }
  .sidebar, .sb-backdrop, .ws-head, .vc-guide, .vc-form-panel, .vc-preview-panel .section-heading, #vc-msg { display: none !important; }
  .app, .workspace, .vc-layout, .vc-preview-panel { display: block !important; margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: none !important; }
  .vc-stage { overflow: visible !important; max-height: none !important; padding: 0 !important; border: 0 !important; background: none !important; }
  .vc-pages { display: block !important; zoom: 1 !important; }
  .vc-page { box-shadow: none !important; break-after: page; page-break-after: always; }
  .vc-page:last-child { break-after: auto; page-break-after: auto; }
}
