/* Feature components: the window card, the catalog row, the stepper, the cart bar,
   the recap screen. */

/* ------------------------------------------------------------ window card -- */
.yu-window {
  background: var(--yu-paper);
  border: 1px solid var(--yu-line);
  border-left: 4px solid var(--yu-ink-30);
  border-radius: var(--yu-r);
  box-shadow: var(--yu-shadow-card);
  padding: 18px 16px;
}
.yu-window--open   { border-left-color: var(--yu-green); }
.yu-window--closed { border-left-color: var(--yu-amber); }
.yu-window--placed { border-left-color: var(--yu-green); }
.yu-window__headline { font-family: var(--yu-font-display); font-weight: 800; font-size: 18px; margin-bottom: 4px; }
.yu-window__detail { color: var(--yu-ink-60); font-size: 14px; }
.yu-window__countdown {
  display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 2px;
  font-weight: 700; font-size: 14px; color: var(--yu-green);
}
.yu-window__countdown--soon { color: var(--yu-amber); }
.yu-window__cta { margin-top: 16px; }

/* ------------------------------------------------------------- conditions -- */
.yu-conditions { display: grid; gap: 10px; }
.yu-conditions__item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.yu-conditions__item svg { flex: none; width: 18px; height: 18px; color: var(--yu-ink-60); }
.yu-conditions__item--free { color: var(--yu-green); font-weight: 600; }
.yu-conditions__item--free svg { color: var(--yu-green); }
.yu-conditions__item--met { color: var(--yu-green); font-weight: 600; }

/* ---------------------------------------------------------------- search -- */
.yu-search { position: relative; margin-bottom: 12px; }
.yu-search input { padding-left: 40px; }
.yu-search svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--yu-ink-30); pointer-events: none;
}
.yu-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.yu-chips::-webkit-scrollbar { display: none; }
.yu-chip {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: var(--yu-r-pill);
  border: 1px solid var(--yu-line); background: var(--yu-paper);
  font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--yu-ink-60);
}
.yu-chip.is-active { background: var(--yu-ink); border-color: var(--yu-ink); color: var(--yu-cream); }

/* --------------------------------------------------------- catalog rows --- */
.yu-catalog { display: flex; flex-direction: column; gap: 8px; }
.yu-product {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  min-height: 96px;
  background: var(--yu-paper);
  border: 1px solid var(--yu-line);
  border-left: 3px solid transparent;
  border-radius: var(--yu-r);
  box-shadow: var(--yu-shadow-card);
  transition: border-color .15s ease, background-color .15s ease;
}
.yu-product.is-in-cart { border-left-color: var(--yu-red); background: var(--yu-red-tint); }
.yu-product[hidden] { display: none; }
.yu-product__img {
  width: 76px; height: 76px; object-fit: contain;
  border-radius: var(--yu-r-sm); background: var(--yu-bg);
}
.yu-product__img--empty { display: grid; place-items: center; color: var(--yu-ink-30); }
.yu-product__body { min-width: 0; }
.yu-product__ref { font-size: 11px; font-weight: 700; color: var(--yu-ink-30); letter-spacing: .04em; }
.yu-product__name {
  font-family: var(--yu-font); font-weight: 600; font-size: 14px; line-height: 1.3;
  /* Clamp, never a fixed height: German names and large system fonts both overflow. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin: 1px 0 3px;
}
.yu-product__meta { display: flex; align-items: baseline; gap: 5px; }
.yu-product__price { font-family: var(--yu-font-display); font-weight: 800; font-size: 16px; }
.yu-product__unit { font-size: 12px; color: var(--yu-ink-60); }

/* --------------------------------------------------------------- stepper -- */
.yu-stepper {
  display: grid; grid-template-columns: 34px 40px 34px; align-items: center;
  border: 1px solid var(--yu-line); border-radius: var(--yu-r-sm);
  background: var(--yu-paper); overflow: hidden; position: relative;
}
.yu-stepper__btn {
  height: 44px; border: 0; background: none; color: var(--yu-ink);
  font-size: 20px; font-weight: 700; line-height: 1; display: grid; place-items: center;
}
.yu-stepper__btn:disabled { color: var(--yu-ink-30); }
.yu-stepper__btn:active:not(:disabled) { background: var(--yu-bg); }
.yu-stepper__btn--add { color: var(--yu-red); }
.yu-stepper__input {
  height: 44px; width: 100%; border: 0; border-left: 1px solid var(--yu-line);
  border-right: 1px solid var(--yu-line); text-align: center;
  font-weight: 700; font-variant-numeric: tabular-nums;
  background: none; -moz-appearance: textfield; padding: 0;
}
.yu-stepper__input::-webkit-outer-spin-button,
.yu-stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.yu-stepper::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--yu-red); transform: scaleX(0); transform-origin: left;
}
.yu-stepper.htmx-request::after { animation: yu-progress 1s ease-in-out infinite; }
.yu-stepper--error { border-color: var(--yu-danger); }
@keyframes yu-progress {
  0%   { transform: scaleX(0);   transform-origin: left; }
  50%  { transform: scaleX(1);   transform-origin: left; }
  100% { transform: scaleX(0);   transform-origin: right; }
}

