@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&family=Playfair+Display:ital,wght@0,700;0,900;1,700&display=swap");

body {
  background-color: #ebebeb;
}
.certificate-container {
  width: 210mm;
  min-height: 320mm;
  height: auto;
  margin: 0 auto;
  padding: 15mm 15mm 15mm 30mm;
  background: #ffffff;
  font-family: "Inter", sans-serif;
  position: relative;
  box-sizing: border-box;
  /* overflow: hidden; */
}

/* Quality Leader Background Pattern (Watermark) */
.watermark-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Ctext x='50%25' y='50%25' font-family='sans-serif' font-size='14' font-weight='800' fill='rgba(0, 0, 0, 0.07)' text-anchor='middle' transform='rotate(-45 60 60)'%3EQAED%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
  z-index: 0;
}

/* Globe/Earth Watermark Layer */
.globe-watermark {
  position: absolute;
  top: 15%; /* Adjusted for better coverage and stability */
  left: 20%;
  width: 70%;
  height: 70%;
  background-image: url("../images/globe-watermark.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  z-index: 0;
  pointer-events: none;
  opacity: 0.08;
}

/* Left Vertical Accent Bar */
.certificate-container::before {
  content: "";
  position: absolute;
  top: 4em;
  left: 18mm;
  height: 290mm;
  background: #ff6b35; /* Changed back to Orange */
  width: 15px; /* Thinner */
  z-index: 1;
}

.vertical-accent-bar {
  position: absolute;
  left: 10mm;
  top: 61mm;
  height: 200mm;
  width: 15px; /* Thinner */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.bar-logo-item {
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border: 2px solid #ff6b35;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bar-iso-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.certificate-watermark-left {
  position: absolute;
  bottom: 60mm;
  transform: rotate(-90deg);
  font-size: 4em;
  color: rgb(0 0 0 / 19%);
  font-weight: 900;
  font-family: "Playfair Display", serif;
  pointer-events: none;
  z-index: 0;
  letter-spacing: 15px;
  top: 13em;
  left: -1em;
}

.certificate-inner {
  position: relative;
  z-index: 2;
}

.certificate-header {
  text-align: center;
  margin-bottom: 25px;
}

.header-top-row {
  display: block;
  position: relative;
  margin-bottom: 20px;
  width: 100%;
}

.header-col-center {
  width: 100%;
  text-align: center;
}

.qaed-logo-section {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qaed-main-logo {
  height: 65px;
  width: auto;
  margin-bottom: 3px;
}

.tagline-pill {
  background: #002b49;
  color: #fff;
  font-size: 9px;
  padding: 3px 12px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-title h1 {
  font-family: serif;
  font-size: 32px;
  color: #1b3b6f;
  margin: 8px 0 3px 0;
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
}

.award-to-section {
  margin: 10px 0 15px 0;
  text-align: center;
}

.award-label {
  color: #1b3b6f;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 3px;
  text-align: left;
}

.company-name {
  font-family: "Inter", sans-serif;
  font-size: 30px;
  color: #ff6b35;
  margin: 3px 0;
  font-weight: 700;
  line-height: 1.1;
}

.company-address {
  font-size: 16px;
  color: #3498db;
  font-weight: 700;
  margin-bottom: 10px;
}

.validation-text {
  font-size: 11px;
  color: #003366;
  font-weight: 900;
  margin-bottom: 15px;
  text-align: center;
}

.scope-section-wrapper {
  margin: 10px 0;
}

.iso-main-layout {
  display: block;
  position: relative;
  width: 100%;
}

.iso-info-row {
  width: 85%;
  position: relative;
  min-height: 80px;
  display: flex;
  align-items: center;
}

.iso-logo-left-col {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-start;
  padding-right: 20px;
}

.iso-badge-img {
  width: 80px;
  height: 80px;
}

.iso-title-col {
  text-align: left;
  flex: 0 0 50%; /* Take exactly 50% */
  padding: 0 10px;
}

.company-logo-right-col {
  flex: 0 0 50%; /* Take exactly 50% */
  display: flex;
  justify-content: flex-end;
}

.client-scope-logo {
  max-width: 150px; /* Increased size for 50-50 layout */
  max-height: 100px;
  object-fit: contain;
}

.scope-title {
  font-size: 34px;
  color: #e67e22;
  font-weight: 900;
  margin: 0;
  line-height: 1;
  font-family: "Inter", sans-serif;
}

.scope-heading {
  font-size: 16px;
  color: #e67e22;
  font-weight: 900;
  margin: 3px 0;
  text-transform: uppercase;
}

.scope-description {
  font-size: 12px;
  line-height: 1.3;
  color: #333;
  text-align: justify;
  font-weight: 700;
}

.certificate-details-row {
  display: block;
  margin: 15px 0;
  padding-bottom: 20px;
  width: 100%;
}

.details-table {
  width: 60%;
  border-collapse: collapse;
}

.details-table td {
  padding: 2px 0;
  font-size: 12px;
  font-weight: 700;
  color: #333;
}

.details-table td.label {
  width: 150px;
}

.signature-block {
  text-align: center;
  width: 35%;
}

.signature-block p {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: #333;
}

.signature-image {
  max-width: 130px;
  height: auto;
  margin: 3px auto;
  display: block;
}

.manager-name {
  color: #3498db !important;
  font-family: serif;
  font-style: italic;
  font-size: 18px !important;
  font-weight: 900 !important;
  margin-top: -3px !important;
}

.certificate-footer-area {
  width: 84%;
  padding-bottom: 10mm;
  position: absolute;
  top: 51em;
  left: 6.2em;
}

.footer-legal-text {
  font-size: 9px;
  line-height: 1.1;
  color: #333;
  margin-bottom: 4px;
  text-align: left;
}

.company-legal-title {
  font-weight: 900;
  color: #000;
  font-size: 10px;
  margin-bottom: 1px;
}

.bottom-logos-row {
  width: 97%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1em;
}

.footer-logo {
  height: 40px;
  width: auto;
}

.footer-iso-logo {
  height: 40px;
  width: 40px;
}

.qr-code-wrapper img {
  width: 75px;
  height: 75px;
  background: #fff;
}

.text-sm p {
  font-size: 12px !important;
}

/* RESPONSIVE STYLES - SCALING APPROACH */
@media screen and (max-width: 210mm) {
  body {
    /* overflow-x: hidden; */
    background: #f0f2f5;
    padding-bottom: 80px;
  }

  .certificate-container {
    /* transform-origin: top center; */
    /* Dynamic scale based on viewport width */
    /* transform: scale(calc(100vw / 210mm * 0.95)); */
    margin: 20px auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  }
}

@media screen and (max-width: 768px) {
  /* Ensure the container doesn't cause overflow issues when scaled */
  body {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* The actions bar should remain fixed and not scale */
  .certificate-actions-bar {
    transform: none;
  }

  .certificate-footer-area {
    top: 47em;
  }

  .bottom-logos-row {
    gap: 15px !important;
  }
}

/* PREMIUM DOWNLOAD BUTTON & ACTIONS BAR */
.certificate-actions-bar {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  pointer-events: none; /* Allow clicks through to background except for the button */
}

.download-btn-premium {
  pointer-events: auto;
  background: #1b3b6f;
  color: #ffffff !important;
  padding: 14px 28px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(27, 59, 111, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.download-btn-premium:hover {
  background: #ff6b35;
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(255, 107, 53, 0.4);
  color: #ffffff !important;
}

.download-btn-premium svg {
  transition: transform 0.3s ease;
}

.download-btn-premium:hover svg {
  transform: translateY(2px);
}

/* Hide action bar when printing */
@media print {
  .certificate-actions-bar {
    display: none;
  }
}

/* Adjust for mobile to ensure it doesn't block content */
@media screen and (max-width: 768px) {
  .certificate-actions-bar {
    bottom: 15px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    pointer-events: auto;
  }

  .download-btn-premium {
    font-size: 14px;
    padding: 12px 22px;
  }
}

/* FINAL MOBILE REFINEMENTS */
@media screen and (max-width: 480px) {
  .company-name {
    font-size: 18px !important;
    word-wrap: break-word;
  }

  .qaed-main-logo {
    height: 50px;
  }

  .signature-image {
    max-width: 100px;
  }

  .iso-badge-img {
    width: 60px;
    height: 60px;
  }

  .tagline-pill {
    font-size: 8px;
    padding: 2px 10px;
  }

  .company-address {
    font-size: 14px;
  }

  .scope-description {
    font-size: 11px;
  }
}
