/* ================================================================= */
/* BEARTELL BEARHIVE AI ENTERPRISE ASSISTANT WIDGET
/* ================================================================= */

/* Floating Launcher Button */
#beartell-ai-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b50202 0%, #850101 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(181, 2, 2, 0.38), 0 2px 6px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99998;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#beartell-ai-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 28px rgba(181, 2, 2, 0.5), 0 3px 8px rgba(0, 0, 0, 0.2);
}

#beartell-ai-launcher i {
  font-size: 24px;
  transition: transform 0.3s ease;
}

#beartell-ai-launcher.active i.fa-comments {
  display: none;
}
#beartell-ai-launcher:not(.active) i.fa-times {
  display: none;
}

/* Online Pulse Indicator */
.beartell-ai-pulse {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background-color: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}
.beartell-ai-pulse::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #10b981;
  animation: beartell-pulse-anim 2s infinite ease-out;
}

@keyframes beartell-pulse-anim {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Peek Badge */
#beartell-ai-badge {
  position: absolute;
  right: 68px;
  background: #ffffff;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid #fecaca;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: beartell-bounce 3s infinite ease-in-out;
}
#beartell-ai-badge strong {
  color: #b50202;
}

@keyframes beartell-bounce {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}

/* Move #back-top-wrapper slightly above so it never overlaps */
#back-top-wrapper {
  bottom: 92px !important;
  right: 30px !important;
  z-index: 99997 !important;
}

/* Chat Modal Window */
#beartell-ai-modal {
  position: fixed;
  bottom: 94px;
  right: 24px;
  width: 380px;
  height: 540px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  font-family: 'Raleway', Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#beartell-ai-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Modal Header */
.beartell-ai-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #b50202;
}

.beartell-ai-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.beartell-ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #b50202;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(181, 2, 2, 0.4);
}

.beartell-ai-meta h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
}

.beartell-ai-meta span {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.beartell-ai-meta span .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.beartell-ai-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.beartell-ai-btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #cbd5e1;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
}
.beartell-ai-btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Security Pill Banner */
.beartell-ai-security-bar {
  background: #fdf2f2;
  color: #b50202;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #fee2e2;
}

/* Messages Area */
.beartell-ai-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual Message Bubble */
.beartell-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
}

.beartell-msg.bot {
  align-self: flex-start;
}

.beartell-msg.user {
  align-self: flex-end;
}

.beartell-bubble {
  padding: 10px 14px;
  border-radius: 12px;
}

.beartell-msg.bot .beartell-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.beartell-msg.user .beartell-bubble {
  background: #b50202;
  color: #ffffff;
  border-top-right-radius: 2px;
  box-shadow: 0 2px 8px rgba(181, 2, 2, 0.25);
}

.beartell-msg.bot .beartell-bubble strong {
  color: #0f172a;
}
.beartell-msg.bot .beartell-bubble code {
  background: #f1f5f9;
  color: #b50202;
  font-size: 11.5px;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
}

.beartell-msg.bot .beartell-bubble a.beartell-inline-link {
  display: inline-block;
  margin-top: 6px;
  padding: 5px 12px;
  background: #fdf2f2;
  color: #b50202;
  font-weight: 700;
  font-size: 11.5px;
  border-radius: 6px;
  border: 1px solid #fecaca;
  text-decoration: none;
  transition: all 0.2s;
}
.beartell-msg.bot .beartell-bubble a.beartell-inline-link:hover {
  background: #b50202;
  color: #ffffff;
}

.beartell-time {
  font-size: 9.5px;
  color: #94a3b8;
  margin-top: 3px;
}
.beartell-msg.user .beartell-time {
  align-self: flex-end;
}

/* Suggestions Pills */
.beartell-ai-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.beartell-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  line-height: 1.3;
}
.beartell-pill:hover {
  background: #fdf2f2;
  border-color: #b50202;
  color: #b50202;
  transform: translateY(-1px);
}

/* Typing Dots Animation */
.beartell-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}
.beartell-typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: beartell-typing-bounce 1.3s infinite ease-in-out;
}
.beartell-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.beartell-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes beartell-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* Input Area */
.beartell-ai-footer {
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.beartell-ai-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12.5px;
  color: #1e293b;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f8fafc;
}
.beartell-ai-input:focus {
  border-color: #b50202;
  box-shadow: 0 0 0 2px rgba(181, 2, 2, 0.12);
  background: #ffffff;
}

.beartell-ai-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #b50202;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: transform 0.15s, background-color 0.2s;
  flex-shrink: 0;
}
.beartell-ai-send:hover {
  background: #930101;
  transform: scale(1.05);
}
.beartell-ai-send:active {
  transform: scale(0.95);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #beartell-ai-modal {
    bottom: 82px;
    right: 12px;
    width: calc(100vw - 24px);
    height: 480px;
  }
  #beartell-ai-launcher {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
  #beartell-ai-badge {
    display: none;
  }
  #back-top-wrapper {
    bottom: 80px !important;
    right: 20px !important;
  }
}
