/* JB Security chat assistant — inherits theme tokens, adapts to light/dark. */
.jbsec-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  font-family: "Manrope", sans-serif;
}
.jbsec-chat[hidden] { display: none; }

.jbsec-chat-fab {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--green);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform .18s ease, background .18s ease;
}
.jbsec-chat-fab:hover { transform: translateY(-2px); background: var(--green-bright); }
.jbsec-chat-fab .jbsec-chat-ic-close { display: none; }
.jbsec-chat.is-open .jbsec-chat-fab .jbsec-chat-ic-open { display: none; }
.jbsec-chat.is-open .jbsec-chat-fab .jbsec-chat-ic-close { display: block; }
.jbsec-chat-fab-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green-bright);
  border: 2px solid var(--bg);
}
.jbsec-chat.is-open .jbsec-chat-fab-dot { display: none; }

.jbsec-chat-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(370px, calc(100vw - 40px));
  max-height: min(540px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.jbsec-chat-panel[hidden] { display: none; }

.jbsec-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.jbsec-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.jbsec-chat-headtxt { display: flex; flex-direction: column; line-height: 1.3; }
.jbsec-chat-headtxt strong { font-size: 15px; color: var(--text); }
.jbsec-chat-headtxt small { font-size: 12px; color: var(--muted); }

.jbsec-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
}
.jbsec-chat-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.jbsec-chat-bot {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.jbsec-chat-user {
  align-self: flex-end;
  background: var(--green);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.jbsec-chat-msg a { color: var(--green-bright); text-decoration: underline; }
.jbsec-chat-user a { color: #fff; }

.jbsec-chat-typing { display: flex; gap: 5px; padding: 13px 16px; }
.jbsec-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: jbsec-chat-blink 1.1s infinite;
}
.jbsec-chat-typing span:nth-child(2) { animation-delay: .18s; }
.jbsec-chat-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes jbsec-chat-blink {
  0%, 80%, 100% { opacity: .25; }
  40% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .jbsec-chat-typing span { animation: none; opacity: .7; }
}

.jbsec-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 10px;
}
.jbsec-chat-chips[hidden] { display: none; }
.jbsec-chat-chip {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--green);
  background: transparent;
  color: var(--green);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.jbsec-chat-chip:hover { background: var(--green); color: #fff; }

.jbsec-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.jbsec-chat-form input {
  flex: 1;
  font: inherit;
  font-size: 14px;
  padding: 10px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  outline: none;
  min-width: 0;
}
.jbsec-chat-form input:focus { border-color: var(--green); }
.jbsec-chat-form button {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.jbsec-chat-form button:hover { background: var(--green-bright); }
