/* ── Review sheet (docs/plans/mobile-cart-ux.md section 6, R4) ─────────────────────────────────────────────────
 * The same dialog everywhere: a centred card on a wide screen, a bottom sheet on a phone. On a phone the wine's name
 * stays pinned on top, the fields scroll, and Save/Skip/Stop stay in a footer above the keyboard (the sheet follows
 * the visual viewport through --cart-sheet-h / --cart-sheet-bottom, set by bindSheetToVisualViewport). */
.confirm-dialog.cart-review-dialog {
  text-align: left;
  max-width: 480px;
  max-height: min(90dvh, var(--cart-sheet-h));
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
/* Defaults for the two values bindSheetToVisualViewport sets while a keyboard is up. */
.cart-review-overlay {
  --cart-sheet-h: 92dvh;
  --cart-sheet-bottom: 0px;
  padding-bottom: var(--cart-sheet-bottom);
}
.cart-review-head,
.cart-review-body,
.cart-review-foot {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.cart-review-head {
  padding-top: 1.25rem;
  flex: 0 1 auto;
  max-height: 30dvh;
  overflow-y: auto;
}
.cart-review-head .confirm-dialog-title {
  margin-bottom: 0.4rem;
  overflow-wrap: anywhere;
}
.cart-review-progress {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.cart-review-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cart-review-foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-top: 0.75rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.cart-review-warning {
  margin: 0.5rem 0 0;
  padding: 0.4rem 0.6rem;
  background: var(--color-warning-bg);
  color: var(--color-warning-ink);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.cart-review-fields .cart-control {
  width: 100%;
  font-size: 1rem; /* 16px: iOS does not zoom the page on focus */
}

@media (max-width: 600px) {
  .cart-review-overlay {
    align-items: flex-end;
  }
  .confirm-dialog.cart-review-dialog {
    position: fixed;
    inset: auto 0 0 0;
    bottom: var(--cart-sheet-bottom);
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    animation: slideUp 0.2s ease-out;
  }
  .cart-review-foot .cart-control {
    flex: 1 1 auto;
  }
}

/* A very short viewport (landscape phone, or the keyboard up on a small one): the header and footer must never leave the fields no room,
 * so the whole sheet scrolls and Save/Skip/Stop stay stuck to its bottom edge. */
@media (max-height: 520px) {
  .confirm-dialog.cart-review-dialog {
    overflow-y: auto;
  }
  .cart-review-head {
    max-height: none;
    overflow: visible;
  }
  .cart-review-body {
    flex: none;
    overflow: visible;
  }
  .cart-review-foot {
    position: sticky;
    bottom: 0;
  }
}

/* The optional price of the review sheet (docs/plans/wine-purchase-lots.md 2.10): one row under the identity fields, never blocking. */
.cart-review-price {
  margin-top: 0.75rem;
}
.cart-review-price .price-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem;
  gap: var(--space-sm);
}
.cart-review-price .price-editor-field {
  display: grid;
  gap: var(--space-xs);
}
.cart-review-price-error {
  margin: 0.25rem 0 0;
  color: var(--color-error, #f44336);
}
.cart-review-placed-price {
  margin: 0.75rem 0 0;
  color: var(--text-muted, #a3a3a3);
}
