/* chat-widget.css — phone frame + chat bubbles.
   Used by BOTH the home scroll-story phone and the live demo widget. */
.phone {
  width: min(360px, 88vw);
  aspect-ratio: 9 / 18.6;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 44px;
  padding: 14px;
  box-shadow: var(--shadow-pop);
  position: relative;
}
.phone::before {
  /* speaker notch */
  content: '';
  position: absolute;
  top: 24px; left: 50%;
  transform: translateX(-50%);
  width: 86px; height: 8px;
  border-radius: 8px;
  background: var(--line);
}
.phone__screen {
  width: 100%; height: 100%;
  border-radius: 32px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.phone__statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 34px 18px 10px;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.phone__biz { display: flex; align-items: center; gap: .5rem; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.phone__biz-dot { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-hot)); display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; font-family: var(--font-display); }
.phone__biz-name { font-weight: 650; font-size: .88rem; }
.phone__biz-status { font-size: .7rem; color: var(--good); display: flex; align-items: center; gap: .3rem; }
.phone__biz-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--good); }

.chat-log {
  flex: 1;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.chat-msg {
  max-width: 82%;
  padding: .62rem .9rem;
  border-radius: 18px;
  font-size: .88rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}
.chat-msg--user {
  align-self: flex-end;
  background: var(--bubble-user);
  border-bottom-right-radius: 6px;
}
.chat-msg--bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  border: 1px solid var(--bubble-bot-line);
  border-bottom-left-radius: 6px;
}
.chat-msg--sys {
  align-self: center;
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--muted);
  background: none;
  padding: .2rem 0;
}
.chat-msg--miss {
  align-self: center;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--miss);
  border: 1px dashed color-mix(in srgb, var(--miss) 55%, transparent);
  border-radius: var(--radius-sm);
  padding: .45rem .9rem;
}

/* phone--biz: the phone is shown from the BUSINESS's side —
   incoming customer messages arrive on the LEFT, replies go RIGHT. */
.phone--biz .chat-msg--user {
  align-self: flex-start;
  border-bottom-right-radius: 18px;
  border-bottom-left-radius: 6px;
}
.phone--biz .chat-msg--bot {
  align-self: flex-end;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 6px;
}

.chat-typing { display: inline-flex; gap: 4px; padding: .7rem .95rem; }
.chat-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: typing 1.1s infinite ease-in-out;
}
.chat-typing i:nth-child(2) { animation-delay: .18s; }
.chat-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* live demo input row (demo page only) */
.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  padding: .6rem 1rem;
  font-size: .9rem;
  color: var(--ink);
}
.chat-input input:focus { outline: none; border-color: var(--accent); }
.chat-input button {
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 50%;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background-color .2s ease, transform .15s ease;
}
.chat-input button:hover { background: var(--accent-hot); transform: scale(1.06); }
.chat-input button:disabled { background: var(--line-strong); cursor: wait; transform: none; }

.chat-chips { display: flex; gap: .5rem; flex-wrap: wrap; padding: 0 14px 12px; }
.chat-chips button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-dim);
  border-radius: var(--pill);
  padding: .38rem .85rem;
  font-size: .78rem;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.chat-chips button:hover { border-color: var(--accent); color: var(--accent); }

/* inline email-capture shown inside the chat log when the service errors out */
.chat-recover {
  align-self: stretch;
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.chat-recover input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  padding: .55rem .9rem;
  font-size: .85rem;
  color: var(--ink);
}
.chat-recover input:focus { outline: none; border-color: var(--accent); }
.chat-recover button {
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--pill);
  padding: 0 1rem;
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s ease;
}
.chat-recover button:hover { background: var(--accent-hot); }
.chat-recover button:disabled { background: var(--line-strong); cursor: wait; }
