/* ==========================================================================
   MADRASA ISLAMIYA BASATPUR BARA NEPAL
   CR80 PVC Student Identity Card Stylesheet (Standard 85.6mm x 53.98mm)
   Bilingual Urdu (Jameel Noori Nastaleeq) & English Layout
   ========================================================================== */

/* Official Urdu Nastaliq Font: Jameel Noori Nastaleeq */
@font-face {
  font-family: 'Jameel Noori Nastaleeq';
  src: local('Jameel Noori Nastaleeq'),
       local('Jameel Noori Nastaleeq Regular'),
       url('../assets/fonts/JameelNooriNastaleeqRegular.woff') format('woff'),
       url('assets/fonts/JameelNooriNastaleeqRegular.woff') format('woff'),
       url('https://fonts.cdnfonts.com/s/149204/JameelNooriNastaleeqRegular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --pvc-maroon: #4d0b17;
  --pvc-maroon-dark: #3b060f;
  --pvc-gold: #c8963e;
  --pvc-gold-light: #fbe29d;
  --pvc-gold-accent: #d4af37;
  --pvc-bg: #fffdf7;
}

/* Base PVC Card Frame (536px x 338px = exact 1.5858 CR80 Aspect Ratio) */
.pvc-card {
  width: 536px;
  height: 338px;
  min-width: 536px;
  min-height: 338px;
  max-width: 536px;
  max-height: 338px;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  background-color: var(--pvc-bg);
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.22), 0 4px 10px rgba(77, 11, 23, 0.15);
  border: 1px solid rgba(200, 150, 62, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
  box-sizing: border-box;
  background-image: 
    radial-gradient(rgba(200, 150, 62, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #fffdf8 40%, #faf5ea 100%);
  background-size: 16px 16px, 100% 100%;
}

/* Maroon Top Header Banner (Grand Full-Line Layout) */
.pvc-header-maroon {
  background: linear-gradient(135deg, #580a1a 0%, #460713 50%, #580a1a 100%);
  border-bottom: 2px solid var(--pvc-gold-accent);
  padding: 4px 14px 4px 10px;
  height: 68px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  box-shadow: 0 3px 6px rgba(0,0,0,0.22);
  flex-shrink: 0;
}

/* Madrasa Campus Building Watermark Background */
.pvc-building-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pvc-building-watermark-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  opacity: 0.16;
  filter: contrast(1.1) brightness(1.02);
  transform: scale(1.04);
}

.pvc-building-front-img {
  object-position: center 32%;
  opacity: 0.22;
  filter: contrast(1.18) brightness(1.04) saturate(1.12);
  transform: scale(1.03);
}

.pvc-building-back-img {
  object-position: center 32%;
  opacity: 0.25;
  filter: contrast(1.2) brightness(1.04) saturate(1.15);
  transform: scale(1.02);
}

.pvc-field-lbl,
.pvc-urdu-name-val,
.pvc-en-main-name,
.pvc-en-sub-name,
.pvc-urdu-sub-val,
.pvc-urdu-val,
.pvc-nid-val,
.pvc-mono-val,
.pvc-session-val,
.pvc-phone-val {
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.95), 0 0 1px #fff;
}

.pvc-guideline-item {
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9), 0 0 1px #fff;
}

/* Back Header */
.pvc-header-maroon-back {
  background: linear-gradient(135deg, #580a1a 0%, #460713 50%, #580a1a 100%);
  border-bottom: 2px solid var(--pvc-gold-accent);
  padding: 5px 12px;
  height: 48px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,0.18);
  flex-shrink: 0;
}

/* Circular Madrasa Logo Badge with Gold Embossed Rim & Glow */
.pvc-logo-badge {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #ffd54f;
  outline: 1.5px solid #d4af37;
  outline-offset: 1px;
  box-shadow: 0 0 10px rgba(255, 213, 79, 0.45), 0 3px 6px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  background-color: #ffffff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pvc-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Header Text Container with Dedicated Vertical Heights to Avoid Any Collision */
.pvc-header-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 60px;
  box-sizing: border-box;
}

/* Full-Span Header Urdu Typography - Grand Bold Heading Style */
.pvc-title-urdu {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 28px;
  font-weight: 900;
  color: #ffffff;
  height: 35px;
  line-height: 35px;
  margin: 0;
  padding: 0;
  display: block;
  text-shadow: 0 0 1px rgba(255,255,255,0.85), 0 2px 4px rgba(0,0,0,0.7);
  letter-spacing: normal !important;
  font-feature-settings: "kern" 1, "liga" 1;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
}

.pvc-title-en {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #ffd54f;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  height: 14px;
  line-height: 14px;
  margin: 5px 0 0 0;
  padding: 0;
  display: block;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.pvc-back-title-urdu {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 29px;
  font-weight: 900;
  color: #ffffff;
  line-height: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  display: block;
  text-shadow: 0 0 1px rgba(255,255,255,0.8), 0 2px 4px rgba(0,0,0,0.6);
  letter-spacing: normal !important;
  font-feature-settings: "kern" 1, "liga" 1;
  text-align: center;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
}

/* Maroon Bottom Accent Bar */
.pvc-footer-maroon {
  background: linear-gradient(135deg, #580a1a 0%, #460713 50%, #580a1a 100%);
  border-top: 1.5px solid var(--pvc-gold-accent);
  height: 10px;
  width: 100%;
  flex-shrink: 0;
}

.pvc-footer-maroon-web {
  background: linear-gradient(135deg, #580a1a 0%, #460713 50%, #580a1a 100%);
  border-top: 1.5px solid var(--pvc-gold-accent);
  height: 18px;
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffd700;
  font-family: Poppins, monospace, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

/* Passport Photo Frame with Golden Double-Border */
.pvc-photo-frame {
  width: 104px;
  height: 124px;
  border: 2px solid #b8860b;
  outline: 1.5px solid #d4af37;
  outline-offset: 1px;
  border-radius: 5px;
  overflow: hidden;
  background-color: #f1ede4;
  box-shadow: 0 3px 7px rgba(0,0,0,0.22);
  flex-shrink: 0;
  position: relative;
}

.pvc-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Dynamic QR Code Box - Crisp & Fully Functional */
.pvc-qr-box {
  width: 72px;
  height: 72px;
  padding: 2px;
  background: #ffffff;
  border: 1.5px solid #d4af37;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  background-color: #ffffff;
}

/* Ensure only the clean canvas renders; hide duplicate img to prevent corruption */
.pvc-qr-box canvas {
  width: 68px !important;
  height: 68px !important;
  display: block !important;
  image-rendering: pixelated;
}

.pvc-qr-box img {
  display: none !important;
}

/* Verified Badge under QR */
.pvc-verified-badge {
  font-family: monospace;
  font-size: 7.5px;
  font-weight: 800;
  color: #064e3b;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.95);
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(212, 175, 55, 0.7);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Student & Faculty Information Block Field Label Styling */
.pvc-field-lbl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  letter-spacing: normal !important;
  text-transform: none !important;
  white-space: nowrap;
  line-height: 1.2;
}

.pvc-field-lbl .lbl-en {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.pvc-field-lbl .lbl-sep {
  color: #94a3b8;
  font-weight: 600;
  font-size: 11px;
  line-height: 1;
  margin: 0 1px;
}

.pvc-field-lbl .lbl-ur {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', 'Amiri', serif !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  color: #4a0c16 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  direction: rtl !important;
  unicode-bidi: isolate;
  line-height: 1.1;
  display: inline-block;
}

.pvc-field-lbl-urdu {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 16px;
  font-weight: normal;
  color: #4d0b17;
  line-height: 1.2;
}

.pvc-en-main-name {
  font-family: 'Poppins', sans-serif;
  font-size: 20.5px;
  font-weight: 800;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin-top: 1px;
}

.pvc-urdu-name-val {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 21px;
  font-weight: normal;
  color: #4d0b17;
  line-height: 1.3;
}

.pvc-en-sub-name {
  font-family: 'Poppins', sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
  margin-top: 0px;
}

.pvc-urdu-sub-val {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 18px;
  font-weight: normal;
  color: #4d0b17;
  line-height: 1.3;
}

.pvc-en-address {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.25;
  white-space: nowrap;
  display: inline-block;
}

.pvc-nid-val {
  font-family: monospace;
  font-size: 15px;
  font-weight: 800;
  color: #701a75;
  line-height: 1.25;
  unicode-bidi: isolate;
  display: inline-block;
}

.pvc-urdu-val {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 16.5px;
  font-weight: normal;
  color: #111827;
  line-height: 1.3;
}

.pvc-mono-val {
  font-family: monospace;
  font-size: 16px;
  font-weight: 800;
  color: #064e3b;
  line-height: 1.2;
  unicode-bidi: isolate;
  display: inline-block;
}

.pvc-session-val {
  font-family: 'Poppins', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
}

.pvc-phone-val {
  font-family: 'Poppins', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  unicode-bidi: isolate;
  display: inline-block;
}

.pvc-hamza {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 16px;
  margin-right: 2px;
}

/* Back Guidelines */
.pvc-guideline-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-size: 20px;
  line-height: 1.85;
  color: #111827;
  font-weight: normal;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.95), 0 0 1px #fff;
}

.pvc-guideline-num {
  font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  font-weight: bold;
  color: #4d0b17;
  font-size: 21px;
}

/* Golden Circular Embossed Seal (Vector) */
.pvc-gold-seal-wrap {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(100, 70, 15, 0.35));
}

/* Guardian Signature Line */
.pvc-sig-line {
  border-top: 1.5px solid #374151;
  width: 88px;
  margin-bottom: 3px;
}

/* Barcode Wrap */
.pvc-barcode-wrap {
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Mobile & Modal Scale Wrappers */
.pvc-card-scale-box {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  overflow: hidden;
}

@media (max-width: 575px) {
  .pvc-card-scale-box .pvc-card {
    transform: scale(0.60);
    transform-origin: top center;
    margin-bottom: -130px;
  }
}

@media (min-width: 576px) and (max-width: 767px) {
  .pvc-card-scale-box .pvc-card {
    transform: scale(0.80);
    transform-origin: top center;
    margin-bottom: -65px;
  }
}

/* Off-Screen Capture Sandbox Rule: Force No Scale */
#pvcOffscreenHost,
#pvcOffscreenHost .pvc-card {
  transform: none !important;
  margin: 0 !important;
}

/* ================= PRINT STYLES FOR DIRECT CR80 PVC PRINTING =================
   Page size is set to exact 85.6mm x 53.98mm with zero margins.
   Each card prints at genuine CR80 size with 3.18mm rounded corners!
============================================================================= */
@page {
  size: 85.6mm 53.98mm;
  margin: 0;
}

@media print {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body * {
    visibility: hidden;
  }

  #printableIdCardArea, #printableIdCardArea * {
    visibility: visible;
  }

  #printableIdCardArea {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 85.6mm !important;
    height: 53.98mm !important;
  }

  .pvc-card-scale-box {
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 85.6mm !important;
    height: 53.98mm !important;
  }

  .pvc-card {
    width: 85.6mm !important;
    height: 53.98mm !important;
    min-width: 85.6mm !important;
    min-height: 53.98mm !important;
    max-width: 85.6mm !important;
    max-height: 53.98mm !important;
    margin: 0 !important;
    border-radius: 3.18mm !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    page-break-after: always;
    break-after: page;
  }

  .no-print {
    display: none !important;
  }
}
