/* ============================================================================
   Bro Fix Phones website chatbot — live-site styles, 1 Dec 2026.
   Taken from the chatbot preview (bro-fix-phones-chatbot-preview) and
   adapted from an inline chat card into a floating widget.
   Everything is scoped under #bfpChat and all variables are renamed
   --bfp-* on purpose: the site's own stylesheet uses --accent for its
   blue (#0072bc) while the chat uses orange (#e85d1f) — unscoped rules
   would have clobbered the whole site's colours.
   ========================================================================== */
#bfpChat {
  --bfp-panel: #ffffff;
  --bfp-panel-2: #f6f8fa;
  --bfp-ink: #12242f;
  --bfp-ink-soft: #43565f;
  --bfp-line: #d7dee3;
  --bfp-brand: #0e2a3d;
  --bfp-brand-ink: #ffffff;
  --bfp-accent: #e85d1f;
  --bfp-accent-soft: #fdeee6;
  --bfp-ok: #1e7d46;
  --bfp-ok-soft: #e5f3ea;
  --bfp-bot-bubble: #eef3f6;
  --bfp-user-bubble: #0e2a3d;
  --bfp-user-ink: #ffffff;
  --bfp-chip-bg: #ffffff;
  --bfp-shadow: 0 18px 50px rgba(14, 42, 61, 0.18);
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  #bfpChat {
    --bfp-panel: #122029;
    --bfp-panel-2: #0e1a22;
    --bfp-ink: #e8eff3;
    --bfp-ink-soft: #a7b8c1;
    --bfp-line: #24363f;
    --bfp-brand: #0e2a3d;
    --bfp-accent-soft: #3a2417;
    --bfp-bot-bubble: #1a2c38;
    --bfp-chip-bg: #16242f;
    --bfp-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
    --bfp-ok-soft: #14301f;
  }
}
#bfpChat button { cursor: pointer; font-family: inherit; }
#bfpChat button, #bfpChat input { font-family: inherit; }

/* ---------- Floating launcher (bottom-left: Netlify's "Powered by Netlify" badge sits bottom-right) ---------- */
#bfpChat .bfp-launcher {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 9998;
  min-height: 52px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  background: var(--bfp-accent);
  color: #fff;
  font-size: 15.5px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(232, 93, 31, 0.45);
  transition: transform 0.2s, background 0.2s;
}
#bfpChat .bfp-launcher:hover { transform: translateY(-2px); }

/* ---------- Floating panel ---------- */
#bfpChat .bfp-panel {
  position: fixed;
  left: 20px;
  bottom: 88px;
  z-index: 9999;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: min(640px, calc(100dvh - 140px));
  display: none;
}
#bfpChat .bfp-panel.open { display: block; }
@media (max-width: 480px) {
  #bfpChat .bfp-panel { left: 12px; bottom: 80px; width: calc(100vw - 24px); }
  #bfpChat .bfp-launcher { left: 12px; bottom: 12px; }
}

/* ---------- Chat widget (from preview) ---------- */
#bfpChat .chat-card {
  background: var(--bfp-panel); border: 1px solid var(--bfp-line);
  border-radius: 20px; box-shadow: var(--bfp-shadow); overflow: hidden;
  display: flex; flex-direction: column; height: 100%;
}
#bfpChat .chat-head {
  background: var(--bfp-brand); color: var(--bfp-brand-ink);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px; flex: none;
}
#bfpChat .avatar {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: var(--bfp-accent); color: #fff; display: grid; place-items: center;
  font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-weight: 700; font-size: 17px; letter-spacing: 0.5px;
}
#bfpChat .chat-head .who { flex: 1; min-width: 0; }
#bfpChat .chat-head .name { font-weight: 700; font-size: 16.5px; line-height: 1.15; }
#bfpChat .chat-head .status { font-size: 13px; opacity: 0.85; display: flex; align-items: center; gap: 6px; }
#bfpChat .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc74; flex: none; }
#bfpChat .restart-btn {
  min-height: 38px; min-width: 38px; padding: 6px 10px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.35); background: transparent; color: #fff;
  font-size: 13.5px; font-weight: 600;
}
#bfpChat .bfp-close {
  min-height: 38px; min-width: 38px; padding: 6px 10px; border-radius: 9px;
  border: none; background: transparent; color: #fff;
  font-size: 22px; font-weight: 400; line-height: 1;
}
#bfpChat .chat-body {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bfp-panel-2);
  scroll-behavior: smooth;
}
#bfpChat .msg { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.45; overflow-wrap: break-word; }
#bfpChat .msg.bot { background: var(--bfp-bot-bubble); color: var(--bfp-ink); border-bottom-left-radius: 5px; align-self: flex-start; }
#bfpChat .msg.user { background: var(--bfp-user-bubble); color: var(--bfp-user-ink); border-bottom-right-radius: 5px; align-self: flex-end; }
#bfpChat .msg p { margin: 0 0 6px; } #bfpChat .msg p:last-child { margin-bottom: 0; }
#bfpChat .msg .time { display: block; margin-top: 5px; font-size: 11px; opacity: 0.55; }

