/* ============================================================================
jf-widget.css — Jos Finserv announcement pop-ups + chat assistant
Loaded by jf-widget.php on every page. Everything is namespaced .jfw- so it
cannot collide with the 2026 design system or the legacy Bootstrap.

Position: bottom LEFT. The right hand side already carries the Trustpilot
badge and the back-to-top control, so the assistant lives on the other side.
--jfw-off is set by the script when something else sits along the bottom
(the cookie notice, the mobile action bar) so nothing is ever covered.
============================================================================ */

:root{
  --jfw-navy:#22205F; --jfw-navy-dk:#171545; --jfw-navy-lo:#EEEEF6;
  --jfw-amber:#F09623; --jfw-amber-dk:#D67F12; --jfw-amber-lo:#FEF4E7;
  --jfw-ink:#14132E; --jfw-ink-2:#3A3960; --jfw-mute:#6B6E86;
  --jfw-line:#E4E5EE; --jfw-soft:#F6F7FB; --jfw-green:#1FA463;
  --jfw-font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;
  --jfw-shadow:0 2px 6px rgba(20,19,46,.08), 0 18px 48px rgba(20,19,46,.18);
  --jfw-spring:cubic-bezier(.34,1.45,.64,1);
  --jfw-ease:cubic-bezier(.2,.7,.3,1);
  --jfw-off:0px;              /* extra lift when a bottom bar is showing */
  --jfw-teaser:0px;           /* extra lift for the toasts while the teaser is up */
  --jfw-side:18px;
}

.jfw, .jfw *{ box-sizing:border-box; }
.jfw{ font-family:var(--jfw-font); font-size:15px; line-height:1.5; color:var(--jfw-ink); }
.jfw button{ font-family:inherit; }
.jfw [hidden]{ display:none !important; }

/* ------------------------------------------------------------ launcher --- */
.jfw-launch{
  position:fixed; left:var(--jfw-side); bottom:calc(24px + var(--jfw-off)); z-index:950;
  width:60px; height:60px; border-radius:50%; border:0; cursor:pointer;
  background:linear-gradient(145deg, var(--jfw-navy) 0%, var(--jfw-navy-dk) 100%);
  color:#fff; display:flex; align-items:center; justify-content:center;
  box-shadow:0 6px 20px rgba(34,32,95,.35);
  transition:transform .25s var(--jfw-spring), box-shadow .25s var(--jfw-ease), bottom .3s var(--jfw-ease);
  animation:jfwLaunchIn .6s var(--jfw-spring) both;
}
.jfw-launch:hover{ transform:scale(1.07); box-shadow:0 10px 28px rgba(34,32,95,.4); }
.jfw-launch:focus-visible{ outline:3px solid var(--jfw-amber); outline-offset:3px; }
.jfw-launch::before{ /* amber pulse ring */
  content:""; position:absolute; inset:-4px; border-radius:50%;
  border:2px solid var(--jfw-amber); opacity:0;
  animation:jfwPulse 2.6s ease-out infinite 1.2s;
}
.jfw-launch svg{ width:28px; height:28px; transition:transform .3s var(--jfw-spring), opacity .2s; position:absolute; }
.jfw-launch .jfw-ic-close{ opacity:0; transform:rotate(-90deg) scale(.6); }
.jfw-launch.is-open .jfw-ic-chat{ opacity:0; transform:rotate(90deg) scale(.6); }
.jfw-launch.is-open .jfw-ic-close{ opacity:1; transform:none; }
.jfw-launch.is-open::before{ animation:none; }
.jfw-badge{
  position:absolute; top:-3px; right:-3px; min-width:22px; height:22px; padding:0 6px;
  border-radius:11px; background:var(--jfw-amber); color:#fff; font-size:12px; font-weight:700;
  display:flex; align-items:center; justify-content:center; border:2px solid #fff;
  animation:jfwPop .4s var(--jfw-spring) both;
}
.jfw-launch.is-open .jfw-badge{ display:none; }

