/* ===================================================================
   Ramekin v4 shell components — Wave A

   Additive component classes for the v4 redesign. Nothing in this file
   restyles an existing page — every selector here is a brand-new `.v4-*`
   class with no collisions against existing class names (checked via
   grep before this file was written). Later design waves consume these
   classes directly instead of writing one-off card/button/chip CSS per
   page.

   Tokens only: every color, radius, and shadow below references a
   design-tokens.css custom property. The three tokens this file needed
   that didn't already exist (--chip-success-border, --chip-success-text,
   --chip-attention-border) were added to design-tokens.css itself, not
   here, so the token layer stays the single source of truth.
   ================================================================= */

/* ---------------------------------------------------------------------
   .v4-card — surface card with optional divided rows
   --------------------------------------------------------------------- */

.v4-card {
  background: var(--bg-surface);
  border: 1px solid var(--hairline-card);
  border-radius: 16px;
  box-shadow: var(--shadow-card-v3);
  padding: 16px 14px;
}

/* Stack .v4-card-row children inside a .v4-card; each row after the
   first gets a hairline divider above it (border-top, not border-bottom,
   so the card's own padding remains the outer edge on every side). */
.v4-card-row + .v4-card-row {
  border-top: 1px solid var(--hairline-divider);
  margin-top: 12px;
  padding-top: 12px;
}

/* ---------------------------------------------------------------------
   .v4-btn — 44px-tall button, four variants
   --------------------------------------------------------------------- */

.v4-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.v4-btn-primary {
  background: var(--brand-primary);
  color: var(--bg-surface);
}

.v4-btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--hairline-control);
  color: var(--brand-primary);
}

.v4-btn-destructive {
  background: transparent;
  color: var(--color-error);
}

.v4-btn-ink {
  background: var(--text-primary);
  color: var(--bg-surface);
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   Chips — 999px pill radius, four intents
   --------------------------------------------------------------------- */

.v4-chip-filter {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--hairline-control);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
}

.v4-chip-filter.selected {
  background: var(--tint-info);
  border-color: var(--border-strong);
  color: var(--brand-primary-hover);
  font-weight: 600;
}

.v4-chip-confirmed {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--tint-success);
  border: 1px solid var(--chip-success-border);
  color: var(--chip-success-text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
}

.v4-chip-attention {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--tint-warning);
  border: 1px solid var(--chip-attention-border);
  color: var(--warning-text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
}

/* Counts inside an attention chip render in mono, per spec. */
.v4-chip-attention .v4-chip-count {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.v4-tag-estimate {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--well);
  border: 1px solid var(--hairline-control);
  color: var(--text-muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

/* ---------------------------------------------------------------------
   Numeric display — mono, reserved for quantities/prices/times
   --------------------------------------------------------------------- */

.v4-display-num {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  font-size: 50px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.v4-data-line {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------
   .v4-day-coin — 34px day-flag circle
   --------------------------------------------------------------------- */

.v4-day-coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--well);
  color: var(--accent-gold);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.v4-day-coin.empty {
  background: var(--bg-surface);
  border: 1.5px dashed var(--hairline-ring);
  color: var(--color-neutral-300);
}

/* ---------------------------------------------------------------------
   .v4-sheet — bottom-sheet primitive (Wave B1)

   A single shared bottom sheet (design board 3a) that supersedes the old
   in-place row expansion (3b, rejected). The item drawer + its variants ride
   on it; later waves (B2) reuse the same primitive for filter/sort/overflow
   sheets. Behavior lives in static/js/v4_sheet.js. Tokens only.
   --------------------------------------------------------------------- */

.v4-sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 35, 43, 0.38);
  opacity: 0;
  transition: opacity 0.24s ease;
}

.v4-sheet-scrim.is-open {
  opacity: 1;
}

.v4-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1201;
  margin: 0 auto;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(15, 35, 43, 0.22);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}

.v4-sheet.is-open {
  transform: translateY(0);
}

.v4-sheet[hidden],
.v4-sheet-scrim[hidden] {
  display: none;
}

/* Page scroll lock while a sheet is open (JS also stores/restores scrollY). */
body.v4-sheet-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

.v4-sheet-grabber {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10px;
  padding-bottom: 6px;
  cursor: grab;
  touch-action: none;
}

.v4-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--hairline-control);
}

.v4-sheet-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 20px 12px;
  border-bottom: 1px solid var(--hairline-divider);
}

.v4-sheet-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.v4-sheet-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  margin: 0;
}

.v4-sheet-price {
  flex: 0 0 auto;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
}

.v4-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
}

.v4-sheet-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hairline-divider);
}

.v4-sheet-footer[hidden] {
  display: none;
}

/* Action rows in the footer stretch full width. */
.v4-sheet-footer .v4-btn {
  width: 100%;
}

/* Neutral (NOT amber) block for reversible decisions inside the sheet body,
   e.g. the herb fresh->dried option. */
.v4-sheet-neutral-block {
  background: var(--well);
  border: 1px solid var(--hairline-control);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 14px;
}

.v4-sheet-neutral-block .v4-sheet-neutral-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.v4-sheet-neutral-block p {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 10px;
}

@media (prefers-reduced-motion: reduce) {
  .v4-sheet,
  .v4-sheet-scrim {
    transition: none;
  }
}
