/* ===========================================================================
   Arjuna POD — personalisation layer (checkout Step 2, the personaliser pop-up, the photo guide,
   the express lock, and the personalised upsell rows). Loaded after arjuna.css on checkout and upsell.
   Colours come from brand-theme.css tokens only.
   =========================================================================== */

/* [hidden] must win over the flex/grid display of the cards, rows, notices and dialog parts. */
.pod-steps [hidden], .pm[hidden], .pm [hidden], .pod-urows [hidden], .pod-upsell-retry[hidden], .pod-upsell-msg[hidden] { display: none !important; }

/* ---- SDK-owned parts that stay in the DOM, out of sight ---- */
/* The slot stages keep each item's data-next-property inputs exactly as the SDK renders them. */
#bundle-slots-stage, .pod-slot-stage { display: none; }
/* Technical line properties (refs, preview URLs) never show in the order summary. */
[data-next-item-properties] { display: none !important; }

/* ---- Step 2: one card per item ---- */
.pod-personalize { margin-top: 8px; }
.pod-personalize .pg-link { align-self: flex-start; margin: -4px 0 4px; }
.c1-pz { display: flex; flex-direction: column; gap: 16px; }
.oc { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 18px 16px 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; }
.oc.is-saved { background: var(--pod--color--soft); border-color: var(--brand--color--primary); }
.oc.is-err { border-color: var(--pod--color--danger); box-shadow: inset 0 0 0 1px var(--pod--color--danger); }
.oc-num { position: absolute; top: -10px; left: 12px; background: var(--brand--color--primary); color: var(--brand--color--primary-foreground); font: 800 13px/1 var(--font-primary); padding: 5px 8px; border-radius: 100px; }
.oc-img { flex: none; width: 88px; height: 88px; border-radius: 8px; object-fit: cover; background: #f3f4f6; }
.oc-c { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.oc-t { margin: 0; font: 700 17px/1.35 var(--font-primary); color: #1a1814; }
.oc-meta { margin: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font: 500 14px/1.4 var(--font-primary); color: #6b7280; }
.oc-meta > span:first-child:not(:last-child) { padding-right: 6px; border-right: 1px solid #e5e7eb; }
.oc-meta s { color: #6b7280; }
.oc-meta b { font: 800 19px/1.2 var(--font-primary); color: #1a1814; }
.oc-saved { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.oc-thumb { flex: none; width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #e5e7eb; }
.oc-chip { display: inline-flex; align-items: center; gap: 4px; flex: none; background: var(--pod--color--success); color: #fff; font: 700 13px/1 var(--font-primary); padding: 5px 8px 5px 6px; border-radius: 100px; }
.oc-chip svg { width: 14px; height: 14px; }
.oc-sum { font: 500 14px/1.3 var(--font-primary); color: #6b7280; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.oc-btn { margin-top: 4px; border: 0; border-radius: 6px; background: var(--pod--color--personalize); color: var(--pod--color--personalize-foreground); box-shadow: inset 0 0 0 1px var(--pod--color--personalize-border); font: 700 16px/1.2 var(--font-primary); padding: 12px 18px; cursor: pointer; }
.oc-btn:hover { filter: brightness(.95); }
.oc-btn--edit { background: #fff; color: #1a1814; box-shadow: inset 0 0 0 1.5px #1a1814; }
.oc-btn:disabled { opacity: .55; cursor: default; }
.oc-err { margin: 0; font: 600 14px/1.4 var(--font-primary); color: var(--pod--color--danger); }
.cz-status { margin: 0; font: 600 14px/1.4 var(--font-primary); color: #6b7280; }
.cz-status:empty { display: none; }
.cz-notice { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: 1px solid var(--pod--color--danger); border-radius: 12px; background: #fff; font: 400 14px/1.45 var(--font-primary); color: #1a1814; scroll-margin-top: 96px; }
.cz-notice strong { font-weight: 700; color: var(--pod--color--danger); }
.oc-btn:focus-visible, .pm-x:focus-visible, .pm-cancel:focus-visible, .pm-sample:focus-visible, .pg-help a:focus-visible { outline: 2px solid var(--brand--color--primary); outline-offset: 2px; }
@media (max-width: 640px) {
  .oc { padding: 16px 12px 12px; }
  .oc-img { width: 64px; height: 64px; }
  .oc-btn { width: 100%; text-align: center; }
}

/* ---- Express checkout lock: the bar is inert until every item has a design the cart confirmed ---- */
.pod-xwrap { display: flex; flex-direction: column; gap: 10px; }
.pod-xwrap.is-locked .pod-xbar { opacity: .45; pointer-events: none; filter: grayscale(1); }
.pod-exlock { margin: 0; text-align: center; font: 500 14px/1.4 var(--font-primary); color: #6b7280; }

/* ---- Personaliser pop-up (Customily's full viewer in one iframe) ---- */
html.pm-lock, html.pm-lock body { overflow: hidden; }
.pm { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pm-back { position: absolute; inset: 0; background: rgba(17, 17, 17, .62); }
.pm-dialog { position: relative; width: min(980px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 64px rgba(0, 0, 0, .3); font-family: var(--font-primary); color: #1a1814; }
.pm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #e5e7eb; }
.pm-head h2 { margin: 0; font: 700 22px/1.2 var(--font-primary); letter-spacing: 0; }
.pm-x { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f3f4f6; color: #1a1814; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.pm-x svg { width: 20px; height: 20px; }
.pm-x:hover { background: #e5e7eb; }
.pm-body { flex: 1; overflow: auto; padding: 20px; }
.pm-slot { display: block; }
.cz-pm-status { margin: 0 0 12px; font: 600 14px/1.4 var(--font-primary); color: #6b7280; }
.cz-pm-status:empty { display: none; }
.cz-pm-error { display: flex; justify-content: center; padding: 8px 0 24px; }
.pm-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 16px 20px; border-top: 1px solid #e5e7eb; }
.cz-pm-help { flex: 1; min-width: 0; margin: 0; font: 500 13px/1.4 var(--font-primary); color: #6b7280; }
.pm-sample { align-self: center; border: 0; background: none; padding: 0; font: 600 14px/1.4 var(--font-primary); color: #1a1814; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.pm-cancel { border: 0; border-radius: 6px; background: #f3f4f6; color: #1a1814; font: 700 16px/1 var(--font-primary); padding: 16px 22px; cursor: pointer; }
/* Customily's viewer: its height follows the viewer's own report (documentHeight). */
#customily-options { display: block; width: 100%; max-width: 100%; height: 560px; border: 0; }
@media (max-width: 640px) {
  .pm { padding: 0; align-items: stretch; }
  .pm-dialog { max-height: none; height: 100%; border-radius: 0; }
  .pm-head h2 { font-size: 19px; }
  .pm-body { padding: 12px; }
  .pm-foot { padding: 12px; flex-wrap: wrap; justify-content: space-between; }
  .pm-foot .cz-pm-help { flex: 1 0 100%; font-size: 12px; }
  #customily-options { height: 640px; }
}

/* ---- Package chooser (shown when a smaller tier is picked with more designs saved than it holds) ---- */
.cz-dialog { width: calc(100% - 32px); max-width: 460px; max-height: 85vh; overflow: auto; border: 0; border-radius: 16px; padding: 20px; font-family: var(--font-primary); color: #1a1814; box-shadow: 0 24px 64px rgba(0, 0, 0, .3); }
.cz-dialog::backdrop { background: rgba(17, 17, 17, .62); }
.cz-dialog__title { margin: 0 0 8px; font: 700 20px/1.2 var(--font-primary); }
.cz-dialog label { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-weight: 600; cursor: pointer; }
.cz-dialog input { width: 18px; height: 18px; accent-color: var(--brand--color--primary); }
.cz-dialog img { width: 64px; height: 64px; margin-left: auto; object-fit: contain; border-radius: 8px; }
.cz-dialog__actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.cz-dialog .pm-save { border: 0; border-radius: 6px; background: var(--pod--color--personalize); color: var(--pod--color--personalize-foreground); font: 700 16px/1 var(--font-primary); padding: 16px 22px; cursor: pointer; }
.cz-dialog .pm-save:disabled { opacity: .45; cursor: not-allowed; }
.cz-dialog button:focus-visible, .cz-dialog input:focus-visible { outline: 2px solid var(--brand--color--primary); outline-offset: 2px; }

/* ---- Photo guide (native <dialog>, above the personaliser) ---- */
html.pg-lock, html.pg-lock body { overflow: hidden; }
.pg-link { display: block; }
.pg { width: calc(100% - 32px); max-width: 520px; max-height: 85vh; overflow: auto; border: 0; border-radius: 16px; padding: 0; background: #fff; font-family: var(--font-primary); color: #1a1814; box-shadow: 0 24px 64px rgba(0, 0, 0, .3); }
.pg::backdrop { background: rgba(17, 17, 17, .62); }
.pg-box { padding: 20px; }
.pg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pg-head h2 { margin: 0; font: 700 22px/1.2 var(--font-primary); }
.pg-steps { list-style: none; margin: 0 0 20px; padding: 0; counter-reset: pg; display: flex; flex-direction: column; gap: 12px; }
.pg-steps li { position: relative; padding-left: 40px; min-height: 28px; font: 400 15px/1.45 var(--font-primary); counter-increment: pg; }
.pg-steps li::before { content: counter(pg); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--brand--color--primary); color: var(--brand--color--primary-foreground); font: 600 14px/28px var(--font-primary); text-align: center; }
.pg-examples { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pg-ex { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.pg-thumb { display: block; width: 100%; max-width: 96px; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 3px solid var(--pod--color--danger); background: #f3f4f6; }
.pg-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pg-ex--ok .pg-thumb { border-color: var(--pod--color--success); }
.pg-ex--blur img { filter: blur(3px); }
.pg-ex--dark img { filter: brightness(.28); }
.pg-ex--cut img { transform: scale(1.9) translate(34%, 22%); }
.pg-cap { font: 400 13px/1.3 var(--font-primary); color: #6b7280; }
.pg-cap b { display: block; font-weight: 700; color: var(--pod--color--danger); }
.pg-ex--ok .pg-cap b { color: var(--pod--color--success); }
.pg-help { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: var(--pod--color--soft); font: 400 14px/1.45 var(--font-primary); }
.pg-help a { color: inherit; font-weight: 700; }
.pg-foot { display: flex; justify-content: flex-end; }
@media (max-width: 480px) {
  .pg-examples { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-head h2 { font-size: 19px; }
}

/* ---- Personalised upsell: one row per extra item ---- */
.pod-urows__guide { align-self: center; margin: 4px 0 0; }
.pod-urows { display: flex; flex-direction: column; gap: 14px; width: 100%; margin: 12px 0 4px; }
.pod-urow { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 10px 10px 14px; min-height: 56px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; text-align: left; }
.pod-urow .oc-num { top: -10px; left: 10px; }
.pod-urow__text { flex: 1; min-width: 0; }
.pod-urow__sum { margin: 0; font: 500 14px/1.4 var(--font-primary); color: #4b5563; overflow: hidden; text-overflow: ellipsis; }
.pod-urow .oc-btn { flex: none; margin-top: 0; padding: 10px 16px; font-size: 14px; }
.pod-urow .oc-err { font-size: 12px; }
.pod-urow.is-saved { background: var(--pod--color--soft); border-color: var(--brand--color--primary); }
.pod-urow.is-err { border-color: var(--pod--color--danger); box-shadow: inset 0 0 0 1px var(--pod--color--danger); }
.pod-qty__value { min-width: 1.5rem; text-align: center; }
.pod-upsell-msg { text-align: center; }
.pod-upsell-msg[data-tone="ok"] { color: var(--pod--color--success); }
.pod-upsell-retry { align-self: center; }
@media (max-width: 640px) {
  .pod-urow { flex-wrap: wrap; }
  .pod-urow .oc-btn { width: 100%; text-align: center; }
}
