/* ── SYSINT CHAT WIDGET ── */
#sysint-chat {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
}

/* ── FAB BUTTON ── */
#chat-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #18c8ff, #8d1cff, #ff7a00);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(141,28,255,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

#chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(141,28,255,0.60);
}

#chat-fab svg {
  width: 24px;
  height: 24px;
  fill: #fff;
  transition: opacity 0.15s, transform 0.2s;
}

/* ── CHAT WINDOW ── */
#chat-window {
  width: 360px;
  height: 500px;
  border-radius: 20px;
  background: #0a1020;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 24px 64px rgba(0,0,0,0.60), 0 0 0 1px rgba(24,200,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s;
  transform-origin: bottom right;
}

#chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── HEADER ── */
#chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(24,200,255,0.10), rgba(141,28,255,0.10));
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #18c8ff, #8d1cff, #ff7a00);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 3px;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.chat-info { flex: 1; }

.chat-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #eef3ff;
  line-height: 1.2;
}

.chat-status {
  font-size: 0.7rem;
  color: #00d084;
  font-weight: 600;
}

#chat-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aeb8d0;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

#chat-close:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* ── MESSAGES ── */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 4px; }

.msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.msg-row.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #18c8ff, #8d1cff, #ff7a00);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 2px;
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.msg-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.83rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-row.bot .msg-bubble {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  color: #d8e4f5;
  border-bottom-left-radius: 4px;
}

.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, #18c8ff22, #8d1cff33);
  border: 1px solid rgba(141,28,255,0.25);
  color: #eef3ff;
  border-bottom-right-radius: 4px;
}

.msg-time {
  font-size: 0.62rem;
  color: rgba(174,184,208,0.45);
  margin-top: 3px;
  padding: 0 4px;
}

.msg-row.user .msg-time { text-align: right; }

/* ── TYPING INDICATOR ── */
.typing-bubble {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  border-radius: 16px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(24,200,255,0.6);
  animation: bounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── INPUT ── */
#chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 9px 13px;
  font-family: inherit;
  font-size: 0.83rem;
  color: #eef3ff;
  outline: none;
  transition: border-color 0.2s;
}

#chat-input::placeholder { color: rgba(174,184,208,0.50); }
#chat-input:focus { border-color: rgba(24,200,255,0.40); }

#chat-send {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #18c8ff, #8d1cff);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.15s;
  flex-shrink: 0;
}

#chat-send:hover { opacity: 0.85; transform: scale(1.05); }
#chat-send svg { width: 16px; height: 16px; fill: #fff; }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  #sysint-chat { bottom: 16px; right: 16px; }
  #chat-window { width: calc(100vw - 32px); height: 72vh; }
}
