/* ==========================================================================
   Marry Me — shared premium file uploader (visual + interaction shell).

   ONE consistent upload look across the storefront and the Business Hub.
   This file is chrome only: every uploader keeps its own <input type=file>
   (name / id / accept / required / multiple), its form, its endpoint and its
   existing JavaScript. Colours come from whichever Marry Me token set is on
   the page (--mm-* storefront, --rs-* repair, --hub-* Business Hub); the
   hard-coded fallbacks are the Marry Me teal used on pages that ship no
   token set (e.g. complete-payment.html).
   Markup contract (built by js/mm-uploader.js or hand-authored):
     .mm-uploader  [data-mm-uploader]
       └ .mm-uploader__drop            (label / clickable drop card)
           ├ input[type=file]          (the original control, visually hidden)
           ├ .mm-uploader__glyph       (decorative SVG)
           ├ .mm-uploader__title
           ├ .mm-uploader__browse > span
           └ .mm-uploader__hints > .mm-uploader__hint …
       ├ .mm-uploader__list [data-mm-uploader-list]   (managed mode only)
       │   └ .mm-uploader__file [.is-error]
       │       ├ .mm-uploader__file-icon (text ext badge or <img> preview)
       │       ├ .mm-uploader__file-meta
       │       │   ├ .mm-uploader__file-name
       │       │   ├ .mm-uploader__file-sub
       │       │   └ .mm-uploader__progress > span   (host-driven, optional)
       │       └ .mm-uploader__remove
       └ .mm-uploader__error [data-mm-uploader-error]
   State hooks: .is-dragover / .is-selected / .is-invalid / .is-disabled
   Modifier:    .mm-uploader--compact
   ========================================================================== */