#bfpChat .quote-card {
  margin-top: 8px; background: var(--bfp-panel); border: 1px solid var(--bfp-line);
  border-radius: 12px; padding: 12px 13px; color: var(--bfp-ink);
}
#bfpChat .quote-card .q-title { font-weight: 700; font-size: 15px; }
#bfpChat .quote-card .q-sub { font-size: 13.5px; color: var(--bfp-ink-soft); }
#bfpChat .quote-card .q-price { font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-size: 34px; font-weight: 700; line-height: 1.1; margin: 4px 0 2px; }
#bfpChat .quote-card .q-price small { font-size: 14px; font-weight: 600; color: var(--bfp-ink-soft); font-family: "Barlow", sans-serif; }
#bfpChat .quote-card .q-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--bfp-ink-soft); margin-top: 6px; }
#bfpChat .quote-card .q-meta b { color: var(--bfp-ink); font-weight: 600; }

#bfpChat .book-card {
  margin-top: 8px; background: var(--bfp-ok-soft); border: 1px solid var(--bfp-ok);
  border-radius: 12px; padding: 12px 13px; color: var(--bfp-ink);
}
#bfpChat .book-card .b-title { font-weight: 700; display: flex; gap: 7px; align-items: center; }
#bfpChat .book-card dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 14px; }
#bfpChat .book-card dt { color: var(--bfp-ink-soft); } #bfpChat .book-card dd { margin: 0; font-weight: 600; }
#bfpChat .mail-btn {
  display: inline-block; margin-top: 4px; padding: 10px 16px; border-radius: 999px;
  background: var(--bfp-accent); color: #fff; font-weight: 700; font-size: 14px; text-decoration: none;
}
#bfpChat .mail-btn:hover { filter: brightness(1.07); }
#bfpChat .mail-btn:active { transform: scale(0.97); }

#bfpChat .typing { align-self: flex-start; background: var(--bfp-bot-bubble); border-radius: 16px; border-bottom-left-radius: 5px; padding: 12px 14px; display: none; gap: 5px; }
#bfpChat .typing.on { display: flex; }
#bfpChat .typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--bfp-ink-soft); animation: bfp-blink 1.1s infinite; }
#bfpChat .typing span:nth-child(2) { animation-delay: 0.18s; } #bfpChat .typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes bfp-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #bfpChat .typing span { animation: none; } #bfpChat .chat-body { scroll-behavior: auto; } }

#bfpChat .chips { flex: none; display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 12px 4px; background: var(--bfp-panel); }
#bfpChat .chips:empty { padding: 0; }
#bfpChat .chip {
  min-height: 38px; padding: 8px 13px; border-radius: 999px; font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--bfp-accent); color: var(--bfp-accent); background: var(--bfp-chip-bg);
}
#bfpChat .chip.primary { background: var(--bfp-accent); color: #fff; }
#bfpChat .chip:active { transform: scale(0.97); }

#bfpChat .chat-input { flex: none; display: flex; gap: 8px; padding: 10px 12px 12px; background: var(--bfp-panel); }
#bfpChat .chat-input input {
  flex: 1; min-width: 0; min-height: 46px; padding: 10px 14px; font-size: 16px;
  border: 1.5px solid var(--bfp-line); border-radius: 12px; background: var(--bfp-panel-2); color: var(--bfp-ink);
}
#bfpChat .chat-input input:focus { outline: 2px solid var(--bfp-accent); outline-offset: 0; border-color: transparent; }
#bfpChat .send-btn {
  min-height: 46px; min-width: 52px; padding: 0 16px; border: none; border-radius: 12px;
  background: var(--bfp-accent); color: #fff; font-weight: 700; font-size: 15px;
}

/* ---------- Booking inbox (kept from the preview, hidden on the live site) ----------
   The preview recorded bookings in a visible on-page inbox panel. There is no
   email/backend delivery in the preview, so on the live site the same record
   is kept in this hidden container and the bot no longer claims a text or
   email was sent. A real delivery mechanism (e.g. Netlify Forms) still
   needs to be chosen before this goes live. */
#bfpChat .bfp-inbox { display: none; }
