/* Full-screen ISBN scanner, bottom sheet, toast, and insert-list (staging cart). RTL-aware. */

/* ===== Full-screen scanner overlay ===== */
.fs-scan {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  overflow: hidden;
}
.fs-scan-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.fs-scan-dim {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 40% at 50% 42%, transparent 0%, transparent 40%, rgba(0,0,0,.55) 100%);
  pointer-events: none;
}
.fs-scan-frame {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(78vw, 360px);
  aspect-ratio: 3 / 2;
  pointer-events: none;
}
.fs-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
  box-shadow: 0 0 8px rgba(0,0,0,.5);
}
.fs-corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 8px; }
.fs-corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 8px; }
.fs-corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 8px; }
.fs-corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 8px; }
.fs-scan-line {
  position: absolute;
  left: 6%;
  right: 6%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary, #d74630), transparent);
  box-shadow: 0 0 10px 1px var(--primary, #d74630);
  border-radius: 2px;
  animation: fsScanSweep 2.2s ease-in-out infinite;
}
@keyframes fsScanSweep {
  0%   { top: 8%; opacity: .4; }
  50%  { top: 88%; opacity: 1; }
  100% { top: 8%; opacity: .4; }
}
.fs-scan-close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  inset-inline-end: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.5);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 3;
}
.fs-scan-close svg { width: 24px; height: 24px; }
.fs-scan-close:hover { background: rgba(0,0,0,.7); }
.fs-scan-status {
  position: absolute;
  top: calc(42% + min(39vw, 180px) + 18px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 86vw;
  text-align: center;
  color: #fff;
  font-size: .92rem;
  line-height: 1.6;
  background: rgba(0,0,0,.45);
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 2;
}
.fs-scan-toast {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.82);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .9rem;
  z-index: 4;
  animation: fsToastIn .2s ease;
}
@keyframes fsToastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== "Submit scanned books" bar inside the scanner overlay ===== */
/* Persistent CTA anchored at the bottom of the live camera. Hidden when the
   queue is empty or while the found-book sheet (#fsScanSheet, z-index 5) is up,
   so it never overlaps the sheet. */
