/* Chat assistant widget. Layering: buybar z-90, bubble z-95, topnav z-100,
   open panel z-120. On mobile the bubble sits a fixed offset above the buybar
   (constant whether or not the bar is slid in, so it never jumps). */

#sx-chat .sx-chat-bubble{
  position:fixed;right:20px;bottom:20px;z-index:95;
  width:52px;height:52px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:var(--obsidian-850);color:var(--accent-mint);
  border:1px solid var(--border-default);cursor:pointer;
  box-shadow:0 4px 24px rgba(0,0,0,0.5);
  transition:transform var(--transition),border-color var(--transition);
}
#sx-chat .sx-chat-bubble:hover{transform:translateY(-2px);border-color:rgba(217,164,65,0.5);}
#sx-chat.is-open .sx-chat-bubble{display:none;}

#sx-chat .sx-chat-panel{
  position:fixed;right:20px;bottom:20px;z-index:120;
  width:min(360px,calc(100vw - 40px));height:min(540px,calc(100dvh - 80px));
  display:flex;flex-direction:column;
  background:var(--obsidian-850);color:var(--metal-100);
  border:1px solid var(--border-default);border-radius:8px;
  box-shadow:0 12px 48px rgba(0,0,0,0.6);
  font-family:var(--font-sans);
}
#sx-chat .sx-chat-panel[hidden]{display:none;}

#sx-chat .sx-chat-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 16px;border-bottom:1px solid var(--border-subtle);
}
#sx-chat .sx-chat-title{
  font-family:var(--font-mono);font-size:11px;letter-spacing:0.2em;
  color:var(--champagne-400);
}
#sx-chat .sx-chat-close{
  background:none;border:none;color:var(--steel-400);font-size:22px;
  line-height:1;cursor:pointer;padding:0 2px;
}
#sx-chat .sx-chat-close:hover{color:var(--metal-100);}

#sx-chat .sx-chat-log{
  flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:10px;
}
#sx-chat .sx-msg{
  max-width:85%;padding:9px 12px;border-radius:8px;
  font-size:14px;line-height:1.5;white-space:pre-wrap;word-break:break-word;
}
#sx-chat .sx-msg-bot{
  align-self:flex-start;background:rgba(255,255,255,0.05);
  border:1px solid var(--border-subtle);
}
#sx-chat .sx-msg-user{
  align-self:flex-end;background:rgba(217,164,65,0.09);
  border:1px solid rgba(217,164,65,0.26);
}
#sx-chat .sx-msg a{color:var(--accent-mint);text-decoration:underline;}

#sx-chat .sx-typing span{
  display:inline-block;width:6px;height:6px;margin:0 2px;border-radius:50%;
  background:var(--steel-400);animation:sx-blink 1.2s infinite;
}
#sx-chat .sx-typing span:nth-child(2){animation-delay:0.2s;}
#sx-chat .sx-typing span:nth-child(3){animation-delay:0.4s;}
@keyframes sx-blink{0%,80%,100%{opacity:0.25;}40%{opacity:1;}}

#sx-chat .sx-chips{display:flex;flex-wrap:wrap;gap:8px;}
#sx-chat .sx-chip{
  font-family:var(--font-mono);font-size:11px;letter-spacing:0.04em;
  color:var(--metal-200);background:none;cursor:pointer;
  border:1px solid var(--border-default);border-radius:999px;padding:7px 12px;
  transition:border-color var(--transition),color var(--transition);
}
#sx-chat .sx-chip:hover{border-color:rgba(217,164,65,0.5);color:var(--accent-mint);}

#sx-chat .sx-chat-inputrow{
  display:flex;gap:8px;padding:12px;border-top:1px solid var(--border-subtle);
}
#sx-chat .sx-chat-input{
  flex:1;background:rgba(255,255,255,0.04);color:var(--metal-100);
  border:1px solid var(--border-default);border-radius:6px;
  padding:9px 12px;font-size:14px;font-family:var(--font-sans);
}
#sx-chat .sx-chat-input:focus{outline:none;border-color:rgba(217,164,65,0.5);}
#sx-chat .sx-chat-send{
  background:var(--accent-mint);color:var(--obsidian-950);border:none;
  border-radius:6px;padding:0 14px;font-size:16px;cursor:pointer;
}
#sx-chat .sx-chat-send:hover{filter:brightness(1.1);}

#sx-chat .sx-leadform{
  display:flex;flex-direction:column;gap:8px;align-self:stretch;
  background:rgba(255,255,255,0.04);border:1px solid var(--border-subtle);
  border-radius:8px;padding:12px;
}
#sx-chat .sx-leadform-title{
  margin:0;font-family:var(--font-mono);font-size:11px;letter-spacing:0.08em;
  color:var(--champagne-400);
}
#sx-chat .sx-leadform input,
#sx-chat .sx-leadform select,
#sx-chat .sx-leadform textarea{
  width:100%;background:rgba(255,255,255,0.04);color:var(--metal-100);
  border:1px solid var(--border-default);border-radius:6px;
  padding:8px 10px;font-size:13px;font-family:var(--font-sans);
}
#sx-chat .sx-leadform textarea{resize:vertical;}
#sx-chat .sx-leadform-row{display:flex;gap:8px;}
#sx-chat .sx-leadform-row select{flex:1;min-width:0;}
#sx-chat .sx-leadform-send{
  background:var(--accent-mint);color:var(--obsidian-950);border:none;
  border-radius:6px;padding:9px 12px;font-size:13px;font-weight:600;cursor:pointer;
}
#sx-chat .sx-leadform-send:disabled{opacity:0.6;cursor:default;}
#sx-chat .sx-leadform-status,#sx-chat .sx-leadform-ok{
  margin:0;font-size:13px;line-height:1.5;
}
#sx-chat .sx-leadform-status a,#sx-chat .sx-leadform-ok a{color:var(--accent-mint);}

@media (max-width:767px){
  #sx-chat .sx-chat-bubble{
    bottom:calc(72px + env(safe-area-inset-bottom));right:16px;
  }
  #sx-chat .sx-chat-panel{
    right:0;left:0;bottom:0;width:100%;
    height:min(85dvh,640px);border-radius:12px 12px 0 0;border-bottom:none;
  }
}

@media (prefers-reduced-motion:reduce){
  #sx-chat .sx-chat-bubble{transition:none;}
  #sx-chat .sx-typing span{animation:none;opacity:0.6;}
}
