/* Flow Chat Bot — Public Styles */
*, *::before, *::after { box-sizing: border-box; }

/* ── Wrapper (positioned fixed via inline style) ── */
#fcb-wrapper {
  position: fixed;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ── Toggle Button ── */
#fcb-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  transition: transform .2s, box-shadow .2s;
  order: 2;
  flex-shrink: 0;
  margin-top: 12px;
}
#fcb-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#fcb-toggle:active { transform: scale(.96); }
.fcb-toggle-icon { width: 32px; height: 32px; object-fit: contain; }
.fcb-toggle-emoji { font-size: 24px; line-height: 1; }

/* ── Chat Window ── */
#fcb-window {
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  order: 1;
  transform-origin: bottom right;
  transform: scale(.85) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
#fcb-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}
/* Left position: origin bottom left */
#fcb-wrapper[style*="left:"] #fcb-window {
  transform-origin: bottom left;
}

/* ── Header ── */
#fcb-header {
  padding: 16px;
  position: relative;
  flex-shrink: 0;
}
#fcb-header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
#fcb-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  overflow: hidden;
  flex-shrink: 0;
}
#fcb-avatar img { width: 100%; height: 100%; object-fit: contain; }
#fcb-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  text-shadow: 0 1px 3px rgba(0,0,0,.2);
}
#fcb-online {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(255,255,255,.85);
  margin-top: 2px;
}
.fcb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  animation: fcb-pulse 2s infinite;
}
@keyframes fcb-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
#fcb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.2);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
#fcb-close:hover { background: rgba(255,255,255,.35); }

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

/* Bot bubble */
.fcb-bubble {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: fcb-fadeup .2s ease;
}
@keyframes fcb-fadeup {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fcb-bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fcb-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
}
.fcb-bubble-body { max-width: 82%; }
.fcb-bubble-text {
  background: #f1f5f9;
  color: var(--fcb-text);
  padding: 10px 14px;
  border-radius: 4px 16px 16px 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}
.fcb-bubble-img {
  margin-top: 8px;
  border-radius: 12px;
  max-width: 100%;
  max-height: 160px;
  object-fit: cover;
  display: block;
}

/* User bubble */
.fcb-bubble.user {
  flex-direction: row-reverse;
}
.fcb-bubble.user .fcb-bubble-text {
  background: var(--fcb-primary);
  color: #fff;
  border-radius: 16px 4px 16px 16px;
}

/* Options / buttons */
.fcb-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  animation: fcb-fadeup .25s ease;
}
.fcb-option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--fcb-bubble);
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fcb-text);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, color .15s;
}
.fcb-option-btn:hover {
  border-color: var(--fcb-primary);
  background: #eff6ff;
  color: var(--fcb-primary);
}
.fcb-option-btn .fcb-opt-arrow { color: #94a3b8; font-size: 12px; transition: color .15s; }
.fcb-option-btn:hover .fcb-opt-arrow { color: var(--fcb-primary); }

/* Nav buttons */
.fcb-nav {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.fcb-nav-btn {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
}
.fcb-nav-btn:hover { border-color: var(--fcb-primary); color: var(--fcb-primary); background: #eff6ff; }

/* Typing indicator */
.fcb-typing .fcb-bubble-text {
  background: #f1f5f9;
  padding: 12px 16px;
}
.fcb-typing-dots { display: flex; gap: 4px; align-items: center; }
.fcb-typing-dots span {
  width: 7px; height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: fcb-bounce .9s infinite;
}
.fcb-typing-dots span:nth-child(2) { animation-delay: .15s; }
.fcb-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes fcb-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}

/* ── Footer ── */
#fcb-footer {
  padding: 8px 16px;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

/* ── Mobile ── */
@media (max-width: 420px) {
  #fcb-window {
    width: calc(100vw - 24px);
    max-height: 75vh;
  }
}
