/* Sentinela Chatbot Widget v1.0 */
.chatbot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #00ff88), var(--primary-dim, #00cc6a));
  color: #000;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,255,136,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform .2s, box-shadow .2s;
}
.chatbot-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0,255,136,.45);
}
.chatbot-fab svg {
  width: 28px;
  height: 28px;
  fill: #000;
}
.chatbot-fab--open svg.icon-chat { display: none; }
.chatbot-fab--open svg.icon-close { display: block; }
.chatbot-fab:not(.chatbot-fab--open) svg.icon-close { display: none; }
.chatbot-fab:not(.chatbot-fab--open) svg.icon-chat { display: block; }

.chatbot-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  border-radius: 16px;
  background: var(--bg-base, #0d1117);
  border: 1px solid var(--border, #30363d);
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chatbotSlideIn .25s ease-out;
}
.chatbot-window--open { display: flex; }

@keyframes chatbotSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-card, #161b22);
  border-bottom: 1px solid var(--border, #30363d);
  flex-shrink: 0;
}
.chatbot-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #00ff88), var(--primary-dim, #00cc6a));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.chatbot-header__info { flex: 1; min-width: 0; }
.chatbot-header__name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg, #e6edf3);
}
.chatbot-header__status {
  font-size: 11px;
  color: var(--primary, #00ff88);
  display: flex;
  align-items: center;
  gap: 4px;
}
.chatbot-header__status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #00ff88);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--border, #30363d); border-radius: 4px; }

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-msg--user {
  align-self: flex-end;
  background: var(--primary, #00ff88);
  color: #000;
  border-bottom-right-radius: 4px;
}
.chat-msg--bot {
  align-self: flex-start;
  background: var(--bg-card, #161b22);
  color: var(--fg, #e6edf3);
  border: 1px solid var(--border, #30363d);
  border-bottom-left-radius: 4px;
}
.chat-msg--bot a { color: var(--primary, #00ff88); }
.chat-msg--bot strong { color: var(--fg, #e6edf3); }
.chat-msg--system {
  align-self: center;
  font-size: 12px;
  color: var(--fg-muted, #8b949e);
  text-align: center;
  padding: 4px 0;
}

.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-card, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-muted, #8b949e);
  animation: chatTyping 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes chatTyping {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.chatbot-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border, #30363d);
  background: var(--bg-card, #161b22);
  flex-shrink: 0;
}
.chatbot-input__field {
  flex: 1;
  background: var(--bg-elev, #1c2128);
  border: 1px solid var(--border, #30363d);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--fg, #e6edf3);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 80px;
  transition: border-color .2s;
}
.chatbot-input__field:focus { border-color: var(--primary, #00ff88); }
.chatbot-input__field::placeholder { color: var(--fg-muted, #8b949e); }

.chatbot-input__send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary, #00ff88);
  color: #000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .2s;
}
.chatbot-input__send:disabled { opacity: .4; cursor: not-allowed; }
.chatbot-input__send svg { width: 18px; height: 18px; fill: #000; }

@media (max-width: 480px) {
  .chatbot-fab { bottom: 16px; right: 16px; width: 50px; height: 50px; }
  .chatbot-window {
    bottom: 80px;
    right: 8px;
    width: calc(100vw - 16px);
    height: calc(100vh - 100px);
    border-radius: 12px;
  }
}