/* "Grace" chat widget — styled to Laura's logo colours.
 * Self-contained so it can be lifted onto the parent spsofmichigan.com later
 * without dragging the whole site stylesheet with it. */

.gchat { position: fixed; right: 22px; bottom: 22px; z-index: 900; font: 400 16px/1.6 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.gchat .sr { position: absolute; left: -9999px; }

/* ---- launcher ---- */
.gchat-fab {
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; box-shadow: 0 10px 30px -8px rgba(47,93,79,.55), 0 0 0 3px rgba(47,93,79,.14);
  display: grid; place-items: center; position: relative;
  transition: transform .22s cubic-bezier(.4,.1,.2,1), box-shadow .22s;
}
.gchat-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 16px 36px -10px rgba(47,93,79,.65), 0 0 0 4px rgba(47,93,79,.2); }
.gchat-fab img { display: block; }
.gchat-fab-x { display: none; position: relative; width: 22px; height: 22px; }
.gchat-fab-x::before, .gchat-fab-x::after {
  content: ""; position: absolute; inset: 0 0 auto 0; top: 10px; height: 2.5px;
  background: #2F5D4F; border-radius: 2px;
}
.gchat-fab-x::before { transform: rotate(45deg); }
.gchat-fab-x::after  { transform: rotate(-45deg); }
.gchat.is-open .gchat-fab img { display: none; }
.gchat.is-open .gchat-fab-x { display: block; }

.gchat-dot {
  position: absolute; top: 4px; right: 4px; width: 15px; height: 15px; border-radius: 50%;
  background: #2F5D4F; border: 2.5px solid #fff;
  animation: gpulse 2.4s ease-in-out infinite;
}
@keyframes gpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.16); } }

