@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design tokens ─── */
:root {
  --c-accent:   #2563eb;
  --c-accent2:  #4f46e5;
  --c-accentRGB:37,99,235;
  --c-bg:       #0f172a;
  --c-glow:     rgba(37,99,235,.25);
  --c-white:    #ffffff;
  --c-surf:     #f8fafc;
  --c-border:   #e2e8f0;
  --c-text:     #0f172a;
  --c-muted:    #64748b;
  --c-font:     'Inter', system-ui, -apple-system, sans-serif;
  --c-r:        20px;
  --c-shadow:   0 25px 50px -12px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.05);
}
#eoot-root * { box-sizing: border-box; margin: 0; padding: 0; }

/* ════════════════════════════════════
   LAUNCHER BUTTON
════════════════════════════════════ */
#eoot-launcher {
  position: fixed;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent2));
  border: none;
  cursor: pointer;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px var(--c-glow), 0 1px 4px rgba(0,0,0,.12);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease, border-radius .3s ease;
}
#eoot-launcher.pos-right { right: 24px; }
#eoot-launcher.pos-left  { left:  24px; }
#eoot-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 32px var(--c-glow), 0 2px 8px rgba(0,0,0,.15);
}
#eoot-launcher:active { transform: scale(.96); }
#eoot-launcher.open   { border-radius: 50%; }

#eoot-launcher svg {
  width: 24px; height: 24px; fill: #fff;
  position: absolute;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}
#eoot-launcher .lc-open  { transform: scale(1)  rotate(0deg);  opacity: 1; }
#eoot-launcher .lc-close { transform: scale(0)  rotate(-45deg);opacity: 0; }
#eoot-launcher.open .lc-open  { transform: scale(0)  rotate(45deg); opacity: 0; }
#eoot-launcher.open .lc-close { transform: scale(1)  rotate(0deg);  opacity: 1; }

/* Notification dot */
#eoot-notif {
  position: absolute;
  top: -3px; right: -3px;
  width: 14px; height: 14px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: notif-pop .4s cubic-bezier(.34,1.56,.64,1) both;
  box-shadow: 0 0 0 0 rgba(239,68,68,.4);
  animation: notif-pop .4s cubic-bezier(.34,1.56,.64,1) both, notif-pulse 2.5s 1s infinite;
}
#eoot-notif.hidden { display: none; }
@keyframes notif-pop   { from { transform:scale(0) } to { transform:scale(1) } }
@keyframes notif-pulse { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.4)} 50%{box-shadow:0 0 0 6px rgba(239,68,68,0)} }

/* ════════════════════════════════════
   CHAT WINDOW
════════════════════════════════════ */
#eoot-window {
  position: fixed;
  bottom: 92px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 110px);
  background: var(--c-white);
  border-radius: var(--c-r);
  box-shadow: var(--c-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99997;
  font-family: var(--c-font);
  transform: translateY(16px) scale(.97);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.1,.64,1), opacity .22s ease;
}
#eoot-window.pos-right { right: 24px; }
#eoot-window.pos-left  { left:  24px; }
#eoot-window.open { transform: none; opacity: 1; pointer-events: all; }

/* ── Header ─── */
#eoot-header {
  background: var(--c-bg);
  padding: 0 20px;
  height: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
#eoot-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 100% -20%, rgba(99,102,241,.35) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at -10% 110%, rgba(37,99,235,.2) 0%, transparent 60%);
  pointer-events: none;
}

.h-avatar {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent2));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.h-avatar svg { width: 22px; height: 22px; fill: #fff; }
.h-avatar::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,.3), transparent);
  z-index: -1;
}

.h-info { flex: 1; z-index: 1; min-width: 0; }
.h-name   { color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -.02em; }
.h-title  { color: rgba(255,255,255,.45); font-size: 11px; margin-top: 1px; }
.h-status {
  display: flex; align-items: center; gap: 5px;
  margin-top: 4px;
}
.h-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 2px rgba(52,211,153,.3);
  animation: status-pulse 2.5s ease-in-out infinite;
}
@keyframes status-pulse { 0%,100%{opacity:1}50%{opacity:.5} }
.h-status-text { color: rgba(255,255,255,.5); font-size: 11px; }

/* Intent badge in header */
#eoot-intent-badge {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,.8);
  font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.15);
  letter-spacing: .04em;
  display: none;
  z-index: 1;
  white-space: nowrap;
}
#eoot-intent-badge.show { display: block; }

/* ── Quick chips ─── */
#eoot-chips {
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--c-surf);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.eoot-chip {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--c-font);
  color: var(--c-accent);
  cursor: pointer;
  transition: all .15s ease;
  letter-spacing: -.01em;
}
.eoot-chip:hover {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--c-glow);
}
#eoot-chips.hidden { display: none; }

/* ── Messages ─── */
#eoot-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--c-surf);
  scroll-behavior: smooth;
}
#eoot-msgs::-webkit-scrollbar { width: 4px; }
#eoot-msgs::-webkit-scrollbar-track { background: transparent; }
#eoot-msgs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Message groups */
.msg-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.msg-group.bot  { align-items: flex-start; }
.msg-group.user { align-items: flex-end;   }

