.pps-builder {
  max-width: 1200px;
  margin: 0 auto;
  font-family: Arial, sans-serif;
}

/* Scoped reset to avoid active theme styles breaking builder UI */
.pps-builder,
.pps-builder * {
  box-sizing: border-box;
}

.pps-builder button,
.pps-builder input,
.pps-builder select,
.pps-builder textarea {
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  margin: 0;
}

.pps-builder button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.pps-builder .pps-step-2,
.pps-builder .pps-step-2 * {
  font-family: Arial, sans-serif !important;
}

.pps-builder img {
  max-width: 100%;
  height: auto;
  border: 0;
}

.pps-step h3 {
  margin: 0 0 12px;
  font-size: 28px;
}

.pps-upload-container {
  border: 1px solid #dde3ed;
  border-radius: 8px;
  padding: 18px;
  background-image: url('tshirt-upload.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #f0f3f8;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.pps-upload-title {
  margin-bottom: 20px;
  font-weight: 700;
  color: #214080;
  text-align: left;
}

.pps-upload-box {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pps-upload-inner {
  background: #ebf3ff;
  border: 1px dashed #4a4ea2;
  border-radius: 12px;
  padding: 40px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.pps-upload-icon {
  color: #4a4ea2;
  margin-bottom: 15px;
}

.pps-upload-drag-text {
  font-weight: 700;
  color: #1f2c46;
  font-size: 18px;
  margin-bottom: 10px;
}

.pps-upload-sep {
  position: relative;
  margin: 25px 0;
  color: #606c7e;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pps-upload-sep span {
  background: #ebf3ff; /* Match pps-upload-inner background */
  padding: 0 10px;
  position: relative;
  z-index: 1;
}

.pps-upload-sep::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #cbd5e0;
  z-index: 0;
}

#pps-upload-input {
  display: none;
}

#pps-upload-trigger {
  width: 100%;
  padding: 14px;
  background: #4a4ea2 !important;
  border: none !important;
  color: #fff !important;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  transition: background 0.2s;
  display: inline-block;
}

.pps-upload-box.is-dragover .pps-upload-inner {
  border-color: #214080;
  background-color: rgba(235, 243, 255, 1);
  transform: scale(1.02);
}

.pps-upload-inner {
  transition: all 0.2s ease;
}

#pps-upload-trigger:hover {
  background: #3b3e8a;
}

.pps-upload-hint {
  margin-top: 15px;
  color: #606c7e;
  font-size: 12px;
  line-height: 1.4;
}

.pps-upload-progress {
  height: 8px;
  background: #e7edf8;
  border-radius: 4px;
  margin-top: 14px;
  overflow: hidden;
}

#pps-upload-progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  background: #2e3eb5;
  transition: width 0.2s ease;
}

.pps-upload-status,
.pps-cart-status {
  margin-top: 10px;
  min-height: 20px;
  color: #1f2c46;
}

.pps-upload-status.is-error,
.pps-cart-status.is-error {
  color: #b12626;
}

.pps-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  overflow: visible !important;
}

.pps-step-2 {
  overflow: visible !important;
}

.pps-left {
  border: 1px solid #dde3ed;
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
  align-self: start;
  position: relative;
  will-change: transform;
}

