/* ============================================================
   PAVI'S LAB — Customization Modal
   Photo / message / song upload before adding to cart.
   ============================================================ */

/* ── Backdrop ── */
.cust-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 1400;
  backdrop-filter: blur(4px);
}
.cust-backdrop.open { display: block; }

/* ── Modal container ── */
.cust-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1500;
  background: #130610;
  border: 1px solid rgba(255, 0, 127, 0.22);
  border-radius: 20px;
  width: 94vw;
  max-width: 1140px;
  max-height: 94vh;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 0, 127, 0.08);
}
.cust-modal.open { display: flex; }

/* ── Header ── */
.cust-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
.cust-head h3 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.cust-head-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}
.cust-close-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.75);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.cust-close-btn:hover { background: rgba(255, 255, 255, 0.15); }
.cust-head-spark { color: var(--pink); margin-right: 4px; }

/* ── Body: stacked numbered cards, each full width ── */
.cust-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  /* Visible scrollbar, not just the native thin auto-hiding one — with
     a dozen photo slots + messages + songs, mobile users had no obvious
     cue that scrolling down further reveals more (Messages, Songs). */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 0, 127, 0.5) rgba(255, 255, 255, 0.06);
}
.cust-body::-webkit-scrollbar { width: 8px; }
.cust-body::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.06); border-radius: 4px; }
.cust-body::-webkit-scrollbar-thumb { background: rgba(255, 0, 127, 0.5); border-radius: 4px; }
.cust-body::-webkit-scrollbar-thumb:hover { background: rgba(255, 0, 127, 0.7); }

/* ── Numbered card sections ── */
.cust-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 0, 127, 0.14);
  border-radius: 16px;
  padding: 18px 20px 20px;
}
.cust-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}
.cust-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cust-num-sm { width: 18px; height: 18px; font-size: 10px; }

/* Two columns inside each card: preview/reference | inputs.
   Falls back to a single column once a card only has one visible
   half (e.g. no sample photos, or no photos needed for this product). */
.cust-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.cust-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--pink);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.cust-section-head i { font-size: 13px; }
.cust-required { color: #ff5555; margin-left: 2px; }
.cust-optional {
  color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 2px;
}
.cust-section-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin: -4px 0 10px;
  line-height: 1.5;
}
.cust-section-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0;
}
.cust-hint-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 8px;
  line-height: 1.5;
}
.cust-hint-note i { color: var(--pink); margin-top: 1px; }
.cust-add-more-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 8px 16px;
  background: rgba(255, 0, 127, 0.08);
  border: 1px dashed rgba(255, 0, 127, 0.4);
  border-radius: 50px;
  color: var(--pink);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.cust-add-more-btn:hover { background: rgba(255, 0, 127, 0.14); border-color: var(--pink); }
.cust-secure-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.28);
  padding-top: 4px;
}
.cust-secure-note i { color: #4caf50; }

/* Photo upload slots — kept compact: with up to a dozen stacked slots on
   frames that need many photos, the previous larger sizing ate most of
   the modal's height that the preview/samples should get instead. */
.cust-photo-slot {
  border: 2px dashed rgba(255, 0, 127, 0.28);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 6px;
  overflow: hidden;
}
.cust-photo-slot:hover {
  border-color: var(--pink);
  background: rgba(255, 0, 127, 0.04);
}
.cust-photo-slot.has-photo {
  border-style: solid;
  border-color: rgba(255, 0, 127, 0.45);
  padding: 8px;
  justify-content: flex-start;
}
.cust-photo-slot input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 1;
}
/* Compact single row instead of a tall icon-over-label-over-hint stack —
   this is what actually shrinks the slot; padding/min-height alone only
   go so far while the content itself is 3 lines tall. */
.cust-slot-idle {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.45);
  flex-wrap: wrap;
}
.cust-slot-idle i { font-size: 15px; color: var(--pink); opacity: 0.7; }
.cust-slot-idle span { font-size: 12.5px; }
.cust-slot-idle small { font-size: 10.5px; color: rgba(255, 255, 255, 0.25); }

