/* ── Build24 Chat Widget ─────────────────────────────────── */

/* Floating bubble */
#b24-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  font-family: 'Inter', sans-serif;
  opacity: 0;
  transition: opacity 1s ease;
}

#b24-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2A9D8F;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-left: auto;
  box-shadow: 0 4px 18px rgba(42,157,143,0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#b24-bubble:hover { transform: scale(1.07); box-shadow: 0 6px 24px rgba(42,157,143,0.55); }

/* Unread dot */
#b24-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: #e63946;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ── Panel ───────────────────────────────────────────────── */
#b24-panel {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 380px;
  height: 540px;
  background: #FAF8F4;      /* cream — matches website */
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* hidden state */
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#b24-panel.b24-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
#b24-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: #2A9D8F;
  flex-shrink: 0;
}
#b24-hname {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}
#b24-header-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}
#b24-reset,
#b24-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
#b24-close { font-size: 18px; }
#b24-reset:hover,
#b24-close:hover { color: #fff; background: rgba(255,255,255,0.15); }
#b24-reset { display: none; }
#b24-reset.visible { display: flex; }

/* Messages area */
#b24-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
#b24-msgs::-webkit-scrollbar { width: 3px; }
#b24-msgs::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.b24-bubble-msg {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.b24-bot {
  background: #fff;
  color: #111827;
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.b24-user {
  background: #2A9D8F;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}

/* Typing dots */
#b24-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 15px;
}
#b24-typing span {
  width: 7px; height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: b24dot 1.2s infinite ease-in-out;
}
#b24-typing span:nth-child(2) { animation-delay: 0.2s; }
#b24-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes b24dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick replies — full-width cards like reference ─────── */
#b24-quick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px 10px;
}
.b24-qr {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  color: #111827;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.b24-qr:hover, .b24-qr:active {
  border-color: #2A9D8F;
  background: #f0fffe;
}

/* ── Input row ───────────────────────────────────────────── */
#b24-footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #ede9e3;
  padding: 10px 12px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#b24-input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 24px;
  padding: 11px 18px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  color: #111;
  background: #fff;
  transition: border-color 0.15s;
}
#b24-input:focus { border-color: #2A9D8F; }
#b24-input:disabled { background: #f9fafb; color: #9ca3af; }
#b24-input::placeholder { color: #9ca3af; }

#b24-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #2A9D8F;
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#b24-send:hover { background: #248a7d; }
#b24-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 500px) {
  #b24-wrap { bottom: 16px; right: 16px; }
  #b24-panel {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    height: 82vh;
    border-radius: 20px 20px 0 0;
    bottom: 0;
    right: 0;
  }
  /* Hide floating bubble when panel is open — header X handles closing */
  #b24-panel.b24-open + #b24-bubble {
    display: none !important;
  }
}
