#fullscreenToggle {
  position: fixed;
  top: 15px;
  right: 15px;
  font-size: 24px;
  color: #333;
  background: #fff;
  border-radius: 50%;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 9999;
  transition: background 0.2s, color 0.2s;
}

#fullscreenToggle:hover {
  background: #228be6;
  color: #fff;
}

   
   body {
        margin: 0;
        background: #e8f0f8;
        font-family: "Lato", sans-serif;
      }

      .controls {
        text-align: center;
        margin: 20px;
      }

      input,
      button,
      textarea,
      select {
        padding: 8px 12px;
        font-size: 14px;
        margin: 4px;
      }

      textarea {
        width: 500px;
      }

      @media print {
        .controls,
        #fullscreenToggle {
          display: none !important;
        }
      
        body {
          margin: 0;
          -webkit-print-color-adjust: exact;
          print-color-adjust: exact;
        }
      }
      

      #pdfContainer {
        width: 1122px;
        margin: 0 auto;
        padding: 0;
        background: white;
      }

      .certificate,
      .certificate-topics {
        width: 1122px;
        height: 793px;
        position: relative;
        overflow: hidden;
        box-sizing: border-box;
      }

      .watermark {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 400px;
        transform: translate(-50%, -50%);
        opacity: 0.1;
        z-index: 1;
      }

      .recipient,
      .institution,
      .statement,
      .course-name,
      .held-info,
      .flourish,
      .footer,
      .topics-title,
      .topics-list {
        position: relative;
        z-index: 2;
      }

      .recipient {
        position: absolute;
        top: 320px;
        left: 0;
        width: 100%;
        text-align: center;
        font-weight: 700;
        font-size: 48px;
        color: #1c1c1e;
      }

      .institution {
        position: absolute;
        top: 375px;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 16px;
        color: #5c677d;
      }

      .present {
        position: absolute;
        top: 280px;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 1.4em;
        font-family: "ui-monospace", sans-serif;
        color: #495057;
      }
      .statement {
        position: absolute;
        top: 420px;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 20px;
        color: #495057;
      }

      .course-name {
        position: absolute;
        top: 470px;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 28px;
        font-weight: 700;
        color: #1c1c1e;
      }

      .held-info {
        position: absolute;
        top: 550px;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 18px;
        color: #5c677d;
      }

      .flourish {
        position: absolute;
        top: 575px;
        left: 50%;
        transform: translateX(-50%);
        width: 200px;
      }

      .footer {
        position: absolute;
        bottom: 60px;
        left: 160px;
        /* right: 60px; */
        display: flex;
        justify-content: space-between;
        gap: 400px;
      }

      .sign-block {
        text-align: center;
        width: 200px;
      }

      .sign-line {
        border-top: 1px solid #000;
        width: 150px;
        margin: 0 auto 4px;
      }

      .signature-img {
        width: 150px;
        /* height: 50px; */
        display: block;
        margin: 0 auto 10px;
        mix-blend-mode: screen; /* Blend with the background */
      }

      .signature-space {
        width: 150px;
        height: 50px;
        border-bottom: 1px solid transparent; /* visually aligned space */
        margin: 0 auto 110px;
      }

      .certificate-topics {
        width: 1122px;
        height: 793px;
        position: relative;
        overflow: hidden;
        box-sizing: border-box;

        /* display: flex;
        justify-content: center;
        align-items: center;
        text-align: center; */
        /* position: relative; */
      }

      .topics-container {
        position: absolute;
        top: 260px; /* adjust this value to move up/down */
        left: 50%;
        transform: translateX(-50%);
        width: 80%;
        text-align: center;
        z-index: 2;
      }

      .topics-title {
        font-size: 32px;
        font-weight: 700;
        color: #1c1c1e;
        margin-bottom: 20px;
      }

      /* .topics-list { */
      /* columns: 2; Create two columns */
      /* column-gap: 80px;
        list-style-type: square;
        padding-left: 0;
        margin: 0 auto;
        width: 80%;
        font-size: 12px;
        color: #1c1c1e;
        text-align: left;
        line-height: 1.6; */
      /* } */

      /* ul.topics-list {
        list-style-type: square;
      } */

      .topics-list {
        columns: 2;
        column-gap: 80px;
        padding-left: 20px; /* spacing for list numbers */
        margin: 0 auto;
        width: 80%;
        font-size: 12px;
        color: #1c1c1e;
        text-align: left;
        line-height: 1.6;
      }

      @page {
        size: A4 landscape;
        margin: 0;
      }

      #page1,
      #page2 {
        width: 1122px;
        height: 793px;
      }

      /* === MOBILE RESPONSIVE FIX === */
/* === MOBILE RESPONSIVE FIX === */
@media screen and (max-width: 768px) {

  /* Scale the whole certificate to fit the screen width */
  #pdfContainer {
    width: 100vw;
    overflow-x: auto;
    padding: 0;
    margin: 0;
    transform: scale(1);
  }

  .certificate,
  .certificate-topics {
    width: 100vw;        /* Fit mobile width */
    height: auto;        /* Let height adjust naturally */
    margin: 0;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1);
    transform-origin: top center;
  }

  /* Reduce text size a bit for readability on small screens */
  .recipient {
    font-size: 6vw;
    top: 35%;
  }

  .institution {
    font-size: 3.5vw;
    top: 41%;
  }

  .statement {
    font-size: 4vw;
    top: 46%;
  }

  .course-name {
    font-size: 5vw;
    top: 52%;
  }

  .held-info {
    font-size: 3.5vw;
    top: 60%;
  }

  /* Footer scaling */
  .footer {
    bottom: 30px;
    left: 0;
    right: 0;
    gap: 60px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .sign-block {
    width: 140px;
  }

  .signature-img,
  .signature-space {
    width: 120px;
  }

  /* Control inputs stacked for mobile */
  .controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    margin: 10px auto;
    gap: 8px;
  }

  input,
  select,
  textarea,
  button {
    width: 100%;
    max-width: 400px;
    font-size: 16px;
  }

  textarea {
    width: 100%;
  }

  /* Adjust fullscreen icon */
  #fullscreenToggle {
    top: 10px;
    right: 10px;
    font-size: 20px;
    padding: 8px;
  }
}
