/*
  The shopping list and its card on the start page, after the approved mock
  (docs/mockup/hauswerk-prototyp.html, "Einkaufsliste" and "Heute"). Built on the tokens of hauswerk.css,
  so light and dark follow the theme without rules of their own.
*/

/* --- entry field and suggestions -------------------------------------------------- */

.hw-shop-entry {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bsft-color-surface);
  border: 1.5px solid var(--bsft-color-border);
  border-radius: 16px;
  padding: 4px 4px 4px 14px;
}

.hw-shop-entry:focus-within {
  border-color: var(--bsft-color-primary);
}

.hw-shop-entry input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--bsft-color-text);
  padding: 10px 0;
  outline: none;
  font: inherit;
  /* 16px keeps mobile browsers from zooming into the field */
  font-size: 16px;
}

.hw-shop-entry input::placeholder {
  color: var(--bsft-color-muted);
}

.hw-shop-suggestions {
  display: flex;
  flex-direction: column;
  background: var(--bsft-color-surface);
  border: 1px solid var(--bsft-color-border);
  border-radius: 14px;
  overflow: hidden;
  margin-top: -4px;
}

.hw-shop-suggestions button {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--bsft-color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hw-shop-suggestions button + button {
  border-top: 1px solid var(--bsft-color-border);
}

.hw-shop-suggestions button:hover,
.hw-shop-suggestions button.is-highlighted {
  background: var(--hw-surface-2);
}

.hw-shop-suggestion-hint {
  font-family: var(--hw-font-mono);
  font-size: 12.5px;
  color: var(--bsft-color-muted);
  white-space: nowrap;
}

/* --- status lines ------------------------------------------------------------------- */

.hw-shop-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  font-size: 13px;
  color: var(--bsft-color-muted);
  padding: 2px 4px;
}

.hw-shop-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hw-shop-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bsft-color-success);
}

.hw-shop-done-toggle {
  margin-left: -4px;
}

/* --- list rows ------------------------------------------------------------------------ */

.hw-shop-list {
  background: var(--bsft-color-surface);
  border: 1px solid var(--bsft-color-border);
  border-radius: 18px;
  padding: 2px 12px;
}

.hw-shop-empty {
  margin: 0;
  padding: 12px 0;
  color: var(--bsft-color-muted);
}

.hw-shop-category {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--bsft-color-muted);
  padding: 12px 0 2px;
}

.hw-shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  /* full-bleed inside the list card, so the highlight of an open sheet or a change reaches its edges */
  margin: 0 -12px;
  padding: 11px 12px;
}

.hw-shop-item-main:disabled {
  cursor: default;
}

.hw-shop-item + .hw-shop-item,
.hw-shop-item + .hw-shop-breakdown,
.hw-shop-breakdown + .hw-shop-item {
  border-top: 1px solid var(--bsft-color-border);
}

.hw-shop-check {
  /* 26px ring inside a 44px touch target */
  width: 44px;
  height: 44px;
  margin: -9px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.hw-shop-check::before {
  content: "";
  grid-area: 1 / 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bsft-color-muted);
  box-sizing: border-box;
}

.hw-shop-check .hw-icon {
  grid-area: 1 / 1;
  width: 15px;
  height: 15px;
  position: relative;
}

.hw-shop-check.is-on {
  color: var(--bsft-color-primary-contrast);
}

.hw-shop-check.is-on::before {
  background: var(--bsft-color-primary);
  border-color: var(--bsft-color-primary);
}

.hw-shop-check:disabled {
  cursor: default;
}

.hw-shop-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--bsft-color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hw-shop-item-name {
  font-weight: 700;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.hw-shop-item.is-done .hw-shop-item-name {
  text-decoration: line-through;
  color: var(--bsft-color-muted);
  font-weight: 400;
}

.hw-shop-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.hw-shop-item-qty {
  flex: none;
  text-align: right;
}

.hw-shop-item-qty .hw-qty {
  display: block;
  font-size: 14px;
}

.hw-shop-pack {
  font-size: 12px;
  color: var(--bsft-color-muted);
}

.hw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hw-surface-2);
  color: var(--bsft-color-muted);
  border: 1px solid var(--bsft-color-border);
  white-space: nowrap;
}

