/* ══════════════════════════════════════════════════════════════
   Alasta v5.17.T169 — AI Integration Agent Chat UI
   ══════════════════════════════════════════════════════════════ */

/* ── Panel wrapper ─────────────────────────────────────────── */
.t169-agent-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-height: 860px;
  min-height: 480px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

/* ── Header ────────────────────────────────────────────────── */
.t169-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafafa;
  flex-shrink: 0;
}
.t169-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  flex-shrink: 0;
  font-family: inherit;
  padding-bottom: 2px;
}
.t169-header-info { flex: 1; min-width: 0; }
.t169-header-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}
.t169-header-sub {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.4;
}
.t169-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 5px;
  vertical-align: middle;
}
.t169-header-actions { display: flex; gap: 6px; }
.t169-btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #64748b;
  transition: background 0.15s, border-color 0.15s;
}
.t169-btn-icon:hover { background: #f1f5f9; border-color: #cbd5e1; color: #0f172a; }

/* ── Integrations bar ──────────────────────────────────────── */
.t169-integ-bar {
  flex-shrink: 0;
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid #f1f5f9;
  scrollbar-width: none;
}
.t169-integ-bar::-webkit-scrollbar { display: none; }
.t169-integ-bar:empty { display: none; }

.t169-integ-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  cursor: default;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.12s;
}
.t169-integ-chip:hover { background: #f1f5f9; }
.t169-integ-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.t169-integ-chip-dot.ok     { background: #22c55e; }
.t169-integ-chip-dot.error  { background: #ef4444; }
.t169-integ-chip-dot.warn   { background: #f59e0b; }
.t169-integ-chip-dot.config { background: #6366f1; }

/* ── Messages area ─────────────────────────────────────────── */
.t169-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.t169-messages::-webkit-scrollbar { width: 4px; }
.t169-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* ── Message bubble ────────────────────────────────────────── */
.t169-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: t169-msg-in 0.22s ease-out;
}
@keyframes t169-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.t169-msg.user  { align-self: flex-end; flex-direction: row-reverse; }
.t169-msg.agent { align-self: flex-start; }

.t169-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #0a0a0a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  flex-shrink: 0;
  padding-bottom: 1px;
  margin-top: 2px;
}
.t169-msg.user .t169-msg-avatar {
  background: #4f46e5;
  font-size: 13px;
}

.t169-msg-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.t169-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #0f172a;
  word-break: break-word;
}
.t169-msg.agent .t169-msg-bubble {
  background: #f1f5f9;
  border-bottom-left-radius: 4px;
}
.t169-msg.user .t169-msg-bubble {
  background: #4f46e5;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.t169-msg-bubble code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: rgba(0,0,0,0.08);
  padding: 1px 5px;
  border-radius: 4px;
}
.t169-msg.user .t169-msg-bubble code {
  background: rgba(255,255,255,0.2);
}
.t169-msg-bubble strong { font-weight: 700; }
.t169-msg-bubble em { font-style: italic; }
.t169-msg-bubble hr {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.1);
  margin: 8px 0;
}

.t169-msg-time {
  font-size: 10.5px;
  color: #94a3b8;
  padding: 0 2px;
}
.t169-msg.user .t169-msg-time { text-align: right; }

/* ── Typing indicator ──────────────────────────────────────── */
.t169-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #f1f5f9;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.t169-typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: t169-bounce 1.2s ease-in-out infinite;
}
.t169-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.t169-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes t169-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%            { transform: translateY(-5px); }
}

/* ── Quick suggestions ─────────────────────────────────────── */
.t169-suggestions {
  flex-shrink: 0;
  padding: 8px 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.t169-suggestion-btn {
  padding: 5px 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #4f46e5;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.t169-suggestion-btn:hover {
  background: #eef2ff;
  border-color: #6366f1;
}

/* ── Input area ────────────────────────────────────────────── */
.t169-input-row {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
}
.t169-textarea {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
  color: #0f172a;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 40px;
  line-height: 1.5;
  transition: border-color 0.15s;
  overflow-y: auto;
}
.t169-textarea:focus { border-color: #6366f1; }
.t169-textarea::placeholder { color: #94a3b8; }

.t169-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #4f46e5;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  font-size: 16px;
}
.t169-send-btn:hover  { background: #4338ca; }
.t169-send-btn:active { transform: scale(0.95); }
.t169-send-btn:disabled { background: #cbd5e1; cursor: not-allowed; }

/* ── Error state ───────────────────────────────────────────── */
.t169-msg-error .t169-msg-bubble {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
