/* ==========================================================================
   Super Pest Controler — Floating Chat Widget
   Standalone CSS (not compiled through Tailwind). Load with:
   <link rel="stylesheet" href="/css/pest-chatbot.css">
   ========================================================================== */

.spc-chat {
  --spc-orange: #ea580c;
  --spc-orange-hover: #c2410c;
  --spc-blue: #1e3a8a;
  --spc-blue-light: #3b82f6;
  --spc-text: #172033;
  --spc-muted: #64748b;
  --spc-bg: #ffffff;
  --spc-light: #f8fafc;
  --spc-border: #e2e8f0;
  --spc-green: #16a34a;
  --spc-launcher-size: 56px;
  /* Clearance above the mobile action bar / desktop FAB stack */
  --spc-gap-bottom: 84px;
  --spc-edge: 16px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}

/* The chat launcher is the only control in the bottom-right corner. Call and
   WhatsApp are already in the sticky header, the mobile action bar and this
   widget's own panel, so their duplicate FAB circles were removed; the
   scroll-to-top button now lives in the opposite corner (left-8). */
@media (min-width: 1024px) {
  .spc-chat {
    --spc-gap-bottom: 32px;
    --spc-edge: 32px;
  }
}

/* --------------------------------------------------------------- Launcher */
.spc-launcher {
  position: fixed;
  right: var(--spc-edge);
  bottom: var(--spc-gap-bottom);
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  width: var(--spc-launcher-size);
  height: var(--spc-launcher-size);
  border: 0;
  border-radius: 999px;
  background: var(--spc-orange);
  color: #fff;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .18);
  transition: background-color .2s ease, transform .2s ease, opacity .2s ease;
}
.spc-launcher:hover { background: var(--spc-orange-hover); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, .22); }
.spc-launcher:focus-visible { outline: 3px solid var(--spc-blue-light); outline-offset: 3px; }
.spc-launcher__icon {
  width: var(--spc-launcher-size);
  height: var(--spc-launcher-size);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.spc-launcher__icon svg { width: 26px; height: 26px; }

/* Icon-only at every width. The label is kept in the DOM as the button's
   accessible name rather than as visible chrome. */
.spc-launcher__label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.spc-chat[data-open="true"] .spc-launcher { opacity: 0; pointer-events: none; transform: scale(.85); }

/* ------------------------------------------------------------- Call button */
/* Sits one step above the launcher in the same right-hand gutter. Navy keeps
   it legible against the orange launcher instead of two identical circles. */
.spc-callfab {
  position: fixed;
  right: var(--spc-edge);
  bottom: calc(var(--spc-gap-bottom) + var(--spc-launcher-size) + 14px);
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: var(--spc-launcher-size);
  height: var(--spc-launcher-size);
  border-radius: 999px;
  background: var(--spc-blue);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .18);
  transition: background-color .2s ease, transform .2s ease, opacity .2s ease,
              padding-right .2s ease;
}
.spc-callfab__icon {
  width: var(--spc-launcher-size);
  height: var(--spc-launcher-size);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.spc-callfab__icon svg { width: 24px; height: 24px; }
.spc-callfab__label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.spc-callfab:hover { background: #172e6d; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, .22); }
.spc-callfab:focus-visible { outline: 3px solid var(--spc-blue-light); outline-offset: 3px; }

/* Shown from lg up only; the mobile action bar already has a full-width Call. */
@media (min-width: 1024px) {
  .spc-callfab { display: flex; }
}

.spc-chat[data-open="true"] .spc-callfab,
.spc-chat[data-revealed="false"] .spc-callfab {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(.9);
}

/* Hidden over the hero so it never covers the page's primary CTA; revealed
   once the visitor scrolls past it (same threshold as the site's own FABs). */
.spc-chat[data-revealed="false"] .spc-launcher {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(.9);
}

/* Desktop hover affordance: the label expands out of the circle on hover or
   keyboard focus, so the button still explains itself without holding 194px
   of the viewport at all times. */
@media (min-width: 1024px) and (hover: hover) {
  .spc-launcher,
  .spc-callfab {
    width: auto;
    min-width: var(--spc-launcher-size);
    padding-right: 0;
    transition: background-color .2s ease, transform .2s ease, opacity .2s ease,
                padding-right .2s ease;
  }
  .spc-launcher__label,
  .spc-callfab__label {
    position: static;
    width: 0;
    height: auto;
    clip: auto;
    clip-path: none;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    transition: width .2s ease, opacity .2s ease;
  }
  .spc-launcher:hover,
  .spc-launcher:focus-visible,
  .spc-callfab:hover,
  .spc-callfab:focus-visible { padding-right: 18px; }
  .spc-launcher:hover .spc-launcher__label,
  .spc-launcher:focus-visible .spc-launcher__label,
  .spc-callfab:hover .spc-callfab__label,
  .spc-callfab:focus-visible .spc-callfab__label {
    width: auto;
    opacity: 1;
    padding-left: 2px;
  }
}

/* Unread/attention dot */
.spc-launcher__dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}
.spc-chat[data-seen="true"] .spc-launcher__dot { display: none; }

/* ------------------------------------------------------------------ Panel */
.spc-panel {
  position: fixed;
  right: var(--spc-edge);
  bottom: var(--spc-gap-bottom);
  z-index: 2147483001;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100dvh - var(--spc-gap-bottom) - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--spc-bg);
  border: 1px solid var(--spc-border);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .20);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.spc-chat[data-open="true"] .spc-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
