/* janbeger.ai chatbot — pure client-side, no external dependencies */

#jb-chat-toggle {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9900;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 0 6px;
  height: 50px;
  background: var(--accent, #d8432a);
  color: #fff;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--sans, system-ui), sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.005em;
  box-shadow: 0 10px 26px -8px rgba(216,67,42,0.4), 0 4px 10px rgba(40,30,22,0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease, filter .15s ease, box-shadow .15s ease;
}
#jb-chat-toggle.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#jb-chat-toggle:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -8px rgba(216,67,42,0.5), 0 6px 14px rgba(40,30,22,0.22);
}
#jb-chat-toggle .icon {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#jb-chat-toggle .icon svg { width: 18px; height: 18px; }

#jb-chat-panel {
  position: fixed;
  bottom: 88px;
  left: 24px;
  width: 340px;
  max-height: 540px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(34,28,23,0.08);
  box-shadow: 0 24px 56px rgba(40,30,22,0.20), 0 8px 20px rgba(40,30,22,0.10);
  display: flex;
  flex-direction: column;
  z-index: 9800;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  transition: opacity .2s ease, transform .2s ease;
}
#jb-chat-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.jchat-header {
  background: var(--ink, #221c17);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.jchat-header-left { display: flex; align-items: center; gap: 10px; }
.jchat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent, #d8432a);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.jchat-avatar svg { width: 16px; height: 16px; color: #fff; }
.jchat-header strong {
  font-family: var(--display, system-ui), sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  display: block;
  letter-spacing: -0.005em;
}
.jchat-header small {
  font-size: 11.5px;
  color: rgba(255,255,255,0.55);
  display: block;
  margin-top: 1px;
}
.jchat-close {
  background: none;
  border: 0;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease;
}
.jchat-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
.jchat-close svg { width: 15px; height: 15px; }

.jchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: #faf7f1;
}
.jchat-msg { display: flex; }
.jchat-msg.user { justify-content: flex-end; }
.jchat-bubble {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  font-family: var(--sans, system-ui), sans-serif;
}
.jchat-msg.bot .jchat-bubble {
  background: #fff;
  color: var(--ink, #221c17);
  border: 1px solid rgba(34,28,23,0.07);
  border-bottom-left-radius: 4px;
}
.jchat-msg.user .jchat-bubble {
  background: var(--accent, #d8432a);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.jchat-bubble a { color: var(--accent, #d8432a); text-decoration: underline; }
.jchat-msg.user .jchat-bubble a { color: rgba(255,255,255,0.92); }

.jchat-chips {
  padding: 4px 14px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  background: #faf7f1;
}
.jchat-chip {
  background: #fff;
  border: 1px solid rgba(34,28,23,0.12);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-family: var(--sans, system-ui), sans-serif;
  color: var(--ink-2, #736a60);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
  white-space: nowrap;
}
.jchat-chip:hover {
  border-color: var(--accent, #d8432a);
  color: var(--accent, #d8432a);
  background: rgba(216,67,42,0.05);
}

.jchat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(34,28,23,0.08);
  flex-shrink: 0;
  background: #fff;
}
.jchat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(34,28,23,0.12);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--sans, system-ui), sans-serif;
  color: var(--ink, #221c17);
  outline: none;
  background: #fff;
  transition: border-color .15s ease;
}
.jchat-input:focus { border-color: var(--accent, #d8432a); }
.jchat-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent, #d8432a);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: filter .15s ease;
}
.jchat-send:hover { filter: brightness(1.08); }
.jchat-send svg { width: 15px; height: 15px; color: #fff; }

@media (max-width: 480px) {
  #jb-chat-panel { left: 10px; right: 10px; width: auto; bottom: 78px; max-height: 70vh; }
  #jb-chat-toggle { left: 14px; right: auto; bottom: 14px; padding: 0 16px 0 6px; height: 46px; }
  #jb-chat-toggle .icon { width: 34px; height: 34px; }
}
