/* Customer support chat window (app/Support/_widget.php, assets/js/support-widget.js).

   One fixed block at the bottom right of the page: a bar ("Need help?") that
   opens a window. Every rule is scoped under .sw and every value is set here,
   so it looks the same on the red homepage and on the purple sign-in pages
   and neither page's own link, input or focus styles leak in.

   States, set by the script on .sw:
     (none)      the bar only
     .is-open    the window, the bar hidden
     .is-big     with .is-open: the larger window

   Theme: data-theme="app" (default, purple) or "home" (red and gold). */

.sw{
  --sw-accent:#7C3AED; --sw-accent-ink:#5B21B6; --sw-on-accent:#fff;
  --sw-launch-bg:#7C3AED; --sw-launch-fg:#fff;
  --sw-ink:#1c1f24; --sw-muted:#5f6672; --sw-line:#DADDE2; --sw-wash:#F3F4F7;
  position:fixed; right:20px; bottom:20px; z-index:70;
  font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  font-size:14px; line-height:1.45; color:var(--sw-ink); text-align:left;
}
.sw[data-theme="home"]{
  --sw-accent:#9E1414; --sw-accent-ink:#7A0E0E;
  --sw-launch-bg:#FFC41F; --sw-launch-fg:#3D0909;
}
.sw *,.sw *::before,.sw *::after{box-sizing:border-box}
.sw [hidden]{display:none !important}
.sw button{font:inherit; cursor:pointer}
.sw a{color:var(--sw-accent-ink); text-decoration:underline}
.sw a:hover{color:var(--sw-accent)}
.sw :focus{outline:none}
.sw :focus-visible{outline:2px solid var(--sw-accent); outline-offset:2px}