.mm-uploader {
  --mmu-accent:      var(--mm-teal, var(--rs-teal, var(--hub-teal, #0b746b)));
  --mmu-accent-deep: var(--mm-teal-deep, var(--rs-teal-deep, #064f4a));
  --mmu-accent-soft: var(--mm-soft-teal, var(--rs-soft, var(--hub-teal-soft, #e7f1ee)));
  --mmu-ink:         var(--mm-ink, var(--rs-ink, var(--hub-ink, #2f2924)));
  --mmu-muted:       var(--mm-muted, var(--rs-muted, var(--hub-muted, #7a6e65)));
  --mmu-line:        var(--mm-line, var(--rs-line, var(--hub-line, #d4c8bc)));
  --mmu-surface:     var(--rs-card, var(--hub-card, #fffdf9));
  --mmu-chip-bg:     var(--rs-soft, var(--hub-teal-soft, #f1ece3));
  --mmu-danger:      var(--mm-danger, var(--rs-danger, var(--hub-danger, #9b3f36)));
  --mmu-gold:        var(--mm-gold, var(--rs-gold, var(--hub-gold, #b8905a)));
  --mmu-radius: 16px;

  display: block;
  margin: 0;
  font-family: var(--mm-body, var(--rs-body, var(--hub-font-body, inherit)));
  font-size: 14px;
  font-weight: 400;
  color: var(--mmu-muted);
  /* the component root is a <label>; neutralise page-level label styling
     (uppercase, letter-spacing, tiny font) so it cannot leak inward */
  text-transform: none;
  letter-spacing: normal;
  line-height: normal;
}
.mm-uploader *,
.mm-uploader *::before,
.mm-uploader *::after { box-sizing: border-box; }

/* ---------- drop card ---------- */
/* the card is a <label>; reset host label/field typography so it cannot style
   the component text through the element or through inheritance */
.mm-uploader__drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 30px 24px;
  border: 1.5px dashed var(--mmu-line);
  border-radius: var(--mmu-radius);
  background: var(--mmu-surface);
  color: var(--mmu-muted);
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.mm-uploader__drop:hover { border-color: var(--mmu-accent); }
.mm-uploader__drop:focus-within,
.mm-uploader__drop.is-focus {
  outline: none;
  border-color: var(--mmu-accent);
  box-shadow: 0 0 0 4px rgba(11, 116, 107, .14);
}
.mm-uploader.is-invalid .mm-uploader__drop { border-color: var(--mmu-danger); }
.mm-uploader__drop.is-dragover {
  border-style: solid;
  border-color: var(--mmu-accent);
  background: var(--mmu-accent-soft);
  box-shadow: 0 0 0 4px rgba(11, 116, 107, .16);
}

/* the real control — reachable by keyboard, invisible to the eye */
.mm-uploader input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- decorative glyph ---------- */
.mm-uploader__glyph { width: 60px; height: 48px; flex: none; pointer-events: none; }
.mm-uploader__glyph .mmu-chip {
  fill: var(--mmu-chip-bg);
  stroke: var(--mmu-line);
  stroke-width: 1.5;
}
.mm-uploader__glyph .mmu-tile {
  fill: var(--mmu-accent-soft);
  stroke: var(--mmu-accent);
  stroke-width: 1.6;
}
.mm-uploader__glyph .mmu-arrow {
  fill: none;
  stroke: var(--mmu-accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mm-uploader__drop.is-dragover .mm-uploader__glyph { transform: translateY(-2px) scale(1.04); }

/* ---------- copy ---------- */
/* explicit resets so host label / field styling (uppercase, tracking) cannot
   reach the component text through inheritance */
.mm-uploader__title,
.mm-uploader__browse,
.mm-uploader__hint,
.mm-uploader__file-name,
.mm-uploader__file-sub,
.mm-uploader__file-icon,
.mm-uploader__error {
  text-transform: none;
  letter-spacing: normal;
}
.mm-uploader__title {
  display: block;
  margin: 2px 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--mmu-ink);
  font-family: inherit;
}
.mm-uploader__browse {
  display: block;
  margin: 0;
  font-size: .85rem;
  color: var(--mmu-muted);
}
.mm-uploader__browse span {
  color: var(--mmu-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mm-uploader__hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 6px;
}
.mm-uploader__hint {
  font-size: .72rem;
  line-height: 1.5;
  color: var(--mmu-muted);
  background: var(--mmu-chip-bg);
  border: 1px solid var(--mmu-line);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- selected / uploaded file rows ---------- */
.mm-uploader__list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.mm-uploader__list:empty { display: none; }
.mm-uploader__file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--mmu-line);
  border-radius: 12px;
  background: var(--mmu-surface);
  box-shadow: 0 6px 18px rgba(47, 41, 36, .06);
}
.mm-uploader__file.is-error { border-color: var(--mmu-danger); }
.mm-uploader__file-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--mmu-accent-soft);
  color: var(--mmu-accent-deep);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .04em;
  overflow: hidden;
}
.mm-uploader__file-icon img { width: 100%; height: 100%; object-fit: cover; }
.mm-uploader__file-meta { min-width: 0; flex: 1; display: grid; gap: 2px; }
.mm-uploader__file-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--mmu-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mm-uploader__file-sub { font-size: .74rem; color: var(--mmu-muted); }
.mm-uploader__file.is-error .mm-uploader__file-sub { color: var(--mmu-danger); }
.mm-uploader__progress {
  display: block;
  height: 4px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--mmu-chip-bg);
  overflow: hidden;
}
/* host drives progress by setting `transform: scaleX(<0..1>)` on this span */
.mm-uploader__progress > span {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--mmu-accent);
  transition: transform .2s ease;
}
.mm-uploader__remove {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--mmu-line);
  background: var(--mmu-surface);
  color: var(--mmu-muted);
  cursor: pointer;
  font-size: .8rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: color .15s ease, border-color .15s ease;
}
.mm-uploader__remove:hover { color: var(--mmu-danger); border-color: var(--mmu-danger); }
.mm-uploader__remove:focus-visible { outline: 2px solid var(--mmu-gold); outline-offset: 2px; }

/* ---------- validation ---------- */
.mm-uploader__error {
  margin: 8px 0 0;
  font-size: .8rem;
  font-weight: 600;
  color: var(--mmu-danger);
}
.mm-uploader__error[hidden] { display: none; }

/* ---------- disabled ---------- */
.mm-uploader.is-disabled .mm-uploader__drop {
  opacity: .6;
  pointer-events: none;
}

/* ---------- compact variant (tight forms, e.g. review photos) ---------- */
.mm-uploader--compact .mm-uploader__drop { padding: 18px 16px; gap: 5px; }
.mm-uploader--compact .mm-uploader__glyph { width: 42px; height: 34px; }
.mm-uploader--compact .mm-uploader__title { font-size: .9rem; }
.mm-uploader--compact .mm-uploader__browse { font-size: .8rem; }
.mm-uploader--compact .mm-uploader__hints { margin-top: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 520px) {
  .mm-uploader__drop { padding: 22px 14px; }
  .mm-uploader__hints { gap: 5px; }
  .mm-uploader__file { gap: 10px; padding: 9px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .mm-uploader__drop,
  .mm-uploader__glyph,
  .mm-uploader__progress > span,
  .mm-uploader__remove { transition: none; }
}
