/* ================================
   JAIFORE — CONFIGURATOR CSS
   styles/configurator.css
   ================================ */

/* ── STUDIO LAYOUT ─────────────────────────────────── */
.studio {
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: 100vh;
  padding-top: 70px;
  gap: 0;
}

/* ── CANVAS SIDE ───────────────────────────────────── */
.studio-canvas-wrap {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  gap: 1.2rem;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}

.studio-product-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}

/* ── VIEW TOGGLE ───────────────────────────────────── */
.view-toggle {
  display: flex;
  gap: 0.4rem;
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 4px;
}

.view-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.45rem 1.2rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.view-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ── ZOOM CONTROLS ─────────────────────────────────── */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 4px 8px;
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.zoom-btn:hover { background: var(--purple-fill); color: #fff; }

/* Reset button variant — was inline-styled (font-size, width, padding) */
.zoom-btn--reset {
  font-size: 0.7rem;
  width: auto;
  padding: 0 8px;
}

.zoom-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-2);
  min-width: 36px;
  text-align: center;
}

/* ── CANVAS OUTER (scrollable when zoomed) ─────────── */
.canvas-outer {
  width: 100%;
  max-width: 480px;
  /* No fixed max-height — let it be natural so zoomed content scrolls */
  border-radius: 16px;
  overflow: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  background: #1a1a1a;
  position: relative;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--purple) var(--bg-soft);
}

.canvas-outer::-webkit-scrollbar       { width: 6px; height: 6px; }
.canvas-outer::-webkit-scrollbar-track { background: var(--bg-soft); border-radius: 4px; }
.canvas-outer::-webkit-scrollbar-thumb { background: var(--purple-fill); border-radius: 4px; }

/* ── CANVAS CONTAINER ──────────────────────────────── */
.canvas-container {
  width: 100%;
  position: relative;
  overflow: visible;
  cursor: crosshair;
  transform-origin: top left;
  transition: transform 0.2s ease;
  /* Allows scaled content to push scroll area */
  display: inline-block;
  min-width: 100%;
}

.merch-mockup {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.34,1.4,0.64,1);
}

/* ── PRINT ZONE ────────────────────────────────────── */
.zone {
  position: absolute;
  border: 2px dashed rgba(137, 50, 187, 0.6);
  border-radius: 8px;
  background: rgba(137, 50, 187, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.zone span {
  display: none; /* label hidden, border stays */
}

/* ── DESIGN LAYER ──────────────────────────────────── */
.design-layer {
  position: absolute;
  cursor: move;
  user-select: none;
  touch-action: none;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.design-layer.selected {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(137, 50, 187, 0.25);
}

/* Border fades out when not selected — no lingering outline after drag/resize */
.design-layer:not(.selected) {
  border-color: transparent;
  box-shadow: none;
}

.design-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.resize-handle {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 14px;
  height: 14px;
  background: var(--purple-fill);
  border-radius: 50%;
  cursor: se-resize;
  border: 2px solid #fff;
  /* Only visible when parent is selected */
  opacity: 0;
  transition: opacity 0.15s;
}

.design-layer.selected .resize-handle {
  opacity: 1;
}

/* ── CANVAS ACTIONS ────────────────────────────────── */
.canvas-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ca-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-2);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, opacity 0.2s;
}

.ca-btn:hover:not(:disabled)       { border-color: var(--purple); color: var(--purple); }
.ca-btn.danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }

/* Disabled state for undo/redo */
.ca-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── PANEL SIDE ────────────────────────────────────── */
.studio-panel {
  background: var(--surface);
  border-left: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  height: calc(100vh - 70px);
  position: sticky;
  top: 70px;
}

.panel-section {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--bg-soft);
}

.panel-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.design-count {
  background: var(--purple-tint);
  color: var(--purple);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Muted inline note inside a panel-label, e.g. "(optional)", "(price per
   design)" — was previously inline-styled per instance. */