.msg-row { display: flex; gap: 8px; animation: msg-in .2s ease; }
.msg-group.user .msg-row { flex-direction: row-reverse; }
@keyframes msg-in { from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none} }

.msg-av {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent2));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: auto;
}
.msg-av svg { width: 14px; height: 14px; fill: #fff; }
.msg-av.hidden { visibility: hidden; }

.msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}
.msg-group.bot .msg-bubble {
  background: var(--c-white);
  color: var(--c-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.04);
}
.msg-group.user .msg-bubble {
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent2));
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px var(--c-glow);
}

.msg-group.bot .msg-bubble.fallback {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
}

.msg-time {
  font-size: 10px;
  color: var(--c-muted);
  margin-top: 4px;
  padding: 0 2px;
}
.msg-group.user .msg-time { text-align: right; }
.msg-group.bot  .msg-time { padding-left: 36px; }

/* Typing indicator */
.typing-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; animation: msg-in .2s ease; }
.typing-bubble {
  background: var(--c-white);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.04);
}
.typing-bubble span {
  width: 6px; height: 6px; border-radius: 50%; background: #94a3b8;
  animation: typing .9s ease-in-out infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: .16s; }
.typing-bubble span:nth-child(3) { animation-delay: .32s; }
@keyframes typing { 0%,80%,100%{transform:translateY(0)}40%{transform:translateY(-6px)} }

/* ════════════════════════════════════
   INLINE LEAD CAPTURE FORM
════════════════════════════════════ */
.lead-form-card {
  background: var(--c-white);
  border-radius: 16px;
  border: 1px solid var(--c-border);
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  overflow: hidden;
  animation: msg-in .25s ease;
  margin-bottom: 10px;
}
.lf-header {
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent2));
  padding: 14px 16px;
  color: #fff;
}
.lf-header h4 { font-size: 13px; font-weight: 700; margin: 0; }
.lf-header p  { font-size: 11px; opacity: .75; margin: 3px 0 0; }
.lf-body { padding: 16px; }

.lf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lf-full { grid-column: 1 / -1; }

.lf-field { display: flex; flex-direction: column; gap: 4px; }
.lf-label {
  font-size: 11px; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.lf-req { color: #ef4444; }

.lf-input,
.lf-select,
.lf-textarea {
  width: 100%;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  padding: 8px 11px;
  font-family: var(--c-font);
  font-size: 12.5px;
  color: var(--c-text);
  background: var(--c-surf);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
  -webkit-appearance: none;
}
.lf-input:focus,
.lf-select:focus,
.lf-textarea:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(var(--c-accentRGB),.12);
  background: #fff;
}
.lf-textarea { resize: none; height: 68px; line-height: 1.5; }

.lf-submit {
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent2));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--c-font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  box-shadow: 0 4px 16px var(--c-glow);
  letter-spacing: -.01em;
}
.lf-submit:hover   { transform: translateY(-1px); box-shadow: 0 6px 20px var(--c-glow); }
.lf-submit:active  { transform: scale(.97); }
.lf-submit:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.lf-footer {
  padding: 10px 16px 14px;
  font-size: 11px;
  color: var(--c-muted);
  text-align: center;
  border-top: 1px solid var(--c-border);
  background: var(--c-surf);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* ── Input bar ─── */
#eoot-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--c-border);
  background: var(--c-white);
  flex-shrink: 0;
}
#eoot-input {
  flex: 1;
  border: 1.5px solid var(--c-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--c-font);
  font-size: 13.5px;
  color: var(--c-text);
  outline: none;
  resize: none;
  height: 44px;
  max-height: 110px;
  overflow-y: auto;
  line-height: 1.5;
  background: var(--c-surf);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
#eoot-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(var(--c-accentRGB),.1);
  background: #fff;
}
#eoot-input::placeholder { color: #94a3b8; }
#eoot-input:disabled { opacity: .5; }

#eoot-send {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent2));
  border: none; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px var(--c-glow);
  transition: transform .15s, box-shadow .15s;
}
#eoot-send:hover   { transform: translateY(-1px); box-shadow: 0 6px 18px var(--c-glow); }
#eoot-send:active  { transform: scale(.93); }
#eoot-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }
#eoot-send svg { width: 18px; height: 18px; fill: #fff; }

/* ── Footer bar ─── */
#eoot-footer {
  text-align: center;
  font-size: 11px;
  color: var(--c-muted);
  padding: 8px 0 10px;
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
  letter-spacing: -.01em;
}
#eoot-footer a { color: var(--c-muted); text-decoration: none; }
#eoot-footer a:hover { color: var(--c-accent); }

/* ── Mobile ─── */
@media (max-width: 480px) {
  #eoot-window {
    width: calc(100vw - 16px);
    right: 8px !important;
    left: 8px !important;
    bottom: 80px;
    height: calc(100vh - 96px);
    max-height: none;
    border-radius: 16px;
  }
  #eoot-launcher { bottom: 14px; }
  #eoot-launcher.pos-right { right: 14px; }
  #eoot-launcher.pos-left  { left:  14px; }
  .lf-grid { grid-template-columns: 1fr; }
  .msg-bubble { max-width: 88%; }
}
