/* Bot page (/ai-nlp-bots/{slug}): the logged-out intro and the chat card.
   Mobile-first: on a phone the chat fills the screen like a messaging app with
   the input pinned at the bottom; from 640px it is a centred card. */

[hidden] { display: none !important; }

.bot { padding-bottom: 40px; }

/* ---------- Logged out ---------- */
.bot__intro {
  display: grid; gap: 0; margin-top: 12px; overflow: hidden;
  background: var(--white); border: 1px solid #eef0f6; border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.bot__media { background: var(--gold-grad); max-height: 190px; overflow: hidden; }
.bot__media img { width: 100%; height: 190px; object-fit: cover; }
.bot__about { padding: 18px 20px 22px; }
.bot__title { display: flex; align-items: center; gap: 10px; font-size: 24px; }
.bot__title .icon { width: 30px; height: 30px; }
.bot__desc { margin-top: 10px; font-size: 15px; color: var(--navy-soft); }

.bot__examples { margin-top: 26px; }
.bot__questions { display: grid; gap: 10px; margin-top: 12px; }
.bot__questions li {
  padding: 12px 16px; background: var(--paper); border-left: 4px solid var(--gold);
  border-radius: var(--r-sm); font-size: 15px; color: var(--navy);
}

.bot__signup {
  margin-top: 26px; padding: 22px 20px; text-align: center;
  background: linear-gradient(135deg, var(--pale-yellow), var(--white)); border: 1px solid #f1deaa; border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.bot__signup-title { font-size: 19px; }
.bot__signup p { margin-top: 8px; font-size: 14px; color: var(--navy-soft); }
.bot__signup-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.bot__signup-actions .btn { flex: 1 1 150px; max-width: 220px; }

/* ---------- Chat card ---------- */
.bot--chat { padding-bottom: 0; }
.bot--chat .container { padding-inline: 0; }
.bot--chat .breadcrumb { padding-inline: 16px; }

.chat {
  display: flex; flex-direction: column; margin-top: 4px;
  height: calc(100vh - var(--header-h) - 44px); height: calc(100dvh - var(--header-h) - 44px); min-height: 420px;
  background: var(--paper); border-top: 1px solid var(--line); overflow: hidden;
}

.chat__head {
  display: flex; align-items: center; gap: 10px; flex: none; padding: 10px 14px;
  background: var(--white); border-bottom: 1px solid var(--line);
}
.chat__avatar {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--gold-grad); color: var(--navy); box-shadow: var(--shadow-sm);
}
.chat__avatar .icon { width: 22px; height: 22px; }
.chat__who { min-width: 0; flex: 1; }
.chat__title { font-size: 15px; line-height: 1.25; }
.chat__status { font-size: 12px; color: var(--navy-soft); }
.chat__count {
  flex: none; max-width: 38%; padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--pale-yellow); font: 600 11.5px/1.25 var(--font-head); color: var(--navy); text-align: center;
}

.chat__log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: auto;
  display: flex; flex-direction: column; gap: 8px; padding: 14px 12px;
}
.msg { display: flex; max-width: 100%; }
.msg__body {
  max-width: 85%; padding: 9px 13px; border-radius: 18px;
  font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg--assistant .msg__body { background: var(--white); border: 1px solid var(--line); border-bottom-left-radius: 5px; color: var(--text); }
.msg--user { justify-content: flex-end; }
.msg--user .msg__body { background: var(--navy); color: var(--white); border-bottom-right-radius: 5px; }
.msg--error .msg__body { background: #fdecec; border: 1px solid #f3b4b4; color: #8a1c1c; font-weight: 600; font-size: 14px; max-width: 100%; }
.msg__retry {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; padding: 8px 18px;
  background: var(--white); border: 2px solid var(--navy); border-radius: var(--r-pill);
  font: 600 13px/1.2 var(--font-head); color: var(--navy); cursor: pointer;
}
.msg__retry:hover { background: var(--pale-yellow); }
.msg__body a { text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.msg--user .msg__body a { color: var(--gold); }
.msg__body strong { font-weight: 700; }

.msg__typing { display: flex; align-items: center; gap: 4px; padding: 14px 16px; }
.msg__typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--navy-soft); opacity: .35;
  animation: typing 1.1s infinite ease-in-out;
}
.msg__typing i:nth-of-type(2) { animation-delay: .18s; }
.msg__typing i:nth-of-type(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .msg__typing i { animation: none; opacity: .6; } }

.chat__foot { flex: none; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--line); }
.chat__error {
  margin-bottom: 8px; padding: 8px 12px; border-radius: var(--r-sm);
  background: #fdecec; border: 1px solid #f3b4b4; color: #8a1c1c; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere;
}
.chat__error a { text-decoration: underline; }

.chat__chips { display: flex; gap: 8px; margin-bottom: 8px; padding-bottom: 2px; overflow-x: auto; scrollbar-width: none; }
.chat__chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; max-width: 78%; min-height: 44px; padding: 8px 14px; background: var(--white); border: 1.5px solid var(--gold-deep);
  border-radius: var(--r-pill); font: 500 13px/1.3 var(--font-body); color: var(--navy); text-align: left; cursor: pointer;
}
.chip:hover { background: var(--pale-yellow); }

.chat__form { display: flex; align-items: flex-end; gap: 8px; }
.chat__form textarea {
  flex: 1; min-width: 0; max-height: 140px; padding: 11px 16px; resize: none;
  border: 1.5px solid var(--line); border-radius: 22px; background: var(--paper);
  font: 400 16px/1.35 var(--font-body); color: var(--text); /* 16px stops iOS zooming in on focus */
}
.chat__form textarea:focus-visible { outline: 3px solid var(--navy); outline-offset: 0; border-color: var(--navy); background: var(--white); }
.chat__send {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  background: var(--gold-grad); border: 2px solid #e6b400; border-radius: 50%; color: var(--navy);
  box-shadow: var(--shadow-gold); cursor: pointer;
}
.chat__send .icon { width: 22px; height: 22px; stroke-width: 2; }
.chat__send:disabled { opacity: .55; cursor: default; box-shadow: none; }
.chat__note { margin-top: 6px; font-size: 12px; line-height: 1.3; color: var(--navy-soft); text-align: center; }

@media (min-width: 640px) {
  .bot { padding-bottom: 56px; }
  .bot__intro { grid-template-columns: 38% 1fr; align-items: stretch; max-width: 880px; margin-inline: auto; }
  .bot__media, .bot__media img { max-height: none; height: 100%; min-height: 200px; }
  .bot__about { align-self: center; padding: 24px 28px; }
  .bot__title { font-size: 28px; }
  .bot__examples, .bot__signup { max-width: 880px; margin-inline: auto; }
  .bot__examples { margin-top: 32px; }
  .bot__signup { margin-top: 32px; padding: 28px; }

  .bot--chat .container { padding-inline: 16px; }
  .bot--chat .breadcrumb { padding-inline: 0; }
  .chat {
    max-width: 780px; margin: 8px auto 40px; border: 1px solid #eef0f6; border-radius: var(--r-lg); box-shadow: var(--shadow-md);
    height: min(720px, calc(100dvh - var(--header-h) - 120px)); min-height: 480px;
  }
  .chat__head { padding: 14px 20px; }
  .chat__title { font-size: 17px; }
  .chat__count { max-width: none; font-size: 12.5px; padding: 6px 14px; }
  .chat__log { padding: 18px 20px; gap: 10px; }
  .msg__body { max-width: 75%; font-size: 15.5px; }
  .chat__foot { padding: 12px 20px 14px; }
}
