/* ============================================================
   Locksmith Callbar — mobile sticky bottom nav + Call FAB +
   slide-up Services / Contact / Referral sheets.
   Ported 1:1 from the Fast Locksmith design handoff (design_handoff_bottom_bar).
   Scoped under .lq-cb so it can ship on any locksmith site or the
   customer portal without colliding with fl.css / portal styles.

   Theming: set --cb-accent (and optionally the surface tokens) on
   .lq-cb — e.g. <div class="lq-cb" style="--cb-accent:#2D6BFF">.
   Defaults are the Fast Locksmith cream / vermilion palette.

   Body classes (set by locksmith-callbar.js on <body>):
     lq-svc-open / lq-ct-open / lq-rf-open
   ============================================================ */
.lq-cb {
  --cb-cream: #EBE7DB;        /* input / sub-surface fills */
  --cb-card: #F6F3EA;         /* bar + sheet surface */
  --cb-sunk: #E1DCCC;         /* pressed list rows, icon wells */
  --cb-ink: #1A1712;          /* text, referral offer block */
  --cb-accent: #E63A1F;       /* FAB, active tab, CTA, prices */
  --cb-accent-d: color-mix(in srgb, var(--cb-accent) 84%, #000);
  --cb-border: #D8D2C1;
  --cb-border-strong: #C6BFAA;
  --cb-muted: #746F5E;
  --cb-faint: #9A937E;
  --cb-font: 'Archivo', system-ui, sans-serif;
  --cb-display: 'Archivo Black', 'Archivo', sans-serif;
  --cb-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  font-family: var(--cb-font);
}
.lq-cb *, .lq-cb *::before, .lq-cb *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- Sticky bottom nav + call FAB ---------- */
.lq-cb .callbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  --liftY: 0px;
  display: flex; align-items: flex-end; gap: 0; height: calc(64px + env(safe-area-inset-bottom));
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--cb-card) 94%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--cb-border);
}
body.lq-svc-open .lq-cb .callbar { --liftY: calc(min(64vh, 540px) + 12px); }
body.lq-ct-open  .lq-cb .callbar { --liftY: calc(min(62vh, 505px) + 12px); }
body.lq-rf-open  .lq-cb .callbar { --liftY: calc(min(46vh, 365px) + 12px); }
.lq-cb .cb-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding-bottom: 2px; color: var(--cb-muted); text-decoration: none;
  background: none; border: none;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
  transition: color .12s, transform .08s;
}
.lq-cb .cb-tab:active { transform: scale(.92); }
.lq-cb .cb-tab svg { width: 21px; height: 21px; }
.lq-cb .cb-tab span {
  font-family: var(--cb-mono); font-size: 8px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.lq-cb .cb-tab.on { color: var(--cb-accent); }
/* Pressed tab swaps its icon for an X (close) while its sheet is open. */
.lq-cb .cb-tab .ic-x { display: none; }
body.lq-svc-open .lq-cb [data-sheet="lq-svc-open"] .ic-n,
body.lq-ct-open  .lq-cb [data-sheet="lq-ct-open"]  .ic-n,
body.lq-rf-open  .lq-cb [data-sheet="lq-rf-open"]  .ic-n { display: none; }
body.lq-svc-open .lq-cb [data-sheet="lq-svc-open"] .ic-x,
body.lq-ct-open  .lq-cb [data-sheet="lq-ct-open"]  .ic-x,
body.lq-rf-open  .lq-cb [data-sheet="lq-rf-open"]  .ic-x { display: block; }
.lq-cb .cb-gap { width: 76px; flex-shrink: 0; }
.lq-cb .cb-fab {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px);
  transform: translateX(-50%) translateY(calc(-1 * var(--liftY)));
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--cb-accent); color: #fff; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: 0 12px 24px -8px color-mix(in srgb, var(--cb-accent) 70%, transparent),
              0 0 0 5px var(--cb-card);
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, transform .34s cubic-bezier(.32,.72,.28,1);
}
.lq-cb .cb-fab:active {
  transform: translateX(-50%) translateY(calc(-1 * var(--liftY))) scale(.94);
  background: var(--cb-accent-d);
}
.lq-cb .cb-fab svg { width: 23px; height: 23px; }
.lq-cb .cb-fab span {
  font-family: var(--cb-mono); font-size: 7px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ---------- Scrim ---------- */
.lq-cb .svc-scrim {
  position: fixed; inset: 0; z-index: 33;
  background: rgba(26,23,18,0.45);
  opacity: 0; pointer-events: none; transition: opacity .28s;
}
body.lq-svc-open .lq-cb .svc-scrim,
body.lq-ct-open  .lq-cb .svc-scrim,
body.lq-rf-open  .lq-cb .svc-scrim { opacity: 1; pointer-events: auto; }

/* ---------- Sheet shell ---------- */
.lq-cb .svc-sheet {
  position: fixed; left: 0; right: 0; z-index: 34;
  bottom: calc(64px + env(safe-area-inset-bottom));
  height: min(64vh, 540px);
  background: var(--cb-card);
  color: var(--cb-ink);
  border-top: 1px solid var(--cb-border-strong);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -18px 50px -22px rgba(26,23,18,0.5);
  display: flex; flex-direction: column;
  transform: translateY(calc(100% + 80px + env(safe-area-inset-bottom)));
  transition: transform .34s cubic-bezier(.32,.72,.28,1);
}
body.lq-svc-open .lq-cb #lqSvcSheet { transform: translateY(0); }
.lq-cb .ct-sheet { height: min(62vh, 505px); }
body.lq-ct-open .lq-cb .ct-sheet { transform: translateY(0); }
.lq-cb .rf-sheet { height: min(46vh, 365px); }
body.lq-rf-open .lq-cb .rf-sheet { transform: translateY(0); }

.lq-cb .svc-handle { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 44px; height: 4px; border-radius: 99px; background: var(--cb-border-strong); }
.lq-cb .svc-head { display: flex; align-items: center; gap: 10px; padding: 20px 16px 10px; }
.lq-cb .svc-head h3 { font-family: var(--cb-display); font-size: 16px; font-weight: 400; letter-spacing: -0.3px; text-transform: uppercase; color: var(--cb-ink); }
.lq-cb .svc-count { font-family: var(--cb-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cb-faint); }
.lq-cb .svc-close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--cb-border-strong); background: var(--cb-cream); cursor: pointer; display: grid; place-items: center; color: var(--cb-ink); }
.lq-cb .svc-close svg { width: 15px; height: 15px; }

