/* Joyvera Care help assistant. Uses the colour tokens from styles.css */
.jc-chat { --jc-gap: 20px; font-family: var(--f-body); }

/* Launcher button */
.jc-launcher { position: fixed; right: max(var(--jc-gap), env(safe-area-inset-right, 0px)); bottom: calc(var(--jc-gap) + env(safe-area-inset-bottom, 0px)); z-index: 70;
  display: inline-flex; align-items: center; gap: .55rem; min-height: 52px; padding: .8rem 1.25rem .8rem 1.05rem;
  border: 0; border-radius: 999px; background: var(--primary); color: var(--white); font: 700 var(--s-sm)/1.2 var(--f-body); cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(23, 81, 143, .55); transition: background-color .2s, transform .2s; }
.jc-launcher:hover { background: var(--primary-deep); transform: translateY(-1px); }
.jc-launcher svg { flex: none; }
.jc-chat.is-open .jc-launcher { display: none; }

/* Panel */
.jc-panel { position: fixed; right: max(var(--jc-gap), env(safe-area-inset-right, 0px)); bottom: calc(var(--jc-gap) + env(safe-area-inset-bottom, 0px)); z-index: 70;
  width: min(390px, calc(100vw - 2 * var(--jc-gap))); height: min(600px, calc(100vh - 2 * var(--jc-gap)));
  display: flex; flex-direction: column; overflow: hidden; background: var(--bg); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 48px -16px rgba(23, 81, 143, .45); animation: jc-in .2s ease-out; }
.jc-panel[hidden] { display: none; }
@keyframes jc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.jc-head { display: flex; align-items: center; gap: .75rem; padding: .85rem .75rem .85rem 1rem; background: var(--white); border-bottom: 1px solid var(--line); }
.jc-head img { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-soft); }
.jc-head-text { flex: 1; min-width: 0; }
.jc-head h2 { font-size: 1.02rem; letter-spacing: 0; }
.jc-head h2:focus { outline: none; }
.jc-head p { font-size: .8rem; line-height: 1.4; color: var(--ink-soft); }
.jc-head p a { color: var(--primary-deep); font-weight: 700; }
.jc-close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.jc-close:hover { background: var(--bg-soft); }

/* Conversation */
.jc-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.jc-msg { max-width: 88%; padding: .7rem .95rem; border-radius: 16px; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; animation: jc-in .18s ease-out; }
.jc-msg p { max-width: none; }
.jc-msg p + p, .jc-msg p + ul, .jc-msg ul + p { margin-top: .45rem; }
.jc-msg ul { margin: .35rem 0 0; padding-left: 1.15rem; }
.jc-msg li::marker { color: var(--primary); }
.jc-msg--bot { align-self: flex-start; background: var(--white); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.jc-msg--bot a { color: var(--primary); font-weight: 700; }
.jc-msg--bot a.jc-cta { display: inline-flex; align-items: center; min-height: 44px; margin-top: .25rem; padding: .55rem 1.1rem; border-radius: 999px; background: var(--primary); color: var(--white); text-decoration: none; }
.jc-msg--bot a.jc-cta:hover { background: var(--primary-deep); color: var(--white); }
.jc-msg--user { align-self: flex-end; background: var(--primary); color: var(--white); border-bottom-right-radius: 5px; }
.jc-quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .25rem; }
.jc-chip { min-height: 40px; padding: .45rem .9rem; border: 1.5px solid var(--primary); border-radius: 999px; background: var(--white); color: var(--primary-deep);
  font: 700 .85rem/1.2 var(--f-body); cursor: pointer; }
.jc-chip:hover { background: var(--primary); color: var(--white); }

.jc-typing { align-self: flex-start; display: flex; gap: 4px; padding: .8rem .95rem; background: var(--white); border: 1px solid var(--line); border-radius: 16px; border-bottom-left-radius: 5px; }
.jc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: jc-dot 1.2s infinite ease-in-out; }
.jc-typing span:nth-child(2) { animation-delay: .15s; }
.jc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes jc-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

/* Input */
.jc-form { display: flex; gap: .5rem; padding: .75rem .75rem .35rem; background: var(--white); border-top: 1px solid var(--line); }
.jc-form input { flex: 1; min-width: 0; min-height: 46px; padding: .6rem 1rem; border-radius: 999px; font-size: 1rem; background: var(--bg); }
.jc-send { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--primary); color: var(--white); cursor: pointer; }
.jc-send:hover { background: var(--primary-deep); }
.jc-note { padding: 0 1rem .65rem; background: var(--white); font-size: .75rem; color: var(--ink-soft); }

/* Footer content stays clear of the launcher */
body.has-chat .site-footer { padding-bottom: 6rem; }

/* Phones: sit above the call/book bar; the panel becomes a bottom sheet */
@media (max-width: 720px) {
  .jc-launcher { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); right: max(14px, env(safe-area-inset-right, 0px)); width: 56px; height: 56px; min-height: 0; padding: 0; justify-content: center; transition: transform .25s ease, background-color .2s; }
  .jc-launcher-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* While the form or careers section is on screen (call bar hidden), tuck the button away so it never covers a field or button */
  .mobile-cta.is-hidden ~ .jc-chat .jc-launcher { transform: translateY(160%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
  .jc-panel { left: 0; right: 0; bottom: 0; width: 100%; height: min(88vh, 640px); height: min(88dvh, 640px); border-radius: 18px 18px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .jc-msg { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .jc-panel, .jc-msg { animation: none; }
  .jc-typing span { animation: none; opacity: .8; }
  .jc-launcher { transition: none; }
}
@media print { .jc-chat { display: none; } }