/* teaser speech bubble next to the launcher */
.jfw-teaser{
  position:fixed; left:calc(var(--jfw-side) + 72px); bottom:calc(30px + var(--jfw-off)); z-index:949;
  max-width:260px; background:#fff; border:1px solid var(--jfw-line); border-radius:16px 16px 16px 4px;
  padding:12px 34px 12px 14px; box-shadow:var(--jfw-shadow); font-size:14px; color:var(--jfw-ink);
  transform-origin:left bottom; animation:jfwPop .5s var(--jfw-spring) both; cursor:pointer;
  transition:bottom .3s var(--jfw-ease);
}
.jfw-teaser strong{ display:block; font-weight:700; margin-bottom:2px; }
.jfw-teaser .jfw-wave{ display:inline-block; animation:jfwWave 1.8s ease-in-out 2; transform-origin:70% 70%; }
.jfw-teaser-x{
  position:absolute; top:6px; right:6px; width:24px; height:24px; border:0; border-radius:50%;
  background:transparent; color:var(--jfw-mute); cursor:pointer; font-size:18px; line-height:1;
}
.jfw-teaser-x:hover{ background:var(--jfw-soft); color:var(--jfw-ink); }

/* --------------------------------------------------------------- panel --- */
.jfw-panel{
  position:fixed; left:var(--jfw-side); bottom:calc(96px + var(--jfw-off)); z-index:951;
  width:384px; max-width:calc(100vw - 2*var(--jfw-side));
  height:600px; max-height:calc(100vh - 116px - var(--jfw-off));
  background:#fff; border-radius:22px; overflow:hidden; box-shadow:var(--jfw-shadow);
  display:flex; flex-direction:column;
  transform-origin:left bottom; opacity:0; transform:translateY(24px) scale(.92); pointer-events:none;
  transition:opacity .28s var(--jfw-ease), transform .42s var(--jfw-spring), bottom .3s var(--jfw-ease);
}
.jfw-panel.is-open{ opacity:1; transform:none; pointer-events:auto; }