@media (max-width: 480px) {
  .spc-panel {
    right: 8px; left: 8px;
    width: auto;
    max-width: none;
    height: calc(100dvh - var(--spc-gap-bottom) - 16px);
  }
}

/* ----------------------------------------------------------------- Header */
.spc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--spc-blue);
  color: #fff;
}
.spc-header__avatar {
  width: 38px; height: 38px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
}
.spc-header__avatar svg { width: 20px; height: 20px; }
.spc-header__text { min-width: 0; line-height: 1.2; }
.spc-header__title { font-size: 15px; font-weight: 700; }
.spc-header__status { font-size: 12px; color: #cbd5e1; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.spc-header__status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
}
.spc-close {
  margin-left: auto;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px;
  background: transparent; color: #fff; cursor: pointer;
}
.spc-close:hover { background: rgba(255, 255, 255, .15); }
.spc-close svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------- Messages */
.spc-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  background: var(--spc-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.spc-msg {
  max-width: 85%;
  padding: 10px 13px;
  font-size: 14.5px;
  line-height: 1.5;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.spc-msg--bot {
  align-self: flex-start;
  background: #fff;
  color: var(--spc-text);
  border: 1px solid var(--spc-border);
  border-bottom-left-radius: 4px;
}
.spc-msg--user {
  align-self: flex-end;
  background: var(--spc-orange);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.spc-msg--error {
  align-self: flex-start;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.spc-msg strong { font-weight: 700; }

/* Typing indicator */
.spc-typing { display: inline-flex; gap: 4px; align-items: center; height: 10px; }
.spc-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--spc-muted);
  animation: spc-bounce 1.2s infinite ease-in-out;
}
.spc-typing span:nth-child(2) { animation-delay: .15s; }
.spc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes spc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .spc-typing span { animation: none; }
  .spc-panel, .spc-launcher { transition: none; }
}

/* ----------------------------------------------------------- Quick chips */
.spc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.spc-chip {
  padding: 7px 13px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--spc-blue);
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.spc-chip:hover { background: #eff6ff; border-color: var(--spc-blue-light); }
.spc-chip:focus-visible { outline: 2px solid var(--spc-blue-light); outline-offset: 2px; }

/* Inline conversion CTAs inside a bot message */
.spc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
/* One primary action (Call) carries the colour; the alternatives are quiet
   outlines so the row reads as a choice, not three competing shouts. */
.spc-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--spc-orange);
  border-radius: 999px;
  text-decoration: none;
  color: #fff;
  background: var(--spc-orange);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.spc-action:hover { background: var(--spc-orange-hover); border-color: var(--spc-orange-hover); }
.spc-action--quote,
.spc-action--wa {
  background: #fff;
}
.spc-action--quote { color: var(--spc-blue); border-color: #c7d2fe; }
.spc-action--quote:hover { background: #eef2ff; border-color: var(--spc-blue); }
.spc-action--wa { color: var(--spc-green); border-color: #bbf7d0; }
.spc-action--wa:hover { background: #f0fdf4; border-color: var(--spc-green); }
.spc-action svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ Input */
.spc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--spc-border);
}
.spc-input {
  flex: 1;
  resize: none;
  max-height: 96px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--spc-text);
  background: var(--spc-light);
  border: 1px solid var(--spc-border);
  border-radius: 12px;
}
.spc-input:focus { outline: none; border-color: var(--spc-blue-light); background: #fff; }
.spc-send {
  width: 42px; height: 42px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px;
  background: var(--spc-orange);
  color: #fff;
  cursor: pointer;
  transition: background-color .15s ease;
}
.spc-send:hover:not(:disabled) { background: var(--spc-orange-hover); }
.spc-send:disabled { opacity: .5; cursor: not-allowed; }
.spc-send svg { width: 18px; height: 18px; }

/* ----------------------------------------------------------------- Footer */
.spc-footer {
  display: flex;
  border-top: 1px solid var(--spc-border);
  background: #fff;
}
.spc-footer a {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 6px;
  font-size: 13.5px; font-weight: 700;
  text-decoration: none;
  color: var(--spc-text);
  border-right: 1px solid var(--spc-border);
}
.spc-footer a:last-child { border-right: 0; }
.spc-footer a:hover { background: var(--spc-light); }
.spc-footer svg { width: 15px; height: 15px; }
.spc-footer .spc-f-call { color: var(--spc-orange); }
.spc-footer .spc-f-wa { color: var(--spc-green); }
.spc-footer .spc-f-quote { color: var(--spc-blue); }

.spc-sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