.pps-mockup-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.pps-area-tile {
  border: 2px solid transparent !important;
  border-radius: 12px;
  padding: 8px;
  background: #fff !important;
  cursor: pointer;
  position: relative;
  grid-column: span 3;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.pps-area-tile:nth-child(n + 3) {
  grid-column: span 2;
}

.pps-area-tile:hover {
  border-color: #214080;
  background: #5991cf;
}

.pps-builder .pps-area-tile:hover,
.pps-builder .pps-area-tile:active,
.pps-builder .pps-area-tile:focus {
  background-color: #5991cf;
  color: inherit;
}

.pps-area-tile.is-selected {
  border-color: #214080;
  box-shadow: 0 0 0 1px #214080;
  background: #fff;
}

.pps-area-tile.is-selected:hover,
.pps-builder .pps-area-tile.is-selected:hover,
.pps-builder .pps-area-tile.is-selected:active,
.pps-builder .pps-area-tile.is-selected:focus {
  background: #fff;
}

.pps-tile-select {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 28px;
  padding: 0 12px !important;
  border-radius: 5px;
  background: #2e66c2 !important;
  color: #fff !important;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none !important;
  cursor: pointer;
  z-index: 5;
}

.pps-tile-select:hover,
.pps-tile-select:focus {
  background: #214d96 !important;
  color: #fff !important;
}

.pps-area-tile:focus-visible {
  border-color: #214080;
  box-shadow: 0 0 0 2px rgba(33, 64, 128, 0.2);
}

.pps-mockup-stack {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f4f9;
  isolation: isolate;
}

.pps-layer,
.pps-base-color,
.pps-design-layer {
  position: absolute;
  inset: 0;
}

.pps-layer {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pps-base-color {
  opacity: 1;
  mix-blend-mode: multiply;
  -webkit-mask-image: var(--pps-base-mask);
  mask-image: var(--pps-base-mask);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  /* Slight bleed avoids white edge artifacts on theme/render differences */
  inset: -1px;
  -webkit-mask-size: calc(100% + 2px) calc(100% + 2px);
  mask-size: calc(100% + 2px) calc(100% + 2px);
  -webkit-mask-position: center;
  mask-position: center;
  pointer-events: none;
}

.pps-design-layer {
  overflow: hidden;
  display: none;
}

.pps-design-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.pps-area-label {
  display: block;
  margin-top: 8px;
  font-weight: 700;
  text-align: center;
  color: #214080;
  border-radius: 8px;
  padding: 4px 8px;
}

.pps-area-tile:hover .pps-area-label {
  background: #214080;
  color: #ffffff;
}

.pps-tile-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: 1px solid #c52222;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.98);
  color: #c52222;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  transition: all 0.2s ease;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
  font-family: Arial, sans-serif !important;
  text-indent: 0 !important;
  overflow: visible;
}

.pps-tile-close::before {
  content: none;
}

.pps-tile-close:hover {
  border-color: #a91a1a;
  background: #c52222;
  color: #fff;
}

.pps-area-tile.is-selected .pps-tile-close {
  display: inline-flex !important;
  opacity: 1;
  pointer-events: auto;
  background: #c52222;
  color: #fff;
  border-color: #a91a1a;
}

.pps-color-palette {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pps-color-title {
  margin-top: 14px;
  font-weight: 700;
  color: #214080;
}

.pps-color-note {
  margin-top: 8px;
  font-size: 13px;
  color: #1f2c46;
}

.pps-swatch {
  width: 13px;
  height: 13px;
  border: 1px solid #b8b8b8 !important;
  border-radius: 4px;
  cursor: pointer;
}

.pps-swatch.is-selected {
  border-color: #1f2c46;
}

.pps-right {
  border: 1px solid #dde3ed;
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.pps-area-panel {
  border: 1px solid #d8dfeb;
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 10px;
}

.pps-area-panel-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.pps-area-panel-head strong {
  color: #921f1f;
  font-size: 26px;
  line-height: 1.1;
}

.pps-remove-area {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.pps-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.pps-option-card {
  border: 1px solid #d8dfeb !important;
  border-radius: 10px !important;
  padding: 10px !important;
  background: #fbfdff !important;
  box-shadow: none !important;
}

.pps-option-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  text-transform: capitalize;
  line-height: 1.25;
  color: #2b3953 !important;
}

.pps-option-size {
  font-size: 14px !important;
  color: #55657f !important;
  margin-bottom: 4px;
}

.pps-qty {
  display: grid;
  grid-template-columns: 24px minmax(28px, 1fr) 24px;
  gap: 2px;
  align-items: center;
  margin-top: 4px;
  border: 1px solid #d2e0f6 !important;
  border-radius: 6px !important;
  padding: 2px 4px !important;
  background: #fff !important;
  box-shadow: none !important;
}

.pps-qty button {
  border: none !important;
  background: transparent !important;
  cursor: pointer;
  width: 24px;
  height: 24px;
  padding: 0 !important;
  line-height: 1;
  font-size: 20px !important;
  color: #5f708d !important;
  box-sizing: border-box;
  box-shadow: none !important;
}

.pps-qty input {
  width: 100%;
  text-align: center;
  min-width: 36px;
  height: 24px;
  padding: 0 2px;
  box-sizing: border-box;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 700;
  line-height: 24px;
  color: #2b3953 !important;
  background: transparent;
  appearance: textfield;
  -moz-appearance: textfield;
  -webkit-appearance: none;
}

.pps-qty-input::-webkit-outer-spin-button,
.pps-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pps-option-price,
.pps-line-total {
  font-size: 14px !important;
  margin-top: 3px;
  color: #4f5d73 !important;
}

.pps-option-price {
  display: none;
}

.pps-total {
  margin-top: 14px;
  font-size: 22px;
}

.pps-subtotal-wrap {
  margin-top: 4px;
  font-size: 13px;
  color: #7c8699;
}

.pps-subtotal-wrap span {
  text-decoration: line-through;
}

.pps-you-save {
  margin-top: 2px;
  font-size: 14px;
  color: #1f8b32;
  font-weight: 700;
}

#pps-add-to-cart {
  margin-top: 12px;
  padding: 12px 24px;
  border: none !important;
  border-radius: 6px;
  background: #df2626 !important;
  color: #fff !important;
  font-size: 18px;
  cursor: pointer;
  text-transform: none;
  display: inline-block;
  box-shadow: none !important;
}

@media (max-width: 980px) {
  .pps-layout {
    grid-template-columns: 1fr;
  }
  .pps-left {
    position: static;
    transform: none !important;
  }
  .pps-mockup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pps-area-tile,
  .pps-area-tile:nth-child(n + 3) {
    grid-column: span 1;
  }
  .pps-option-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
