/* ===== RC-2.0.0 Components ===== */

/* card */
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  box-shadow:var(--shadow);
}

.mutedBox{
  background:#f8fafc;
  border:1px dashed #cbd5e1;
  border-radius:12px;
  padding:10px 12px;
  font-size:12px;
  color:#334155;
  line-height:1.5;
}

/* top controls */
.backBtn{
  width:auto;
  flex:0 0 auto;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  font-weight:900;
  cursor:pointer;
}
.backBtn:disabled{ opacity:.45; cursor:not-allowed; }

.dots{ display:flex; gap:6px; align-items:center; }
.dot{ width:8px; height:8px; border-radius:99px; background:var(--c-primary-tint); border:1px solid var(--c-border); }
.dot.on{ background:var(--brand); border-color:transparent; }

/* chips */
.chipgrid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
/* Step3 grid overridden by .selection-step[data-step="3"] block below */
.chip{
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px;
  background:#fff;
  cursor:pointer;
  transition:transform .06s ease, border-color .12s ease, box-shadow .12s ease;
}
.chip:hover{ transform:translateY(-1px); box-shadow:0 8px 18px rgba(229,62,62,.10); }
.chip.selected{
  border-color:var(--c-primary);
  outline:2px solid rgba(229,62,62,.14);
  background:var(--c-primary-tint);
}

/* ===== Step 3: XD Pixel-Fixed Layout (CSS-only) ===== */
/*
 * Gate: .selection-step[data-step="3"]
 * Mode: .step3--large  (Cat Normal — 2-col 154px cards)
 *       .step3--compact (Dog Normal / all Rx — 3-col 100px cards)
 * Mode class set by renderStep3() in steps.js.
 */

/* ── Shared: all Step3 modes ─────────────────────────────── */

