/* Agiletech247 AI Chatbot Stylesheet (Laya System 1 on User Hardware) */

#agiletech-chatbot-wrapper {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: var(--font-family, 'Open Sans', sans-serif);
  visibility: visible !important;
  display: block !important;
}

/* Floating Launcher Button */
.chatbot-launcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #ffffff;
  border: 1.5px solid rgba(0, 210, 255, 0.4);
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 102, 204, 0.45), 0 0 20px rgba(0, 210, 255, 0.25);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.chatbot-launcher:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: #00d2ff;
  box-shadow: 0 12px 32px rgba(0, 102, 204, 0.6), 0 0 30px rgba(0, 210, 255, 0.4);
}

.chatbot-launcher .launcher-icon-open {
  font-size: 1.25rem;
  display: block;
}

.chatbot-launcher .launcher-icon-close {
  font-size: 1.25rem;
  display: none;
}

.chatbot-launcher.active .launcher-icon-open {
  display: none;
}

.chatbot-launcher.active .launcher-icon-close {
  display: block;
}

.launcher-label {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.launcher-badge-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: #00d2ff;
  border-radius: 50%;
  box-shadow: 0 0 10px #00d2ff;
  animation: laya-pulse 2s infinite;
}

@keyframes laya-pulse {
  0% { transform: scale(0.95); opacity: 0.9; }
  50% { transform: scale(1.4); opacity: 0.3; }
  100% { transform: scale(0.95); opacity: 0.9; }
}

/* Chatbot Modal Window */
.chatbot-modal {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: rgba(10, 15, 29, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(0, 210, 255, 0.28);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 35px rgba(0, 210, 255, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(16, 26, 46, 0.9);
  border-bottom: 1px solid rgba(0, 210, 255, 0.2);
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0066cc 0%, #00d2ff 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.1rem;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.4);
}

.header-branding h3 {
  font-size: 1.05rem;
  color: #ffffff;
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
}

.header-sub {
  font-size: 0.72rem;
  color: #00d2ff;
  font-weight: 600;
  margin: 2px 0 0;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  gap: 6px;
}

.header-icon-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #00d2ff;
  border-color: rgba(0, 210, 255, 0.4);
}

/* Laya Routing Explainer Bar */
.laya-routing-info-bar {
  background: rgba(0, 102, 204, 0.15);
  border-bottom: 1px solid rgba(0, 210, 255, 0.15);
  padding: 8px 14px;
  font-size: 0.73rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}

.laya-routing-info-bar .info-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00d2ff;
  box-shadow: 0 0 6px #00d2ff;
  flex-shrink: 0;
}

/* Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 210, 255, 0.2);
  border-radius: 4px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: fadeInMsg 0.25s ease forwards;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-message {
  align-self: flex-end;
}

.bot-message {
  align-self: flex-start;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  position: relative;
  line-height: 1.55;
  font-size: 0.92rem;
}

.user-message .message-bubble {
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #ffffff;
  border: 1px solid rgba(0, 210, 255, 0.35);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 102, 204, 0.25);
}

.bot-message .message-bubble {
  background: rgba(22, 36, 64, 0.7);
  color: #f1f5f9;
  border: 1px solid rgba(0, 210, 255, 0.2);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Laya Decision Badges */
.laya-decision-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 4px 9px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pill-local {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.pill-routing {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.pill-llm {
  background: rgba(0, 210, 255, 0.15);
  color: #00d2ff;
  border: 1px solid rgba(0, 210, 255, 0.35);
}

.message-content p {
  margin: 0 0 8px 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul {
  margin: 6px 0 8px 18px;
  padding: 0;
}

.message-content li {
  margin-bottom: 4px;
}

.message-content a {
  color: #00d2ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.message-content a:hover {
  color: #38bdf8;
}

.message-content code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: #00d2ff;
  border: 1px solid rgba(0, 210, 255, 0.2);
}

.message-time {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 6px;
  text-align: right;
}

/* Typing Indicator */
.typing-bubble {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
}

.laya-evaluating-text {
  font-size: 0.72rem;
  color: #00d2ff;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.typing-dots {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: #00d2ff;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

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

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

/* Quick Prompts Chips */
.chatbot-quick-chips {
  padding: 8px 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 29, 0.6);
}

.chatbot-quick-chips::-webkit-scrollbar {
  display: none;
}

.quick-chip {
  background: rgba(16, 26, 46, 0.8);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.quick-chip i {
  color: #00d2ff;
  font-size: 0.75rem;
}

.quick-chip:hover {
  background: rgba(0, 102, 204, 0.3);
  border-color: #00d2ff;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Input Bar */
.chatbot-input-bar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(16, 26, 46, 0.95);
  border-top: 1px solid rgba(0, 210, 255, 0.2);
  gap: 10px;
}

.chatbot-input-bar input {
  flex: 1;
  background: rgba(10, 15, 29, 0.8);
  border: 1px solid rgba(0, 210, 255, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 0.92rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chatbot-input-bar input:focus {
  border-color: #00d2ff;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.chatbot-input-bar button {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
  color: #ffffff;
  border: 1px solid rgba(0, 210, 255, 0.4);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chatbot-input-bar button:hover {
  background: linear-gradient(135deg, #0077ee 0%, #0066cc 100%);
  transform: scale(1.04);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.4);
}

/* Mobile Responsive */
@media (max-width: 500px) {
  #agiletech-chatbot-wrapper {
    bottom: 16px;
    right: 16px;
  }

  .chatbot-modal {
    position: fixed;
    top: 10px;
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    border-radius: 16px;
  }

  .launcher-label {
    display: none;
  }

  .chatbot-launcher {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
  }
}