.panel-label-note {
  color: var(--muted2);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* size-guide-link when it appears inline inside a panel-label (as opposed
   to its standalone use elsewhere) — was previously inline-styled. */
.size-guide-link--inline {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.72rem;
}

/* ── MERCH INFO ────────────────────────────────────── */
.panel-merch-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-merch-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.panel-merch-price {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--purple);
}

/* ── DESIGN SLOTS ──────────────────────────────────── */
.design-slots {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.design-slot {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1.5px dashed var(--border);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--muted2);
  overflow: hidden;
  position: relative;
}

.design-slot.filled {
  border-color: var(--purple);
  border-style: solid;
}

.design-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.design-slot .slot-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  border-radius: 50%;
  color: #fff;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

/* ── GRAPHIC GRID ──────────────────────────────────── */
.graphic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.gd-item {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}

.gd-item:hover { border-color: var(--purple); transform: scale(1.03); }
.gd-item.selected { border-color: var(--purple); }

.gd-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gd-item .gd-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--purple-tint);
}

.gd-item .gd-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.58rem;
  padding: 3px 5px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s;
  line-height: 1.3;
}

.gd-item:hover .gd-name { opacity: 1; }

/* ── UPLOAD ────────────────────────────────────────── */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}

.upload-zone:hover {
  border-color: var(--purple);
  background: var(--bg-tint);
}

.upload-icon {
  width: 36px;
  height: 36px;
  background: var(--purple-tint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--purple);
}

.upload-text {
  font-size: 0.82rem;
  color: var(--ink-2);
  line-height: 1.5;
}

.upload-text span { font-size: 0.72rem; color: var(--muted2); }

/* ── PRINT SIZE ────────────────────────────────────── */
.print-size-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.print-size-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}

.print-size-btn:hover   { border-color: var(--purple); }
.print-size-btn.selected { background: var(--purple-tint); border-color: var(--purple); }

.ps-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 55px;
  text-align: left;
}

.ps-dim {
  font-size: 0.75rem;
  color: var(--muted);
  flex: 1;
  text-align: center;
}

.ps-price {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--purple);
}

/* ── GARMENT SIZE ──────────────────────────────────── */
.size-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sz-btn {
  background: var(--bg-panel);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}

.sz-btn:hover    { border-color: var(--purple); color: var(--purple); }
.sz-btn.selected { background: var(--purple-fill); border-color: var(--purple); color: #fff; }

/* ── QUANTITY (item 18) ────────────────────────────── */
.quantity-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--ink-2);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  flex-shrink: 0;
}

.qty-btn:hover:not(:disabled) { border-color: var(--purple); color: var(--purple); }
.qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.quantity-input {
  width: 56px;
  height: 34px;
  text-align: center;
  background: var(--bg-panel);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
  /* Hide native spinner arrows — the qty-btn pair replaces them */
  -moz-appearance: textfield;
  appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quantity-input:focus { border-color: var(--purple); }

/* ── NOTES ─────────────────────────────────────────── */
.design-notes {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding: 0.7rem 0.9rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.design-notes:focus { border-color: var(--purple); }

/* ── ADD TO CART ───────────────────────────────────── */
.add-to-cart-btn {
  margin: 1.2rem 1.5rem;
  background: var(--inverse-bg);
  color: var(--inverse-ink);
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  width: calc(100% - 3rem);
}

.add-to-cart-btn:hover    { background: var(--purple-fill); transform: translateY(-1px); }
.add-to-cart-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.studio-msg {
  text-align: center;
  font-size: 0.8rem;
  min-height: 1rem;
  padding: 0 1.5rem 1rem;
  color: var(--purple);
}

/* ── CTA ROW (item 19) ─────────────────────────────────
   Wraps Add to Cart + Save for Later side by side. Replaces the standalone
   margin/width the button used to carry on its own — moved here so the two
   buttons share the row instead of each re-declaring layout independently. */
.cta-row {
  display: flex;
  gap: 0.6rem;
  margin: 1.2rem 1.5rem;
}
 
.cta-row .add-to-cart-btn {
  margin: 0;       /* was 1.2rem 1.5rem — now owned by .cta-row's margin */
  width: auto;     /* was calc(100% - 3rem) — now flexes within the row */
  flex: 1;
}
 
.save-for-later-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--purple);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
 
.save-for-later-btn:hover {
  border-color: var(--purple);
  background: var(--purple-tint);
  transform: translateY(-1px);
}
 
.save-for-later-btn.saved {
  background: var(--purple-fill);
  border-color: var(--purple);
  color: #fff;
}
 
@media (max-width: 768px) {
  .cta-row { flex-direction: column; }
  .save-for-later-btn { width: 100%; }
}

/* ── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 768px) {
  .studio {
    grid-template-columns: 1fr;
    padding-top: 60px;
  }

  .studio-canvas-wrap {
    position: relative;
    top: 0;
    height: auto;
  }

  .studio-panel {
    position: relative;
    top: 0;
    height: auto;
  }

  .canvas-outer { max-width: 100%; }
}
/* ── PER-DESIGN PRINT SIZE ─────────────────────────── */
.design-slot { cursor: pointer; }
.design-slot.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--purple); }