.fs-submit-queue {
  position: absolute;
  inset-inline: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  background: var(--primary, #d74630);
  color: var(--primary-foreground, #fffaf5);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  animation: fsSubmitQueueIn .26s cubic-bezier(.16, 1, .3, 1);
}
.fs-submit-queue[hidden] { display: none; }
.fs-submit-queue:hover { background: var(--primary-strong, #b93423); }
.fs-submit-queue:active { transform: translateY(1px); }
@keyframes fsSubmitQueueIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fs-submit-queue-count {
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.25);
  display: grid;
  place-items: center;
  font-size: .9rem;
  font-weight: 800;
}

/* ===== Bottom sheet over the camera ===== */
/* Bare positioning wrapper. The visible surfaces are the .fs-sheet-card
   (drag-transformed) and the .fs-sheet-foot (pinned), placed absolutely. */
.fs-scan-sheet {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 5;
  /* JS sets these per book/viewport. */
  --fs-foot-h: 170px;     /* measured footer height */
  --fs-card-h: 60vh;      /* card height when fully expanded */
  --fs-y: 0px;            /* current drag offset (0 = expanded, compactY = compact) */
  animation: fsSheetUp .22s ease;
}
/* Draggable content card — bottom edge sits on the footer; grows by sliding up
   (transform → GPU smooth). */
.fs-sheet-card {
  position: absolute;
  inset-inline: 0;
  bottom: var(--fs-foot-h);
  height: var(--fs-card-h);
  display: flex;
  flex-direction: column;
  background: var(--card, #fff);
  color: var(--card-foreground, #191715);
  border-top-left-radius: var(--fs-radius, 18px);
  border-top-right-radius: var(--fs-radius, 18px);
  box-shadow: 0 -10px 40px rgba(0,0,0,.4);
  padding: 6px 18px 0;
  transform: translateY(var(--fs-y));
  transition: transform .26s cubic-bezier(.22,.61,.36,1), border-radius .26s cubic-bezier(.22,.61,.36,1);
  z-index: 1;
}
.fs-scan-sheet.sheet-dragging .fs-sheet-card { transition: none; will-change: transform; }
/* display:flex above would otherwise override the `hidden` attribute, leaving
   the sheet up before anything is scanned. */
.fs-scan-sheet[hidden] { display: none !important; }
/* Wrapper is zero-height (children are absolute), so a px slide + fade, not %. */
@keyframes fsSheetUp { from { transform: translateY(48px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Grab handle: tap or drag up to expand to near full-screen, tap/drag down to collapse. */
.fs-sheet-handle {
  flex: 0 0 auto;
  width: 44px;
  height: 5px;
  border: none;
  padding: 0;
  border-radius: 999px;
  background: var(--border, #dfdad3);
  margin: 8px auto 22px;
  cursor: grab;
  touch-action: none;
  position: relative;
}
.fs-sheet-handle::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted-foreground, #706a62);
}
.fs-scan-sheet.expanded .fs-sheet-handle::after { content: "بستن جزئیات ▾"; }

/* First-use drag hint — shown only when not used in the last 3 days (toggled in JS). */
.fs-sheet-hint {
  flex: 0 0 auto;
  text-align: center;
  font-size: .76rem;
  font-weight: 800;
  color: var(--primary, #d74630);
  margin: -14px 0 8px;
  animation: fsHintPulse 1.6s ease-in-out infinite;
}
.fs-sheet-hint[hidden] { display: none; }
@keyframes fsHintPulse { 0%,100% { opacity: .6; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.fs-scan-sheet.expanded .fs-sheet-hint { display: none; }

/* The scroll container so long content scrolls inside the sheet, not the page. */
.fs-sheet-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;      /* don't rubber-band the page while dragging */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;             /* hide the scrollbar but keep it scrollable */
}
.fs-sheet-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }
/* Pinned footer: price/stock + action buttons, always at the screen bottom,
   above the card (so the card slides behind it). */
.fs-sheet-foot {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  padding: 10px 18px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border, #dfdad3);
  background: var(--card, #fff);
}
/* Top shadow only once expanded (no shadow looming over the compact peek). */
.fs-scan-sheet.expanded .fs-sheet-foot { box-shadow: 0 -6px 20px rgba(0,0,0,.10); }
.fs-sheet-foot .fs-sheet-set { margin-top: 4px; }
.fs-sheet-inner { display: flex; gap: 14px; align-items: flex-start; }
.fs-sheet-cover {
  flex: 0 0 64px;
  width: 64px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--muted, #f1efeb);
  display: grid;
  place-items: center;
  color: var(--muted-foreground, #706a62);
  font-weight: 700;
  font-size: 1.4rem;
}
.fs-sheet-cover img { width: 100%; height: 100%; object-fit: cover; }
.fs-sheet-info { flex: 1; min-width: 0; }
.fs-sheet-title { font-weight: 700; font-size: 1rem; line-height: 1.5; }
.fs-sheet-author { color: var(--muted-foreground, #706a62); font-size: .88rem; margin-top: 2px; }
.fs-sheet-isbn { color: var(--muted-foreground, #706a62); font-size: .82rem; margin-top: 4px; }
/* Price + inventory set on the scan sheet (so the user sets them at scan time). */
.fs-sheet-set { display: flex; gap: 12px; margin-top: 14px; }
.fs-set-field { display: flex; flex-direction: column; gap: 5px; }
.fs-set-price { flex: 1 1 auto; }
.fs-set-field label { font-size: .76rem; font-weight: 800; color: var(--muted-foreground, #706a62); }
.fs-set-input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--input, #dfdad3);
  border-radius: var(--radius-sm, 6px);
  background: var(--card, #fff);
  color: var(--foreground, #191715);
  padding: 8px 12px;
  font-weight: 700;
}
.fs-price-wrap { position: relative; }
.fs-price-suffix {
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  color: var(--muted-foreground, #706a62);
  font-size: .8rem;
  font-weight: 800;
  pointer-events: none;
}
.fs-price-input { padding-left: 56px; text-align: right; }
.qty-stepper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--input, #dfdad3);
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
}
.qty-btn {
  width: 42px;
  border: 0;
  background: var(--muted, #f1efeb);
  color: var(--foreground, #191715);
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}
.qty-btn:hover { background: color-mix(in srgb, var(--primary, #d74630) 14%, var(--muted, #f1efeb)); }
.qty-input {
  width: 56px;
  min-height: 44px;
  border: 0;
  text-align: center;
  background: var(--card, #fff);
  color: var(--foreground, #191715);
  font-weight: 800;
}

.fs-sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.fs-sheet-actions .btn { flex: 1; justify-content: center; }

/* Expansion is driven by --fs-y (card transform), not height. */
.fs-sheet-inner { position: relative; }

/* Full book detail — always rendered in the card; hidden in compact simply by
   being below the visible peek (the card is translated down). */
.fs-sheet-details { display: block; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border, #dfdad3); }
.fs-d-list { display: grid; gap: 9px 16px; margin: 0; }
.fs-d-row { display: flex; gap: 8px; align-items: baseline; }
.fs-d-row dt { color: var(--muted-foreground, #706a62); font-size: .82rem; flex: 0 0 auto; min-width: 82px; }
.fs-d-row dd { margin: 0; font-size: .88rem; font-weight: 650; color: var(--foreground, #191715); }
.fs-d-isbn { margin-top: 10px; color: var(--muted-foreground, #706a62); font-size: .82rem; font-weight: 800; }
.fs-details-loading { text-align: center; padding: 16px; }
.fs-details-empty { color: var(--muted-foreground, #706a62); font-size: .85rem; }

.fs-sheet-view { display: flex; width: 100%; justify-content: center; margin-top: 12px; }
.fs-scan-sheet.no-view .fs-sheet-view { display: none; }

/* Desktop (>=880px): render the found-book sheet as a centered window over the camera. */
@media (min-width: 880px) {
  /* Centered window: card + footer flow normally inside it, no drag transform. */
  .fs-scan-sheet {
    position: absolute;
    inset-inline: auto;
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(460px, calc(100% - 48px));
    max-width: 460px;
    display: flex;
    flex-direction: column;
    max-height: 84vh;
    background: var(--card, #fff);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-lg, 0 24px 64px rgba(0,0,0,.45));
    overflow: hidden;
    animation: fsSheetPop .2s cubic-bezier(.16, 1, .3, 1);
  }
  .fs-sheet-card {
    position: static;
    bottom: auto;
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    transform: none !important;
    transition: none;
    border-radius: 0;
    box-shadow: none;
    padding: 18px 18px 0;
  }
  .fs-sheet-foot {
    position: static;
    box-shadow: none;
  }
  /* The drag handle is a touch affordance — desktop has no drag-to-expand. */
  .fs-sheet-handle,
  .fs-sheet-hint { display: none; }
  .fs-scan-sheet.no-view .fs-sheet-view { display: none; }
}
@keyframes fsSheetPop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ===== Scan tab: primary camera button + secondary photo link ===== */
.scan-primary-btn {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  justify-content: center;
  gap: 10px;
}
.scan-photo-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .86rem;
  font-weight: 700;
  color: var(--muted-foreground, #706a62);
  background: transparent;
  border: none;
  padding: 6px 4px;
}
.scan-photo-link:hover { color: var(--primary, #d74630); }
.scan-photo-link .ico { flex: 0 0 auto; }

/* ===== Insert-list floating pill ===== */
.insert-pill {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 20px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: var(--primary, #d74630);
  color: var(--primary-foreground, #fffaf5);
  font-family: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-lg, 0 18px 48px rgba(0,0,0,.2));
}
.insert-pill:hover { background: var(--primary-strong, #b93423); }
.insert-pill[hidden] { display: none; }
.insert-pill .ico { width: 18px; height: 18px; }
/* Tasteful slide+fade entrance when the first item is added. */
.insert-pill-in { animation: insertPillIn .32s cubic-bezier(.16, 1, .3, 1); }
@keyframes insertPillIn {
  from { opacity: 0; transform: translateY(16px) scale(.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 880px) {
  .insert-pill {
    inset-inline: 16px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    min-height: 48px;
    justify-content: center;
    font-size: .9rem;
  }
}
.insert-pill-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.25);
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 700;
}

/* ===== Insert-list bottom sheet ===== */
.insert-sheet { position: fixed; inset: 0; z-index: 950; }
.insert-sheet[hidden] { display: none; }
.insert-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
  animation: insertBackdropIn .24s ease;
}
.insert-sheet.closing .insert-sheet-backdrop { animation: insertBackdropOut .22s ease forwards; }
@keyframes insertBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes insertBackdropOut { from { opacity: 1; } to { opacity: 0; } }
/* Bare positioning wrapper; the visible surfaces are the draggable card and the
   pinned footer (same continuous-grow pattern as the scan sheet). */
.insert-sheet-panel {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  margin-inline: auto;
  width: 100%;
  --fs-foot-h: 150px;     /* JS sets these per open/viewport */
  --fs-card-h: 56vh;
  --fs-y: 0px;
  animation: insertSheetUp .26s cubic-bezier(.16, 1, .3, 1);
}
/* Draggable content card — slides between compact peek and full height. */
.insert-sheet-card {
  position: absolute;
  inset-inline: 0;
  bottom: var(--fs-foot-h);
  height: var(--fs-card-h);
  display: flex;
  flex-direction: column;
  background: var(--card, #fff);
  color: var(--card-foreground, #191715);
  border-top-left-radius: var(--fs-radius, 20px);
  border-top-right-radius: var(--fs-radius, 20px);
  box-shadow: var(--shadow-lg, 0 -10px 48px rgba(0,0,0,.28));
  transform: translateY(var(--fs-y));
  transition: transform .26s cubic-bezier(.16, 1, .3, 1), border-radius .26s cubic-bezier(.16, 1, .3, 1);
  z-index: 1;
}
.insert-sheet-panel.sheet-dragging .insert-sheet-card { transition: none; will-change: transform; }
.insert-sheet.closing .insert-sheet-panel { animation: insertSheetDown .22s ease forwards; }
/* Wrapper is zero-height (children are absolute), so a px slide, not %. */
@keyframes insertSheetUp { from { transform: translateY(48px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes insertSheetDown { from { transform: translateY(0); opacity: 1; } to { transform: translateY(40px); opacity: 0; } }
/* Desktop: center with a comfortable max-width anchored to the bottom. */
@media (min-width: 560px) {
  .insert-sheet-panel { max-width: 520px; }
}
/* Desktop (>=880px): render the cart drawer as a centered modal window. */
@media (min-width: 880px) {
  .insert-sheet {
    display: grid;
    place-items: center;
    padding: 24px;
  }
  .insert-sheet-panel {
    position: relative;
    inset: auto;
    margin-inline: 0;
    width: min(520px, 100%);
    max-width: 520px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    background: var(--card, #fff);
    border-radius: var(--radius, 8px);
    box-shadow: var(--shadow-lg, 0 24px 64px rgba(0,0,0,.28));
    overflow: hidden;
    animation: insertSheetPop .2s cubic-bezier(.16, 1, .3, 1);
  }
  .insert-sheet-card {
    position: static;
    bottom: auto;
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    transform: none !important;
    transition: none;
    border-radius: 0;
    box-shadow: none;
  }
  .insert-sheet-foot { position: static; box-shadow: none; }
  /* The drag handle is a touch affordance; the header ✕ + backdrop click close it. */
  .insert-sheet-handle { display: none; }
}
@keyframes insertSheetPop {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes insertSheetPopOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(.96); }
}
.insert-sheet-handle {
  width: 44px;
  height: 5px;
  border: none;
  padding: 0;
  border-radius: 999px;
  background: var(--border, #dfdad3);
  margin: 10px auto 4px;
  flex: 0 0 auto;
  cursor: grab;
  touch-action: none;
}
.insert-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px 14px;
  border-bottom: 1px solid var(--border, #dfdad3);
}
.insert-sheet-head strong { font-size: 1.02rem; }
.insert-sheet-count { color: var(--muted-foreground, #706a62); font-weight: 600; }
.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted-foreground, #706a62);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: var(--radius-sm, 6px);
}
.icon-btn:hover { background: var(--muted, #f1efeb); }
.insert-sheet-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.insert-sheet-list::-webkit-scrollbar { width: 0; height: 0; display: none; }
.insert-sheet-foot {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  padding: 12px 18px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border, #dfdad3);
  background: var(--card, #fff);
}
/* Top shadow only once expanded (no shadow looming over the compact peek). */
.insert-sheet-panel.expanded .insert-sheet-foot { box-shadow: 0 -6px 20px rgba(0,0,0,.10); }
.insert-bulk-summary {
  margin-bottom: 10px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted-foreground, #706a62);
  text-align: center;
  min-height: 0;
}
.insert-bulk-summary:empty { display: none; }
.insert-foot-row { display: flex; gap: 10px; align-items: stretch; }
.insert-foot-row .btn { justify-content: center; }
.insert-bulk-submit { flex: 1 1 auto; min-height: 44px; font-size: .95rem; }
.insert-bulk-clear { flex: 0 0 auto; white-space: nowrap; }
.insert-empty { text-align: center; color: var(--muted-foreground, #706a62); padding: 32px 12px; font-size: .9rem; }
.insert-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--border, #dfdad3);
  border-radius: var(--radius, 8px);
  padding: 10px;
}
.insert-item-link {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.insert-item-cover {
  flex: 0 0 44px;
  width: 44px;
  height: 62px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--muted, #f1efeb);
  display: grid;
  place-items: center;
  color: var(--muted-foreground, #706a62);
  font-weight: 700;
}
.insert-item-cover img { width: 100%; height: 100%; object-fit: cover; }
.insert-item-info { flex: 1; min-width: 0; }
.insert-item-title { font-weight: 600; font-size: .9rem; line-height: 1.5; }
.insert-item-isbn { color: var(--muted-foreground, #706a62); font-size: .78rem; margin-top: 3px; }
.insert-item-publish {
  display: inline-block;
  margin-top: 8px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--primary, #d74630);
}
.insert-item-link:hover .insert-item-publish { text-decoration: underline; }
.insert-item-link:hover .insert-item-title { color: var(--primary, #d74630); }
.insert-item-remove {
  border: none;
  background: transparent;
  color: var(--muted-foreground, #706a62);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: var(--radius-sm, 6px);
}
.insert-item-remove:hover { background: var(--muted, #f1efeb); color: var(--primary, #d74630); }
.insert-item-remove svg { width: 18px; height: 18px; }

/* ===== "Add" button on normal result cards ===== */
.result-add-btn {
  flex: 0 0 auto;
  align-self: center;
  border: 1px solid var(--border, #dfdad3);
  background: var(--card, #fff);
  color: var(--primary, #d74630);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  cursor: pointer;
  margin-inline-start: auto;
}
.result-add-btn:hover { background: var(--primary-soft, #fff0eb); }
.result-add-btn.added { background: var(--success-soft, #e9f8ef); color: var(--success, #15803d); border-color: transparent; }
.result-add-btn svg { width: 18px; height: 18px; }

/* Loading sentinel for lazy pagination */
.results-sentinel {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}
.results-more-btn { width: 100%; max-width: 280px; margin: 4px auto 0; }

/* Reduced motion: sheets/hint appear instantly and fully visible (no stuck state). */
@media (prefers-reduced-motion: reduce) {
  .fs-scan-sheet, .insert-sheet-panel, .fs-sheet-card, .insert-sheet-card { animation: none !important; transition: none !important; }
  .fs-scan-sheet, .insert-sheet-panel, .fs-sheet-hint { opacity: 1 !important; }
  .fs-sheet-hint { animation: none !important; }
}

/* While actively dragging: transform-only (GPU) — no transition fighting. */
.fs-scan-sheet.sheet-dragging,
.insert-sheet-panel.sheet-dragging { transition: none !important; will-change: transform; }

/* Dismiss drag: the pinned footer follows the card off-screen (var set in JS),
   so the whole sheet leaves together. Stays put (--fs-foot-y:0) while resizing. */
.fs-sheet-foot,
.insert-sheet-foot { transform: translateY(var(--fs-foot-y, 0px)); transition: transform .26s cubic-bezier(.22,.61,.36,1); }
.fs-scan-sheet.sheet-dragging .fs-sheet-foot,
.insert-sheet-panel.sheet-dragging .insert-sheet-foot { transition: none; }
/* Desktop: card + footer flow STATICALLY inside the centered window (these come
   after the base position:absolute rules, so they actually win). No overlap. */
@media (min-width: 880px) {
  .fs-sheet-card, .insert-sheet-card { position: static !important; transform: none !important; }
  .fs-sheet-foot, .insert-sheet-foot { position: static !important; transform: none !important; }
}

/* Fullscreen when expanded: square the top corners + drop the floating shadow,
   so the card reads as a full page covering the screen (and clears the notch). */
.fs-scan-sheet.expanded .fs-sheet-card,
.insert-sheet-panel.expanded .insert-sheet-card {
  box-shadow: none;
  padding-top: max(6px, env(safe-area-inset-top));
}
/* Cart list scrolls exactly like the scan-details body — one consistent feel. */
.insert-sheet-list { min-height: 0; -webkit-overflow-scrolling: touch; }

/* Background scroll-lock while a bottom sheet is open (no page scroll behind). */
body.sheet-locked { overflow: hidden; }

/* Scan sheet: compact peek must not scroll (title stayed put) — content scrolls
   only once expanded; an up-pull expands the sheet instead. */
.fs-scan-sheet:not(.expanded) .fs-sheet-scroll { overflow: hidden; }
