/* ═══════════════════════════════════════════════════════
   AI Chat — Hermes
   ═══════════════════════════════════════════════════════ */

/* ─── Bar wrapper (centering shell) ──────────────────── */
.ai-bar-wrap {
  position: fixed;
  bottom: 22px;
  left: var(--sidebar-w);
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
  padding: 0 24px;
}

/* ─── The bar itself ─────────────────────────────────── */
.ai-bar {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 28px;
  padding: 0 6px 0 18px;
  height: 50px;
  width: 100%;
  max-width: 620px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.05);
  transition: box-shadow .2s, border-color .2s, transform .15s;
  user-select: none;
}
.ai-bar:hover {
  box-shadow: 0 6px 28px rgba(78,122,90,.18), 0 2px 6px rgba(0,0,0,.06);
  border-color: var(--green);
  transform: translateY(-1px);
}
.ai-bar.chat-open {
  border-color: var(--green);
  box-shadow: 0 6px 30px rgba(78,122,90,.22), 0 2px 6px rgba(0,0,0,.06);
  transform: translateY(-1px);
}

.ai-bar-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}
.ai-bar-placeholder {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-bar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  background: var(--green);
  border-radius: 22px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  letter-spacing: .2px;
}

/* ─── Chat window ────────────────────────────────────── */
.ai-window {
  position: fixed;
  bottom: 86px;
  /* center in content area */
  left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2);
  transform: translateX(-50%) translateY(16px);
  width: 480px;
  height: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0,0,0,.15), 0 3px 10px rgba(0,0,0,.08);
  z-index: 199;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.ai-window.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

/* ─── Window header ──────────────────────────────────── */
.ai-win-header {
  background: var(--sidebar-bg);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ai-win-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.ai-win-title { flex: 1; }
.ai-win-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.ai-win-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-sidebar);
  margin-top: 2px;
}
.status-online {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #5DC780;
}
.ai-win-actions { display: flex; gap: 6px; }
.ai-win-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,.1);
  color: var(--text-sidebar);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.ai-win-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ─── Messages area ──────────────────────────────────── */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F9F8F5;
}

/* ─── Welcome screen ─────────────────────────────────── */
.chat-welcome {
  text-align: center;
  padding: 24px 16px 12px;
}
.chat-welcome-icon  { font-size: 34px; margin-bottom: 10px; }
.chat-welcome-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.chat-welcome-text  { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  justify-content: center;
}
.suggestion-chip {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.suggestion-chip:hover {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
}

/* ─── Message bubbles ────────────────────────────────── */
.message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}
.message-user {
  align-self: flex-end;
  align-items: flex-end;
}
.message-assistant {
  align-self: flex-start;
  flex-direction: row;
  align-items: flex-end;
  gap: 7px;
  max-width: 88%;
}
.message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.msg-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.message-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
.message-user .message-bubble {
  background: var(--green);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message-assistant .message-bubble {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 2px;
}

/* ─── Typing indicator ───────────────────────────────── */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  min-width: 54px;
}
.typing-bubble span {
  width: 6px; height: 6px;
  background: #B8C4BC;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 1.3s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: .2s; }
.typing-bubble span:nth-child(3) { animation-delay: .4s; }

@keyframes pulse-dot {
  0%, 80%, 100% { transform: scale(.8); opacity: .4; }
  40%           { transform: scale(1.15); opacity: 1; }
}

/* ─── Input area ─────────────────────────────────────── */
.ai-input-area {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  flex-shrink: 0;
}
.ai-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 100px;
  line-height: 1.45;
  transition: border-color .15s;
  overflow-y: auto;
}
.ai-input:focus { border-color: var(--green); }
.ai-input::placeholder { color: var(--text-muted); }

.ai-send-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--green);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  color: #fff;
  line-height: 1;
  transition: background .15s, transform .1s;
}
.ai-send-btn:hover  { background: #3d6248; }
.ai-send-btn:active { transform: scale(.92); }
.ai-send-btn:disabled { background: var(--border); cursor: not-allowed; }
