/* ============================================================
   PBS Designer V3 — Single-canvas responsive layout
   One 715×680 canvas scaled via CSS transform for all screens.
   All classes prefixed pbd3-.
   ============================================================ */

/* ── Page wrapper ──────────────────────────────────────────── */
.pbd3-page {
  padding: 0 4px 32px;
  max-width: 1160px;
  margin: 0 auto;
}

/* ── Carousel panel ────────────────────────────────────────── */
.pbd3-carousel-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 12%);
  margin-bottom: 16px;
  overflow: hidden;
}
.pbd3-carousel-panel.pbd3-hidden { display: none; }
.pbd3-carousel-heading {
  background: #f1f1f1;
  color: #333;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 1px solid #e8e8e8;
}
.pbd3-carousel-body { padding: 6px 4px 0; position: relative; }

/* Prev / Next arrow buttons */
.pbd3-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-60%);
  z-index: 5;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.42);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  padding: 0 0 2px;
  transition: background 0.15s;
}
.pbd3-carousel-btn:hover { background: rgba(0,0,0,0.72); }
.pbd3-carousel-btn-prev { left: 2px; }
.pbd3-carousel-btn-next { right: 2px; }

/* Carousel flex-scroll (no owl carousel) */
#pbd3-style-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 4px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
#pbd3-style-carousel::-webkit-scrollbar { height: 4px; }
#pbd3-style-carousel::-webkit-scrollbar-track { background: #f1f1f1; }
#pbd3-style-carousel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.pbd3-item {
  flex: 0 0 120px;
  height: 100px;
  max-height: 182px;
  position: relative;
  cursor: pointer;
  border-radius: 4px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #f8f8f8;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  overflow: hidden;
}
.pbd3-item:hover { border-color: #ffa040; }
.pbd3-item.active { border-color: #f60; }
.pbd3-item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  background: rgba(255,255,255,0.88);
  color: #333;
  padding: 3px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.pbd3-item.active .pbd3-item-label {
  background: rgba(255,153,51,0.92);
  color: #5a2800;
}

/* Suffix design area on canvas (hidden when no suffix coords) */
.pbd3-suffix-area { display: none; }
.pbd3-suffix-area.pbd3-active { display: flex; }

/* ── Main two-column layout ────────────────────────────────── */
.pbd3-main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.pbd3-col-preview {
  flex: 1 1 0;
  min-width: 0;
}
.pbd3-col-options {
  flex: 0 0 380px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 12%);
  padding: 20px 18px;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 991px) {
  .pbd3-main { flex-direction: column; }
  .pbd3-col-options { flex: 1 1 auto; width: 100%; }
}

/* ── Canvas wrapper ────────────────────────────────────────── */
/* JS sets height = 680 * scale */
.pbd3-canvas-wrap {
  width: 100%;
  overflow: hidden;
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 12%);
}

/* ── Canvas (745×680 reference matches old .pbsdesigner resolved width, transform-scaled by JS) ───── */
.pbd3-canvas {
  width: 745px;
  height: 680px;
  position: relative;
  background-size: auto 100%;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  background-color: transparent;
  transform-origin: top left;
}

/* ── Text design area ──────────────────────────────────────── */
.pbd3-designarea {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
}
.pbd3-text-span {
  display: block;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: none;
  user-select: none;
}

/* Loader */
.pbd3-loader {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: none;
}

/* ── Options panel: title ──────────────────────────────────── */
.pbd3-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 6px;
  color: #222;
}
.pbd3-shipping {
  font-size: 0.78rem;
  line-height: 1.3;
  font-weight: 600;
  margin-bottom: 6px;
}
.pbd3-afterpay {
  font-size: 0.875rem;
  margin-bottom: 10px;
}
.pbd3-afterpay img { vertical-align: middle; }

