/* JtA Back to Top and Chat — v1.3.6 */
:root{
  /* Fallbacks if the site tokens aren't present */
  --jta-blue: var(--wp--preset--color--custom-jt-a-link-blue, #7ab8fa);
  --jta-red:  var(--wp--preset--color--custom-jt-a-link-red,  #ff5151);
  --jta-ink:  var(--wp--preset--color--contrast, #111111);
  --jta-base: var(--wp--preset--color--base, #ffffff);
}

/* Base floating button style (Back to Top + Chat share this) */
.jta-back-to-top,
.jta-chat-toggle,
.jta-chat-new-toggle{
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 0.5rem 0.875rem;
  border: 2px solid transparent;
  border-radius: 9999px;       /* match pill buttons */
  background: var(--jta-blue); /* Back to top default */
  color: var(--jta-base);
  font-size: 14px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  cursor: pointer;
  z-index: 2147483647;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity .25s ease,
    transform .25s ease,
    visibility .25s ease,
    background-color .2s ease,
    color .2s ease,
    border-color .2s ease;
}

/* Chat button uses brand red by default for contrast */
.jta-chat-toggle{
  background: var(--jta-red);
}



/* New Chat button uses the standard (blue) JtA style */
.jta-chat-new-toggle{
  background: var(--jta-blue);
}
/* When chat is open, make the toggle look like the usual (blue) button */
.jta-chat-toggle.is-open{
  background: var(--jta-blue);
  border-color: transparent;
}

/* Visible state */
.jta-back-to-top.is-visible,
.jta-chat-toggle.is-visible,
.jta-chat-new-toggle.is-visible{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Hover/focus styles */
.jta-back-to-top:hover,
.jta-back-to-top:focus,
.jta-chat-toggle:hover,
.jta-chat-toggle:focus,
.jta-chat-new-toggle:hover,
.jta-chat-new-toggle:focus{
  background: var(--jta-red);
  color: var(--jta-base);
  border-color: var(--jta-red);
  outline: none;
}

/* Keep the open/close state visually "blue" on hover/focus */
.jta-chat-toggle.is-open:hover,
.jta-chat-toggle.is-open:focus{
  background: var(--jta-blue);
  border-color: var(--jta-blue);
  filter: brightness(0.96);
}

/* High-contrast focus ring for keyboard users */
.jta-back-to-top:focus-visible,
.jta-chat-toggle:focus-visible,
.jta-chat-new-toggle:focus-visible{
  box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 6px rgba(0,0,0,.3);
}

/* Wrapper (mainly for stacking context) */
.jta-btt-wrapper{
  position: relative;
  z-index: 2147483647;
}

/* Chat panel container (holds Gravity Form) */
.jta-chat-panel{
  position: fixed;
  bottom: 5.25rem; /* just above buttons */
  right: 2rem;
  max-width: 360px;
  width: calc(100% - 3rem);
  max-height: 70vh;
  background: var(--jta-base);
  color: var(--jta-ink);
  border-radius: 1.25rem;
  box-shadow: 0 14px 30px rgba(0,0,0,.25);
  padding: 1.5rem 1.25rem 1.25rem;
  overflow: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity .25s ease,
    transform .25s ease,
    visibility .25s ease;
  z-index: 2147483646;
  box-sizing: border-box;
}

/* Close button inside panel */
.jta-chat-close{
  position: absolute;
  top: 0.35rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  color: var(--jta-ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

/* Open state */
.jta-chat-panel.is-open{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce){
  .jta-back-to-top,
  .jta-chat-toggle,
  .jta-chat-panel{
    transition: none;
  }
}

/* Mobile tweaks */
@media (max-width: 480px){
  .jta-back-to-top,
  .jta-chat-toggle{
    bottom: 1rem;
    right: 1rem;
  }

  .jta-chat-panel{
    bottom: 4.5rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
  }
}


/* =======================
   AI Answer block (GF confirmation)
   ======================= */
.jta-ai-answer{
  margin-top: 0.75rem;
  padding: 0.9rem 0.9rem 0.75rem;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(122,184,250,0.14), rgba(255,255,255,0.0));
}
.jta-ai-answer__title{
  margin: 0 0 0.5rem;
  font-size: 1rem;
  line-height: 1.2;
}
.jta-ai-answer__disclaimer{
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  opacity: 0.85;
}


/* =======================
   Follow-up chat (persistent)
   ======================= */
.jta-chat-followup{
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.jta-chat-followup__head{
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.jta-chat-new{
  border: 1px solid rgba(0,0,0,0.14);
  background: transparent;
  border-radius: 9999px;
  padding: 0.35rem 0.65rem;
  font-size: 12px;
  cursor: pointer;
}

.jta-chat-new:hover,
.jta-chat-new:focus{
  border-color: var(--jta-blue);
  outline: none;
}

.jta-chat-transcript{
  max-height: 34vh;
  overflow: auto;
  padding: 0.25rem 0.15rem 0.5rem;
}

.jta-chat-empty{
  opacity: 0.85;
  font-size: 0.92rem;
  padding: 0.25rem 0.25rem 0.5rem;
}

.jta-chat-msg{
  display: flex;
  margin: 0.35rem 0;
}

.jta-chat-msg--user{
  justify-content: flex-end;
}

.jta-chat-msg--assistant{
  justify-content: flex-start;
}

.jta-chat-bubble{
  max-width: 88%;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(122,184,250,0.10);
  font-size: 0.95rem;
  line-height: 1.35;
}

.jta-chat-msg--user .jta-chat-bubble{
  background: rgba(0,0,0,0.04);
}

.jta-chat-bubble p{ margin: 0.4rem 0; }

.jta-chat-followup__form{
  margin-top: 0.5rem;
}

.jta-chat-followup__input{
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.14);
  padding: 0.55rem 0.65rem;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 2.5rem;
}

.jta-chat-followup__actions{
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.jta-chat-send{
  border: none;
  background: var(--jta-blue);
  color: var(--jta-base);
  border-radius: 9999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

.jta-chat-send:hover,
.jta-chat-send:focus{
  filter: brightness(0.96);
  outline: none;
}

.jta-chat-followup__form.is-sending .jta-chat-send{
  opacity: 0.65;
  cursor: wait;
}
