/* JtA Back to Top and Chat — v1.0.8 brand colours */
: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{
  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);
}

/* Visible state */
.jta-back-to-top.is-visible,
.jta-chat-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{
  background: var(--jta-red);
  color: var(--jta-base);
  border-color: var(--jta-red);
  outline: none;
}

/* High-contrast focus ring for keyboard users */
.jta-back-to-top:focus-visible,
.jta-chat-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;
  }
}
