/* chatbot.css — Floating AI chatbot widget for Bright Smile Dental demo */
/* Matches LocalSpark warm orange/cream theme */

:root {
  --cb-bg: #FDFCF8;
  --cb-accent: #F97316;
  --cb-accent-dark: #E8610A;
  --cb-navy: #1E2A3A;
  --cb-border: #E8E2D9;
  --cb-card: #FFFFFF;
  --cb-fg: #1C1C1E;
  --cb-fg-muted: #6B6B6B;
  --cb-font-head: 'Plus Jakarta Sans', sans-serif;
  --cb-font-body: 'Source Sans 3', sans-serif;
  --cb-shadow: 0 8px 32px rgba(30, 42, 58, 0.12), 0 2px 8px rgba(30, 42, 58, 0.08);
  --cb-radius: 16px;
  --cb-btn-radius: 50%;
}

/* ── Floating button ── */
.cb-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 64px;
  height: 64px;
  background: var(--cb-accent);
  border: none;
  border-radius: var(--cb-btn-radius);
  box-shadow: var(--cb-shadow);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  color: white;
}

.cb-toggle:hover { background: var(--cb-accent-dark); transform: scale(1.08); }
.cb-toggle svg { width: 28px; height: 28px; }

/* Badge on toggle when window is closed */
.cb-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #EF4444;
  border-radius: 50%;
  border: 2px solid var(--cb-bg);
  display: none;
}

/* ── Chat window ── */
.cb-window {
  position: fixed;
  bottom: 104px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--cb-card);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cb-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ── */
.cb-header {
  background: var(--cb-navy);
  padding: 20px 20px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.cb-avatar {
  width: 44px;
  height: 44px;
  background: var(--cb-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.cb-header-info { flex: 1; }
.cb-header-info h3 {
  font-family: var(--cb-font-head);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
.cb-header-info span {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.cb-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.cb-close:hover { color: white; background: rgba(255,255,255,0.1); }
.cb-close svg { width: 20px; height: 20px; }

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

.cb-msg {
  display: flex;
  gap: 10px;
  animation: cb-pop 0.2s ease;
}

@keyframes cb-pop {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cb-msg.user { flex-direction: row-reverse; }
.cb-msg.user .cb-bubble { background: var(--cb-accent); color: white; border-radius: 16px 4px 16px 16px; }
.cb-msg.bot .cb-bubble  { background: var(--cb-bg-alt, #F5F1E8); color: var(--cb-fg); border-radius: 4px 16px 16px 16px; }

.cb-bubble {
  max-width: 75%;
  padding: 10px 14px;
  font-family: var(--cb-font-body);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.cb-msg-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--cb-font-head);
}
.cb-msg.bot .cb-msg-icon { background: var(--cb-accent); color: white; }
.cb-msg.user .cb-msg-icon { background: var(--cb-navy); color: white; }

/* Typing indicator */
.cb-typing {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}
.cb-typing span {
  width: 7px; height: 7px;
  background: var(--cb-fg-muted);
  border-radius: 50%;
  animation: cb-dots 1.2s infinite;
}
.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cb-dots {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Input area ── */
.cb-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--cb-border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.cb-input {
  flex: 1;
  border: 1.5px solid var(--cb-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--cb-font-body);
  font-size: 14px;
  color: var(--cb-fg);
  background: var(--cb-bg);
  resize: none;
  min-height: 42px;
  max-height: 90px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s;
}
.cb-input:focus { border-color: var(--cb-accent); }
.cb-input::placeholder { color: var(--cb-fg-muted); }

.cb-send {
  width: 42px;
  height: 42px;
  background: var(--cb-accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
.cb-send:hover { background: var(--cb-accent-dark); }
.cb-send:active { transform: scale(0.92); }
.cb-send svg { width: 18px; height: 18px; }

/* ── Lead form modal ── */
.cb-form-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30,42,58,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
.cb-form-overlay.open { display: flex; }

.cb-form-card {
  background: var(--cb-card);
  border-radius: var(--cb-radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
}

.cb-form-card h4 {
  font-family: var(--cb-font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--cb-navy);
  margin-bottom: 4px;
}
.cb-form-card p {
  font-size: 13px;
  color: var(--cb-fg-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.cb-field {
  margin-bottom: 12px;
}
.cb-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--cb-font-head);
  color: var(--cb-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}
.cb-field input,
.cb-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--cb-border);
  border-radius: 8px;
  font-family: var(--cb-font-body);
  font-size: 14px;
  color: var(--cb-fg);
  background: var(--cb-bg);
  outline: none;
  transition: border-color 0.2s;
}
.cb-field input:focus,
.cb-field select:focus { border-color: var(--cb-accent); }

.cb-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.cb-btn-primary {
  flex: 1;
  padding: 10px;
  background: var(--cb-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--cb-font-head);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.cb-btn-primary:hover { background: var(--cb-accent-dark); }

.cb-btn-secondary {
  padding: 10px 14px;
  background: var(--cb-bg);
  color: var(--cb-fg-muted);
  border: 1.5px solid var(--cb-border);
  border-radius: 8px;
  font-family: var(--cb-font-body);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.cb-btn-secondary:hover { background: var(--cb-border); }

/* Booking confirmation */
.cb-confirm {
  text-align: center;
}
.cb-confirm-icon {
  width: 56px; height: 56px;
  background: #DCFCE7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: #16A34A;
}
.cb-confirm h4 {
  font-family: var(--cb-font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--cb-navy);
  margin-bottom: 6px;
}
.cb-confirm p {
  font-size: 13px;
  color: var(--cb-fg-muted);
  line-height: 1.5;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .cb-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    border-radius: var(--cb-radius) var(--cb-radius) 0 0;
    height: 85vh;
  }
  .cb-toggle { bottom: 20px; right: 20px; }
}