/* C-shared) Grid container base — flow layout, 360px centered */
.selection-step[data-step="3"] .chipgrid.selection-list {
  display: grid;
  width: 360px;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

/* D-shared) Card base */
.selection-step[data-step="3"] .selection-card {
  position: relative !important;
  height: auto !important;
  min-height: unset !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  background: #FFFFFF !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  cursor: pointer;
  text-align: left;
}
.selection-step[data-step="3"] .selection-card:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* E-shared) Thumbnail base */
.selection-step[data-step="3"] .product-thumb {
  position: relative;
  background: #F5F5F5 !important;
  border: 1px solid transparent !important;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.selection-step[data-step="3"] .product-thumb img {
  width: 88%;
  height: 88%;
  display: block;
  object-fit: contain;
  margin: 0 auto;
  background: transparent !important;
}

/* H) Hide .small inside Step3 cards */
.selection-step[data-step="3"] .selection-card .small {
  display: none !important;
}

/* I) Selected state — only thumbnail gets pink tint + border */
.selection-step[data-step="3"] .selection-card.selected,
.selection-step[data-step="3"] .selection-card.is-active {
  background: #FFFFFF !important;
  border: none !important;
  border-radius: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}
.selection-step[data-step="3"] .selection-card.selected .product-thumb,
.selection-step[data-step="3"] .selection-card.is-active .product-thumb {
  background: #FFE6EB !important;
  border-color: #CE0F2D !important;
}
/* Text stays black on selected/active */
.selection-step[data-step="3"] .selection-card.selected .chip-badge,
.selection-step[data-step="3"] .selection-card.is-active .chip-badge {
  color: #070707 !important;
}
.selection-step[data-step="3"] .selection-card.selected b,
.selection-step[data-step="3"] .selection-card.is-active b {
  color: #070707 !important;
}

/* F-shared) Base <b> title styling — all Step3 product names are Regular(400) per Zeplin */
.selection-step[data-step="3"] .selection-card b {
  display: block;
  margin-top: 8px;
  font-weight: 400;
  line-height: 1.2;
}

/* card-inner: neutral pass-through for non-pixel modes */
.selection-step[data-step="3"] .card-inner {
  display: contents;
}

/* ── Large mode: Cat Normal (2-col, 154px cards) ─────────── */

.selection-step[data-step="3"].step3--large .chipgrid.selection-list {
  grid-template-columns: repeat(2, 154px);
  justify-content: center;
  column-gap: 16px;
  row-gap: 20px;
}
.step3--large .selection-card {
  width: 154px !important;
}
.step3--large .product-thumb {
  width: 154px;
  height: 154px;
  border-radius: 8px !important;
}
.step3--large .selection-card.selected .product-thumb,
.step3--large .selection-card.is-active .product-thumb {
  border-radius: 8px !important;
}
.step3--large .chip-badge {
  display: block;
  margin-top: 8px;
  width: 100%;
  font: 700 16px/20px 'SUIT', sans-serif;
  letter-spacing: -0.32px;
  color: #070707;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
/* Specificity bump (0,4,1) beats shared base (0,3,1) — Cat Normal only */
.selection-step[data-step="3"].step3--large .selection-card b {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  width: 153px;
  height: 40px;
  font: 400 16px/20px 'SUIT', sans-serif;
  letter-spacing: -0.48px;
  color: #070707;
  text-align: left;
}

/* ── Compact mode: Dog Normal / Cat Rx (3-col CSS grid fallback) ─── */

.selection-step[data-step="3"].step3--compact .chipgrid.selection-list {
  grid-template-columns: repeat(2, 1fr);
  column-gap: 16px;
  row-gap: 16px;
}
.step3--compact .selection-card {
  width: 100px !important;
}
.step3--compact .product-thumb {
  width: 100px;
  height: 100px;
  border-radius: 4px !important;
  box-sizing: border-box;
}
.step3--compact .chip-badge {
  display: block;
  margin-top: 8px;
  width: 100px;
  font: 700 12px/10px 'SUIT', sans-serif;
  letter-spacing: -0.24px;
  color: #070707;
  text-align: left;
  padding-left: 0;
}
.step3--compact .selection-card b {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 4px;
  width: 100px;
  height: 32px;
  max-height: 32px;
  font-size: 12px;
  line-height: 16px;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  font-weight: 400;
  font-family: 'SUIT', sans-serif;
  letter-spacing: -0.36px;
  color: #070707;
  text-align: left;
  padding: 0;
  padding-left: 0;
  box-sizing: border-box;
}

/* ── Dog General title: design-matched 2-line forced rendering ────── */
/* Override clamp — we control lines via .t1/.t2 spans, not browser wrap */
.step3--dog-general.step3--compact .selection-card b.title--twoline {
  display: block !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: unset !important;
  font-size: 12px !important;
  line-height: 16px !important;
  letter-spacing: -0.36px !important;
  height: 32px !important;
  max-height: 32px !important;
  overflow: hidden !important;
  padding: 0 !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100px !important;
  box-sizing: border-box !important;
}
.step3--dog-general.step3--compact .selection-card b.title--twoline .t1,
.step3--dog-general.step3--compact .selection-card b.title--twoline .t2 {
  display: block;
  line-height: 16px;
  height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── SSOT: 3-col grid (Dog Normal 3+3, future 5-item 3+2) ──────────────────
   Card spec: 100px card / 10px col-gap / 16px row-gap
   Layout : left-aligned (no centering), 20px side padding → 3×100+2×10=320px
   5-item rule: row1=3, row2=2 left-aligned (slot 3 empty, no space-around)
   Shared card style: identical to pixel-dogcare / pixel-catcare (size/gap/typo)
   ──────────────────────────────────────────────────────────────────────────── */
.selection-step[data-step="3"].step3--dog-general .chipgrid.selection-list {
  grid-template-columns: repeat(3, 100px) !important;
  column-gap: 10px;
  row-gap: 16px;
  justify-content: start;
  padding: 0 20px;
}

/* ── Pixel absolute modes: shared grid-kill (display:block, no grid columns) ─ */

.selection-step[data-step="3"].step3--pixel-dogcare .chipgrid.selection-list,
.selection-step[data-step="3"].step3--pixel-catcare .chipgrid.selection-list {
  grid-template-columns: none;
  display: block; /* let absolute positioning take over */
}

/* ── Pixel-dogcare mode: Dog Rx only, absolute cards, flow internals ─ */
/*
 * Specificity: all selectors use .selection-step[data-step="3"].step3--pixel-dogcare
 * to beat the shared base (.selection-step[data-step="3"] .X) at (0,3,0).
 * Grid is fully killed with !important to guarantee block positioning.
 */

/* Canvas: selection-list = coordinate anchor for absolute cards */
.selection-step[data-step="3"].step3--pixel-dogcare .chipgrid.selection-list {
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 320px !important;
  height: 560px !important;
  gap: 0 !important;
  grid-template-columns: none !important;
  place-items: unset !important;
  justify-content: unset !important;
  align-content: unset !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Card: absolutely positioned by JS (left/top inline), 100px wide */
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card {
  position: absolute !important;
  width: 100px !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
}

/* card-inner: vertical flow container for thumb → badge → title */
.selection-step[data-step="3"].step3--pixel-dogcare .card-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100px;
}

/* Thumbnail: flow, 100x100, radius 4 */
.selection-step[data-step="3"].step3--pixel-dogcare .product-thumb {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 4px !important;
  box-sizing: border-box;
  flex-shrink: 0;
  margin-bottom: 8px;
}
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card.selected .product-thumb,
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card.is-active .product-thumb {
  border-radius: 4px !important;
}

/* Badge: flow, below thumb, offset 108-100=8px margin */
.selection-step[data-step="3"].step3--pixel-dogcare .chip-badge {
  display: block;
  margin-top: 0px;
  margin-bottom: 4px;
  width: 100px;
  font: 700 12px/10px 'SUIT', sans-serif;
  letter-spacing: -0.24px;
  color: #070707;
  text-align: left;
  padding-left: 4px;
  white-space: nowrap;
  overflow: visible;
}

/* Title: 2-line clamp, 32px = 2×16px line-height (XD 31→32 to prevent glyph clip) */
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card b {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;
  overflow: hidden !important;
  margin-top: 0px;
  width: 100px;
  font-size: 12px !important;
  line-height: 16px !important;
  height: 51px !important;
  max-height: 51px !important;
  padding: 0 !important;
  margin-left: 0;
  padding-left: 4px;
  box-sizing: border-box !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  font-weight: 400;
  font-family: 'SUIT', sans-serif;
  letter-spacing: -0.36px;
  color: #070707;
  text-align: left;
}

/* Text stays black on selected/active — dogcare specific */
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card.selected .chip-badge,
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card.is-active .chip-badge {
  color: #070707 !important;
}
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card.selected b,
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card.is-active b {
  color: #070707 !important;
}



/* ── Pixel-catcare mode: Cat Rx, same engine as Dog Rx ──────────── */
/*
 * Mirrors .step3--pixel-dogcare exactly — same coords, same card/thumb sizes.
 * Specificity: .selection-step[data-step="3"].step3--pixel-catcare (0,4,0).
 */

/* Canvas: grid kill, block positioning */
.selection-step[data-step="3"].step3--pixel-catcare .chipgrid.selection-list {
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 320px !important;
  height: 560px !important;
  gap: 0 !important;
  grid-template-columns: none !important;
  place-items: unset !important;
  justify-content: unset !important;
  align-content: unset !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Card: absolute, 100px wide */
.selection-step[data-step="3"].step3--pixel-catcare .selection-card {
  position: absolute !important;
  width: 100px !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
}

/* card-inner: vertical flow */
.selection-step[data-step="3"].step3--pixel-catcare .card-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100px;
}

/* Thumbnail: 100x100, radius 4 */
.selection-step[data-step="3"].step3--pixel-catcare .product-thumb {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 4px !important;
  box-sizing: border-box;
  flex-shrink: 0;
  margin-bottom: 8px;
}
.selection-step[data-step="3"].step3--pixel-catcare .selection-card.selected .product-thumb,
.selection-step[data-step="3"].step3--pixel-catcare .selection-card.is-active .product-thumb {
  border-radius: 4px !important;
}

/* Badge: 8px below thumb */
.selection-step[data-step="3"].step3--pixel-catcare .chip-badge {
  display: block;
  margin-top: 0px;
  margin-bottom: 4px;
  width: 100px;
  font: 700 12px/10px 'SUIT', sans-serif;
  letter-spacing: -0.24px;
  color: #070707;
  text-align: left;
  padding-left: 4px;
  white-space: nowrap;
  overflow: visible;
}

/* Title: 2-line clamp, 32px */
.selection-step[data-step="3"].step3--pixel-catcare .selection-card b {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;
  overflow: hidden !important;
  margin-top: 0px;
  width: 100px;
  font-size: 12px !important;
  line-height: 16px !important;
  height: 51px !important;
  max-height: 51px !important;
  padding: 0 !important;
  margin-left: 0;
  padding-left: 4px;
  box-sizing: border-box !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  font-weight: 400;
  font-family: 'SUIT', sans-serif;
  letter-spacing: -0.36px;
  color: #070707;
  text-align: left;
}

/* Text stays black on selected/active */
.selection-step[data-step="3"].step3--pixel-catcare .selection-card.selected .chip-badge,
.selection-step[data-step="3"].step3--pixel-catcare .selection-card.is-active .chip-badge {
  color: #070707 !important;
}
.selection-step[data-step="3"].step3--pixel-catcare .selection-card.selected b,
.selection-step[data-step="3"].step3--pixel-catcare .selection-card.is-active b {
  color: #070707 !important;
}

/* inputs */
select, input[type="number"], input[type="text"]{
  width:100%;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  font-size:14px;
  outline:none;
}
input:focus, select:focus{
  border-color:var(--c-primary);
  box-shadow:0 0 0 4px rgba(229,62,62,.12);
}

input.invalid{
  border-color: var(--bad) !important;
  box-shadow: 0 0 0 4px rgba(239,68,68,.12) !important;
}
.hint{
  margin-top:6px;
  font-size:12px;
  line-height:1.45;
  color: var(--bad);
  font-weight: 800;
}

/* details */
details{
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
}
summary{ cursor:pointer; font-weight:900; }

/* bottom buttons */
#docActionsRow{ position:relative; z-index:10000; }
/* XD footer bar: 360px fixed, 20px side padding — Step1 SSOT (no border-top) */
.btnrow{
  position:fixed;
  left:0; right:0; bottom:0;
  display:flex;
  justify-content:center;
  background:var(--white, #FFFFFF);
  border-top:none;
  box-shadow:none;
  padding-bottom:env(safe-area-inset-bottom, 0px);
  z-index:9999;
  pointer-events:auto;
}
.btnrowInner{
  width:360px;
  padding:12px 20px;
  display:flex;
  gap:12px;
}
/* Step1 SSOT: 8px gap, asymmetric buttons (124 + 8 + 188 = 320, +40pad = 360) */
.btnrowInner.footerInner{
  display:flex;
  gap:8px;
}
#prevBtn{ width:124px; flex:0 0 124px; }
#nextBtn{ width:188px; flex:0 0 188px; }
/* Step 7: Zeplin footer — share(52) + prev(124) + next(124), gap:10px = 320px */
.btnrow.footer--share .btnrowInner.footerInner{
  display:grid;
  grid-template-columns:52px 124px 124px;
  gap:10px;
  padding:16px 20px 24px;
}
.footer--share #shareBtn,
.footer--share #prevBtn,
.footer--share #nextBtn{
  width:auto;
  flex:none;
}
.footer--share #shareBtn{
  padding:14px;
  background:var(--primary-color);
  border-color:transparent;
}
.action.icon{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
}
/* XD bottom nav buttons: base 52px tall, radius 8, medium 19px SUIT
   Actual widths: #prevBtn 124px / #nextBtn 188px (Step1 SSOT) */
button.action{
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  padding:0;
  width:154px;
  height:52px;
  border-radius:8px;
  font:500 19px/24px 'SUIT', sans-serif;
  letter-spacing:-0.38px;
  cursor:pointer;
  flex:0 0 154px;
}
button.action.primary{
  background:var(--c-primary);
  color:#fff;
  border-color:transparent;
}
button.action:hover{
  transform:none !important;
  box-shadow:none !important;
}
button.action:disabled{
  background:var(--black_10);
  color:var(--black_30);
  border-color:transparent;
  opacity:1;
  cursor:not-allowed;
}
#prevBtn:not(:disabled){
  background:var(--white);
  border:1px solid var(--black_20);
  color:var(--black);
}
#nextBtn:not(:disabled){
  background:var(--primary-color);
  color:var(--white);
  border-color:transparent;
}

