body.no-scroll {
  overflow: hidden
}

.preview-overlay,
.personalise-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: opacity .3s ease, visibility .3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.personalise-overlay.active,
.preview-overlay.active {
  visibility: visible;
  opacity: 1
}

.personalise-popup-holder,
.preview-popup-holder {
  max-width: 800px;
  margin: 0 auto;
  padding: 10px;
  display: flex;
  align-items: center;
  min-height: 100%;
  width: auto;
  pointer-events: none
}

.preview-popup-holder {
  max-width: 1200px
}

.personalise-popup,
.preview-popup {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
  width: 100%;
  padding: 40px 16px 16px;
  position: relative;
  transform: scale(.9);
  transition: transform .3s ease;
  pointer-events: auto
}

.personalise-overlay.active .personalise-popup,
.preview-overlay.active .preview-popup {
  transform: scale(1)
}

.personalise-overlay .row {
  display: flex;
  flex-wrap: wrap;
  margin: -8px
}

.personalise-overlay .row>* {
  padding: 8px;
  width: 100%
}

.preview-popup .close-btn,
.personalise-popup .close-btn {
  position: absolute;
  top: 0;
  right: 5px;
  font-size: 22px;
  cursor: pointer;
  color: #777
  z-index: 10;
  width: 30px;
  height: 30px;
  text-align: center;
}

.preview-popup .close-btn:hover,
.personalise-popup .close-btn:hover {
  color: #000
}

.preview-popup h2,
.personalise-popup h2 {
  text-align: center;
  margin: 0 0 20px;
  font-size: 24px;
  color: #333
}

.personalise-popup .summary,
.personalise-popup .step {
  background: #eef3f8;
  border-radius: 8px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, .05);
  height: 100%;
  overflow: hidden
}

.personalise-popup .summary-holder,
.personalise-popup .step-holder {
  padding: 12px
}

.personalise-popup .summary h3,
.personalise-popup .step h3 {
  background-color: #022054;
  color: #fff;
  font-size: 16px;
  margin: 0;
  padding: 12px 12px 8px
}

.personalise-popup .step select,
.personalise-popup .step textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  line-height: 18px;
  outline: none
}

.personalise-popup .step textarea {
  height: 80px;
  resize: none
}

.personalise-popup .img-holder {
  margin: 12px auto 0;
  width: 80px;
  height: 80px;
  position: relative;
  overflow: hidden;
  display: block;
  max-width: 100%;
}


#pp-popup {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
}



#pp-popup {
  display: none;
  /* hidden by default */
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
}

#pp-popup.active {
  display: block !important;
}


.preview-img {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

#logoOverlay {
  position: absolute;
  pointer-events: none;
}


#previewCanvas {
  position: relative;
  display: inline-block;
  vertical-align: top;
  transition: transform 0.6s ease;
  transform-origin: center center;
  perspective: 1000px;
}

#previewCanvas.pp-3d-right {
  transform: perspective(1000px) rotateY(-18deg);
}

#previewCanvas.pp-3d-left {
  transform: perspective(1000px) rotateY(18deg);
}

#previewCanvas.pp-3d-center {
  transform: perspective(1000px) rotateY(0deg);
}


/* Order: Qty (1) → Customize (2) → Add to cart (3) */
.variations_button .quantity {
  order: 1 !important;
  margin: 0 !important;
}

#pp-open-popup {
  order: 2 !important;
}

.variations_button .single_add_to_cart_button[type="submit"] {
  order: 3 !important;
}

/* Simple product ordering */
form.cart .quantity {
  order: 1 !important;
  margin: 0 !important;
}

form.cart #pp-open-popup {
  order: 2 !important;
}

form.cart .single_add_to_cart_button[type="submit"] {
  order: 3 !important;
}

/* Make both buttons visually identical and not full-width */
#pp-open-popup,
.single_add_to_cart_button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-height: 44px !important;
  padding: 0 22px !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  white-space: nowrap !important;
}




/* popup styling 


/* --- Preview Popup Styling --- */
.preview-popup {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

/* Container for product image */
.preview-img {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Product image scales nicely */
#previewImage {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Logo overlay on top of product */
#logoOverlay {
  position: absolute;
  display: none;
  pointer-events: none;
  max-width: 120px;
  /* safety limit */
  max-height: 120px;
  transition: transform 0.3s ease;
}

/* Heading area at top */
.preview-popup .heading-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  position: relative;
}

.preview-popup .heading-area h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.add-logo-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.summary-holder .actions {
  padding-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}



/* location list grid layout */

#pp-location-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* 4 per row */
  gap: 12px;
  /* spacing between items */
  list-style: none;
  padding: 0;
  margin: 0;
}

#pp-location-list li {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  transition: border-color 0.2s;
}

#pp-location-list li:hover {
  border-color: #0073aa;
  /* WooCommerce blue */
}

#pp-location-list .img {
  display: block;
  margin-bottom: 8px;
}

#pp-location-list img[data-role="loc-image"] {
  max-width: 80px;
  height: auto;
  display: block;
  margin: 0 auto;
}

#pp-location-list .location-text {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.preview-disclaimer {
  background: #fff8e5;
  border: 1px solid #f0c36d;
  color: #000;
  font-size: 13px;
  padding: 8px 12px;
  margin: 0 0 16px;
  border-radius: 4px;
  text-align: left;
  line-height: 1.4;
}

#pp-location-list .price {
  font-size: 13px;
  color: #444;
}

@media (max-width: 767px) {
  .personalise-popup, .preview-popup {
    padding: 40px 12px 12px;
  }

  #pp-location-list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .add-logo-area .delete-logo,
  .summary-holder .actions .btn {
    padding: 10px 12px;
    font-size: 11px;
  }
  
  .summary-holder .actions #previewBtn,
  .summary-holder .actions #pp_add_to_cart {
    flex: auto;
  }
  
  .preview-popup .heading-area h2 {
    text-align: left;
  }
  
  .preview-popup .heading-area,
  .preview-disclaimer {
    margin-bottom: 8px;
  }
}