/* SitesMade chat button: a blue round SitesMade button with a WhatsApp badge, fixed bottom right on
   every page and above the phone tab bar. A greeting bubble and a small options panel open above it. */
.sm-chat {
  position: fixed; z-index: 44;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--tabbar-h, 0px) + 20px);
  display: grid; justify-items: end; gap: 14px;
  font-family: var(--body);
}

.sm-chat-btn {
  position: relative; width: 72px; height: 72px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: #fff;
  box-shadow: 0 12px 30px -8px rgba(14, 21, 48, .45), 0 2px 6px rgba(14, 21, 48, .15), inset 0 0 0 2px var(--blue-100);
  transition: transform .2s, box-shadow .2s;
  animation: sm-chat-in .5s cubic-bezier(.2, 1.4, .4, 1) .8s both;
}
.sm-chat-btn:hover { transform: translateY(-2px) scale(1.03); }
.sm-chat-btn:focus-visible { outline: 3px solid var(--blue-hi); outline-offset: 3px; }
.sm-chat-mark { position: absolute; inset: 0; display: grid; place-items: center; }
.sm-chat-mark svg { width: 100%; height: 100%; }
.sm-chat-badge {
  position: absolute; right: -3px; bottom: -3px; width: 26px; height: 26px; border-radius: 50%;
  background: #25d366; color: #fff; display: grid; place-items: center;
  box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(14, 21, 48, .25);
}
.sm-chat-badge svg { width: 15px; height: 15px; }
.sm-chat.open .sm-chat-btn { box-shadow: 0 12px 30px -8px rgba(14, 21, 48, .45), 0 0 0 4px var(--blue-100), inset 0 0 0 2px var(--blue); }
/* When open, a pointer joins the panel to the button, like a speech bubble coming from it */
.sm-chat.open::after {
  content: ""; position: absolute; z-index: 1;
  right: 27px; bottom: 77px; width: 18px; height: 18px;
  background: var(--bg); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-bottom-right-radius: 4px; transform: rotate(45deg);
  animation: sm-chat-pop .3s cubic-bezier(.2, 1.1, .4, 1);
}

/* Greeting bubble */
.sm-chat-hello {
  position: relative; max-width: 250px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px 18px 6px 18px;
  box-shadow: var(--shadow-lg); padding: 12px 36px 12px 14px;
  animation: sm-chat-pop .35s cubic-bezier(.2, 1.2, .4, 1);
}
.sm-chat-hello-text { all: unset; cursor: pointer; font-size: 14.5px; font-weight: 600; line-height: 1.4; display: block; }
.sm-chat-hello-text:focus-visible { outline: 3px solid var(--blue-hi); outline-offset: 4px; border-radius: 6px; }
.sm-chat-hello .sm-chat-x { position: absolute; top: 6px; right: 6px; }

/* Close buttons */
.sm-chat-x {
  width: 28px; height: 28px; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1;
  display: grid; place-items: center;
}
.sm-chat-x:hover { background: var(--surface-2); color: var(--ink); }
.sm-chat-x:focus-visible { outline: 3px solid var(--blue-hi); outline-offset: 1px; }

/* Options panel */
.sm-chat-panel {
  width: min(340px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: sm-chat-pop .3s cubic-bezier(.2, 1.1, .4, 1);
  transform-origin: bottom right;
}
.sm-chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; background: var(--navy); color: #fff; }
.sm-chat-head .sm-chat-x { color: var(--on-navy-muted); margin-left: auto; }
.sm-chat-head .sm-chat-x:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sm-chat-avatar { width: 46px; height: 46px; padding: 4px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .15); }
.sm-chat-avatar svg { width: 100%; height: 100%; }
.sm-chat-who { display: grid; line-height: 1.25; }
.sm-chat-who b { font-size: 15.5px; }
.sm-chat-who small { font-size: 12.5px; color: var(--on-navy-muted); }
.sm-chat-body { padding: 16px; display: grid; gap: 10px; background: var(--bg); }
.sm-chat-msg { justify-self: start; max-width: 85%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 6px; padding: 10px 13px; font-size: 14.5px; }
.sm-chat-pick { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; margin-top: 4px; }
.sm-chat-opts { display: grid; gap: 8px; }
.sm-chat-opt {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 14px; border: 1.5px solid var(--blue-100); background: var(--surface);
  color: var(--ink); font-size: 14.5px; font-weight: 600; text-decoration: none;
  transition: border-color .15s, background .15s;
}
.sm-chat-opt span { color: var(--blue); }
.sm-chat-opt:hover { border-color: var(--blue); background: var(--blue-50); }
.sm-chat-opt:focus-visible { outline: 3px solid var(--blue-hi); outline-offset: 2px; }
.sm-chat-wa {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px;
  padding: 12px; border-radius: 14px; background: #128c4a; color: #fff; font-weight: 700; font-size: 14.5px; text-decoration: none;
}
.sm-chat-wa svg { width: 18px; height: 18px; }
.sm-chat-wa:hover { background: #0d6b39; }
.sm-chat-wa:focus-visible { outline: 3px solid var(--blue-hi); outline-offset: 2px; }

/* Back to top: a blue rounded square centred above the chat button (and above the greeting while it shows),
   shown once you scroll down */
.sm-top {
  justify-self: end; margin-right: 10px;
  width: 52px; height: 52px; padding: 0; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--blue); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px -8px rgba(31, 94, 255, .6), 0 2px 6px rgba(14, 21, 48, .15);
  opacity: 0; visibility: hidden; transform: translateY(10px) scale(.9);
  transition: opacity .25s, transform .25s cubic-bezier(.2, 1.3, .4, 1), visibility .25s, background .15s;
}
.sm-top.show { opacity: 1; visibility: visible; transform: none; }
.sm-top:hover { background: var(--blue-hi); transform: translateY(-2px); }
.sm-top:focus-visible { outline: 3px solid var(--blue-hi); outline-offset: 3px; }
/* While the chat panel is open, the panel sits right above the chat button */
.sm-chat.open .sm-top { display: none; }

/* Leave room so the button never covers the footer's last links */
footer.site .legal { padding-right: 96px; }

@keyframes sm-chat-in { from { opacity: 0; transform: scale(.6) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sm-chat-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .sm-chat { right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--tabbar-h, 0px) + 14px); }
  .sm-chat-btn { width: 64px; height: 64px; }
  footer.site .legal { padding-right: 80px; }
  .sm-top { width: 48px; height: 48px; border-radius: 15px; margin-right: 8px; }
  .sm-chat.open::after { right: 23px; bottom: 69px; }
  .sm-chat-panel { max-height: calc(100vh - var(--tabbar-h, 0px) - 120px); overflow-y: auto; }
  /* Keep out of the way while the cookie banner is showing */
  body:has(.cc-banner) .sm-chat { visibility: hidden; pointer-events: none; }
}