.yu-qty-static {
  min-width: 44px; height: 36px; padding: 0 12px; border-radius: var(--yu-r-sm);
  background: var(--yu-bg); color: var(--yu-ink-60);
  display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- cart bar -- */
.yu-cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: var(--yu-cream);
  box-shadow: var(--yu-shadow-bar);
  padding-bottom: var(--yu-safe);
  transition: transform .2s ease;
}
.yu-cartbar--empty { transform: translateY(110%); }
.yu-cartbar__progress { height: 4px; background: var(--yu-cream-deep); }
.yu-cartbar__fill { height: 100%; background: var(--yu-red); transition: width .25s ease; }
.yu-cartbar--reached .yu-cartbar__fill { background: var(--yu-green); }
.yu-cartbar__row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px var(--yu-gutter); min-height: 72px;
}
.yu-cartbar__left { min-width: 0; flex: 1; }
.yu-cartbar__total {
  display: block; font-family: var(--yu-font-display); font-weight: 800; font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.yu-cartbar__count { font-size: 12px; color: var(--yu-ink-60); }
.yu-cartbar__hint { font-size: 12px; color: var(--yu-amber); font-weight: 600; }
.yu-cartbar--reached .yu-cartbar__hint { color: var(--yu-green); }
.yu-cartbar__cta { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------- cart list -- */
.yu-line {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--yu-line);
}
.yu-line:last-child { border-bottom: 0; }
.yu-line__img { width: 52px; height: 52px; object-fit: contain; border-radius: var(--yu-r-sm); background: var(--yu-bg); }
.yu-line__name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.yu-line__meta { font-size: 12px; color: var(--yu-ink-60); font-variant-numeric: tabular-nums; }
.yu-line__total { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.yu-totals { margin-top: 4px; }
.yu-totals__row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; font-size: 14px; }
.yu-totals__row--grand {
  border-top: 1px solid var(--yu-line); margin-top: 6px; padding-top: 12px;
  font-family: var(--yu-font-display); font-weight: 800; font-size: 20px;
}
.yu-totals__free { color: var(--yu-green); font-weight: 700; }
.yu-num-strong { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ----------------------------------------------------------------- recap -- */
body.yu-recap-page { background: var(--yu-paper); }
.yu-recap__band {
  background: var(--yu-red); color: var(--yu-cream);
  padding: 22px var(--yu-gutter);
  margin: 0 calc(-1 * var(--yu-gutter)) 20px;
  animation: yu-fade .25s ease;
}
.yu-recap__band h1 { font-size: 22px; margin-bottom: 6px; }
.yu-recap__band p { font-size: 15px; line-height: 1.4; }
@keyframes yu-fade { from { opacity: 0; } }

.yu-kv { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 15px; }
.yu-kv svg { flex: none; width: 18px; height: 18px; color: var(--yu-ink-30); margin-top: 2px; }
.yu-kv__label { color: var(--yu-ink-60); }
.yu-kv__value { font-weight: 600; }

.yu-check {
  display: flex; gap: 12px; align-items: flex-start;
  min-height: 44px; padding: 11px 0; cursor: pointer; font-size: 15px; line-height: 1.35;
}
.yu-check input {
  flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--yu-red);
}
.yu-recap__actions {
  position: sticky; bottom: 0;
  background: var(--yu-paper);
  padding: 12px 0 calc(12px + var(--yu-safe));
  border-top: 1px solid var(--yu-line);
  margin-top: 20px;
}
.yu-recap__blocker { text-align: center; font-size: 13px; color: var(--yu-ink-60); margin-top: 8px; }

/* ------------------------------------------------------------ confirmed --- */
.yu-done { text-align: center; padding: 40px 0 24px; }
.yu-done__mark {
  width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%;
  background: var(--yu-green-tint); display: grid; place-items: center; color: var(--yu-green);
}
.yu-done__mark svg { width: 36px; height: 36px; }
.yu-ref {
  display: inline-block; margin: 12px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; font-weight: 700;
  background: var(--yu-bg); border: 1px solid var(--yu-line); border-radius: var(--yu-r-pill);
  padding: 7px 16px; letter-spacing: .02em;
}

/* -------------------------------------------------------------- history --- */
.yu-order-card {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 14px 16px; background: var(--yu-paper);
  border: 1px solid var(--yu-line); border-radius: var(--yu-r); box-shadow: var(--yu-shadow-card);
  text-decoration: none; margin-bottom: 10px;
}
.yu-order-card__ref { font-weight: 700; font-size: 15px; }
.yu-order-card__date { font-size: 13px; color: var(--yu-ink-60); }
.yu-order-card__total { font-family: var(--yu-font-display); font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; text-align: right; }
.yu-order-card__foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 8px; }

.yu-timeline { display: flex; align-items: flex-start; gap: 0; margin: 8px 0 4px; }
.yu-timeline__step { flex: 1; text-align: center; position: relative; font-size: 11px; color: var(--yu-ink-30); line-height: 1.25; }
.yu-timeline__dot {
  display: block;
  width: 14px; height: 14px; border-radius: 50%; background: var(--yu-line);
  margin: 0 auto 8px; position: relative; z-index: 1;
  box-shadow: 0 0 0 3px var(--yu-paper);
}
.yu-timeline__step.is-done { color: var(--yu-green); font-weight: 700; }
.yu-timeline__step.is-done .yu-timeline__dot { background: var(--yu-green); }
.yu-timeline__step:not(:first-child)::before {
  content: ''; position: absolute; left: -50%; top: 6px; width: 100%; height: 2px; background: var(--yu-line);
}
.yu-timeline__step.is-done:not(:first-child)::before { background: var(--yu-green); }

.yu-diff { font-size: 14px; }
.yu-diff__list { margin: 8px 0 0; padding-left: 18px; }
.yu-diff__list li { margin-bottom: 3px; }
.yu-diff del { color: var(--yu-ink-60); text-decoration-thickness: 1px; }
.yu-diff ins { text-decoration: none; font-weight: 700; }
