/* AI Marketing Chatbot — Frontend Styles */
:root {
  --amcb-primary: #21759b;
  --amcb-primary-dark: #185a7a;
  --amcb-agent: #1a6b3c;
  --amcb-radius: 14px;
  --amcb-font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Floating wrapper ─────────────────────────────────── */
.amcb-floating {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 999999;
  width: 360px;
  max-height: 600px;
}

.amcb-floating.amcb-pos-left {
  right: auto;
  left: 20px;
}

/* ── Inline wrapper ───────────────────────────────────── */
.amcb-inline {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

/* ── Window ───────────────────────────────────────────── */
.amcb-window {
  display: flex;
  flex-direction: column;
  border-radius: var(--amcb-radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  background: #fff;
  font-family: var(--amcb-font);
  height: 520px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Header ───────────────────────────────────────────── */
.amcb-header {
  background: var(--amcb-primary);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: background 0.4s;
}

.amcb-header-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.amcb-header-info {
  flex: 1;
  min-width: 0;
}

.amcb-header-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.amcb-header-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.amcb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.amcb-dot-green {
  background: #4cde69;
}
.amcb-dot-orange {
  background: #f5a623;
  animation: amcb-pulse 1.5s ease-in-out infinite;
}
.amcb-dot-red {
  background: #e74c3c;
}

@keyframes amcb-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.amcb-mode-badge {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 500;
  vertical-align: middle;
  margin-left: 4px;
}

.amcb-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s;
}
.amcb-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Lead form ────────────────────────────────────────── */
.amcb-lead-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 12px;
}

.amcb-lead-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: center;
}

.amcb-lead-sub {
  font-size: 13px;
  color: #777;
  text-align: center;
  margin-top: -6px;
}

.amcb-field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 9px;
  font-size: 14px;
  font-family: var(--amcb-font);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.amcb-field:focus {
  border-color: var(--amcb-primary);
}

.amcb-start-btn {
  width: 100%;
  padding: 11px;
  background: var(--amcb-primary);
  color: #fff;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--amcb-font);
  transition: background 0.15s;
}
.amcb-start-btn:hover:not(:disabled) {
  background: var(--amcb-primary-dark);
}
.amcb-start-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Messages ─────────────────────────────────────────── */
.amcb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.amcb-messages::-webkit-scrollbar {
  width: 4px;
}
.amcb-messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

.amcb-msg-row {
  display: flex;
  gap: 7px;
  align-items: flex-end;
}
.amcb-msg-row.amcb-user {
  flex-direction: row-reverse;
}

.amcb-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}
.amcb-bot-av {
  background: var(--amcb-primary);
  color: #fff;
}
.amcb-user-av {
  background: #f0f0f0;
  color: #555;
  border: 1px solid #e0e0e0;
}
.amcb-agent-av {
  background: var(--amcb-agent);
  color: #fff;
}

.amcb-msg-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 13px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #1a1a1a;
  background: #f2f2f2;
  border: 1px solid #e8e8e8;
  white-space: pre-wrap;
  word-break: break-word;
}

.amcb-msg-row.amcb-user .amcb-msg-bubble {
  background: var(--amcb-primary);
  color: #fff;
  border-color: transparent;
}

.amcb-msg-bubble.amcb-agent-bubble {
  background: #e8f5ee;
  border-color: #b2dfca;
  color: #0d3b1e;
}

.amcb-system-bubble {
  align-self: center;
  font-size: 11.5px;
  color: #888;
  background: #f9f9f9;
  border: 1px solid #ebebeb;
  border-radius: 20px;
  padding: 5px 14px;
  text-align: center;
}

.amcb-ts {
  font-size: 9.5px;
  color: #bbb;
  padding: 0 3px 1px;
  align-self: flex-end;
}
.amcb-msg-row.amcb-user .amcb-ts {
  text-align: left;
}

/* typing */
.amcb-typing-bub {
  padding: 10px 14px;
  background: #f2f2f2;
  border: 1px solid #e8e8e8;
  border-radius: 13px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.amcb-td {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amcb-primary);
  opacity: 0.4;
  animation: amcb-bounce 1.2s ease-in-out infinite;
}
.amcb-td:nth-child(2) {
  animation-delay: 0.2s;
}
.amcb-td:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes amcb-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ── Quick-reply chips ────────────────────────────────── */
.amcb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
  flex-shrink: 0;
}

.amcb-chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 18px;
  border: 1.5px solid var(--amcb-primary);
  color: var(--amcb-primary);
  background: transparent;
  cursor: pointer;
  font-family: var(--amcb-font);
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}
.amcb-chip:hover {
  background: var(--amcb-primary);
  color: #fff;
}

/* ── Handoff banner ───────────────────────────────────── */
.amcb-handoff-bar {
  margin: 0 14px 10px;
  padding: 9px 12px;
  background: #fff8e1;
  border: 1px solid #f5c842;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.amcb-handoff-bar span {
  font-size: 12.5px;
  color: #7a5c00;
  flex: 1;
  line-height: 1.4;
}

.amcb-handoff-btn {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 7px;
  background: #f5a623;
  border: none;
  color: #fff;
  cursor: pointer;
  font-family: var(--amcb-font);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}
.amcb-handoff-btn:hover {
  background: #d4891e;
}

/* ── WhatsApp bar ─────────────────────────────────────── */
.amcb-whatsapp-bar {
  margin: 0 14px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.amcb-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: #25d366;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  font-family: var(--amcb-font);
  transition: background 0.15s;
}
.amcb-wa-btn:hover {
  background: #1da851;
  color: #fff;
}

.amcb-or {
  font-size: 11.5px;
  color: #999;
}

/* ── Input area ───────────────────────────────────────── */
.amcb-input-area {
  border-top: 1px solid #f0f0f0;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.amcb-input {
  flex: 1;
  resize: none;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: var(--amcb-font);
  background: #fafafa;
  color: #1a1a1a;
  outline: none;
  max-height: 80px;
  min-height: 34px;
  line-height: 1.5;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.amcb-input:focus {
  border-color: var(--amcb-primary);
  background: #fff;
}
.amcb-input::placeholder {
  color: #bbb;
}
.amcb-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.amcb-send-btn {
  border-radius: 9px;
  padding: 12px;
  background: var(--amcb-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.15s,
    transform 0.1s;
}
.amcb-send-btn:hover:not(:disabled) {
  background: var(--amcb-primary-dark);
}
.amcb-send-btn:active:not(:disabled) {
  transform: scale(0.93);
}
.amcb-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.amcb-send-btn svg {
  display: block;
  fill: white !important;
}

/* ── Footer ───────────────────────────────────────────── */
.amcb-powered {
  text-align: center;
  font-size: 10px;
  color: #ccc;
  padding: 4px 0 7px;
  font-family: var(--amcb-font);
  flex-shrink: 0;
}

/* ── Floating bubble button ───────────────────────────── */
.amcb-launcher {
  position: fixed;
  bottom: 20px;
  right: 75px;
  z-index: 999999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--amcb-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  transition:
    background 0.15s,
    transform 0.2s;
  padding: 15px;
}
.amcb-launcher:hover {
  transform: scale(1.08);
  background: var(--amcb-primary-dark);
}

.amcb-bubble-icon {
  display: block;
}

.amcb-notif-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f5a623;
  border: 2px solid #fff;
}

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .amcb-floating {
    width: calc(80vw - 20px);
    right: 10px;
    bottom: 80px;
  }
  .amcb-window {
    height: 80vh;
    max-height: 540px;
    border-radius: 12px;
  }
}