/* ---------- Services sheet ---------- */
.lq-cb .svc-search { margin: 0 16px 10px; display: flex; align-items: center; gap: 9px; background: var(--cb-cream); border: 1px solid var(--cb-border-strong); border-radius: 10px; padding: 11px 12px; }
.lq-cb .svc-search svg { width: 16px; height: 16px; color: var(--cb-faint); flex-shrink: 0; }
.lq-cb .svc-search input { flex: 1; min-width: 0; border: none; background: none; outline: none; font-family: var(--cb-mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.03em; text-transform: uppercase; color: var(--cb-ink); }
.lq-cb .svc-search input::placeholder { color: var(--cb-faint); }

/* Horizontal padding on an overflow-x scroller is unreliable (the end-side
   padding collapses once scrolled, and some host pages reset it entirely) —
   flex spacer pseudo-elements scroll WITH the chips instead, so the first
   chip starts 16px in and the last chip ends 16px short of the edge.
   9px spacer + 7px gap = 16px effective inset on both ends. */
.lq-cb .svc-cats { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 12px; flex-shrink: 0; scrollbar-width: none; white-space: nowrap; }
.lq-cb .svc-cats::before, .lq-cb .svc-cats::after { content: ""; flex: 0 0 9px; }
.lq-cb .svc-cats::-webkit-scrollbar { display: none; }
.lq-cb .svc-cat { flex-shrink: 0; white-space: nowrap; font-family: var(--cb-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 8px 12px; border-radius: 3px; border: 1px solid var(--cb-border-strong); background: var(--cb-cream); color: var(--cb-muted); cursor: pointer; }
.lq-cb .svc-cat.on { background: var(--cb-ink); color: var(--cb-card); border-color: var(--cb-ink); }
/* "All services" — accent chip at the END of the swipe row. Selected state
   (.on) goes a shade darker so it still reads as pressed. */
.lq-cb .svc-cat.svc-cat-all { background: var(--cb-accent); color: #fff; border-color: var(--cb-accent); }
.lq-cb .svc-cat.svc-cat-all.on { background: var(--cb-accent-d); color: #fff; border-color: var(--cb-accent-d); }

.lq-cb .svc-list { flex: 1; overflow-y: auto; padding: 0 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.lq-cb .svc-item { display: flex; align-items: center; gap: 12px; background: var(--cb-cream); border: 1px solid var(--cb-border); border-radius: 12px; padding: 12px; cursor: pointer; text-align: left; font-family: var(--cb-font); text-decoration: none; }
.lq-cb .svc-item:active { background: var(--cb-sunk); }
.lq-cb .svc-item .si { width: 38px; height: 38px; border-radius: 9px; background: var(--cb-sunk); display: grid; place-items: center; color: var(--cb-ink); flex-shrink: 0; }
.lq-cb .svc-item .si svg { width: 18px; height: 18px; }
.lq-cb .svc-item .sm { flex: 1; min-width: 0; }
.lq-cb .svc-item .sn { font-weight: 700; font-size: 14px; color: var(--cb-ink); }
.lq-cb .svc-item .sc { font-family: var(--cb-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cb-faint); margin-top: 2px; }
.lq-cb .svc-item .sp { font-family: var(--cb-mono); font-size: 11.5px; font-weight: 700; color: var(--cb-accent); white-space: nowrap; }
.lq-cb .svc-empty { text-align: center; color: var(--cb-faint); font-family: var(--cb-mono); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 28px 0; }

/* ---------- Service detail view (in-sheet) ---------- */
.lq-cb .svc-sheet.detail-open .svc-search,
.lq-cb .svc-sheet.detail-open .svc-cats,
.lq-cb .svc-sheet.detail-open .svc-list { display: none; }
.lq-cb .svc-detail { flex: 1; overflow-y: auto; padding: 0 16px 18px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.lq-cb .sd-back { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-family: var(--cb-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cb-muted); background: var(--cb-cream); border: 1px solid var(--cb-border-strong); border-radius: 8px; padding: 8px 12px 8px 9px; cursor: pointer; margin-bottom: 14px; }
.lq-cb .sd-back svg { width: 14px; height: 14px; }
.lq-cb .sd-cat { font-family: var(--cb-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cb-faint); }
.lq-cb .sd-name { font-family: var(--cb-display); font-size: 24px; letter-spacing: -0.4px; text-transform: uppercase; color: var(--cb-ink); line-height: 1.1; margin-top: 4px; }
.lq-cb .sd-price { font-family: var(--cb-mono); font-size: 13px; font-weight: 700; color: var(--cb-accent); margin-top: 6px; }
.lq-cb .sd-desc { font-family: var(--cb-font); font-size: 14px; font-weight: 500; line-height: 1.55; color: var(--cb-muted); margin-top: 10px; }
.lq-cb .sd-add { margin-top: 16px; width: 100%; }
.lq-cb .sd-add.added { background: var(--cb-ink); }
.lq-cb .sd-visit { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; font-family: var(--cb-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cb-ink); text-decoration: none; background: var(--cb-cream); border: 1px solid var(--cb-border-strong); border-radius: 12px; padding: 12px 14px; }
.lq-cb .sd-visit svg { width: 14px; height: 14px; color: var(--cb-accent); }

/* ---------- Cart bar (sheet foot) + tab badge ---------- */
.lq-cb .svc-cartbar { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 10px 16px calc(10px + 4px); border-top: 1px solid var(--cb-border); background: var(--cb-cream); }
.lq-cb .svc-cartbar[hidden] { display: none; }
.lq-cb .cbar-count { font-family: var(--cb-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cb-ink); }
.lq-cb .cbar-clear { font-family: var(--cb-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cb-faint); background: none; border: none; cursor: pointer; text-decoration: underline; }
.lq-cb .cbar-go { margin-left: auto; margin-top: 0; padding: 10px 14px; font-size: 11px; border-radius: 10px; }
.lq-cb .cb-tab { position: relative; }
.lq-cb .cb-badge { position: absolute; top: -3px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--cb-accent); color: #fff; font-family: var(--cb-mono); font-style: normal; font-size: 9px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--cb-card); }

/* ---------- Contact sheet ---------- */
.lq-cb .ct-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 4px; }
.lq-cb .ct-quick.one-col { grid-template-columns: 1fr; }
.lq-cb .ct-quick a { display: flex; align-items: center; justify-content: center; gap: 7px; font-family: var(--cb-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cb-ink); text-decoration: none; background: var(--cb-cream); border: 1px solid var(--cb-border-strong); border-radius: 10px; padding: 11px 8px; }
.lq-cb .ct-quick a svg { width: 15px; height: 15px; color: var(--cb-accent); flex-shrink: 0; }
.lq-cb .ct-or { display: flex; align-items: center; gap: 10px; padding: 10px 16px 8px; font-family: var(--cb-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cb-faint); }
.lq-cb .ct-or::before, .lq-cb .ct-or::after { content: ""; flex: 1; height: 1px; background: var(--cb-border); }
.lq-cb .ct-form { flex: 1; overflow-y: auto; padding: 0 16px 18px; display: flex; flex-direction: column; gap: 9px; }
.lq-cb .ct-field { display: flex; flex-direction: column; gap: 5px; }
.lq-cb .ct-field label { font-family: var(--cb-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cb-faint); }
.lq-cb .ct-field input, .lq-cb .ct-field textarea, .lq-cb .ct-field select { background: var(--cb-cream); border: 1px solid var(--cb-border-strong); border-radius: 10px; padding: 11px 12px; font-family: var(--cb-font); font-size: 14px; font-weight: 500; color: var(--cb-ink); outline: none; resize: none; width: 100%; appearance: none; -webkit-appearance: none; }
.lq-cb .ct-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23746F5E' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
  padding-right: 34px;
}
.lq-cb .ct-field input:focus, .lq-cb .ct-field textarea:focus, .lq-cb .ct-field select:focus { border-color: var(--cb-ink); }
.lq-cb .ct-field input::placeholder, .lq-cb .ct-field textarea::placeholder { color: var(--cb-faint); }
.lq-cb .cb-hp { position: absolute; left: -9999px; top: -9999px; height: 1px; width: 1px; overflow: hidden; }

.lq-cb .cb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--cb-mono); font-weight: 700; font-size: 12.5px;
  letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: 12px; padding: 13px 16px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; margin-top: 3px;
  background: var(--cb-accent); color: #fff;
  transition: background .12s, transform .04s;
}
.lq-cb .cb-btn:active { transform: translateY(1px); background: var(--cb-accent-d); }
.lq-cb .cb-btn[disabled] { opacity: .6; pointer-events: none; }

/* ---------- Referral sheet ---------- */
.lq-cb .rf-body { flex: 1; overflow-y: auto; padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.lq-cb .rf-offer { background: var(--cb-ink); border-radius: 14px; padding: 18px 16px; color: var(--cb-card); }
.lq-cb .rf-offer .ro-amt { font-family: var(--cb-display); font-size: 30px; font-weight: 400; letter-spacing: -0.6px; text-transform: uppercase; line-height: 1.05; }
.lq-cb .rf-offer .ro-amt sup { font-size: 16px; color: var(--cb-accent); }
.lq-cb .rf-offer .ro-sub { font-family: var(--cb-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #C9C3B2; margin-top: 7px; }
.lq-cb .rf-link { display: flex; align-items: center; gap: 8px; background: var(--cb-cream); border: 1px dashed var(--cb-border-strong); border-radius: 10px; padding: 6px 6px 6px 12px; }
.lq-cb .rf-link .rl-url { flex: 1; min-width: 0; font-family: var(--cb-mono); font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; color: var(--cb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lq-cb .rf-link button { flex-shrink: 0; font-family: var(--cb-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; background: var(--cb-accent); border: none; border-radius: 7px; padding: 9px 13px; cursor: pointer; }
.lq-cb .rf-link button:active { background: var(--cb-accent-d); }
.lq-cb .rf-fine { font-family: var(--cb-mono); font-size: 9.5px; font-weight: 500; letter-spacing: 0.03em; line-height: 1.6; color: var(--cb-faint); }
.lq-cb .rf-fine sup { color: var(--cb-accent); }
/* Signed-out referral CTA — mono note + Sign in / Sign up pair in one row. */
.lq-cb .rf-auth { display: flex; flex-direction: column; gap: 8px; }
.lq-cb .rf-auth-note { font-family: var(--cb-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cb-faint); }
.lq-cb .rf-auth-btns { display: flex; gap: 8px; }
.lq-cb .rf-auth-btns .cb-btn { flex: 1; margin-top: 0; }
.lq-cb .rf-auth-btns .rf-signin { background: var(--cb-cream); color: var(--cb-ink); border-color: var(--cb-border-strong); }
.lq-cb .rf-auth-btns .rf-signin:active { background: var(--cb-sunk); }

/* ---------- Toast ---------- */
.lq-cb .cb-toast {
  position: fixed; left: 50%; bottom: 150px; z-index: 70;
  transform: translateX(-50%) translateY(16px);
  background: var(--cb-ink); color: #fff;
  font-family: var(--cb-font); font-size: 13.5px; font-weight: 600;
  padding: 12px 18px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: all .25s;
  display: flex; align-items: center; gap: 9px;
  box-shadow: 0 18px 50px -22px rgba(26,23,18,0.50);
  max-width: calc(100vw - 32px); text-align: center;
}
.lq-cb .cb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.lq-cb .cb-toast .tk { width: 8px; height: 8px; border-radius: 50%; background: #3C8F5F; flex-shrink: 0; }

/* Keep page content clear of the fixed bar (mobile only). */
@media (max-width: 999.98px) {
  body:has(.lq-cb) { padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
}

/* Scroll lock — the page behind must not scroll while a sheet is open.
   Sheet interiors keep scrolling; overscroll-behavior stops the chain. */
body.lq-svc-open, body.lq-ct-open, body.lq-rf-open { overflow: hidden; }
.lq-cb .svc-list, .lq-cb .ct-form, .lq-cb .rf-body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* ---------- Desktop: component is mobile-only ---------- */
@media (min-width: 1000px) {
  .lq-cb { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .lq-cb .svc-sheet, .lq-cb .svc-scrim, .lq-cb .cb-fab, .lq-cb .cb-toast { transition: none; }
}

/* ---------- Services | Parts mode switch ---------- */
.lq-cb .svc-mode { display: flex; gap: 4px; margin: 0 16px 10px; background: var(--cb-cream); border: 1px solid var(--cb-border-strong); border-radius: 10px; padding: 3px; }
.lq-cb .svc-mode-btn { flex: 1; font-family: var(--cb-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--cb-muted); background: none; border: none; border-radius: 8px; padding: 9px 6px; cursor: pointer; }
.lq-cb .svc-mode-btn.on { background: var(--cb-ink); color: var(--cb-card); }
