/**
 * QR Bell — QR Card Template Styles
 * Templates 1–3: original generic frames.
 * Templates 4–8: product-specific sticker types from the QRBELL STICKERS PDF.
 * Used by: partials/card.ejs  →  branded, print, print-templates pages.
 */

/* ── Shared base ──────────────────────────────────────────────────────────────── */
.qr-card {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
}

/* Background image replaced with <img> for full print resolution */
.tpl-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
}

/* Horizontal two-column layout: QR left, info right */
.tpl-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
}

/* Shared "no image" placeholder */
.qr-no-img {
  background: #f3f4f6;
  border-radius: 4px;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #9ca3af;
  font-size: 9px;
  letter-spacing: .3px;
  box-sizing: border-box;
}

/* Shared screw hole */
.qr-card .screw {
  position: absolute;
  border-radius: 50%;
  display: block;
  z-index: 2;
}

/* ── Info panel — shared ──────────────────────────────────────────────────────── */
.tpl-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 150px;
}

.tpl-info-name {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .4px;
  text-transform: uppercase;
  line-height: 1.25;
  word-break: break-word;
  margin-bottom: 5px;
}

.tpl-info-addr {
  font-size: 9px;
  line-height: 1.4;
  word-break: break-word;
  margin-bottom: 9px;
  color: #6b7280;
  min-height: 12px;
}

.tpl-info-scan-head {
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 5px;
}

.tpl-info-bullets {
  margin: 0 0 auto 13px;
  padding: 0;
  font-size: 8px;
  line-height: 1.6;
  color: #374151;
}

.tpl-info-website {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .4px;
  color: #6b7280;
  margin-top: 8px;
  word-break: break-all;
}

/* Shared serial / vehicle number bar — solid top rule, no dashes */
.tpl-serial-bar {
  border-top: 1px solid #e5e7eb;
  margin-top: 6px;
  padding-top: 4px;
  font-family: 'Courier New', monospace;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .6px;
  text-align: center;
  color: #555;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 1 — Compact Sticker  (original)
   White bg · Rounded corners · Thin gray border
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-1 {
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: 14px;
  padding: 16px 18px 16px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .07);
}

.qr-card.tpl-1 .tpl1-qr-area {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: 8px;
  padding: 6px;
  flex-shrink: 0;
}