/* ---- nudge ---- */
.gchat-nudge {
  position: absolute; right: 0; bottom: 80px; width: 282px; cursor: pointer;
  background: #fff; border: 1px solid #E2E6EA; border-radius: 16px 16px 4px 16px;
  padding: 16px 38px 16px 18px; box-shadow: 0 18px 44px -18px rgba(27,42,54,.4);
  opacity: 0; transform: translateY(10px) scale(.96); pointer-events: none;
  transition: opacity .3s, transform .3s cubic-bezier(.4,.1,.2,1);
}
.gchat-nudge.show { opacity: 1; transform: none; pointer-events: auto; }
.gchat-nudge strong { display: block; color: #1B2A36; font-size: 1rem; margin-bottom: 3px; }
.gchat-nudge span { display: block; color: #5B6B7A; font-size: .9rem; line-height: 1.45; }
.gchat-nudge-x { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 1.3rem; line-height: 1; color: #9AA7B2; cursor: pointer; padding: 2px 5px; border-radius: 6px; }
.gchat-nudge-x:hover { background: #F2F5F7; color: #1B2A36; }

/* ---- panel ---- */
/* The panel sets `display: flex` below, which beats the user agent's
   `[hidden] { display: none }` on equal specificity by source order. Without
   this the panel is permanently visible - on a phone it covers the whole
   screen with an empty chat box. */
.gchat-panel[hidden] { display: none !important; }

.gchat-panel {
  position: absolute; right: 0; bottom: 80px; width: 384px; max-width: calc(100vw - 32px);
  height: 572px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 28px 70px -22px rgba(27,42,54,.5); border: 1px solid #E2E6EA;
  display: flex; flex-direction: column;
  animation: gin .28s cubic-bezier(.4,.1,.2,1);
}
@keyframes gin { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@media (max-width: 460px) {
  .gchat { right: 14px; bottom: 14px; }
  .gchat-panel { width: calc(100vw - 28px); height: calc(100vh - 110px); }
}

.gchat-head {
  display: flex; align-items: center; gap: 12px; padding: 15px 16px;
  background: linear-gradient(120deg, #2F5D4F, #234639); color: #fff;
}
.gchat-head img { border-radius: 10px; background: #fff; padding: 4px; flex: 0 0 auto; }
.gchat-head-txt { margin-right: auto; line-height: 1.3; min-width: 0; }
.gchat-head-txt b { display: block; font-size: 1.07rem; }
.gchat-head-txt span { display: block; font-size: .83rem; color: rgba(255,255,255,.85); }
.gchat-call, .gchat-close {
  background: rgba(255,255,255,.16); border: 0; color: #fff; cursor: pointer;
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  text-decoration: none; transition: background .18s;
}
.gchat-call:hover, .gchat-close:hover { background: rgba(255,255,255,.3); }
.gchat-call svg { width: 18px; height: 18px; }
.gchat-close { font-size: 1.5rem; line-height: 1; }

.gchat-log { flex: 1; overflow-y: auto; padding: 18px 16px 6px; background: #F7F5F0; }
.gchat-msg { display: flex; margin-bottom: 12px; }
.gchat-msg.user { justify-content: flex-end; }
.gchat-bub {
  max-width: 86%; padding: 12px 15px; border-radius: 16px; font-size: .99rem; line-height: 1.58;
  box-shadow: 0 2px 8px rgba(27,42,54,.07);
}
.gchat-msg.bot .gchat-bub { background: #fff; color: #1B2A36; border-bottom-left-radius: 5px; }
.gchat-msg.user .gchat-bub { background: #2F5D4F; color: #fff; border-bottom-right-radius: 5px; }

.gchat-typing .gchat-bub { display: flex; gap: 5px; padding: 15px; }
.gchat-typing i { width: 8px; height: 8px; border-radius: 50%; background: #B6C4CF; animation: gbounce 1.3s infinite; }
.gchat-typing i:nth-child(2) { animation-delay: .18s; }
.gchat-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes gbounce { 0%,60%,100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-6px); opacity: 1 } }

/* ---- starter chips ---- */
.gchat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; background: #F7F5F0; }
.gchat-chip {
  background: #fff; border: 1px solid #D5DFD9; color: #234639; border-radius: 100px;
  padding: 9px 14px; font-size: .88rem; cursor: pointer; font-family: inherit; text-align: left;
  transition: background .16s, border-color .16s, transform .16s;
}
.gchat-chip:hover { background: #E8EEEA; border-color: #2F5D4F; transform: translateY(-1px); }

/* ---- composer ---- */
.gchat-form { display: flex; gap: 9px; padding: 12px 14px; border-top: 1px solid #E8EDF1; background: #fff; }
.gchat-form input {
  flex: 1; min-width: 0; padding: 13px 15px; border: 1.5px solid #DDE4EA; border-radius: 100px;
  font: inherit; font-size: 1rem; background: #F7F5F0; transition: border-color .16s, background .16s, box-shadow .16s;
}
.gchat-form input:focus { outline: none; border-color: #2F5D4F; background: #fff; box-shadow: 0 0 0 3px rgba(47,93,79,.15); }
.gchat-form button {
  width: 46px; height: 46px; flex: 0 0 auto; border: 0; border-radius: 50%; cursor: pointer;
  background: #2F5D4F; color: #fff; display: grid; place-items: center;
  transition: background .18s, transform .18s;
}
.gchat-form button:hover { background: #234639; transform: scale(1.06); }
.gchat-form button svg { width: 19px; height: 19px; }

.gchat-foot { margin: 0; padding: 0 16px 13px; font-size: .78rem; color: #8C99A4; background: #fff; text-align: center; line-height: 1.45; }

/* ---- lead capture ---- */
.gchat-lead { background: #fff; border: 1px solid #D5DFD9; border-radius: 14px; padding: 16px; margin: 4px 0 14px; box-shadow: 0 4px 16px rgba(27,42,54,.08); }
.gchat-lead-t { margin: 0 0 12px; font-weight: 600; color: #1B2A36; font-size: 1.02rem; }
.gchat-f { width: 100%; padding: 12px 14px; margin-bottom: 9px; border: 1.5px solid #DDE4EA; border-radius: 9px; font: inherit; font-size: .98rem; background: #F7F5F0; }
.gchat-f:focus { outline: none; border-color: #2F5D4F; background: #fff; box-shadow: 0 0 0 3px rgba(47,93,79,.14); }
.gchat-send-lead {
  width: 100%; padding: 13px; border: 0; border-radius: 100px; background: #2F5D4F; color: #fff;
  font: 600 1rem ui-sans-serif, system-ui, sans-serif; cursor: pointer; transition: background .18s, transform .18s;
}
.gchat-send-lead:hover:not(:disabled) { background: #234639; transform: translateY(-1px); }
.gchat-send-lead:disabled { opacity: .65; cursor: default; }
.gchat-lead-n { margin: 10px 0 0; font-size: .82rem; color: #8C99A4; text-align: center; line-height: 1.45; }
.gchat-warn { margin: 0 0 9px; font-size: .88rem; color: #C0421A; }

@media (prefers-reduced-motion: reduce) {
  .gchat-dot, .gchat-typing i { animation: none; }
  .gchat-panel { animation: none; }
}

/* The panel is a <section>, and the site stylesheet pads every section
   (120px top and bottom), which showed up as a big white gap above Grace's
   header and crushed the message log. The widget owns its own spacing. */
.gchat .gchat-panel { padding: 0 !important; background: #fff; }