/* RRP / price row */
.pbd3-rrp {
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
  padding: 8px 0;
  text-align: center;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.pbd3-rrp del { color: #999; }

/* ── Form fields ───────────────────────────────────────────── */
.pbd3-field { margin-bottom: 12px; }
.pbd3-field > label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
}
.pbd3-input,
.pbd3-select {
  display: block;
  width: 100%;
  height: 36px;
  padding: 4px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9375rem;
  line-height: 1.5;
  background: #fff;
  color: #333;
  box-sizing: border-box;
}
.pbd3-select { padding: 4px 8px; }
.pbd3-input:focus,
.pbd3-select:focus {
  border-color: #f60;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(255,102,0,.15);
}

.pbd3-charlimit-note {
  float: right;
  font-size: 0.75rem;
  color: #888;
  font-weight: 400;
}
.pbd3-charlimit { color: #f60; font-weight: 600; }

/* ── Color swatches ────────────────────────────────────────── */
.pbd3-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 0 2px;
}
.pbd3-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #e0e0e0;
  transition: transform 0.12s, border-color 0.12s;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  box-sizing: content-box;
  padding: 0;
  background: none;
}
.pbd3-swatch:hover { transform: scale(1.12); border-color: #999; }
.pbd3-swatch.active { border-color: #f60; transform: scale(1.18); }

/* ── Font picker ───────────────────────────────────────────── */
.pbd3-fonts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
  max-height: 210px;
  overflow-y: auto;
}
.pbd3-font-opt {
  flex: 0 0 calc(33.333% - 4px);
  border: 2px solid #e9ecef;
  border-radius: 5px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  box-sizing: border-box;
  font-size: 0.7rem;
  color: #555;
  line-height: 1.3;
}
.pbd3-font-opt:hover { border-color: #ffa040; }
.pbd3-font-opt.active { border-color: #f60; background: #fff8f3; }
.pbd3-font-sample {
  display: block;
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: 2px;
  overflow: hidden;
  white-space: nowrap;
}

/* ── Text color picker ─────────────────────────────────────── */
.pbd3-textpicker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pbd3-colorinput {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  cursor: pointer;
  background: none;
  flex: 0 0 44px;
  box-sizing: border-box;
}
.pbd3-textpicker-preview {
  font-size: 1.4rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  background: #1a1a1a;
  letter-spacing: 0.05em;
  flex: 1;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}

/* ── Suffix row ────────────────────────────────────────────── */
.pbd3-suffix-row { display: flex; gap: 8px; }
.pbd3-suffix-row .pbd3-select,
.pbd3-suffix-row .pbd3-input { flex: 1; }

/* ── Preview button ────────────────────────────────────────── */
.pbd3-btn-preview {
  display: block;
  text-align: center;
  padding: 8px 12px;
  border: 2px solid #b132ac;
  color: #b132ac;
  border-radius: 24px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  margin: 6px 0 10px;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.pbd3-btn-preview:hover { background: #b132ac; color: #fff; }

/* ── Add to cart ───────────────────────────────────────────── */
.pbd3-btn-cart {
  display: block;
  width: 100%;
  padding: 12px 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  box-sizing: border-box;
}

/* ── Error ─────────────────────────────────────────────────── */
.pbd3-error:not(:empty) {
  background: #fff3f3;
  border: 1px solid #ffb3b3;
  color: #c00;
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 0.875rem;
}

/* ── Footer ────────────────────────────────────────────────── */
.pbd3-footer { margin-top: 14px; }
.pbd3-payment-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 6px;
  border-top: 1px solid #f0f0f0;
}
.pbd3-payment-logos span { display: inline-flex; align-items: center; }
.pbd3-back-link {
  text-align: center;
  font-size: 0.85rem;
  padding: 8px 0 2px;
  color: #555;
}
.pbd3-back-link a { color: #f60; text-decoration: none; }
.pbd3-back-link a:hover { text-decoration: underline; }

/* ── Thumbnails strip ──────────────────────────────────────── */
.pbd3-thumbnails { margin-top: 10px; }
.pbd3-thumbnails .row-thumbnails-span img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.pbd3-thumbnails .row-thumbnails-span img:hover,
.pbd3-thumbnails .row-thumbnails-span img.active { border-color: #f60; }
.row-thumbnails-span-flex {
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-thumbnails-span-flex.outline { border: 1px dashed #d3d3d3; border-radius: 4px; }

/* ── Design style picker (embroidery templates for stockings/hats) ── */
.pbd3-designs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
  max-height: 300px;
  overflow-y: auto;
}
.pbd3-design-opt {
  flex: 0 0 calc(25% - 5px);
  border: 2px solid #e9ecef;
  border-radius: 5px;
  padding: 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.pbd3-design-opt:hover { border-color: #ffa040; }
.pbd3-design-opt.active { border-color: #f60; background: #fff8f3; }
.pbd3-design-opt img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
}
.pbd3-design-opt span {
  display: block;
  font-size: 0.65rem;
  color: #555;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Wilcom/preview image overlay on canvas — sized like old designer's desktop rule */
.pbd3-wilcom-img {
  position: absolute;
  top: 194px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  max-width: 260px;
  max-height: 145px;
  z-index: 5;
  pointer-events: none;
}

/* ── Wilcom generating overlays ────────────────────────────── */
#pbd3-wilcom-overlay,
#pbd3-opts-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.72);
  z-index: 20;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
}
#pbd3-wilcom-overlay::after {
  content: 'Generating preview…';
  font-size: 0.95rem;
  font-weight: 600;
  color: #555;
  background: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
#pbd3-wilcom-overlay[style*="block"],
#pbd3-opts-overlay[style*="block"] { display: flex; }

/* ── Utility ───────────────────────────────────────────────── */
.pbd3-hidden { display: none !important; }

/* ── Mobile adjustments ────────────────────────────────────── */
@media (max-width: 767px) {
  .pbd3-col-options { padding: 16px 14px; }
  .pbd3-title { font-size: 1.15rem; }
}
