/* SA247 certificate — Phôi overlay (name / date / code / QR) */
:root {
  --cert-navy: #0b1f3a;
  --cert-ink: #12233a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #e8ecf1;
  color: var(--cert-ink);
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
}

.cert-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: #0b1f3a;
  color: #fff;
}

.cert-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cert-toolbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.45rem 1rem;
  border-radius: 0.45rem;
  border: 1px solid transparent;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.cert-toolbar .btn--amber { background: #f0b429; color: #12233a; }
.cert-toolbar .btn--line {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.cert-status {
  margin: 1rem auto;
  max-width: 52rem;
  padding: 0 1rem;
  text-align: center;
  color: #334155;
}

.cert-stage {
  padding: 1.25rem 1rem 2.5rem;
  display: flex;
  justify-content: center;
}

/* Display Form mẫu (showcase) */
.cert-showcase {
  width: min(100%, 1100px);
}
.cert-showcase img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 18px 50px rgba(6, 20, 40, 0.18);
}

/* Printable Phôi sheet */
.cert-sheet {
  --cw: 1491;
  --ch: 1055;
  position: relative;
  width: min(100%, 1100px);
  aspect-ratio: 1491 / 1055;
  background: #fff;
  box-shadow: 0 18px 50px rgba(6, 20, 40, 0.18);
  overflow: hidden;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.cert-sheet__phoi {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  pointer-events: none;
  user-select: none;
}

.cert-field {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--cert-navy);
  line-height: 1.1;
  overflow: hidden;
}

.cert-field--name {
  left: calc(100% * 484 / 1491);
  top: calc(100% * 448 / 1055);
  width: calc(100% * 520 / 1491);
  height: calc(100% * 90 / 1055);
  font-family: "Great Vibes", "Segoe Script", cursive;
  font-size: clamp(1.6rem, 4.2vw, 3.1rem);
  font-weight: 400;
}

.cert-field--code-cover {
  left: calc(100% * 248 / 1491);
  top: calc(100% * 848 / 1055);
  width: calc(100% * 290 / 1491);
  height: calc(100% * 34 / 1055);
  background: #f7f8f9;
}

.cert-field--code {
  left: calc(100% * 248 / 1491);
  top: calc(100% * 848 / 1055);
  width: calc(100% * 290 / 1491);
  height: calc(100% * 34 / 1055);
  justify-content: flex-start;
  padding-left: 0.15em;
  font-size: clamp(0.55rem, 1.05vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.cert-field--date {
  left: calc(100% * 640 / 1491);
  top: calc(100% * 908 / 1055);
  width: calc(100% * 200 / 1491);
  height: calc(100% * 36 / 1055);
  font-size: clamp(0.7rem, 1.25vw, 0.95rem);
  font-weight: 700;
}

.cert-field--qr {
  left: calc(100% * 112 / 1491);
  top: calc(100% * 818 / 1055);
  width: calc(100% * 118 / 1491);
  height: calc(100% * 118 / 1055);
  background: #fff;
  padding: 2px;
}

.cert-field--qr canvas,
.cert-field--qr img {
  width: 100%;
  height: 100%;
  display: block;
}

@media print {
  @page { size: A4 landscape; margin: 0; }
  html, body { background: #fff; }
  .cert-toolbar, .cert-status, .no-print { display: none !important; }
  .cert-stage { padding: 0; }
  .cert-sheet, .cert-showcase {
    width: 297mm;
    height: 210mm;
    aspect-ratio: auto;
    box-shadow: none;
  }
  .cert-showcase img { width: 100%; height: 100%; object-fit: fill; }
}
