.gmwcpApp {
  text-align: center;
}

/* Styling for the download button */
.pdf-download-button {
  display: inline-block;
  padding: 10px 20px;
  margin: 20px auto;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  background-color: #007bff;
  border: none;
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.pdf-download-button:hover {
  background-color: #0056b3;
}

.pdf-download-button:focus {
  outline: none;
}

.pdf-download-button:active {
  background-color: #00408d;
}

/* Loader styles */
.loader {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  border-top-color: #000;
  animation: spin 1s ease-in-out infinite;
  margin-top: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Centered text for loading state */
.loading-text {
  font-size: 16px;
  font-weight: bold;
  margin-top: 10px;
}

/* A4 Page Size Definition */
@page {
  size: A4;
  margin: 0;
}

/* Cover Page Styles
 * 
 * HTML Structure Example:
 * <div class="gmwcp-cover-page">
 *   <img src="[pluginurl]/img/360-light-logo.png" class="gmwcp-cover-logo" alt="360 Logo" />
 *   <div class="gmwcp-cover-product-title">Product Title Here</div>
 * </div>
 * 
 * The cover page will have:
 * - Background image: img/pdf-coverbg.png
 * - Logo positioned at top right
 * - Product title positioned at bottom right
 */
@media print {
  .gmwcp-cover-page {
    width: 210mm;
    height: 295mm;
    /* Reduced to 295mm */
    background-image: url('../img/pdf-coverbg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    page-break-after: always;
    overflow: hidden;
    /* Strict overflow */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  .gmwcp-cover-logo {
    position: absolute;
    top: 20mm;
    right: 20mm;
    z-index: 2;
    max-width: 150px;
    max-height: 60px;
    height: auto;
    width: auto;
  }

  .gmwcp-cover-product-title {
    position: absolute;
    bottom: 30mm;
    right: 30mm;
    z-index: 2;
    color: #ffffff;
    font-size: 28px;
    font-family: "GT Super Ds Trial", Sans-serif;
    text-align: right;
    max-width: 55%;
    line-height: 1.3;
    margin: 0;
    padding: 0;
  }
}

/* Screen styles for preview */
.gmwcp-cover-page {
  width: 210mm;
  height: 297mm;
  background-image: url('../img/pdf-coverbg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
  margin: 0 auto 20px auto;
  box-sizing: border-box;
}

.gmwcp-cover-logo {
  position: absolute;
  top: 40px;
  right: 40px;
  z-index: 2;
  max-width: 200px;
  height: auto;
}

.gmwcp-cover-product-title {
  position: absolute;
  bottom: 60px;
  right: 60px;
  z-index: 2;
  color: #ffffff;
  font-size: 32px;
  font-family: Georgia, serif;
  text-align: right;
  max-width: 60%;
}

/* Product Detail Page (2D Page) Styles
 * 
 * HTML Structure Example:
 * <div class="gmwcp-product-page">
 *   <div class="gmwcp-page-header">
 *     <div class="gmwcp-pagination">1/2</div>
 *     <img src="[pluginurl]/img/360-dark-logo.png" class="gmwcp-header-logo" alt="360 Logo" />
 *   </div>
 *   <div class="gmwcp-page-body">
 *     <div class="gmwcp-product-main">
 *       <div class="gmwcp-product-info">
 *         <h1 class="gmwcp-product-title">Product Title</h1>
 *         <p class="gmwcp-product-description">Product short description</p>
 *       </div>
 *       <div class="gmwcp-product-image">
 *         <img src="[featured-image-url]" alt="Product Image" />
 *       </div>
 *     </div>
 *     <div class="gmwcp-2d-section">
 *       <h2 class="gmwcp-2d-heading">2d Representation</h2>
 *       <div class="gmwcp-2d-drawings">
 *         <img src="[2d_drawings-image-url]" alt="2D Drawings" />
 *       </div>
 *     </div>
 *   </div>
 *   <div class="gmwcp-page-footer">
 *     <div class="gmwcp-tagline">Making furniture.<br />For you.</div>
 *     <div class="gmwcp-site-link">interiorthreesixty.com</div>
 *   </div>
 * </div>
 */
@media print {
  .gmwcp-product-page {
    width: 210mm;
    height: 295mm;
    /* Reduced to 295mm */
    background-color: #ffffff;
    position: relative;
    page-break-after: always;
    display: block;
    /* Block for absolute footer */
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  .gmwcp-page-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30mm;
    padding: 0 20mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Center vertically */
    border-bottom: 1px solid #000000;
    box-sizing: border-box;
    z-index: 10;
    background: #fff;
  }

  .gmwcp-pagination {
    font-size: 12px;
    font-family: "Bw Gradual DEMO", Sans-serif;
    color: #000000;
    font-weight: normal;
  }

  .gmwcp-header-logo {
    max-width: 120px;
    max-height: 50px;
    height: auto;
    width: auto;
  }

  .gmwcp-page-body {
    position: absolute;
    top: 30mm;
    bottom: 20mm;
    left: 0;
    width: 100%;
    padding: 10mm 20mm;
    /* Internal padding */
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .gmwcp-product-main {
    display: flex;
    gap: 15mm;
    align-items: flex-start;
    flex-shrink: 0;
  }

  .gmwcp-product-info {
    flex: 1;
    max-width: 50%;
    min-width: 0;
  }

  .gmwcp-product-title {
    font-size: 32px;
    font-family: "GT Super Ds Trial", Sans-serif;
    font-weight: 300;
    color: #60715f;
    margin: 0 0 10px 0;
    line-height: 1.2;
  }

  .gmwcp-product-description {
    font-size: 14px;
    font-family: "Bw Gradual DEMO", Sans-serif;
    color: #4d4d4d;
    line-height: 1.5;
    margin: 0;
  }

  .gmwcp-product-image {
    flex: 1;
    max-width: 50%;
    background-color: #f5f5f5;
    padding: 10px;
    box-sizing: border-box;
    min-width: 0;
    aspect-ratio: 1/1 !important;
    object-fit: contain;
  }

  .gmwcp-product-image img {
    width: 100%;
    height: auto;
    display: block;
    height: 120mm;
    object-fit: contain;
  }

  .gmwcp-2d-section {
    width: 100%;
    flex-shrink: 0;
  }

  .gmwcp-2d-heading {
    font-size: 32px;
    font-family: "GT Super Ds Trial", Sans-serif;
    font-weight: 300;
    color: #60715f;
    text-align: center;
    margin: 0 0 15px 0;
    text-transform: lowercase;
  }

  .gmwcp-2d-drawings {
    width: 100%;
    text-align: center;
  }

  .gmwcp-2d-drawings img {
    max-width: 100%;
    max-height: 80mm;
    height: auto;
    display: inline-block;
    object-fit: contain;
  }

  .gmwcp-page-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20mm;
    padding: 0 20mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #000000;
    box-sizing: border-box;
    z-index: 10;
    background: #fff;
  }

  .gmwcp-tagline {
    font-size: 14px;
    font-family: "Bw Gradual DEMO", Sans-serif;
    color: #000000;
    line-height: 1.4;
  }

  .gmwcp-tagline em,
  .gmwcp-tagline i {
    font-style: italic;
  }

  .gmwcp-site-link {
    font-size: 14px;
    font-family: "Bw Gradual DEMO", Sans-serif;
    color: #000000;
  }
}

/* Screen styles for preview */
.gmwcp-product-page {
  width: 210mm;
  min-height: 297mm;
  background-color: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0 auto 20px auto;
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
}

.gmwcp-page-header {
  width: 100%;
  padding: 30px 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #000000;
  position: relative;
  box-sizing: border-box;
}

.gmwcp-pagination {
  font-size: 14px;
  font-family: "Bw Gradual DEMO", Sans-serif;
  color: #000000;
  font-weight: normal;
}

.gmwcp-header-logo {
  max-width: 180px;
  height: auto;
}

.gmwcp-page-body {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 50px;
  box-sizing: border-box;
}

.gmwcp-product-main {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.gmwcp-product-info {
  flex: 1;
  max-width: 50%;
}

.gmwcp-product-title {
  font-size: 48px;
  font-family: Georgia, serif;
  font-weight: normal;
  color: #000000;
  margin: 0 0 20px 0;
  line-height: 1.2;
}

.gmwcp-product-description {
  font-size: 16px;
  font-family: "Bw Gradual DEMO", Sans-serif;
  color: #000000;
  line-height: 1.6;
  margin: 0;
}

.gmwcp-product-image {
  flex: 1;
  max-width: 50%;
  background-color: #f5f5f5;
  padding: 20px;
  box-sizing: border-box;
}

.gmwcp-product-image img {
  width: 100%;
  height: auto;
  display: block;
}

.gmwcp-2d-section {
  width: 100%;
}

.gmwcp-2d-heading {
  font-size: 48px;
  font-family: Georgia, serif;
  font-weight: normal;
  color: #000000;
  text-align: center;
  margin: 0 0 30px 0;
  text-transform: lowercase;
}

.gmwcp-2d-drawings {
  width: 100%;
  text-align: center;
}

.gmwcp-2d-drawings img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

.gmwcp-page-footer {
  width: 100%;
  padding: 30px 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid #000000;
  margin-top: auto;
  box-sizing: border-box;
}

.gmwcp-tagline {
  font-size: 14px;
  font-family: "Bw Gradual DEMO", Sans-serif;
  color: #000000;
  line-height: 1.4;
}

.gmwcp-tagline em,
.gmwcp-tagline i {
  font-style: italic;
}

.gmwcp-site-link {
  font-size: 14px;
  font-family: "Bw Gradual DEMO", Sans-serif;
  color: #000000;
}

/* Specifications Page (3rd Page) Styles
 * 
 * HTML Structure Example:
 * <div class="gmwcp-specifications-page">
 *   <div class="gmwcp-page-header">
 *     <div class="gmwcp-pagination">2/3</div>
 *     <img src="[pluginurl]/img/360-dark-logo.png" class="gmwcp-header-logo" alt="360 Logo" />
 *   </div>
 *   <div class="gmwcp-specifications-body">
 *     <h1 class="gmwcp-spec-product-title">Product Title</h1>
 *     <div class="gmwcp-summary-section">
 *       <h2 class="gmwcp-section-heading">Summary</h2>
 *       <div class="gmwcp-product-description">Product description content</div>
 *     </div>
 *     <div class="gmwcp-specifications-section">
 *       <h2 class="gmwcp-section-heading">Specifications</h2>
 *       <div class="gmwcp-spec-list">
 *         <div class="gmwcp-spec-item">
 *           <span class="gmwcp-spec-label">Material:</span>
 *           <span class="gmwcp-spec-value">Aluminum</span>
 *         </div>
 *         <div class="gmwcp-spec-item">
 *           <span class="gmwcp-spec-label">Stackable:</span>
 *           <span class="gmwcp-spec-value">No</span>
 *         </div>
 *         <div class="gmwcp-spec-item">
 *           <span class="gmwcp-spec-label">Dimension:</span>
 *           <span class="gmwcp-spec-value">W 470 x D 590 x H 1030 - SH 650 MM</span>
 *         </div>
 *       </div>
 *     </div>
 *   </div>
 *   <div class="gmwcp-page-footer">
 *     <div class="gmwcp-tagline">Making furniture.<br />For you.</div>
 *     <div class="gmwcp-site-link">interiorthreesixty.com</div>
 *   </div>
 * </div>
 */
@media print {

  /* Shared Footer Style */
  .gmwcp-page-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20mm;
    padding: 0 20mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #000000;
    box-sizing: border-box;
    z-index: 10;
    background: #fff;
  }

  .gmwcp-specifications-page {
    width: 210mm;
    height: 295mm;
    /* Reduced to 295mm */
    background-color: #ffffff;
    position: relative;
    page-break-after: always;
    display: block;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
    /* Strict overflow */
  }

  .gmwcp-specifications-body {
    position: absolute;
    top: 30mm;
    bottom: 20mm;
    left: 0;
    width: 100%;
    padding: 10mm 20mm;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .gmwcp-spec-product-title {
    font-size: 32px;
    font-family: Georgia, serif;
    font-weight: normal;
    color: #000000;
    margin: 0 0 15px 0;
    line-height: 1.2;
  }

  .gmwcp-section-heading {
    font-size: 20px;
    font-family: "Bw Gradual DEMO", Sans-serif;
    font-weight: normal;
    color: #000000;
    margin: 0 0 12px 0;
    text-transform: capitalize;
  }

  .gmwcp-summary-section,
  .gmwcp-specifications-section {
    width: 100%;
    flex-shrink: 0;
  }

  .gmwcp-product-description {
    font-size: 14px;
    font-family: "Bw Gradual DEMO", Sans-serif;
    color: #000000;
    line-height: 1.5;
    margin: 0;
  }

  .gmwcp-spec-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .gmwcp-spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #000000;
    font-size: 14px;
    font-family: "Bw Gradual DEMO", Sans-serif;
  }

  .gmwcp-spec-item:last-child {
    border-bottom: none;
  }

  .gmwcp-spec-label {
    font-weight: normal;
    color: #000000;
    flex-shrink: 0;
    margin-right: 15mm;
  }

  .gmwcp-spec-value {
    color: #000000;
    text-align: right;
    flex: 1;
  }
}

/* Finishes Page (4th Page) Styles
 * 
 * HTML Structure Example:
 * <div class="gmwcp-finishes-page">
 *   <div class="gmwcp-page-header">
 *     <div class="gmwcp-pagination">3/4</div>
 *     <img src="[pluginurl]/img/360-dark-logo.png" class="gmwcp-header-logo" alt="360 Logo" />
 *   </div>
 *   <div class="gmwcp-finishes-body">
 *     <h1 class="gmwcp-finishes-title">Available Finishes</h1>
 *     <div class="gmwcp-finish-section">
 *       <h2 class="gmwcp-finish-section-heading">Wood</h2>
 *       <div class="gmwcp-finish-grid">
 *         <div class="gmwcp-finish-item">
 *           <div class="gmwcp-finish-image"><img src="[image-url]" alt="Iroko" /></div>
 *           <div class="gmwcp-finish-label">Iroko</div>
 *         </div>
 *       </div>
 *     </div>
 *   </div>
 *   <div class="gmwcp-page-footer">
 *     <div class="gmwcp-tagline">Making furniture.<br />For you.</div>
 *     <div class="gmwcp-site-link">interiorthreesixty.com</div>
 *   </div>
 * </div>
 */
@media print {
  .gmwcp-finishes-page {
    width: 210mm;
    height: 295mm;
    background-color: #ffffff;
    position: relative;
    page-break-after: always;
    display: block;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  .gmwcp-finishes-body {
    position: absolute;
    top: 30mm;
    bottom: 20mm;
    left: 0;
    width: 100%;
    padding: 10mm 20mm;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .gmwcp-finishes-title {
    font-size: 32px;
    font-family: Georgia, serif;
    font-weight: normal;
    color: #000000;
    text-align: center;
    margin: 0 0 20px 0;
    line-height: 1.2;
  }

  .gmwcp-finish-section {
    width: 100%;
    margin-bottom: 25px;
    flex-shrink: 0;
  }

  .gmwcp-finish-section-heading {
    font-size: 20px;
    font-family: "Bw Gradual DEMO", Sans-serif;
    font-weight: normal;
    color: #000000;
    margin: 0 0 15px 0;
    text-transform: capitalize;
    border-bottom: 1px solid #000000;
    padding-bottom: 8px;
  }

  .gmwcp-finish-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5mm;
    margin-top: 10px;
    align-items: flex-start;
  }

  .gmwcp-finish-item {
    width: 12.5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2mm;
  }

  .gmwcp-finish-image {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin-bottom: 8px;
    background: #f5f5f5;
  }

  .gmwcp-finish-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .gmwcp-finish-label {
    font-size: 12px;
    font-family: "Bw Gradual DEMO", Sans-serif;
    color: #000000;
    margin-top: 4px;
    line-height: 1.3;
  }

  /* Strict Finish Page Sizing for Print */
  .gmwcp-finishes-page {
    width: 210mm;
    height: 295mm;
    background-color: #ffffff;
    position: relative;
    page-break-after: always;
    display: block;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  .gmwcp-finishes-body {
    position: absolute;
    top: 30mm;
    bottom: 20mm;
    left: 0;
    width: 100%;
    padding: 10mm 20mm;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
    overflow: hidden;
  }
}

/* Screen styles for preview */
.gmwcp-finishes-page {
  width: 210mm;
  min-height: 297mm;
  background-color: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0 auto 20px auto;
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
}

.gmwcp-finishes-body {
  flex: 1;
  padding: 15mm 20mm;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
}

.gmwcp-finishes-title {
  font-size: 32px;
  font-family: Georgia, serif;
  font-weight: normal;
  color: #000000;
  text-align: center;
  margin: 0 0 20px 0;
  line-height: 1.2;
}

.gmwcp-finish-section {
  width: 100%;
  margin-bottom: 25px;
}

.gmwcp-finish-section-heading {
  font-size: 20px;
  font-family: "Bw Gradual DEMO", Sans-serif;
  font-weight: normal;
  color: #000000;
  margin: 0 0 15px 0;
  text-transform: capitalize;
  border-bottom: 1px solid #000000;
  padding-bottom: 8px;
}

.gmwcp-finish-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5mm;
  margin-top: 10px;
  align-items: flex-start;
}

.gmwcp-finish-item {
  width: 12.5%;
  /* Roughly 1/7 minus gap allowance */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 2mm;
}

.gmwcp-finish-image {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid #e0e0e0;
  overflow: hidden;
  margin-bottom: 8px;
  background: #f5f5f5;
}

.gmwcp-finish-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gmwcp-finish-label {
  font-size: 12px;
  font-family: "Bw Gradual DEMO", Sans-serif;
  color: #000000;
  margin-top: 4px;
  line-height: 1.3;
}

/* Screen styles for preview */
.gmwcp-specifications-page {
  width: 210mm;
  min-height: 297mm;
  background-color: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0 auto 20px auto;
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
}

.gmwcp-specifications-body {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  box-sizing: border-box;
}

.gmwcp-spec-product-title {
  font-size: 48px;
  font-family: Georgia, serif;
  font-weight: normal;
  color: #000000;
  margin: 0 0 20px 0;
  line-height: 1.2;
}

.gmwcp-section-heading {
  font-size: 24px;
  font-family: "Bw Gradual DEMO", Sans-serif;
  font-weight: normal;
  color: #000000;
  margin: 0 0 20px 0;
  text-transform: capitalize;
}

.gmwcp-summary-section,
.gmwcp-specifications-section {
  width: 100%;
}

.gmwcp-product-description {
  font-size: 16px;
  font-family: "Bw Gradual DEMO", Sans-serif;
  color: #000000;
  line-height: 1.6;
  margin: 0;
}

.gmwcp-spec-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.gmwcp-spec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #000000;
  font-size: 16px;
  font-family: "Bw Gradual DEMO", Sans-serif;
}

.gmwcp-spec-item:last-child {
  border-bottom: none;
}

.gmwcp-spec-label {
  font-weight: normal;
  color: #000000;
  flex-shrink: 0;
  margin-right: 20px;
}

.gmwcp-spec-value {
  color: #000000;
  text-align: right;
  flex: 1;
}