/* ==========================================================================
   PrepCo Hub V2: floating helpers.
   A "Need help?" chat button on the start side (left in English, right in Arabic) and a back-to-top button
   on the end side. Used by v2.html and, through assets/js/ui-mode.js, by the shared pages in the V2 look.
   Colours are written out here (not page tokens) so the helpers look the same on every page.
   ========================================================================== */
.flt-chat,.flt-top,.chat{font-family:inherit;box-sizing:border-box}
.chat *,.chat *::before,.chat *::after{box-sizing:border-box}

/* chat button */
.flt-chat{position:fixed;z-index:60;bottom:24px;inset-inline-start:24px;display:inline-flex;align-items:center;gap:10px;height:52px;padding-block:0;padding-inline:14px 20px;border:0;border-radius:999px;background:var(--navy);color:#fff;font-size:15px;font-weight:500;cursor:pointer;box-shadow:0 18px 40px -16px rgba(var(--ink-rgb),.6);transition:transform .3s cubic-bezier(.34,1.56,.64,1),background-color .2s ease;animation:fltIn .4s cubic-bezier(.34,1.56,.64,1)}
.flt-chat:hover{transform:translateY(-3px);background:var(--blue-dark)}
.flt-chat[aria-expanded="true"]{background:var(--blue-dark)}
.flt-chat svg{flex:none;width:24px;height:24px}

/* back to top: a round button with a ring that fills as the page is read */
.flt-top{position:fixed;z-index:60;bottom:24px;inset-inline-end:24px;width:52px;height:52px;padding:0;border:0;border-radius:50%;background:#fff;color:var(--navy);cursor:pointer;display:grid;place-items:center;box-shadow:0 14px 30px -12px rgba(var(--ink-rgb),.35);animation:fltIn .35s cubic-bezier(.34,1.56,.64,1)}
.flt-top[hidden]{display:none}
.flt-top .ring{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}
.flt-top .ring circle{fill:none;stroke:var(--line);stroke-width:3}
.flt-top .ring .prog{stroke:var(--blue);stroke-linecap:round;stroke-dasharray:138.23;stroke-dashoffset:138.23;transition:stroke-dashoffset .15s linear}
.flt-top .up{position:relative;width:20px;height:20px;transition:transform .25s ease}
.flt-top:hover .up{transform:translateY(-3px)}
@keyframes fltIn{from{opacity:0;transform:translateY(12px) scale(.9)}}

/* chat panel */
.chat{position:fixed;z-index:61;bottom:88px;inset-inline-start:24px;width:min(360px,calc(100vw - 32px));max-height:min(540px,calc(100vh - 120px));display:flex;flex-direction:column;background:#fff;color:var(--ink);border:1px solid var(--line);border-radius:22px;box-shadow:0 40px 80px -30px rgba(var(--ink-rgb),.45);overflow:hidden;transform-origin:bottom left;animation:chatIn .3s cubic-bezier(.34,1.3,.5,1);text-align:start}
html[dir="rtl"] .chat{transform-origin:bottom right}
.chat[hidden]{display:none}
@keyframes chatIn{from{opacity:0;transform:translateY(10px) scale(.96)}}
.chat-h{display:flex;align-items:center;gap:10px;padding:14px;padding-inline-start:16px;background:radial-gradient(120% 90% at 90% 0%,var(--blue-dark) 0%,var(--t-ink-hover) 55%,var(--navy) 100%);color:#fff}
.chat-av{flex:none;width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.14);display:grid;place-items:center}
.chat-av svg{width:20px;height:20px}
/* two classes, so page heading styles (for example the V2 look on the shared pages) never resize it */
.chat .chat-h h2{margin:0;font-family:inherit;font-size:15px;font-weight:500;letter-spacing:-.01em;line-height:1.3;color:#fff}
.chat .chat-h p{margin:2px 0 0;font-size:12px;line-height:1.4;color:var(--t-edge-2)}
.chat-x{flex:none;margin-inline-start:auto;width:34px;height:34px;padding:0;border:0;border-radius:10px;background:none;color:#fff;cursor:pointer;display:grid;place-items:center}
.chat-x:hover{background:rgba(255,255,255,.12)}
.chat-x svg{width:18px;height:18px}
.chat-log{flex:1;min-height:140px;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px;background:var(--paper)}
.cm{max-width:85%;margin:0;padding:9px 12px;border-radius:14px;font-size:13.5px;line-height:1.45;animation:cmIn .25s ease;overflow-wrap:anywhere}
.cm.bot{align-self:flex-start;background:#fff;border:1px solid var(--line);border-end-start-radius:4px;color:var(--ink)}
.cm.me{align-self:flex-end;background:var(--blue);color:#fff;border-end-end-radius:4px}
.cm a{display:inline-block;margin-top:6px;color:var(--blue-dark);font-weight:500}
@keyframes cmIn{from{opacity:0;transform:translateY(6px)}}
.cm.typing{display:inline-flex;gap:4px;padding:12px 14px}
.cm.typing i{width:6px;height:6px;border-radius:50%;background:#98A2B3;animation:tp 1s infinite}
.cm.typing i:nth-child(2){animation-delay:.15s}
.cm.typing i:nth-child(3){animation-delay:.3s}
@keyframes tp{0%,60%,100%{opacity:.4;transform:none}30%{opacity:1;transform:translateY(-4px)}}
.chat-quick{display:flex;flex-wrap:wrap;gap:6px;padding:10px 14px 0;background:#fff}
.chat-quick a{font-size:12.5px;font-weight:500;padding:6px 11px;border-radius:999px;border:1px solid var(--line-2);color:var(--ink);text-decoration:none;transition:border-color .2s ease,background-color .2s ease,color .2s ease}
.chat-quick a:hover{border-color:var(--blue);background:var(--blue-tint);color:var(--blue-dark)}
.chat-f{display:flex;gap:6px;margin:0;padding:10px 14px 14px;background:#fff}
.chat-f input{flex:1;min-width:0;height:42px;border:1px solid var(--line-2);border-radius:12px;padding:0 12px;font:inherit;font-size:13.5px;color:var(--ink);background:#fff;outline:none;transition:border-color .2s ease,box-shadow .2s ease}
.chat-f input::placeholder{color:var(--soft)}
.chat-f input:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(var(--blue-rgb),.15)}
.chat-f button{flex:none;width:42px;height:42px;padding:0;border:0;border-radius:12px;background:var(--blue);color:#fff;cursor:pointer;display:grid;place-items:center;transition:background-color .2s ease}
.chat-f button:hover{background:var(--blue-dark)}
.chat-f button svg{width:18px;height:18px}
html[dir="rtl"] .chat-f button svg{transform:scaleX(-1)}
.flt-chat:focus-visible,.flt-top:focus-visible,.chat :focus-visible{outline:2px solid var(--blue);outline-offset:3px}
.chat-h :focus-visible{outline-color:#fff}

/* phones: icon-only chat button, closer to the edges */
@media (max-width:600px){
  .flt-chat{width:52px;padding:0;justify-content:center;bottom:16px;inset-inline-start:16px}
  .flt-chat span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .flt-top{bottom:16px;inset-inline-end:16px}
  .chat{bottom:80px;inset-inline-start:16px}
}
@media (prefers-reduced-motion:reduce){
  .flt-chat,.flt-top,.flt-top .up,.flt-top .ring .prog,.chat,.cm,.cm.typing i{animation:none!important;transition:none!important}
}
@media print{.flt-chat,.flt-top,.chat{display:none!important}}