/* Step3 Pixel Rx — CAT URINARY only: 3-line exception */
.selection-step[data-step="3"].step3--pixel-catcare .selection-card b.rx-cat-urinary360 {
  -webkit-line-clamp: 3 !important;
  height: 51px !important;
  max-height: 51px !important;
}



/* modal */
.modalOverlay{ position:fixed; inset:0; background:rgba(15,23,42,.45); display:none; align-items:center; justify-content:center; padding:16px; z-index:10001; }
.modalOverlay.show{ display:flex; }
.modalCard{ width:min(420px, 100%); background:#fff; border:1px solid var(--line); border-radius:16px; padding:14px; box-shadow:0 10px 30px rgba(15,23,42,.20); }
.modalHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.modalHeader .modalTitle{ margin-bottom:0; }
.modalClose{
  background:none;
  border:none;
  font-size:22px;
  cursor:pointer;
  color:var(--muted);
  padding:0 2px;
  line-height:1;
}
.modalTitle{ font-size:16px; font-weight:800; margin-bottom:6px; }
.modalBtns{ display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap; }
.btn.ghost{ background:#fff; color:var(--text); border:1px solid var(--line); }

/* ── Share modal — Zeplin pixel overrides ── */
#shareModal .modalCard{
  width:320px;
  padding:20px;
  border-radius:8px;
  border:none;
  box-shadow:0 0 12px 0 rgba(0,0,0,0.12);
}
#shareModal .modalHeader{
  margin-bottom:16px;
}
#shareModal .modalTitle{
  font:600 19px/normal 'SUIT', sans-serif;
  letter-spacing:-0.38px;
  color:#070707;
  margin:0;
}
#shareModal .modalClose{
  padding:0;
  line-height:0;
  color:inherit;
}
#shareModal label{
  display:block;
  font:600 16px/1.13 'SUIT', sans-serif;
  letter-spacing:-0.32px;
  color:#070707;
  margin-bottom:8px;
}
#shareModal input[type="text"]{
  width:100%;
  height:44px;
  border-radius:5px;
  border:1px solid #E3E3E3;
  background:#fff;
  padding:0 12px;
  font:400 16px/1 'SUIT', sans-serif;
  color:#070707;
  box-sizing:border-box;
  margin-bottom:20px;
}
#shareModal input[type="text"]::placeholder{
  color:#BABABA;
}



