/* ========================================================
   Certificate View & Print Styling
   Matches the Official Bangladesh Union Parishad Trade License
   ======================================================== */

.certificate-wrapper {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  margin: 0 auto 40px auto;
  max-width: 980px;
  padding: 20px;
  box-sizing: border-box;
}

/* The Ornate Double Border & Pattern Frame */
.certificate-frame {
  position: relative;
  border: 14px double #b84a28;
  padding: 25px 30px;
  background-color: #ffffff;
  box-sizing: border-box;
  overflow: hidden;
}

/* Subtle Watermark Seal in the Center */
.certificate-frame::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 320px;
  background-image: url('../uploads/bd_logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.05;
  pointer-events: none;
  z-index: 1;
}

.certificate-content {
  position: relative;
  z-index: 2;
}

/* Header Section */
.cert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  margin-bottom: 12px;
}

.cert-logo-left, .cert-logo-right {
  width: 95px;
  height: 95px;
  flex-shrink: 0;
}

.cert-logo-left img, .cert-logo-right img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cert-header-center {
  flex: 1;
  padding: 0 15px;
}

.cert-header-center h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: #111111;
}

.cert-header-center h2 {
  font-size: 1.85rem;
  font-weight: 700;
  margin: 4px 0;
  color: #0b1a30;
}

.cert-sub-address {
  font-size: 1rem;
  font-weight: 600;
  margin: 2px 0;
  color: #222222;
}

.cert-rule-text {
  font-size: 0.85rem;
  font-weight: 500;
  margin: 4px 0 0 0;
  color: #333333;
}

/* Green Bar with Centered Red Banner: ট্রেড লাইসেন্স (Trade Licence) */
.cert-title-container {
  position: relative;
  margin: 15px 0 20px 0;
  text-align: center;
}

.cert-green-line {
  height: 14px;
  background-color: #0a7037;
  border-radius: 3px;
  width: 100%;
}

.cert-red-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #bf1e2e;
  color: #ffffff;
  padding: 6px 36px;
  border-radius: 20px;
  font-size: 1.15rem;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
  border: 1px solid #ffffff;
  white-space: nowrap;
}

/* Certificate Body Layout */
.cert-body-grid {
  display: flex;
  gap: 25px;
  margin-bottom: 15px;
}

.cert-body-left {
  flex: 1;
}

.cert-body-right {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10px;
}

/* Section Header Badge */
.cert-section-title {
  background-color: #0b4526;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.98rem;
  padding: 5px 15px;
  display: inline-block;
  border-radius: 3px;
  margin-bottom: 10px;
}

/* Dotted Fields Table */
.cert-fields-table {
  width: 100%;
  border-collapse: collapse;
}

.cert-fields-table tr {
  line-height: 1.6;
}

.cert-label {
  font-weight: 700;
  color: #111111;
  font-size: 0.98rem;
  white-space: nowrap;
  vertical-align: top;
  padding: 3px 0;
}

.cert-colon {
  font-weight: 700;
  padding: 3px 6px;
  vertical-align: top;
  text-align: center;
}

.cert-value {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 1rem;
  vertical-align: top;
  padding: 3px 0;
  border-bottom: 1px dotted #444444;
}

/* Declaration and Financial Details */
.cert-declaration {
  margin: 14px 0 10px 0;
  font-size: 0.97rem;
  font-weight: 600;
  color: #111111;
  line-height: 1.5;
}

.cert-financial-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 15px;
  margin: 6px 0;
  font-size: 0.98rem;
}

.cert-financial-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.dotted-fill {
  border-bottom: 1px dotted #444444;
  font-weight: 700;
  padding: 0 8px;
}

.cert-validity {
  margin: 12px 0 8px 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: #111111;
}

/* Right Column: Verify QR Box & Chairman Signature */
.cert-verify-box {
  border: 1.5px solid #222222;
  border-radius: 4px;
  width: 175px;
  padding: 10px 8px;
  text-align: center;
  background: #ffffff;
  margin-bottom: 25px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.cert-verify-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111111;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.cert-qr-container {
  width: 145px;
  height: 145px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cert-signature-area {
  text-align: center;
  margin-top: auto;
  width: 100%;
}

.cert-signature-img {
  height: 48px;
  max-width: 150px;
  object-fit: contain;
  display: block;
  margin: 0 auto 4px auto;
}

.cert-signature-line {
  border-top: 1px dashed #333333;
  width: 140px;
  margin: 4px auto;
}

.cert-signature-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111111;
}

/* Print Specific Rules */
@media print {
  @page {
    size: A4 landscape;
    margin: 6mm;
  }
  
  body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .site-header,
  .site-footer,
  .search-card,
  .status-badge-verified,
  .action-bar,
  .info-grid,
  .no-print {
    display: none !important;
  }

  .certificate-wrapper {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .certificate-frame {
    border: 10px double #b84a28 !important;
    padding: 15px 20px !important;
  }

  .cert-red-badge {
    background: #bf1e2e !important;
    color: #ffffff !important;
  }

  .cert-green-line {
    background: #0a7037 !important;
  }

  .cert-section-title {
    background: #0b4526 !important;
    color: #ffffff !important;
  }
}