/* ═══ GarmentPreview — Artwork positioning on garment photos ═══ */

.gp-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  user-select: none;
}

/* ── Garment display area ── */
.gp-canvas {
  position: relative;
  background: #f4f6f2;
  border: 1px solid #e4eade;
  border-radius: 8px 8px 0 0;
  overflow: visible;
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gp-garment-img {
  max-width: 85%;
  max-height: 90%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.gp-garment-svg {
  width: 55%;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.08));
}

/* ── Artwork overlay (draggable/resizable) ── */
/* Black/white alternating border — visible on any garment colour */
.gp-artwork-zone {
  position: absolute;
  border: 2px dashed #000;
  outline: 2px dashed #fff;
  outline-offset: -4px;
  background: rgba(128,128,128,.06);
  cursor: move;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.gp-artwork-zone:hover,
.gp-artwork-zone.is-dragging {
  background: rgba(128,128,128,.12);
}
.gp-artwork-zone.has-art {
  border-style: solid;
  outline-style: solid;
  background: none;
}
.gp-artwork-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: top center;
  pointer-events: none;
  display: block;
}
.gp-artwork-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  color: rgba(28,48,16,.35);
  font-size: .6rem;
  text-align: center;
  pointer-events: none;
}
.gp-artwork-placeholder svg {
  width: 20px;
  height: 20px;
  opacity: .5;
}

/* ── Resize handle ── */
.gp-resize-handle {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: #000;
  border: 2px solid #fff;
  border-radius: 2px;
  cursor: nwse-resize;
  box-shadow: 0 0 3px rgba(0,0,0,.3);
}