.hw-chip.is-warn {
  background: var(--bsft-color-warning-surface);
  color: var(--bsft-color-warning);
  border-color: transparent;
}

/* --- breakdown ---------------------------------------------------------------------- */

.hw-shop-breakdown {
  padding: 4px 0 10px 38px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13.5px;
}

/* --- item sheet: stepper, one-tap amounts, typed quantity, sources, partial purchase ---------- */

.hw-shop-qty-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hw-shop-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hw-shop-stepper .hw-icon-button {
  width: 56px;
  height: 56px;
}

.hw-shop-stepper .hw-icon {
  width: 24px;
  height: 24px;
}

.hw-shop-stepper-value {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
}

.hw-shop-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hw-shop-quick .hw-pill {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 15px;
}

.hw-shop-qty-form {
  display: flex;
  flex-direction: column;
}

.hw-shop-qty-input {
  flex: 1;
  min-width: 0;
  font-family: var(--hw-font-mono);
}

.hw-shop-sheet-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.hw-shop-sheet-section .hw-sheet-label,
.hw-shop-qty-form .hw-sheet-label {
  margin: 0 0 2px;
}

.hw-shop-sheet-section .hw-chip {
  align-self: flex-start;
}

.hw-shop-breakdown .hw-error {
  margin: 0;
  font-size: 13px;
}

.hw-shop-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--bsft-color-muted);
}

.hw-shop-breakdown-row .hw-qty {
  font-size: 12.5px;
}

.hw-shop-breakdown-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.hw-shop-purchase {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hw-shop-amount,
.hw-shop-unit {
  min-height: 40px;
  border: 1px solid var(--bsft-color-border);
  border-radius: 10px;
  background: var(--bsft-color-surface);
  color: var(--bsft-color-text);
  padding: 6px 8px;
  font: inherit;
  font-size: 14px;
}

.hw-shop-amount {
  width: 5.5em;
  font-family: var(--hw-font-mono);
}

/* --- article sheet, store order, always at home -------------------------------------- */

.hw-article-sheet .hw-switches {
  border-top: 1px solid var(--bsft-color-border);
  border-bottom: 1px solid var(--bsft-color-border);
}

.hw-article-staple .bsft-button {
  flex: none;
}

.hw-article-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.hw-article-chip {
  min-height: 36px;
  padding: 4px 12px;
  font-size: 14px;
  color: var(--bsft-color-text);
}

.hw-article-sheet label.hw-sheet-label {
  display: block;
}

.hw-article-category {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--bsft-color-border);
  border-radius: 10px;
  background: var(--bsft-color-surface);
  color: var(--bsft-color-text);
  padding: 0 10px;
  font: inherit;
  font-size: 16px; /* 16px keeps iOS from zooming into a focused field */
}

.hw-article-entry select {
  flex: none;
  max-width: 40%;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--hw-surface-2);
  color: var(--bsft-color-text);
  padding: 0 8px;
  font: inherit;
}

.hw-article-sheet .hw-link-button {
  margin-top: 8px;
}

.hw-shop-order-number {
  background: var(--hw-accent-soft);
  color: var(--bsft-color-primary);
}

.hw-staples-always {
  margin-top: 20px;
}

.hw-staples-always .hw-hint {
  margin: 4px 0 0;
}

/* --- start page card ---------------------------------------------------------------- */

.hw-today-card .hw-card-head {
  justify-content: flex-start;
}

.hw-today-card .hw-card-title {
  flex: 1;
}

.hw-today-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--bsft-color-primary);
}

.hw-today-more {
  font-size: 13px;
  font-weight: 700;
  color: var(--bsft-color-primary);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.hw-today-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}

.hw-today-row .hw-qty {
  font-size: 14px;
}

.hw-today-row + .hw-today-row {
  border-top: 1px solid var(--bsft-color-border);
}

.hw-today-row-text {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}
