/* ────────────────────────────────────────────────────────────────────────
   _photo-uploader.css — Shared photo upload + crop component
   Used by /shop/mosaics, /shop/posters, /shop/cards, /shop/magnets
   Loaded after _shop.css.
   ──────────────────────────────────────────────────────────────────────── */

/* ── UPLOAD ZONE ──────────────────────────────────────────────────────── */
.kmpu { font-family: 'DM Sans', sans-serif; width: 100%; box-sizing: border-box; }
.kmpu *, .kmpu *::before, .kmpu *::after { box-sizing: border-box; }

.kmpu-zone {
  display: block;            /* labels are inline by default — force block */
  border: 2px dashed var(--camel-mid);
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
  background: var(--off-white);
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
  width: 100%;
}
.kmpu-zone:hover { border-color: var(--camel); background: white; }
.kmpu-zone.dragging { border-color: var(--camel); background: var(--camel-pale); }
.kmpu-zone-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.6; }
.kmpu-zone-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 6px;
}
.kmpu-zone-sub { font-size: 12px; color: var(--muted); }
.kmpu-zone input[type="file"] { display: none; }

/* ── PROGRESS BAR ─────────────────────────────────────────────────────── */
.kmpu-progress {
  display: none;
  margin: 16px 0;
  padding: 16px;
  background: var(--off-white);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.kmpu-progress.active { display: block; }
.kmpu-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.kmpu-progress-fill {
  height: 100%;
  background: var(--camel);
  border-radius: 4px;
  width: 0%;
  transition: width 0.2s;
}
.kmpu-progress-label {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ── QUALITY BANNER ───────────────────────────────────────────────────── */
.kmpu-quality {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.kmpu-quality.hidden { display: none; }
.kmpu-quality.good { background: #ECF7F0; border: 1px solid #B5D9C2; color: #1F5F38; }
.kmpu-quality.ok   { background: #FDF6E5; border: 1px solid #E5CD90; color: #6E5217; }
.kmpu-quality.warn { background: #FBE9E5; border: 1px solid #DCA396; color: #7A2A1B; }
.kmpu-quality-icon { font-weight: 700; font-size: 16px; flex-shrink: 0; }
.kmpu-quality-text strong { font-weight: 600; }

/* ── CROPPER STAGE ────────────────────────────────────────────────────── */
.kmpu-crop-stage { display: none; }
.kmpu-crop-stage.active { display: block; margin-top: 16px; }
.kmpu-crop-help {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 14px;
  line-height: 1.5;
}
.kmpu-crop-help strong { color: var(--text); font-weight: 500; }
.kmpu-crop-wrap {
  /* Light cropper frame — customers were confused by the previous dark
     background, interpreting the empty space around their photo as a dark
     overlay or as something that would print on the magnet. A light frame
     makes it obvious which area is their photo and which is just canvas. */
  background: var(--paper, #FBF8F3);
  border: 1px solid var(--line, #E5DDD0);
  border-radius: 10px;
  padding: 8px;
  max-width: 540px;
  margin: 0 auto 16px;
}
.kmpu-crop-wrap img { display: block; max-width: 100%; max-height: 460px; }

/* Cropper.js overrides — keep our brand */
.cropper-view-box,
.cropper-face { border-radius: 0; }
.cropper-line { background-color: var(--camel); }
.cropper-point { background-color: var(--camel); }
/* Light canvas background (matches kmpu-crop-wrap) so empty space around the
   image reads as "empty canvas" rather than as part of the photo. */
.cropper-bg { background-image: none; background: var(--paper, #FBF8F3); }
/* Cropper.js dims the OUTSIDE of the crop box by 50% by default (so the part
   getting cropped away looks faded). On a light canvas this still reads as a
   gentle dim, but we lighten it slightly so it doesn't look like a heavy
   overlay over the customer's photo. */
.cropper-modal { background-color: #1A1814; opacity: 0.35; }

.kmpu-crop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}
.kmpu-action-btn {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.kmpu-action-btn:hover { border-color: var(--camel-mid); background: var(--off-white); }
.kmpu-action-btn:active { transform: translateY(1px); }

/* ── PREVIEW GRID (mosaics) ───────────────────────────────────────────── */
.kmpu-preview-stage { display: none; margin-top: 24px; }
.kmpu-preview-stage.active { display: block; }
.kmpu-preview-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  text-align: center;
  margin-bottom: 4px;
  color: var(--text);
}
.kmpu-preview-sub {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
}
.kmpu-grid {
  display: grid;
  gap: 4px;
  margin: 0 auto;
  background: var(--border);
  padding: 4px;
  border-radius: 4px;
}
.kmpu-cell {
  aspect-ratio: 1;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-color: var(--camel-pale);
  background-position: center center;
  border-radius: 1px;
}

/* Preview for single-photo products (posters, cards) */
.kmpu-preview-single {
  max-width: 320px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.kmpu-preview-single img {
  display: block;
  width: 100%;
  height: auto;
}

/* ── APPROVAL SECTION ─────────────────────────────────────────────────── */
.kmpu-approve-stage { display: none; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.kmpu-approve-stage.active { display: block; }
.kmpu-approve-summary {
  background: var(--camel-pale);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--camel-dark);
  margin-bottom: 14px;
  line-height: 1.5;
}
.kmpu-approve-summary strong { font-weight: 600; }
.kmpu-approve-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.kmpu-approve-buttons .btn-camel { flex: 1; min-width: 200px; }

/* ── APPROVED STATE ───────────────────────────────────────────────────── */
.kmpu-approved {
  display: none;
  background: #ECF7F0;
  border: 1px solid #B5D9C2;
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 16px;
}
.kmpu-approved.active { display: flex; align-items: center; gap: 14px; }
.kmpu-approved-thumb {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid #B5D9C2;
}
.kmpu-approved-text { flex: 1; font-size: 13px; color: #1F5F38; }
.kmpu-approved-text strong { display: block; font-weight: 500; margin-bottom: 2px; }
.kmpu-approved-actions { flex-shrink: 0; }
.kmpu-approved-actions button {
  background: none;
  border: 0;
  color: #1F5F38;
  text-decoration: underline;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
}

/* ── MULTI-PHOTO LIST (magnets) ───────────────────────────────────────── */
.kmpu-multi-list { margin-top: 16px; }
.kmpu-multi-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: white;
}
.kmpu-multi-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.kmpu-multi-info { flex: 1; min-width: 0; }
.kmpu-multi-info strong { display: block; font-size: 13px; font-weight: 500; }
.kmpu-multi-info span { font-size: 11px; color: var(--muted); }
.kmpu-multi-qty { display: flex; align-items: center; gap: 6px; }
.kmpu-multi-qty button {
  width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 4px; background: white; cursor: pointer; font-size: 13px;
}
.kmpu-multi-qty input { width: 36px; height: 26px; text-align: center; font-size: 12px; }
.kmpu-multi-remove {
  background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 8px;
}

@media (max-width: 600px) {
  .kmpu-zone { padding: 28px 20px; }
  .kmpu-action-btn { padding: 8px 12px; font-size: 11px; }
  .kmpu-approve-buttons .btn-camel { min-width: 100%; }
}

/* ── MAGNET UPLOADER (multi-photo with allocation tracking) ──────────── */
.kmmu { font-family: 'DM Sans', sans-serif; }

.kmmu-alloc {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.kmmu-alloc-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}
.kmmu-alloc-fill {
  height: 100%;
  background: var(--camel);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s, background 0.3s;
}
.kmmu-alloc-fill.full { background: var(--success); }
.kmmu-alloc-fill.over { background: var(--error); }
.kmmu-alloc-text {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.kmmu-alloc-text.done { color: var(--success); }
.kmmu-alloc-text.over { color: var(--error); }

.kmmu-photos-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.kmmu-photo-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.kmmu-photo-thumb {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: var(--camel-pale);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.kmmu-photo-meta {
  min-width: 0;
}
.kmmu-photo-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.kmmu-q-pill {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
}
.kmmu-q-pill.q-good { background: #ECF7F0; color: #1F5F38; }
.kmmu-q-pill.q-ok   { background: #FDF6E5; color: #6E5217; }
.kmmu-q-pill.q-warn { background: #FBE9E5; color: #7A2A1B; }

.kmmu-photo-actions { display: flex; gap: 8px; margin-top: 6px; }
.kmmu-mini-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 0;
}
.kmmu-mini-btn:hover { color: var(--error); }

.kmmu-photo-qty {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  text-align: center;
}
.kmmu-photo-qty-label {
  font-size: 10px;
  color: var(--light);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kmmu-photo-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.kmmu-qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.kmmu-qty-btn:hover:not(:disabled) { border-color: var(--camel); }
.kmmu-qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.kmmu-qty-val {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  min-width: 24px;
  text-align: center;
}
.kmmu-photo-qty-sub {
  font-size: 10px;
  color: var(--muted);
}

.kmmu-add-zone {
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--off-white);
}
.kmmu-add-zone-prompt {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 12px;
}
.kmmu-add-zone-prompt strong { color: var(--text); font-weight: 500; }

@media (max-width: 600px) {
  .kmmu-photo-row { grid-template-columns: 60px 1fr; gap: 10px; padding: 10px; }
  .kmmu-photo-row .kmmu-photo-thumb { width: 60px; height: 60px; }
  .kmmu-photo-row .kmmu-photo-qty { grid-column: 1 / -1; flex-direction: row; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 6px; }
}
