/* Grace web chat for tummysolutions.com. No framework, no CDN, no web fonts.
   A message window: header, thread, composer. Colors come from the site:
   primary rgb(67,86,163) #4356a3, hover tint #6a7cc4, dark #334380. */

.gws {
  --gws-navy: #4356a3;
  --gws-navy-2: #334380;
  --gws-gold: #6a7cc4;
  --gws-ink: #1b1e28;
  --gws-mute: #6a6f80;
  --gws-line: #e3e6ee;
  --gws-paper: #ffffff;
  --gws-mist: #eef0f8;
  --gws-shadow: 0 18px 48px rgba(28, 38, 84, 0.28), 0 2px 8px rgba(28, 38, 84, 0.12);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--gws-ink);
  -webkit-font-smoothing: antialiased;
}

.gws *,
.gws *::before,
.gws *::after { box-sizing: border-box; }

.gws button { font: inherit; }

.gws-pill:focus-visible,
.gws button:focus-visible,
.gws textarea:focus-visible,
.gws a:focus-visible {
  outline: 3px solid var(--gws-navy);
  outline-offset: 2px;
}

/* Launcher: a round message-bubble button */
.gws-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--gws-navy);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(28, 38, 84, 0.35);
  transition: transform 140ms ease, background 140ms ease;
}
.gws-pill:hover { background: var(--gws-navy-2); transform: translateY(-2px); }
.gws-pill svg { width: 28px; height: 28px; fill: #fff; }
.gws-open .gws-pill { display: none; }

/* Window */
.gws-panel {
  display: none;
  flex-direction: column;
  width: 384px;
  height: min(640px, calc(100vh - 40px));
  overflow: hidden;
  border-radius: 18px;
  background: var(--gws-paper);
  box-shadow: var(--gws-shadow);
}
.gws-open .gws-panel {
  display: flex;
  animation: gws-in 180ms ease-out;
}
@keyframes gws-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* Header */
.gws-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--gws-navy);
  color: #fff;
}
.gws-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: var(--gws-navy-2);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}
.gws-who { flex: 1 1 auto; min-width: 0; }
.gws-who h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}
.gws-who p {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 6px;
}
.gws-who p::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6fd39a;
}
.gws-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.gws-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* Thread */
.gws-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--gws-paper);
  overscroll-behavior: contain;
}
.gws-msg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 18px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 15px;
}
.gws-them {
  align-self: flex-start;
  background: var(--gws-mist);
  color: var(--gws-ink);
  border-bottom-left-radius: 6px;
}
.gws-me {
  align-self: flex-end;
  background: var(--gws-navy);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.gws-sys {
  align-self: flex-start;
  max-width: 84%;
  margin: -2px 0 4px 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--gws-mute);
}

/* Quick replies inside the thread */
.gws-chips {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 92%;
  margin: 2px 0 4px;
}
.gws-chips button {
  padding: 8px 14px;
  border: 1.5px solid var(--gws-navy);
  border-radius: 999px;
  background: #fff;
  color: var(--gws-navy);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.gws-chips button:hover { background: var(--gws-navy); color: #fff; }

/* Booking card */
.gws-card {
  align-self: flex-start;
  width: 84%;
  padding: 14px 14px 12px;
  border: 1px solid var(--gws-line);
  border-left: 4px solid var(--gws-navy);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(16, 22, 48, 0.06);
}
.gws-card b {
  display: block;
  font-size: 15px;
  color: var(--gws-navy);
  margin-bottom: 3px;
}
.gws-card span {
  display: block;
  font-size: 13px;
  color: var(--gws-mute);
  margin-bottom: 10px;
}
.gws-card a {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--gws-navy);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.gws-card a:hover { background: var(--gws-navy-2); }

/* Typing */
.gws-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 5px;
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  background: var(--gws-mist);
}
.gws-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa0b4;
  animation: gws-blink 1.1s infinite ease-in-out;
}
.gws-typing i:nth-child(2) { animation-delay: 0.15s; }
.gws-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes gws-blink {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Composer */
.gws-foot {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--gws-line);
  background: var(--gws-paper);
}
.gws-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1.5px solid var(--gws-line);
  border-radius: 24px;
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.gws-row:focus-within {
  border-color: var(--gws-navy);
  box-shadow: 0 0 0 3px rgba(31, 42, 87, 0.12);
}
.gws-row textarea {
  flex: 1 1 auto;
  min-height: 24px;
  max-height: 120px;
  padding: 6px 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--gws-ink);
}
.gws-row textarea::placeholder { color: #6a6f80; }
.gws-row textarea:focus-visible { outline: none; }
.gws-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--gws-navy);
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 120ms ease;
}
.gws-send svg { width: 18px; height: 18px; fill: currentColor; }
.gws-send:hover { background: var(--gws-navy-2); }
.gws-send:disabled { background: #c5c9d6; cursor: default; }
.gws-count {
  display: none;
  margin: 6px 4px 0 auto;
  font-size: 11.5px;
  color: var(--gws-mute);
  text-align: right;
}
.gws-count.gws-show { display: block; }
.gws-count.gws-over { color: #b3261e; }
.gws-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Phones: full-screen sheet */
@media (max-width: 520px) {
  .gws { right: 14px; bottom: 14px; }
  .gws-pill { width: 56px; height: 56px; }
  .gws-pill svg { width: 26px; height: 26px; }
  .gws-open { inset: 0; right: 0; bottom: 0; }
  .gws-panel {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .gws-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .gws-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .gws-msg, .gws-card, .gws-sys { max-width: 90%; }
}

@media (prefers-reduced-motion: reduce) {
  .gws-open .gws-panel { animation: none; }
  .gws-typing i { animation: none; opacity: 0.7; }
  .gws-pill { transition: none; }
}
