/* Kenya Airways virtual assistant: chat widget styles.
   Requires site.css, which defines the colour tokens and the high-contrast theme. */

/* ---------- Launcher ---------- */

.launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 20px 0 16px;
  border: 2px solid transparent; border-radius: 28px;
  background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow);
}
.launcher:hover { background: var(--brand-dark); }
:root[data-theme="high-contrast"] .launcher { border-color: var(--border); }
.launcher[aria-expanded="true"] { display: none; }
.launcher__new { margin-left: 2px; }

/* ---------- Chat panel ---------- */

.chat {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  width: min(400px, calc(100vw - 40px));
  height: min(640px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat[hidden] { display: none; }

.chat__header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 8px 10px 14px;
  background: var(--brand); color: #fff;
}
:root[data-theme="high-contrast"] .chat__header { border-bottom: 2px solid var(--border); }
.chat__identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat__avatar {
  flex: none; display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: var(--brand); font-weight: 800; font-size: 0.85rem;
}
:root[data-theme="high-contrast"] .chat__avatar { color: #000; }
.chat__title { margin: 0; font-size: 1rem; }
.chat__status { margin: 0; font-size: 0.8rem; display: flex; align-items: center; gap: 6px; }
.chat__status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #d0d0d0; border: 1px solid #fff;
}
.chat__status[data-state="online"] .chat__status-dot { background: #3ddc84; }
.chat__status[data-state="offline"] .chat__status-dot { background: #ffb4ab; }

.chat__tools { display: flex; gap: 2px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;     /* >= 24px target size */
  border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.18); }
.icon-btn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.3); box-shadow: inset 0 0 0 2px #fff; }
:root[data-theme="high-contrast"] .icon-btn[aria-pressed="true"] { background: #ffff00; color: #000; }

.chat__log {
  flex: 1; overflow-y: auto;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
}

.msg {
  max-width: 85%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-line;        /* keep the bot's line breaks and bullet lists */
  overflow-wrap: anywhere;
}
.msg--bot {
  align-self: flex-start;
  background: var(--bubble-bot); color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg--user {
  align-self: flex-end;
  background: var(--bubble-user); color: var(--bubble-user-text);
  border-bottom-right-radius: 4px;
}
:root[data-theme="high-contrast"] .msg--bot { border: 2px solid var(--border); }
.msg--error {
  align-self: stretch; max-width: none;
  background: var(--bg); color: var(--status-down);
  border: 2px solid var(--status-down);
}

.quick-replies {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0; padding: 0; list-style: none;
}
.chip {
  min-height: 36px; padding: 6px 14px;
  border: 2px solid var(--chip-text); border-radius: 18px;
  background: var(--chip-bg); color: var(--chip-text);
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.chip:hover { background: var(--chip-text); color: var(--chip-bg); }
.chip--inline { margin-left: 8px; }
.chip--link { display: inline-flex; align-items: center; box-sizing: border-box; text-decoration: underline; }
.chip--link:visited { color: var(--chip-text); }
.chip--link:hover { color: var(--chip-bg); }
.chip:disabled { opacity: 0.55; cursor: default; background: var(--chip-bg); color: var(--chip-text); }

.chat__typing { margin: 0; padding: 0 14px 6px; }
.dots { display: inline-flex; gap: 4px; padding: 10px 14px; border-radius: 14px; background: var(--bubble-bot); }
.dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.2s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat__composer {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 10px 4px;
  border-top: 1px solid var(--border);
}
.chat__composer input {
  flex: 1; min-width: 0; min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 22px;
  background: var(--bg); color: var(--text);
  font: inherit;
}
.chat__composer input::placeholder { color: var(--text-muted); opacity: 1; }
.icon-btn--mic { color: var(--text); }
.icon-btn--mic:hover { background: var(--bubble-bot); }
.icon-btn--mic[aria-pressed="true"] { background: var(--status-down); color: #fff; box-shadow: none; }
.send-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 2px solid transparent; border-radius: 50%;
  background: var(--brand); color: #fff; cursor: pointer;
}
:root[data-theme="high-contrast"] .send-btn { background: #ffff00; color: #000; }
.send-btn:disabled { opacity: 0.5; cursor: default; }
.chat__hint { margin: 0; padding: 0 16px 10px; font-size: 0.75rem; color: var(--text-muted); }

/* Phones: the panel takes the whole screen */
@media (max-width: 480px) {
  .chat { right: 0; bottom: 0; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
  .launcher__label { display: none; }
  .launcher { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .dots span { animation: none; opacity: 0.7; }
  .chat__log { scroll-behavior: auto; }
}