.jfw-head{
  position:relative; padding:16px 16px 14px; color:#fff;
  background:linear-gradient(135deg, var(--jfw-navy) 0%, var(--jfw-navy-dk) 100%);
  display:flex; align-items:center; gap:12px; flex:0 0 auto;
}
.jfw-head::after{ /* soft amber glow, matches the hero */
  content:""; position:absolute; right:-40px; top:-60px; width:160px; height:160px; border-radius:50%;
  background:radial-gradient(closest-side, rgba(240,150,35,.45), rgba(240,150,35,0)); pointer-events:none;
}
.jfw-avatar{
  width:44px; height:44px; border-radius:50%; background:var(--jfw-amber); color:#fff;
  font-weight:800; font-size:19px; display:flex; align-items:center; justify-content:center; position:relative; flex:0 0 auto;
  box-shadow:0 0 0 3px rgba(255,255,255,.15);
}
.jfw-avatar .jfw-dot{
  position:absolute; right:-1px; bottom:-1px; width:13px; height:13px; border-radius:50%;
  background:var(--jfw-green); border:2px solid var(--jfw-navy-dk);
}
.jfw-avatar .jfw-dot.is-away{ background:#A5A8BC; }
.jfw-head-t{ flex:1; min-width:0; position:relative; }
.jfw-head-t strong{ display:block; font-size:15.5px; font-weight:700; letter-spacing:-.01em; }
.jfw-head-t span{ display:block; font-size:12.5px; color:rgba(255,255,255,.78); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.jfw-hbtn{
  width:36px; height:36px; border-radius:50%; border:0; background:rgba(255,255,255,.12); color:#fff;
  cursor:pointer; display:flex; align-items:center; justify-content:center; position:relative; flex:0 0 auto;
  transition:background .15s;
}
.jfw-hbtn:hover{ background:rgba(255,255,255,.22); }
.jfw-hbtn svg{ width:18px; height:18px; }
.jfw-hbtn.is-on{ background:var(--jfw-amber); }

.jfw-body{
  flex:1 1 auto; overflow-y:auto; padding:16px 14px 8px; background:var(--jfw-soft);
  scroll-behavior:smooth; overscroll-behavior:contain;
}
.jfw-body::-webkit-scrollbar{ width:6px; }
.jfw-body::-webkit-scrollbar-thumb{ background:#D5D7E3; border-radius:3px; }

.jfw-day{ text-align:center; font-size:11.5px; color:var(--jfw-mute); margin:0 0 12px; letter-spacing:.02em; }

.jfw-row{ display:flex; margin:0 0 10px; animation:jfwMsg .38s var(--jfw-spring) both; }
.jfw-row.is-user{ justify-content:flex-end; }
.jfw-msg{
  max-width:86%; padding:11px 14px; border-radius:18px; font-size:14.5px; line-height:1.5;
  word-wrap:break-word; white-space:pre-line;
}
.jfw-row.is-bot .jfw-msg{
  background:#fff; border:1px solid var(--jfw-line); border-bottom-left-radius:6px; color:var(--jfw-ink);
  box-shadow:0 1px 2px rgba(20,19,46,.04);
}
.jfw-row.is-user .jfw-msg{
  background:var(--jfw-navy); color:#fff; border-bottom-right-radius:6px;
}
.jfw-msg a{ color:var(--jfw-navy); font-weight:600; text-decoration:underline; text-underline-offset:2px; }
.jfw-row.is-user .jfw-msg a{ color:#fff; }
.jfw-msg b{ font-weight:700; }

/* A real person has joined. Their messages get a name above them and a
   warmer edge, so nobody mistakes them for the bot's canned answers. */
.jfw-joined{
  text-align:center; font-size:12px; color:var(--jfw-ink-2); margin:6px 0 12px;
  animation:jfwMsg .4s var(--jfw-spring) both;
}
.jfw-joined::before{
  content:""; display:inline-block; width:7px; height:7px; border-radius:50%;
  background:var(--jfw-green); margin-right:7px; vertical-align:middle;
  animation:jfwBlip 2s ease-in-out infinite;
}
.jfw-row.is-agent{ display:block; }
.jfw-who{
  font-size:11.5px; font-weight:700; color:var(--jfw-amber-dk); margin:0 0 3px 4px;
  letter-spacing:.01em;
}
.jfw-row.is-agent .jfw-msg{
  display:inline-block; max-width:86%;
  background:#fff; border:1px solid var(--jfw-amber); border-bottom-left-radius:6px;
  box-shadow:0 1px 3px rgba(240,150,35,.16);
}

.jfw-typing{ display:inline-flex; gap:5px; align-items:center; padding:14px 16px; }
.jfw-typing i{
  width:7px; height:7px; border-radius:50%; background:#B4B7C9; display:block;
  animation:jfwDots 1.1s ease-in-out infinite;
}
.jfw-typing i:nth-child(2){ animation-delay:.15s; }
.jfw-typing i:nth-child(3){ animation-delay:.3s; }

.jfw-chips{ display:flex; flex-wrap:wrap; gap:7px; margin:2px 0 14px 2px; }
.jfw-chip{
  border:1.5px solid var(--jfw-navy); background:#fff; color:var(--jfw-navy); border-radius:999px;
  padding:7px 13px; font-size:13.5px; font-weight:600; cursor:pointer; line-height:1.2;
  transition:background .15s, color .15s, transform .18s var(--jfw-spring);
  animation:jfwChip .4s var(--jfw-spring) both; animation-delay:calc(var(--i,0) * 60ms);
  text-decoration:none; display:inline-flex; align-items:center; gap:6px;
}
.jfw-chip:hover{ background:var(--jfw-navy); color:#fff; transform:translateY(-1px); }
.jfw-chip.is-amber{ border-color:var(--jfw-amber); background:var(--jfw-amber); color:#fff; }
.jfw-chip.is-amber:hover{ background:var(--jfw-amber-dk); border-color:var(--jfw-amber-dk); }
.jfw-chips.is-used .jfw-chip{ opacity:.45; pointer-events:none; }

/* lead card inside the conversation */
.jfw-card{
  background:#fff; border:1px solid var(--jfw-line); border-radius:16px; padding:14px; margin:0 0 12px;
  animation:jfwMsg .4s var(--jfw-spring) both; box-shadow:0 1px 2px rgba(20,19,46,.04);
}
.jfw-card h4{ margin:0 0 4px; font-size:15px; font-weight:700; }
.jfw-card p{ margin:0 0 10px; font-size:13px; color:var(--jfw-mute); }
.jfw-f{ display:block; margin:0 0 9px; }
.jfw-f span{ display:block; font-size:12px; font-weight:600; color:var(--jfw-ink-2); margin-bottom:4px; }
.jfw-f input, .jfw-f select{
  width:100%; border:1.5px solid var(--jfw-line); border-radius:10px; padding:9px 11px; font:inherit; font-size:14px;
  color:var(--jfw-ink); background:#fff; transition:border-color .15s, box-shadow .15s;
}
.jfw-f input:focus, .jfw-f select:focus{ outline:0; border-color:var(--jfw-navy); box-shadow:0 0 0 3px rgba(34,32,95,.12); }
.jfw-f2{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.jfw-hp{ position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }
.jfw-err{ color:#B42318; font-size:12.5px; margin:-4px 0 8px; }
.jfw-btn{
  width:100%; border:0; border-radius:12px; padding:12px; font-size:14.5px; font-weight:700; cursor:pointer;
  background:var(--jfw-amber); color:#fff; transition:background .15s, transform .18s var(--jfw-spring);
  position:relative; overflow:hidden;
}
.jfw-btn:hover{ background:var(--jfw-amber-dk); transform:translateY(-1px); }
.jfw-btn[disabled]{ opacity:.7; cursor:wait; }
.jfw-fine{ font-size:11px; color:var(--jfw-mute); margin:8px 0 0; line-height:1.45; }
.jfw-fine a{ color:var(--jfw-mute); }
.jfw-done{ text-align:center; padding:6px 4px; }
.jfw-done .jfw-tick{
  width:52px; height:52px; border-radius:50%; background:var(--jfw-green); color:#fff; margin:0 auto 10px;
  display:flex; align-items:center; justify-content:center; animation:jfwPop .5s var(--jfw-spring) both;
}
.jfw-done .jfw-tick svg{ width:26px; height:26px; }

.jfw-foot{ flex:0 0 auto; border-top:1px solid var(--jfw-line); background:#fff; padding:10px 12px 8px; }
.jfw-inrow{ display:flex; gap:8px; align-items:flex-end; }
.jfw-in{
  flex:1; border:1.5px solid var(--jfw-line); border-radius:14px; padding:10px 13px; font:inherit; font-size:14.5px;
  resize:none; max-height:96px; min-height:42px; line-height:1.4; color:var(--jfw-ink); background:var(--jfw-soft);
  transition:border-color .15s, background .15s;
}
.jfw-in:focus{ outline:0; border-color:var(--jfw-navy); background:#fff; }
.jfw-send{
  width:42px; height:42px; border-radius:50%; border:0; background:var(--jfw-amber); color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:center; flex:0 0 auto;
  transition:background .15s, transform .18s var(--jfw-spring);
}
.jfw-send:hover{ background:var(--jfw-amber-dk); transform:scale(1.06); }
.jfw-send svg{ width:20px; height:20px; margin-left:2px; }
.jfw-tiny{ text-align:center; font-size:10.5px; color:var(--jfw-mute); margin:7px 0 0; }
.jfw-tiny a{ color:var(--jfw-mute); }

/* -------------------------------------------------------- announcements --- */
/* The teaser bubble sits beside the launcher, so the toast stack is lifted
   clear of it whenever it is on screen rather than landing on top of it. */
.jfw-toasts{
  position:fixed; left:var(--jfw-side); bottom:calc(98px + var(--jfw-off) + var(--jfw-teaser)); z-index:948;
  display:flex; flex-direction:column; gap:10px; width:344px; max-width:calc(100vw - 2*var(--jfw-side));
  pointer-events:none; transition:bottom .3s var(--jfw-ease);
}
.jfw-toasts.is-hidden{ display:none; }
.jfw-toast{
  pointer-events:auto; position:relative; overflow:hidden; background:#fff; border:1px solid var(--jfw-line);
  border-radius:16px; box-shadow:var(--jfw-shadow); padding:13px 38px 14px 14px;
  display:flex; gap:12px; align-items:flex-start;
  animation:jfwToastIn .55s var(--jfw-spring) both;
}
.jfw-toast.is-out{ animation:jfwToastOut .3s var(--jfw-ease) both; }
.jfw-toast-ic{
  width:40px; height:40px; border-radius:12px; background:var(--jfw-amber-lo); display:flex; align-items:center; justify-content:center;
  font-size:20px; flex:0 0 auto;
}
.jfw-toast-b{ flex:1; min-width:0; }
.jfw-toast-b strong{ display:block; font-size:14px; font-weight:700; color:var(--jfw-ink); margin-bottom:2px; }
.jfw-toast-b p{ margin:0; font-size:13px; color:var(--jfw-ink-2); line-height:1.45; }
.jfw-toast-b a.jfw-cta{
  display:inline-flex; align-items:center; gap:4px; margin-top:7px; font-size:13px; font-weight:700; color:var(--jfw-navy);
  text-decoration:none;
}
.jfw-toast-b a.jfw-cta:hover{ text-decoration:underline; }
.jfw-toast-b a.jfw-cta::after{ content:"→"; transition:transform .18s; }
.jfw-toast-b a.jfw-cta:hover::after{ transform:translateX(3px); }
.jfw-toast-x{
  position:absolute; top:8px; right:8px; width:26px; height:26px; border:0; border-radius:50%; background:transparent;
  color:var(--jfw-mute); cursor:pointer; font-size:19px; line-height:1;
}
.jfw-toast-x:hover{ background:var(--jfw-soft); color:var(--jfw-ink); }
.jfw-toast-bar{ position:absolute; left:0; bottom:0; height:3px; background:var(--jfw-amber); width:100%; transform-origin:left; animation:jfwBar linear both; }
.jfw-toast:hover .jfw-toast-bar{ animation-play-state:paused; }

/* --------------------------------------------------------------- mobile --- */
@media (max-width:640px){
  :root{ --jfw-side:14px; }
  .jfw-launch{ width:56px; height:56px; }
  .jfw-teaser{ max-width:calc(100vw - 100px); }
  .jfw-panel{
    left:0; right:0; bottom:0; width:100%; max-width:100%; height:100dvh; max-height:100dvh; border-radius:0;
    transform-origin:center bottom;
  }
  .jfw-head{ padding-top:calc(14px + env(safe-area-inset-top)); }
  .jfw-foot{ padding-bottom:calc(8px + env(safe-area-inset-bottom)); }
  .jfw-toasts{ width:auto; right:var(--jfw-side); max-width:none; }
  body.jf-menu-open .jfw-launch, body.jf-menu-open .jfw-teaser, body.jf-menu-open .jfw-toasts{ display:none; }
}

/* ---------------------------------------------------------- animations --- */
@keyframes jfwLaunchIn{ from{ transform:scale(0) rotate(-30deg); opacity:0; } to{ transform:none; opacity:1; } }
@keyframes jfwPulse{ 0%{ transform:scale(.9); opacity:.9; } 70%{ transform:scale(1.5); opacity:0; } 100%{ transform:scale(1.5); opacity:0; } }
@keyframes jfwPop{ from{ transform:scale(.6); opacity:0; } to{ transform:scale(1); opacity:1; } }
@keyframes jfwWave{ 0%,100%{ transform:rotate(0); } 25%{ transform:rotate(18deg); } 50%{ transform:rotate(-10deg); } 75%{ transform:rotate(12deg); } }
@keyframes jfwMsg{ from{ transform:translateY(10px) scale(.97); opacity:0; } to{ transform:none; opacity:1; } }
@keyframes jfwChip{ from{ transform:translateY(8px); opacity:0; } to{ transform:none; opacity:1; } }
@keyframes jfwDots{ 0%,60%,100%{ transform:translateY(0); opacity:.5; } 30%{ transform:translateY(-5px); opacity:1; } }
@keyframes jfwToastIn{ from{ transform:translateX(-120%); opacity:0; } to{ transform:none; opacity:1; } }
@keyframes jfwToastOut{ from{ transform:none; opacity:1; max-height:200px; } to{ transform:translateX(-30px); opacity:0; max-height:0; margin:0; padding:0; } }
@keyframes jfwBar{ from{ transform:scaleX(1); } to{ transform:scaleX(0); } }
@keyframes jfwBlip{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }

@media (prefers-reduced-motion:reduce){
  .jfw-launch, .jfw-teaser, .jfw-row, .jfw-chip, .jfw-card, .jfw-toast, .jfw-badge,
  .jfw-done .jfw-tick, .jfw-joined, .jfw-joined::before{ animation:none !important; }
  .jfw-launch::before{ animation:none; }
  .jfw-panel{ transition:opacity .2s; transform:none; }
  .jfw-teaser .jfw-wave{ animation:none; }
}

@media print{ .jfw{ display:none !important; } }
