/* ---------- Add a product: the wizard ---------------------------------------
   Six screens in one sheet: a rail across the top saying where you are, one
   question in the middle, and Back/Next pinned to the bottom so the buttons
   don't wander as the question changes height. js/add-item.js */

/* The same layer as every other overlay, and earlier in the source than all of
   them — so the scanner, the link picker and the new-ingredient sheet, each of
   which opens from inside the wizard, land on top of it without needing a
   z-index of their own. It can't sit *below* 60 either: the mobile nav bar is
   59 and would cut the Back/Next row off the bottom of the sheet. */
#addWizOverlay { z-index: 60; padding: 20px 14px; }
#addWizSheet { max-width: 780px; display: flex; flex-direction: column; max-height: calc(100vh - 40px); }

.aw-head {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.aw-head h3 {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 12px; font-size: 17px; letter-spacing: -.01em;
}
.aw-head h3 .ic { width: 18px; height: 18px; color: var(--accent); }

/* the rail: where you are, and — once the thing has a name — a way to any of
   the other five without walking through them */
.aw-rail { display: flex; gap: 4px; flex-wrap: wrap; }
.aw-railstep {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px; font-weight: 650;
  cursor: pointer;
  transition: background-color .14s ease, color .14s ease, border-color .14s ease;
}
.aw-railstep:hover:not(:disabled) { background: var(--surface-3); color: var(--text-soft); }
.aw-railstep:disabled { opacity: .45; cursor: default; }
.aw-railn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-muted);
  font-size: 10.5px; font-weight: 800;
}
.aw-railn .ic { width: 11px; height: 11px; }
.aw-railstep.done { color: var(--text-soft); }
.aw-railstep.done .aw-railn { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.aw-railstep.on {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
}
.aw-railstep.on .aw-railn { background: var(--accent); color: #fff; }

.aw-body { padding: 20px; overflow-y: auto; flex: 1; }
/* Two questions stacked straight in the body — the second one's label would
   otherwise sit flush against the first one's help text and read as part of it. */
.aw-body > .pfield + .pfield,
.aw-body > .pfield + .af-grid,
.aw-body > .af-grid + .pfield { margin-top: 20px; }
.aw-q { margin-bottom: 16px; }
.aw-q b { display: block; font-size: 19px; font-weight: 750; letter-spacing: -.015em; }
.aw-q span { display: block; margin-top: 4px; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

.aw-status { display: none; }
.aw-status.show {
  display: block;
  margin-bottom: 14px; padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.5;
  background: var(--surface-2); color: var(--text-soft);
  border: 1px solid var(--border);
}
.aw-status.show.ok { background: var(--accent-soft); color: var(--green-dark);
                     border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.aw-status.show.warn { background: color-mix(in srgb, var(--amber) 11%, transparent); color: var(--amber);
                       border-color: color-mix(in srgb, var(--amber) 38%, transparent); }

.aw-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.aw-count { font-size: 11.5px; color: var(--text-muted); font-weight: 650; }
/* Next sits hard right, however many buttons are between it and Back */
.aw-foot .tool.big { margin-left: auto; }
.aw-foot .tool.ghost:not(:first-child) { margin-left: auto; }
.aw-foot .tool.ghost:not(:first-child) ~ .tool.big { margin-left: 0; }

/* ---- step 1: find it ---- */
.aw-scan {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 2px 14px;
  width: 100%; text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
  cursor: pointer;
  transition: border-color .14s ease, transform .1s ease;
}
.aw-scan:hover { border-color: var(--accent); }
.aw-scan:active { transform: translateY(1px); }
.aw-scan > .ic { grid-row: 1 / 3; align-self: center; width: 30px; height: 30px; color: var(--accent); }
.aw-scan b { font-size: 15px; font-weight: 750; color: var(--green-dark); }
.aw-scan i { font-style: normal; font-size: 12px; color: var(--text-soft); line-height: 1.5; }

.aw-orline {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0 12px;
  font-size: 11px; font-weight: 750; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-muted);
}
.aw-orline::before, .aw-orline::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.aw-lookrow { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.aw-lookrow input {
  flex: 1; min-width: 190px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 13.5px;
}
.aw-lookrow input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.aw-lookrow .tool { flex: none; }
#awSearchResults { position: static; margin: 4px 0 0; max-height: 260px; }

/* the product Woolworths came back with, before you commit to it */
.aw-found {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  margin-top: 12px; padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
}
.aw-found img, .aw-found-ph {
  width: 52px; height: 52px; flex: none;
  border-radius: 9px; background: var(--surface); object-fit: contain;
  display: flex; align-items: center; justify-content: center;
}
.aw-found-ph .ic { width: 26px; height: 26px; color: var(--text-muted); }
.aw-found-t { flex: 1; min-width: 160px; }
.aw-found-t b { display: block; font-size: 13.5px; font-weight: 700; }
.aw-found-t small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }

.aw-doors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aw-door {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  gap: 2px 11px; text-align: left;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .14s ease;
}
.aw-door:hover { border-color: var(--accent); }
.aw-door > .ic { grid-row: 1 / 3; align-self: center; width: 20px; height: 20px; color: var(--accent); }
.aw-door b { font-size: 13.5px; font-weight: 700; }
.aw-door i { font-style: normal; font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }

.aw-tpl {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px; margin-top: 14px;
}
.aw-tplcard {
  display: flex; flex-direction: column; gap: 3px;
  text-align: left; padding: 12px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease;
}
.aw-tplcard:hover { border-color: var(--accent); }
.aw-tplcard.on { border-color: var(--accent); background: var(--accent-soft); }
.aw-tplcard > .ic { width: 19px; height: 19px; color: var(--accent); margin-bottom: 2px; }
.aw-tplcard b { font-size: 13px; font-weight: 750; }
.aw-tplcard i { font-style: normal; font-size: 11.5px; color: var(--text-soft); }
.aw-tplcard small { font-size: 10.5px; color: var(--text-muted); line-height: 1.4; }

.aw-note {
  display: flex; gap: 9px; align-items: flex-start;
  margin-top: 13px; padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11.5px; line-height: 1.55; color: var(--text-soft);
}
.aw-note .ic { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--text-muted); }

/* ---- step 2: what is it ---- */
.aw-from {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--green-dark);
  font-size: 12px; font-weight: 650;
  width: fit-content; max-width: 100%;
}
.aw-from .ic { width: 14px; height: 14px; flex: none; }
.aw-from button {
  border: none; background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; padding: 0; opacity: .65;
}
.aw-from button:hover { opacity: 1; }
.aw-from button .ic { width: 12px; height: 12px; }
input.aw-big { font-size: 15px !important; padding: 11px 13px !important; }

/* ---- step 5: what it counts as ----
   Both of these were only ever styled inside something the wizard doesn't use —
   .chips-inline inside .linkfield, .rcp-dollar inside .rcp-price — so they get
   their own rule here rather than a wrapper that exists to carry CSS. */
.aw-body .chips-inline { display: flex; gap: 6px; flex-wrap: wrap; }
.aw-body .chips-inline:not(:empty) { margin-bottom: 7px; }
.aw-body .rcp-dollar {
  display: inline-flex; align-items: center;
  font-size: 13.5px; font-weight: 700; color: var(--text-muted);
}

/* ---- step 4: what you've got ---- */
.aw-unitword {
  display: inline-flex; align-items: center;
  padding: 0 4px;
  font-size: 12.5px; color: var(--text-muted); white-space: nowrap;
}

/* ---- step 5: reorder rules ---- */
.aw-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 9px; }
.aw-rule {
  display: flex; flex-direction: column; gap: 3px;
  text-align: left; padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease;
}
.aw-rule:hover { border-color: var(--accent); }
.aw-rule.on { border-color: var(--accent); background: var(--accent-soft); }
.aw-rule b { font-size: 13px; font-weight: 750; }
.aw-rule i { font-style: normal; font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }

/* ---- step 6: check it over ---- */
.aw-check { display: flex; flex-direction: column; gap: 5px; margin-bottom: 6px; }
.aw-row {
  display: flex; align-items: baseline; gap: 12px;
  width: 100%; text-align: left;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .14s ease;
}
.aw-row:hover { border-color: var(--accent); }
.aw-rowl { flex: none; width: 108px; font-size: 11.5px; font-weight: 750; color: var(--text-muted); }
.aw-rowv { flex: 1; font-size: 13px; color: var(--text-soft); line-height: 1.45; }
.aw-rowv small { color: var(--text-muted); font-size: 11px; }
/* an answer nobody has given yet says what the app won't be able to do, in the
   quiet voice — it isn't an error, and most products ship with a few */
.aw-rowv i { font-style: normal; color: var(--text-muted); }
.aw-row.todo { border-style: dashed; }
.aw-row > .ic { flex: none; width: 13px; height: 13px; color: var(--text-muted); align-self: center; }
.aw-row:hover > .ic { color: var(--accent); }

@media (max-width: 620px) {
  #addWizOverlay { padding: 0; }
  #addWizSheet { max-height: 100vh; height: 100dvh; border-radius: 0; border: none; max-width: none; }
  .aw-head { padding: 14px 16px 10px; }
  .aw-body { padding: 16px; }
  .aw-foot { padding: 11px 16px calc(11px + env(safe-area-inset-bottom)); }
  .aw-q b { font-size: 17px; }
  /* the rail loses its words on a phone — six labelled pills wrap to three
     rows and eat the question underneath them */
  .aw-raill { display: none; }
  .aw-rail { gap: 6px; }
  .aw-railstep { padding: 4px; }
  .aw-railstep.on { padding-inline: 8px; }
  .aw-railstep.on .aw-raill { display: inline; }
  .aw-doors, .aw-tpl, .aw-rules { grid-template-columns: 1fr; }
  .aw-rowl { width: 84px; }
  .aw-foot .tool { flex: 1 1 auto; justify-content: center; }
}