/* FIX: All Step3 modes — kill .chip base padding (12px) that slips through */
/* Rx Pixel modes */
.selection-step[data-step="3"].step3--pixel-dogcare .chip.selection-card,
.selection-step[data-step="3"].step3--pixel-catcare .chip.selection-card {
  padding: 0 !important;
}
/* Cat Normal (step3--large): same fix — was missing, caused padding-left bleed */
.selection-step[data-step="3"].step3--large .chip.selection-card {
  padding: 0 !important;
}
/* Dog Normal / Dog Rx / Cat Rx compact fallback */
.selection-step[data-step="3"].step3--compact .chip.selection-card {
  padding: 0 !important;
}

/* FIX: Rx pixel badge/title left alignment */
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card .chip-badge,
.selection-step[data-step="3"].step3--pixel-catcare .selection-card .chip-badge,
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card b,
.selection-step[data-step="3"].step3--pixel-catcare .selection-card b {
  display: block !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
  text-indent: 0 !important;
  text-align: left !important;
}

/* Step3 Rx title — local override: restore -webkit-box for line-clamp */
.selection-step[data-step="3"].step3--pixel-dogcare .selection-card b,
.selection-step[data-step="3"].step3--pixel-catcare .selection-card b {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  -webkit-line-clamp: 3 !important;
  height: 51px !important;
  max-height: 51px !important;
  word-break: normal !important;
}

/* ── TASK C: Global progress bar (Steps 2-7) ───────────────────────── */

/* Explicit colors — safe fallback if CSS vars fail */
/* Global progress: header bottom → progress top = 20px (matches step-shell .step-top .progress) */
.stage > .app__progress {
  background: #EDEDED;
  border-radius: 999px;
  overflow: hidden;
  margin: 20px auto 0;
}
.stage > .app__progress > .bar {
  background: #C9002B;
  height: 100%;
}

/* Hide global progress when step-shell is active (Step1 renders its own) */
.stage:has(#screen .step-shell) > .app__progress {
  display: none !important;
}