.design-slot .slot-size {
  position: absolute;
  left: 2px;
  bottom: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--purple-dark);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}
.design-slot .slot-size.unset { background: #b3261e; }

.ps-hint { font-size: 0.72rem; color: var(--muted); margin: 0 0 0.5rem; }

.apply-all-btn {
  margin-top: 0.5rem;
  width: 100%;
  background: transparent;
  border: 1.5px solid var(--purple);
  color: var(--purple-dark);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.apply-all-btn:hover:not(:disabled) { background: var(--purple-tint); }
.apply-all-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── DESIGN PICKER SEARCH ──────────────────────────── */
.gd-search {
  width: 100%;
  margin-bottom: 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  font: inherit;
  font-size: 0.8rem;
}
.gd-search:focus { outline: none; border-color: var(--purple); }
#gdLoadMore[hidden] { display: none; }

/* ── IMMERSIVE VIEWER (Phase 2) ────────────────────────
   Desktop: big preview filling the stage, controls in a floating card.
   Phones: the same controls become a bottom sheet (see the end of configurator.js). */
.sheet-handle { display: none; }

@media (min-width: 769px) {
  .studio {
    display: block;
    position: relative;
    height: 100vh;
    min-height: 700px;
    padding-top: 70px;
  }

  .studio-canvas-wrap {
    position: relative;
    top: 0;
    height: 100%;
    padding: 1.5rem 430px 1.5rem 2rem;
    justify-content: center;
    background: radial-gradient(ellipse at 40% 45%, var(--purple-tint), var(--bg) 72%);
  }

  .canvas-outer {
    max-width: min(660px, 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }

  .studio-panel {
    position: absolute;
    top: calc(70px + 1rem);
    right: 1.25rem;
    bottom: 1.25rem;
    width: 380px;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
  }
}

@media (max-width: 768px) {
  .studio-canvas-wrap { padding-bottom: 180px; }

  .studio-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
    max-height: 74vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 30px rgba(20, 18, 28, 0.18);
    z-index: var(--z-drawer);
    background: var(--surface);
  }

  .sheet-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-height: 44px;
    padding: 0.6rem 1rem 0.4rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .sheet-grip { width: 44px; height: 4px; border-radius: 2px; background: var(--border); }
  .studio-panel.expanded .sheet-handle-text::after { content: " ▾"; }
  .studio-panel:not(.expanded) .sheet-handle-text::after { content: " ▴"; }

  /* Collapsed: just the price + Add to Cart */
  .studio-panel:not(.expanded) .panel-section { display: none; }

  .studio ~ .footer { margin-bottom: 170px; }
}