.qr-card.tpl-1 .tpl-info-name     { color: #111827; }
.qr-card.tpl-1 .tpl-info-scan-head{ color: #2563eb; }
.qr-card.tpl-1 .tpl-info-website  { color: #2563eb; }

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 2 — Premium Metallic Name Plate  (original)
   Silver-to-dark gradient · 4 prominent screw holes
   QR inside white-padded inner frame
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-2 {
  background: linear-gradient(160deg,
    #dce3ea 0%, #b8c5cf 25%,
    #d6dfe6 50%, #a8b8c4 75%,
    #c5d0d8 100%);
  border: 2px solid #8fa0ad;
  border-radius: 10px;
  padding: 32px;
  box-shadow:
    0 3px 12px rgba(0, 0, 0, .18),
    inset 0 1px 0 rgba(255, 255, 255, .55),
    inset 0 -1px 0 rgba(0, 0, 0, .08);
}

.qr-card.tpl-2 .screw {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 38% 35%, #e0e8f0, #7a8e9e);
  border: 1.5px solid #607080;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, .3),
    inset 0 1px 0 rgba(255, 255, 255, .45);
}
.qr-card.tpl-2 .screw::before,
.qr-card.tpl-2 .screw::after {
  content: '';
  position: absolute;
  background: rgba(0, 0, 0, .25);
  border-radius: 1px;
}
.qr-card.tpl-2 .screw::before { width: 8px;   height: 1.5px; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.qr-card.tpl-2 .screw::after  { width: 1.5px; height: 8px;   top: 50%; left: 50%; transform: translate(-50%, -50%); }

.qr-card.tpl-2 .screw.tl { top: 10px;    left: 10px;   }
.qr-card.tpl-2 .screw.tr { top: 10px;    right: 10px;  }
.qr-card.tpl-2 .screw.br { bottom: 10px; right: 10px;  }
.qr-card.tpl-2 .screw.bl { bottom: 10px; left: 10px;   }

.qr-card.tpl-2 .tpl2-qr-frame {
  background: #ffffff;
  border-radius: 10px;
  padding: 8px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, .2),
    inset 0 1px 0 rgba(255, 255, 255, .8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qr-card.tpl-2 .tpl-info-name     { color: #1e3a5f; }
.qr-card.tpl-2 .tpl-info-addr     { color: #374151; }
.qr-card.tpl-2 .tpl-info-scan-head{ color: #1e3a5f; font-weight: 900; }
.qr-card.tpl-2 .tpl-info-bullets  { color: #374151; }
.qr-card.tpl-2 .tpl-info-website  { color: #2c4a6e; }

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 3 — Standard Name Plate  (original)
   White bg · Thick black border · 4 screw holes · "HOME NAME PLATE" footer
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-3 {
  background: #ffffff;
  border: 3.5px solid #111827;
  border-radius: 3px;
  padding: 20px 20px 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .1);
}

.qr-card.tpl-3 .screw {
  width: 11px;
  height: 11px;
  background: radial-gradient(circle at 35% 35%, #e8e8e8, #b0b0b0);
  border: 1.5px solid #888;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 2px rgba(0,0,0,.2);
}
.qr-card.tpl-3 .screw::before,
.qr-card.tpl-3 .screw::after {
  content: '';
  position: absolute;
  background: rgba(0, 0, 0, .3);
  border-radius: 1px;
}
.qr-card.tpl-3 .screw::before { width: 6px;   height: 1.5px; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.qr-card.tpl-3 .screw::after  { width: 1.5px; height: 6px;   top: 50%; left: 50%; transform: translate(-50%, -50%); }

.qr-card.tpl-3 .screw.tl { top: 8px;     left: 8px;   }
.qr-card.tpl-3 .screw.tr { top: 8px;     right: 8px;  }
.qr-card.tpl-3 .screw.br { bottom: 26px; right: 8px;  }
.qr-card.tpl-3 .screw.bl { bottom: 26px; left: 8px;   }

.qr-card.tpl-3 .tpl3-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.qr-card.tpl-3 .tpl3-footer {
  border-top: 2.5px solid #111827;
  margin-top: 10px;
  padding-top: 6px;
  text-align: center;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: #111827;
}

.qr-card.tpl-3 .tpl-info-name     { color: #111827; }
.qr-card.tpl-3 .tpl-info-scan-head{ color: #111827; }
.qr-card.tpl-3 .tpl-info-website  { color: #374151; }

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 4 — HOME NAME PLATE  (product sticker)
   White bg · Rounded border · Rounded QR area · Owner name + address prominent
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-4 {
  background: #ffffff;
  border: 2px solid #111827;
  border-radius: 4px;
  padding: 16px 18px;
  
  /* background-color: #1e3a5f; */
  box-shadow: 0 1px 6px rgba(0, 0, 0, .07);
}

.qr-card.tpl-4 .tpl4-qr-area {
  display: flex;
  align-items: center;
  justify-content: center;
  /* background: #f3f4f6; */
  padding: 6px;
  flex-shrink: 0;
}

.qr-card.tpl-4 .tpl4-info {
  min-height: 150px;
}

.qr-card.tpl-4 .tpl4-owner-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  color: #9ca3af;
  margin-bottom: 2px;
}

.qr-card.tpl-4 .tpl4-name {
  font-size: 16px;
  font-weight: 900;
  color: #111827;
  text-align: center;
  margin-bottom: 6px;
}

.qr-card.tpl-4 .tpl4-addr-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  color: #9ca3af;
  margin-bottom: 2px;
}

.qr-card.tpl-4 .tpl4-addr {
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  color: #374151;
  margin-bottom: 9px;
}

.qr-card.tpl-4 .tpl-info-scan-head { color: #2563eb; }
.qr-card.tpl-4 .tpl-info-website   { color: #2563eb; }

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 5 — FOR BIKE  (product sticker)
   Vertical layout matching PDF: instructions top · large QR center · serial bottom
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-5 {
  background: #ffffff;
  border: 2px solid #1f2937;
  border-radius: 6px;
  padding: 14px 16px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  width: 310px;
  display: flex;
  flex-direction: column;
}

/* Bold vehicle/serial number at the bottom */
.qr-card.tpl-5 .tpl5-serial {
  border-top: 2px solid #1f2937;
  margin-top: 10px;
  padding-top: 7px;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #111827;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 6 — FOR PETS  (product sticker)
   Two 2-inch squares side-by-side
═══════════════════════════════════════════════════════════════════════════════ */
.tpl-pets-wrapper {
  display: inline-flex;
  gap: 12px;
  align-items: flex-start;
}

.qr-card.tpl-6 {
  background: #ffffff;
  border: 2px solid #111827;
  border-radius: 4px;
  padding: 10px;
  width: 130px;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.qr-card.tpl-6 .tpl-info-website {
  margin-top: 6px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 7 — LOST AND FOUND TAG  (product sticker)
   White bg · Border · QR left · "Found This Parsal" right
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-7 {
  background: #ffffff;
  border: 2px solid #111827;
  border-radius: 4px;
  padding: 14px 16px 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  min-width: 260px;
}

.qr-card.tpl-7 .tpl7-qr-area {
  background: #fafafa;
  border-radius: 6px;
  padding: 5px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 8 — FOR CAR  (product sticker)
   Two cards: BACK GLASS (small square) · FRONT GLASS (wide)
═══════════════════════════════════════════════════════════════════════════════ */
.tpl-car-wrapper {
  display: inline-flex;
  gap: 16px;
  align-items: flex-start;
}

.qr-card.tpl-8 {
  background: #ffffff;
  border: 2px solid #111827;
  border-radius: 4px;
  padding: 10px 12px;
  box-sizing: border-box;
}

.qr-card.tpl-8.tpl8-back {
  width: 120px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-card.tpl-8.tpl8-front {
  min-width: 220px;
}

.qr-card.tpl-8 .tpl8-qr-area {
  background: #fafafa;
  border-radius: 4px;
  padding: 4px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 9 — QR BELL NAME PLATE
   Full-bleed background image · QR code, owner name, and flat/house number
   overlaid at precise positions matching the printed design.
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-9 {
  width: 760px;
  height: 378px;
  background-color: #0d1b40;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}

/* QR image — fills the white scan box on the left panel exactly */
.qr-card.tpl-9 .tpl9-qr-area {
  position: absolute;
  left: 45px;
  top: 65px;
  width: 219px;
  height: 172px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-card.tpl-9 .tpl9-qr-img {
  width: 152px;
  height: 152px;
  margin-bottom: 15px;
  object-fit: contain;
  display: block;
}

/* Owner name — overlaid on the NAME: ........ field */
.qr-card.tpl-9 .tpl9-name {
  position: absolute;
  left: 463px;
  top: 236px;
  width: 283px;
  font-size: 13px;
  font-weight: 800;
  color: #1a3a5c;
  text-transform: uppercase;
  letter-spacing: .5px;
  line-height: 3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Flat / house number — overlaid on the FLAT/HOUSE NO. ........ field */
.qr-card.tpl-9 .tpl9-flat {
  position: absolute;
  left: 499px;
  top: 272px;
  width: 247px;
  font-size: 12px;
  font-weight: 700;
  color: #1a3a5c;
  letter-spacing: .3px;
  line-height: 3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 10 — CAR STICKER
   Full-bleed branded car sticker background · QR overlaid in centre white box
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-10 {
  width: 277px;
  height: 270px;
  border-radius: 0;
  border: none;
  overflow: hidden;
  position: relative;
}

.qr-card.tpl-10 .tpl10-qr-area {
  position: absolute;
  left: 26px;
  top: 34px;
  width: 225px;
  height: 215px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.qr-card.tpl-10 .tpl10-qr-img {
  width: 112px;
  height: 100px;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 11 — LOST & FOUND
   Full-bleed branded lost-and-found background · QR overlaid in centre white box
   Physical size: 3×2 in  (288×192 px at 96 dpi)
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-11 {
  width: 288px;
  height: 192px;
  border-radius: 0;
  border: none;
  overflow: hidden;
  position: relative;
}

.qr-card.tpl-11 .tpl11-qr-area {
  position: absolute;
  left: 88px;
  top: 41px;
  width: 112px;
  height: 102px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 10px;
}

.qr-card.tpl-11 .tpl11-qr-img {
  width: 115px;
  height: 102px;
  object-fit: fill;
  display: block;
  border-radius: 5px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 14 — DOOR BELL BLUE
   Full-bleed branded door-plate background · QR overlaid in centre white box
   Physical size: ~4.04×7.63 in  (388×732 px at 96 dpi)
   Sized so 3 columns × 2 rows (6 per page) fit on a 13×19in print sheet
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-14 {
  width: 388px;
  height: 732px;
  border-radius: 0;
  border: none;
  overflow: hidden;
  position: relative;
}

.qr-card.tpl-14 .tpl14-qr-area {
 position: absolute;
  left: 66px;
  top: 236px;
  width: 253px;
  height: 237px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
}

.qr-card.tpl-14 .tpl14-qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Trims the QR image's own dashed border out of view (~3% into the image on
     every edge) without stretching the QR pattern — see tpl16 comment below. */
  clip-path: inset(3% 9.35% 3% 9.35%);
  -webkit-clip-path: inset(3% 9.35% 3% 9.35%);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 15 — DOOR BELL GREEN
   Same design as Door Bell Blue (tpl-14), green colourway
   Physical size: ~4.04×7.63 in  (388×732 px at 96 dpi)
   Sized so 3 columns × 2 rows (6 per page) fit on a 13×19in print sheet
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-15 {
  width: 388px;
  height: 732px;
  border-radius: 0;
  border: none;
  overflow: hidden;
  position: relative;
}

.qr-card.tpl-15 .tpl15-qr-area {
  position: absolute;
  left: 71px;
  top: 233px;
  width: 251px;
  height: 237px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
}

.qr-card.tpl-15 .tpl15-qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  clip-path: inset(3% 9.03% 3% 9.03%);
  -webkit-clip-path: inset(3% 9.03% 3% 9.03%);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 16 — Door Bell Green
   Full-bleed branded door-plate background · QR overlaid in centre white box
   Physical size: 4×8 in (384×768 px at 96 dpi)
   Sized so 3 columns × 2 rows (6 per page) fit on a 13×19in print sheet
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-16 {
  width: 384px;
  height: 768px;
  border-radius: 0;
  border: none;
  overflow: hidden;
  position: relative;
}

.qr-card.tpl-16 .tpl16-qr-area {
  position: absolute;
  left: 71px;
  top: 249px;
  width: 245px;
  height: 247px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
}

.qr-card.tpl-16 .tpl16-qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* The branded QR PNG (QR + serial number, wrapped in a thin dashed cut-line
     border) is portrait (~0.92 aspect) while this box is near-square, so
     object-fit:contain leaves a gap on one axis. clip-path trims ~3% off
     every edge of the *image itself* (not the box) to cut the dashed border
     out — it sits <1% from the image edge — while staying clear of the QR
     modules and serial text. The left/right % is larger than top/bottom
     because it also has to close that contain gap first.
  */
  clip-path: inset(3% 6.25% 3% 6.25%);
  -webkit-clip-path: inset(3% 6.25% 3% 6.25%);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 12 — BIKE STICKER
   Same visual design as Car Sticker (tpl-10) · one sticker per QR code
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-12 {
  width: 277px;
  height: 270px;
  border-radius: 0;
  border: none;
  overflow: hidden;
  position: relative;
}

.qr-card.tpl-12 .tpl12-qr-area {
  position: absolute;
  left: 26px;
  top: 34px;
  width: 225px;
  height: 215px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.qr-card.tpl-12 .tpl12-qr-img {
  width: 112px;
  height: 100px;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TEMPLATE 13 — LOST & FOUND v2
   Updated lost-and-found background (new-lost-found.png)
   Physical size: 2.75×1.75 in  (264×168 px at 96 dpi)
═══════════════════════════════════════════════════════════════════════════════ */
.qr-card.tpl-13 {
  width: 264px;
  height: 168px;
  border-radius: 0;
  border: none;
  overflow: hidden;
  position: relative;
}

.qr-card.tpl-13 .tpl13-qr-area {
  position: absolute;
  left: 54px;
  top: 21px;
  width: 160px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 3px;
}

.qr-card.tpl-13 .tpl13-qr-img {
  width: 134px;
  height: 124px;
  object-fit: fill;
  display: block;
  border-radius: 5px;
}

/* ── @media print ────────────────────────────────────────────────────────────── */
@media print {
  .qr-card {
    break-inside:              avoid;
    page-break-inside:         avoid;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust:         exact !important;
    color-adjust:               exact !important;
  }

  .qr-card .screw,
  .qr-card .screw::before,
  .qr-card .screw::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust:         exact !important;
  }

  .qr-card.tpl-2 {
    box-shadow:
      0 3px 12px rgba(0,0,0,.18),
      inset 0 1px 0 rgba(255,255,255,.55),
      inset 0 -1px 0 rgba(0,0,0,.08) !important;
  }
  .qr-card.tpl-2 .tpl2-qr-frame {
    box-shadow:
      0 2px 8px rgba(0,0,0,.2),
      inset 0 1px 0 rgba(255,255,255,.8) !important;
  }

  .tpl-pets-wrapper,
  .tpl-car-wrapper {
    break-inside:      avoid;
    page-break-inside: avoid;
  }

}
