
/* AELAI Chat Widget — базовые стили для плавающей кнопки и окна */
#aelai-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: none;
  background: #1f6feb;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
#aelai-chat-fab:hover { transform: translateY(-2px); box-shadow:0 10px 28px rgba(0,0,0,.22); background:#195fd2; }
#aelai-chat-fab:active { transform: translateY(0); }
#aelai-chat-fab:focus { outline: 2px solid #cde1ff; outline-offset: 2px; }

#aelai-chat-window {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 360px;
  max-width: calc(100vw - 24px*2);
  height: 520px;
  max-height: calc(100vh - 120px);
  z-index: 2147483000;
  background: #fff;
  color: #0f172a;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.20);
  display: none;
  overflow: hidden;
}
#aelai-chat-window.open { display: flex; flex-direction: column; }

.aelai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 16px;
  background: #0b1220;
  color: #fff;
}
.aelai-title { font-size: 14px; display:flex; align-items:center; gap:8px; }
.aelai-status { margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #475569; }
.aelai-status.ok { background: #16a34a; }
.aelai-status.bad { background: #ef4444; }

.aelai-close {
  border: none; background: transparent; color: #fff; font-size: 18px; cursor: pointer;
}
.aelai-close:hover { opacity: .9; }
.aelai-close:focus { outline: 2px solid #cde1ff; outline-offset: 2px; }

.aelai-body { flex: 1; background: #f8fafc; overflow: hidden; }
.aelai-messages { height: 100%; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }

.aelai-msg { display: flex; }
.aelai-msg.me { justify-content: flex-end; }
.aelai-msg.bot, .aelai-msg.op, .aelai-msg.sys { justify-content: flex-start; }

.aelai-bubble {
  max-width: 90%;
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.35;
  font-size: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
  background: #e2e8f0;
  color: #0f172a;
}
.aelai-msg.me .aelai-bubble { background: #1f6feb; color: #fff; }
.aelai-msg.op .aelai-bubble { background: #06b6d4; color: #07242a; }
.aelai-msg.sys .aelai-bubble { background: #fbbf24; color: #111827; }

.aelai-sources { list-style: none; padding: 6px 0 0 0; margin: 0; font-size: 12px; }
.aelai-sources li { margin: 2px 0; }
.aelai-sources a { color: #0b5fff; text-decoration: underline; }
.aelai-sources a:hover { opacity: .9; }

.aelai-footer { padding: 8px; background: #f1f5f9; border-top: 1px solid #e5e7eb; }
#aelai-form { display: flex; gap: 8px; }
#aelai-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}
#aelai-input:focus { outline: 2px solid #a7c5ff; outline-offset: 1px; }
.aelai-send {
  min-width: 44px;
  border: none;
  border-radius: 12px;
  background: #0b5fff;
  color: #fff; font-weight: 600;
  cursor: pointer;
  padding: 0 12px;
}
.aelai-send:hover { background: #084bd3; }
.aelai-send:focus { outline: 2px solid #cde1ff; outline-offset: 2px; }

/* Mobile tweaks */
@media (max-width: 480px) {
  #aelai-chat-window {
    right: 12px; bottom: 84px;
    width: calc(100vw - 24px);
    height: 65vh;
  }
  #aelai-chat-fab { right: 12px; bottom: 12px; }
}