.cust-slot-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  pointer-events: none;
}
.cust-slot-info {
  flex: 1;
  min-width: 0;
  pointer-events: none;
}
.cust-slot-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cust-slot-status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cust-slot-status.ok { color: #4caf50; }
.cust-slot-status.err { color: #ff5555; }
.cust-slot-status.uploading { color: var(--pink); }
.cust-slot-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(220, 0, 0, 0.75);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
}
.cust-slot-remove:hover { background: rgba(220, 0, 0, 1); }

/* Compact multi-photo grid (5 columns) — the mockup shows small square
   tiles rather than stacked full-width rows, so within this grid the
   slot and its idle content switch to a centered column layout. */
.cust-photo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.cust-photo-grid .cust-photo-slot {
  flex-direction: column;
  aspect-ratio: 1;
  min-height: 0;
  padding: 6px;
  gap: 4px;
  margin-bottom: 0;
}
.cust-photo-grid .cust-photo-slot.has-photo {
  justify-content: center;
  align-items: center;
}
.cust-photo-grid .cust-slot-idle {
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.cust-photo-grid .cust-slot-idle span { font-size: 10.5px; line-height: 1.3; }
.cust-photo-grid .cust-slot-idle i { font-size: 14px; }
.cust-photo-grid .cust-slot-thumb { width: 100%; height: 100%; }
.cust-photo-grid .cust-slot-remove { width: 18px; height: 18px; font-size: 9px; top: 4px; right: 4px; }

/* Message inputs — 2 columns on desktop, matching the mockup's paired
   message-slot layout; each slot still stacks label/textarea/counter. */
.cust-msg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 16px;
  align-items: start;
}

/* Message textarea */
.cust-msg-wrap { margin-bottom: 8px; }
.cust-msg-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 6px;
}
.cust-msg-label i:first-child { color: var(--pink); font-size: 11px; }
.cust-msg-label-heart { color: rgba(255, 0, 127, 0.35); font-size: 11px; }
.cust-msg-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px 14px;
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  min-height: 84px;
  outline: none;
  transition: border-color 0.2s;
}
.cust-msg-textarea::placeholder { color: rgba(255, 255, 255, 0.25); }
.cust-msg-textarea:focus { border-color: var(--pink); }
.cust-msg-counter {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  text-align: right;
  margin-top: 4px;
}
.cust-msg-counter.over { color: #ff5555; }

/* Song input */
.cust-song-wrap { margin-bottom: 8px; }
.cust-song-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px 14px;
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.cust-song-input::placeholder { color: rgba(255, 255, 255, 0.25); }
.cust-song-input:focus { border-color: #1DB954; }
.cust-song-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.28);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cust-song-hint i { color: #1DB954; }

/* ── Preview column (left half of card 1's grid) ── */
.cust-preview {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cust-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.cust-preview-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: repeating-conic-gradient(#2a2a2a 0% 25%, #1e1e1e 0% 50%) 0 / 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 120px;
  flex-shrink: 0; /* never compress below its content's real height */
}

/* All three layers share base positioning */
.cust-layer {
  display: block;
  width: 100%;
}

/* Layer 1 — product marketing photo (sets the height of the frame).
   object-fit:contain (not cover) — this is the most important image in
   this screen, it must never be cropped, whatever its aspect ratio. */
.cust-layer-product {
  max-height: 280px;
  object-fit: contain;
}

/* Layer 2 — buyer's photo: positioned at frame inner coordinates (set by JS) */
.cust-layer-user {
  position: absolute;
  object-fit: cover;
  /* top / left / width / height applied inline by JS from product.frame_inner_* fields */
}

/* Layer 3 — frame template: static base that sets the container height */
.cust-layer-tpl {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}
.cust-preview-meta {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  /* Not flex:1 — that stretched this box to fill all leftover column
     height, turning "nothing typed yet" into a big empty gray panel.
     It should only be as tall as its actual content. */
  min-height: 0;
}
.cust-preview-meta .pm-msg {
  border-left: 2px solid var(--pink);
  padding-left: 8px;
  font-style: italic;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.7);
}
.cust-preview-meta .pm-song {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}
.cust-preview-meta .pm-song i { color: #1DB954; }
.cust-preview-empty {
  color: rgba(255, 255, 255, 0.18);
  font-style: italic;
  font-size: 12px;
}

/* ── Sample photos (admin-uploaded, view-only reference) ── */
.cust-sample-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}
.cust-sample-label i { color: var(--pink); font-size: 12px; }
/* 2 columns (not 3) — with usually just 1-3 sample photos, 3 columns made
   each thumbnail too small to judge clearly. Clicking one opens the same
   lightbox already used for the main product gallery (openLightbox()). */
.cust-sample-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
/* No forced square/cover crop — sample uploads vary a lot (a cropped
   product photo, but also often a tall instructional poster/how-to-order
   graphic like this one), and cover was cutting the bottom off those.
   Same "never crop the important image" rule as the main preview layer. */
.cust-sample-grid img {
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.cust-sample-grid img:hover {
  transform: scale(1.04);
  border-color: rgba(255, 0, 127, 0.4);
}
.cust-sample-caption {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.28);
  margin: 8px 0 0;
  line-height: 1.5;
  font-style: italic;
}

/* ── Spotify how-to guide: horizontal row of numbered step cards ── */
.cust-spotify-guide {
  background: rgba(29, 185, 84, 0.06);
  border: 1px solid rgba(29, 185, 84, 0.18);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.cust-spotify-steps {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(29, 185, 84, 0.5) rgba(255, 255, 255, 0.06);
}
.cust-spotify-step {
  flex: 0 0 150px;
}
.cust-spotify-step img {
  width: 100%;
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.cust-link-highlight { color: var(--pink); }

/* ── Footer ── */
.cust-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
  gap: 12px;
}
.cust-footer .cust-secure-note { flex: 1; padding-top: 0; }
.cust-confirm-btn {
  padding: 11px 26px;
  background: var(--pink);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.15s;
}
.cust-confirm-btn:hover { background: var(--pink-deep); transform: translateY(-1px); }
.cust-confirm-btn:disabled { background: #444; cursor: not-allowed; transform: none; }

/* ── Tablet: each card's two-column grid stacks into one column ── */
@media (max-width: 900px) {
  .cust-card-grid { grid-template-columns: 1fr; }
}

/* ── Mobile: full-width cards, tighter paddings, preview scrolls same
   order as desktop (already stacked via .cust-card-grid at 900px) ── */
@media (max-width: 640px) {
  .cust-modal { width: 97vw; max-height: 96vh; border-radius: 16px; }
  .cust-body  { gap: 14px; padding: 16px; }
  .cust-card  { padding: 14px 14px 16px; border-radius: 12px; }
  .cust-preview-frame { max-width: min(360px, 88vw); margin: 0 auto; }
  .cust-preview-overlay { width: 36%; height: 36%; }
  .cust-sample-grid { max-width: min(360px, 88vw); margin: 0 auto; }
  .cust-head  { padding: 16px; }
  .cust-footer { padding: 12px 16px; flex-wrap: wrap; }
  .cust-footer .cust-secure-note { width: 100%; order: 2; justify-content: center; }
  .cust-confirm-btn { order: 1; width: 100%; justify-content: center; }
  .cust-photo-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .cust-msg-grid { grid-template-columns: 1fr; gap: 0; }
  .cust-spotify-step { flex: 0 0 118px; }
}

@media (max-width: 380px) {
  .cust-photo-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Very small phones: shrink the upload-slot text a touch further
   (keep the ratio hint visible — buyers still need to know the crop
   ratio — just let it wrap onto its own line via the flex-wrap already
   set on .cust-slot-idle) ── */
@media (max-width: 380px) {
  .cust-slot-idle span  { font-size: 11.5px; }
  .cust-slot-idle small { font-size: 10px; flex-basis: 100%; text-align: center; }
}

/* ============================================================
   PAVI'S SPARKLES — light theme overrides
   ============================================================ */
[data-theme="sparkles"] .cust-modal { background: #fff; border-color: rgba(255,0,127,0.18); box-shadow: 0 32px 80px rgba(61,26,46,0.2), 0 0 0 1px rgba(255,0,127,0.08); }
[data-theme="sparkles"] .cust-head { border-bottom-color: rgba(61,26,46,0.08); }
[data-theme="sparkles"] .cust-head h3 { color: #3d1a2e; }
[data-theme="sparkles"] .cust-head-sub { color: rgba(61,26,46,0.4); }
[data-theme="sparkles"] .cust-close-btn { background: rgba(61,26,46,0.06); color: rgba(61,26,46,0.75); }
[data-theme="sparkles"] .cust-close-btn:hover { background: rgba(61,26,46,0.12); }
[data-theme="sparkles"] .cust-body { scrollbar-color: rgba(255, 0, 127, 0.5) rgba(61,26,46,0.06); }
[data-theme="sparkles"] .cust-body::-webkit-scrollbar-track { background: rgba(61,26,46,0.06); }
[data-theme="sparkles"] .cust-slot-idle { color: rgba(61,26,46,0.45); }
[data-theme="sparkles"] .cust-slot-idle small { color: rgba(61,26,46,0.3); }
[data-theme="sparkles"] .cust-slot-name { color: rgba(61,26,46,0.7); }
[data-theme="sparkles"] .cust-slot-status { color: rgba(61,26,46,0.4); }
[data-theme="sparkles"] .cust-msg-textarea,
[data-theme="sparkles"] .cust-song-input { background: rgba(61,26,46,0.04); border-color: rgba(61,26,46,0.12); color: #3d1a2e; }
[data-theme="sparkles"] .cust-msg-textarea::placeholder,
[data-theme="sparkles"] .cust-song-input::placeholder { color: rgba(61,26,46,0.3); }
[data-theme="sparkles"] .cust-msg-counter { color: rgba(61,26,46,0.35); }
[data-theme="sparkles"] .cust-song-hint { color: rgba(61,26,46,0.35); }
[data-theme="sparkles"] .cust-preview-label { color: rgba(61,26,46,0.4); }
[data-theme="sparkles"] .cust-preview-frame { background: repeating-conic-gradient(#f5e6ee 0% 25%, #fdf4f8 0% 50%) 0 / 10px 10px; border-color: rgba(61,26,46,0.08); }
[data-theme="sparkles"] .cust-preview-meta { background: rgba(61,26,46,0.04); border-color: rgba(61,26,46,0.07); color: rgba(61,26,46,0.6); }
[data-theme="sparkles"] .cust-preview-meta .pm-msg { color: rgba(61,26,46,0.75); }
[data-theme="sparkles"] .cust-preview-empty { color: rgba(61,26,46,0.25); }
[data-theme="sparkles"] .cust-sample-label { color: rgba(61,26,46,0.4); }
[data-theme="sparkles"] .cust-sample-grid img { border-color: rgba(61,26,46,0.1); background: rgba(61,26,46,0.04); }
[data-theme="sparkles"] .cust-footer { border-top-color: rgba(61,26,46,0.08); }
[data-theme="sparkles"] .cust-optional { color: rgba(61,26,46,0.3); }
[data-theme="sparkles"] .cust-card { background: rgba(61,26,46,0.025); border-color: rgba(255,0,127,0.14); }
[data-theme="sparkles"] .cust-card-title { color: #3d1a2e; }
[data-theme="sparkles"] .cust-spotify-step img { background: rgba(61,26,46,0.03); border-color: rgba(61,26,46,0.08); }
[data-theme="sparkles"] .cust-link-highlight { color: var(--pink); }
[data-theme="sparkles"] .cust-section-desc { color: rgba(61,26,46,0.45); }
[data-theme="sparkles"] .cust-section-divider { border-top-color: rgba(61,26,46,0.08); }
[data-theme="sparkles"] .cust-hint-note { color: rgba(61,26,46,0.35); }
[data-theme="sparkles"] .cust-add-more-btn { background: rgba(255,0,127,0.06); }
[data-theme="sparkles"] .cust-secure-note { color: rgba(61,26,46,0.3); }
[data-theme="sparkles"] .cust-msg-label { color: rgba(61,26,46,0.7); }
[data-theme="sparkles"] .cust-sample-caption { color: rgba(61,26,46,0.3); }
[data-theme="sparkles"] .cust-spotify-guide { background: rgba(29,185,84,0.05); border-color: rgba(29,185,84,0.2); }