/* ---- the bar (minimized) ---- */
.sw-launch{
  position:relative; display:inline-flex; align-items:center; gap:8px;
  height:48px; padding:0 18px 0 15px; border:0; border-radius:999px;
  background:var(--sw-launch-bg); color:var(--sw-launch-fg);
  font-size:15px; font-weight:600; letter-spacing:.005em;
  box-shadow:0 8px 24px rgba(0,0,0,.28), 0 1px 2px rgba(0,0,0,.2);
  transition:transform .15s ease, box-shadow .15s ease;
}
.sw-launch:hover{transform:translateY(-1px); box-shadow:0 12px 28px rgba(0,0,0,.32), 0 1px 2px rgba(0,0,0,.2)}
.sw-launch:focus-visible{outline:3px solid #fff; outline-offset:2px; box-shadow:0 0 0 6px var(--sw-accent), 0 8px 24px rgba(0,0,0,.28)}
.sw-launch svg{flex:none}
.sw-dot{position:absolute; top:-2px; right:-2px; width:14px; height:14px; border-radius:50%; background:#E5484D; border:2px solid #fff}
.sw.is-open .sw-launch{display:none}

/* ---- the window ---- */
.sw-panel{
  display:flex; flex-direction:column; width:360px; height:520px;
  max-width:calc(100vw - 24px); max-height:calc(100vh - 40px); max-height:calc(100dvh - 40px);
  background:#fff; border-radius:16px; overflow:hidden;
  box-shadow:0 18px 50px rgba(0,0,0,.34), 0 2px 6px rgba(0,0,0,.18);
}
.sw.is-big .sw-panel{width:480px; height:720px}

.sw-head{flex:none; display:flex; align-items:center; gap:4px; padding:12px 10px 12px 16px; background:var(--sw-accent); color:var(--sw-on-accent)}
.sw-head-t{flex:1; min-width:0; display:flex; flex-direction:column}
.sw-head-t strong{font-size:15.5px; font-weight:700; line-height:1.25}
.sw-status{display:flex; align-items:center; gap:6px; font-size:12.5px; opacity:.92; line-height:1.3}
.sw-status.is-on::before{content:""; flex:none; width:8px; height:8px; border-radius:50%; background:#4ADE80}
.sw-ico{flex:none; display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; border:0; border-radius:10px; background:transparent; color:inherit}
.sw-ico:hover{background:rgba(255,255,255,.18)}
.sw-ico:focus-visible{outline:2px solid #fff; outline-offset:-2px}

.sw-body{flex:1; min-height:0; display:flex; flex-direction:column}

/* ---- step 1: who you are and what you need ---- */
.sw-form{flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:12px; margin:0; padding:16px}
.sw-intro{margin:0; font-size:14px; color:var(--sw-ink)}
.sw-f{display:flex; flex-direction:column; gap:5px; margin:0; font-size:13px; font-weight:600; color:var(--sw-ink)}
.sw-f input,.sw-f select{
  width:100%; height:44px; padding:0 12px; margin:0; border:1px solid var(--sw-line); border-radius:10px;
  background:#fff; color:var(--sw-ink); font:inherit; font-size:16px; font-weight:400;
}
.sw-f select{padding-right:8px}
.sw-f input:focus-visible,.sw-f select:focus-visible,.sw-send textarea:focus-visible{outline:2px solid var(--sw-accent); outline-offset:1px; border-color:transparent}
.sw-f input.is-bad,.sw-f select.is-bad{border-color:#D93025}
.sw-hp{position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden}
.sw-btn{height:46px; border:0; border-radius:10px; background:var(--sw-accent); color:var(--sw-on-accent); font-size:15px; font-weight:700}
.sw-btn:hover:not(:disabled){background:var(--sw-accent-ink)}
.sw-btn:disabled,.sw-sendbtn:disabled{opacity:.55; cursor:default}
.sw-fine{margin:0; font-size:12px; color:var(--sw-muted)}
.sw-err{margin:0; padding:9px 11px; border-radius:9px; background:#FEF1F0; border:1px solid #F4C7C3; color:#A1211B; font-size:13px}

/* ---- step 2: the conversation ---- */
.sw-chat{flex:1; min-height:0; display:flex; flex-direction:column}
.sw-msgs{flex:1; min-height:0; overflow-y:auto; display:flex; flex-direction:column; gap:8px; padding:14px 14px 10px; background:var(--sw-wash)}
.sw-note{align-self:center; max-width:92%; margin:0 0 4px; padding:8px 12px; border-radius:10px; background:#fff; border:1px solid #E6E8EC; color:var(--sw-muted); font-size:12.5px; text-align:center}
.sw-m{display:flex; flex-direction:column; max-width:84%}
.sw-m-who{margin:0 0 2px 4px; font-size:11.5px; font-weight:600; color:var(--sw-muted)}
.sw-m-b{padding:9px 12px; border-radius:14px; font-size:14.5px; line-height:1.4; white-space:pre-wrap; overflow-wrap:anywhere}
.sw-m-at{margin:2px 4px 0; font-size:11px; color:var(--sw-muted)}
.sw-m.is-support{align-self:flex-start}
.sw-m.is-support .sw-m-b{background:#fff; border:1px solid #E6E8EC; color:var(--sw-ink); border-bottom-left-radius:5px}
.sw-m.is-you{align-self:flex-end; align-items:flex-end}
.sw-m.is-you .sw-m-b{background:var(--sw-accent); color:var(--sw-on-accent); border-bottom-right-radius:5px}
.sw-chat .sw-err{margin:0 12px 8px}
.sw-closed{margin:0; padding:10px 14px; border-top:1px solid #ECEEF1; font-size:13px; color:var(--sw-muted); text-align:center}
.sw-link{padding:0; border:0; background:none; color:var(--sw-accent-ink); font-weight:600; text-decoration:underline}
.sw-send{flex:none; display:flex; align-items:flex-end; gap:8px; margin:0; padding:10px 12px; border-top:1px solid #ECEEF1; background:#fff}
.sw-send textarea{
  flex:1; min-width:0; min-height:42px; max-height:104px; padding:10px 12px; margin:0; resize:none;
  border:1px solid var(--sw-line); border-radius:12px; background:#fff; color:var(--sw-ink);
  font:inherit; font-size:16px; line-height:1.3;
}
.sw-sendbtn{flex:none; display:inline-flex; align-items:center; justify-content:center; width:42px; height:42px; border:0; border-radius:50%; background:var(--sw-accent); color:var(--sw-on-accent)}
.sw-sendbtn:hover:not(:disabled){background:var(--sw-accent-ink)}

/* ---- phones: the window is a sheet across the bottom; larger = full screen ---- */
@media (max-width:520px){
  .sw{right:12px; bottom:12px}
  .sw.is-open{left:8px; right:8px; bottom:8px}
  .sw-panel{width:100%; max-width:none; height:min(78vh, 560px); height:min(78dvh, 560px); max-height:none}
  .sw.is-open.is-big{left:0; right:0; bottom:0; top:0}
  .sw.is-big .sw-panel{width:100%; height:100%; border-radius:0}
  .sw-ico{width:40px; height:40px}
  /* The homepage's payout pop-ups sit along the bottom on a phone: lift them clear of the bar. */
  #payout-toasts{bottom:72px}
}

@media (prefers-reduced-motion:reduce){
  .sw-launch{transition:none}
  .sw-launch:hover{transform:none}
}