/* ── Measurement rulers ── */
/* High-contrast rulers: black dashes on white stripe — visible on any colour */
.gp-measure {
  position: absolute;
  pointer-events: none;
}
.gp-measure-v {
  width: 0;
  border-left: 2px dashed #000;
  box-shadow: -1px 0 0 #fff, 1px 0 0 #fff;
  display: flex;
  align-items: flex-start;
}
.gp-measure-label {
  position: absolute;
  font-size: .6rem;
  font-weight: 800;
  background: rgba(255,255,255,.92);
  padding: .1rem .35rem;
  border-radius: 3px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.gp-measure-v .gp-measure-label {
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: #333;
}
.gp-measure-h {
  height: 0;
  border-top: 2px dashed #000;
  box-shadow: 0 -1px 0 #fff, 0 1px 0 #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gp-measure-h .gp-measure-label {
  top: -2px;
  transform: translateY(-100%);
  color: #3355aa;
}

/* ── Front/Back side tabs with print size ── */
.gp-side-tabs {
  display: flex;
  gap: 1px;
  background: #d0dcc8;
}
.gp-side-tab {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  background: #f4f6f2;
  cursor: pointer;
  transition: background .14s, border-color .14s;
  border-bottom: 3px solid transparent;
}
.gp-side-tab:hover { background: #eaf0e4; }
.gp-side-tab.active {
  background: #ddecd2;
  border-bottom-color: var(--forest, #1c3010);
}
.gp-tab-label {
  font-family: var(--font-display, sans-serif);
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--forest, #1c3010);
  white-space: nowrap;
}
.gp-side-tab:not(.active) .gp-tab-label { color: #8a9a8a; }
.gp-tab-size {
  display: flex;
  gap: 2px;
  margin-left: auto;
}
.gp-size-btn {
  padding: .25rem .5rem;
  border: 1.5px solid #c0ccb8;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: .65rem;
  font-weight: 700;
  color: var(--forest, #1c3010);
  transition: background .12s, border-color .12s;
}
.gp-size-btn:hover { background: #f0f4ec; }
.gp-size-btn.active {
  background: var(--forest, #1c3010);
  color: #fff;
  border-color: var(--forest, #1c3010);
}

/* Hide old toggle */
.gp-view-toggle { display: none; }

/* ── Controls bar ── */
.gp-controls {
  display: flex;
  gap: .5rem;
  padding: .35rem .6rem;
  background: #eaf3e4;
  border: 1px solid #d0dcc8;
  border-top: none;
  border-radius: 0 0 8px 8px;
  flex-wrap: wrap;
  align-items: center;
}
.gp-ctrl-group {
  display: flex;
  align-items: center;
  gap: .2rem;
}
.gp-ctrl-label {
  font-family: var(--font-display, sans-serif);
  font-size: .5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--forest, #1c3010);
  white-space: nowrap;
}
.gp-ctrl-input {
  width: 40px;
  height: 22px;
  border: 1px solid #d0dcc8;
  border-radius: 3px;
  text-align: center;
  font-size: .6rem;
  color: var(--forest, #1c3010);
  background: #fff;
  outline: none;
}
.gp-ctrl-input:focus {
  border-color: var(--forest, #1c3010);
  box-shadow: 0 0 0 2px rgba(28,48,16,.1);
}
.gp-ctrl-unit {
  font-size: .5rem;
  color: #8a9a8a;
}
.gp-ctrl-select {
  height: 22px;
  border: 1px solid #d0dcc8;
  border-radius: 3px;
  font-size: .6rem;
  color: var(--forest, #1c3010);
  background: #fff;
  padding: 0 .3rem;
  outline: none;
}
.gp-ctrl-value {
  font-size: .6rem;
  font-weight: 600;
  color: var(--forest, #1c3010);
  min-width: 24px;
  text-align: center;
}

/* ── Align icon buttons ── */
.gp-align-btns {
  display: flex;
  gap: 1px;
  background: #d0dcc8;
  border-radius: 4px;
  overflow: hidden;
}
.gp-align-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border: none;
  background: #fff;
  color: #8a9a8a;
  cursor: pointer;
  padding: 0;
  transition: background .12s, color .12s;
}
.gp-align-btn:hover {
  background: #f0f4ec;
  color: var(--forest, #1c3010);
}
.gp-align-btn.active {
  background: var(--forest, #1c3010);
  color: #fff;
}

/* ── Upload zone (below garment) ── */
.gp-upload {
  border: 2px dashed #d0dcc8;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-top: .3rem;
}
.gp-upload:hover {
  border-color: var(--accent, #8a4a1a);
  background: #fdf8f2;
}
.gp-upload-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .4rem .6rem;
  font-size: .65rem;
  color: #7a8a7a;
}
.gp-upload-content svg {
  width: 16px;
  height: 16px;
  color: #aaa;
}
.gp-upload-link {
  color: var(--accent, #8a4a1a);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.gp-upload-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .3rem .5rem;
  gap: .3rem;
}
.gp-upload-name {
  font-size: .65rem;
  font-weight: 600;
  color: var(--forest, #1c3010);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.gp-upload-remove {
  background: none;
  border: none;
  font-size: .9rem;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
}
.gp-upload-remove:hover { color: #c0392b; }

/* ── Split front/back uploads ── */
.gp-uploads {
  display: flex;
  gap: .3rem;
  margin-top: .3rem;
}
.gp-upload-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.gp-upload-side-label {
  font-family: var(--font-display, sans-serif);
  font-size: .5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--forest, #1c3010);
  padding: .15rem .3rem;
  background: #eaf3e4;
  border: 1px solid #d0dcc8;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.gp-upload-side .gp-upload {
  margin-top: 0;
  border-radius: 0 0 4px 4px;
}
.gp-upload-side .gp-upload-content {
  padding: .3rem .4rem;
  font-size: .58rem;
}
.gp-upload-side .gp-upload-content svg { width: 14px; height: 14px; }
.gp-upload-reuse {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .4rem;
  background: #f0f8e8;
  border: 1px solid #d0dcc8;
  border-radius: 4px;
  margin-top: .2rem;
  width: 100%;
}
