/* JJ Handyman ATX — Chatbot Widget v1.0 */

/* ── Trigger button ── */
#cb-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #036955;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 20px rgba(3,105,85,.40);
  z-index: 9998;
  transition: transform .2s ease, box-shadow .2s ease;
}
#cb-trigger:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(3,105,85,.50); }
#cb-trigger .cb-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #f5ab38;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
}

/* ── Chat window ── */
#cb-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  transform: scale(.92) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s ease, opacity .25s ease;
}
#cb-window.cb-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
#cb-header {
  background: #036955;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#cb-header .cb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
#cb-header .cb-title { flex: 1; }
#cb-header .cb-title strong { display: block; font-size: 14px; font-weight: 700; }
#cb-header .cb-title span  { font-size: 11px; opacity: .78; }
#cb-lang {
  display: flex;
  gap: 4px;
  margin-right: 6px;
}
#cb-lang button {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s;
}
#cb-lang button.cb-lang-active { background: rgba(255,255,255,.35); }
#cb-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
#cb-close:hover { color: #fff; }

/* ── Messages area ── */
#cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
#cb-messages::-webkit-scrollbar { width: 4px; }
#cb-messages::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* Bot message */
.cb-msg-bot {
  align-self: flex-start;
  background: #f3f4f6;
  color: #111827;
  border-radius: 4px 14px 14px 14px;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 88%;
  white-space: pre-line;
}
/* User message (echoed selection) */
.cb-msg-user {
  align-self: flex-end;
  background: #036955;
  color: #fff;
  border-radius: 14px 4px 14px 14px;
  padding: 9px 13px;
  font-size: 13.5px;
  max-width: 80%;
}

/* Typing indicator */
.cb-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: #f3f4f6;
  border-radius: 4px 14px 14px 14px;
}
.cb-typing span {
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: cb-bounce .9s infinite;
}
.cb-typing span:nth-child(2) { animation-delay: .15s; }
.cb-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes cb-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* ── Options (quick reply buttons) ── */
#cb-options {
  padding: 8px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}
.cb-opt {
  background: #fff;
  border: 1.5px solid #036955;
  color: #036955;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.cb-opt:hover { background: #036955; color: #fff; }
.cb-opt.cb-opt-accent {
  background: #f5ab38;
  border-color: #f5ab38;
  color: #111;
}
.cb-opt.cb-opt-accent:hover { background: #d4901e; border-color: #d4901e; }
.cb-opt.cb-opt-wa {
  background: #25d366;
  border-color: #25d366;
  color: #fff;
}
.cb-opt.cb-opt-wa:hover { background: #1da851; border-color: #1da851; }

/* ── Input area ── */
#cb-input-area {
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}
#cb-input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
#cb-input:focus { border-color: #036955; }
#cb-send {
  background: #036955;
  border: none;
  color: #fff;
  border-radius: 8px;
  width: 38px;
  cursor: pointer;
  font-size: 16px;
  transition: background .15s;
}
#cb-send:hover { background: #025244; }

/* ── Mobile ── */
@media (max-width: 480px) {
  #cb-window {
    bottom: 0;
    right: 0;
    width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }
  #cb-trigger { bottom: 20px; right: 16px; }
}
