/* ==========================================================================
   INTELLIGENT AI CHATBOT (AKS-AI) - NEUMORPHIC GLASS STYLES
   ========================================================================== */

/* Floating Chat Launcher Button */
#chatbot-launcher {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem 0.75rem 0.9rem;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(6, 182, 212, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 25px var(--accent-cyan-glow), var(--neu-shadow-raised);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
  user-select: none;
}

#chatbot-launcher:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.75), 0 0 35px rgba(6, 182, 212, 0.6);
  border-color: var(--accent-cyan);
}

.chatbot-launcher-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.chatbot-launcher-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chatbot-launcher-pulse {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-emerald);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.chatbot-launcher-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.launcher-title {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.launcher-sub {
  font-family: var(--font-code);
  font-size: 0.7rem;
  color: var(--accent-cyan);
}

/* Chatbot Floating Window */
#chatbot-window {
  position: fixed;
  bottom: 6.5rem;
  right: 2rem;
  width: 420px;
  max-width: calc(100vw - 2.5rem);
  height: 600px;
  max-height: calc(100vh - 8rem);
  z-index: 9995;
  background: var(--glass-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(6, 182, 212, 0.15), var(--neu-shadow-raised);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Window Header */
.chatbot-header {
  padding: 1rem 1.25rem;
  background: rgba(10, 16, 28, 0.88);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-theme="light"] .chatbot-header {
  background: rgba(240, 246, 255, 0.9);
}

.chatbot-header-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chatbot-header-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
}

.chatbot-header-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chatbot-header-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent-emerald);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 6px var(--accent-emerald);
}

.chatbot-header-info h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.chatbot-header-info span {
  font-family: var(--font-code);
  font-size: 0.68rem;
  color: var(--accent-cyan);
}

.chatbot-header-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chatbot-ctrl-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.chatbot-ctrl-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.chatbot-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}

/* Suggested Chips Bar */
.chatbot-chips-bar {
  padding: 0.6rem 0.85rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  scrollbar-width: none;
}

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

.chatbot-chip {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chatbot-chip:hover {
  color: #fff;
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
}

/* Messages Body */
.chatbot-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble {
  max-width: 86%;
  padding: 0.85rem 1.1rem;
  border-radius: 18px;
  font-size: 0.875rem;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}

.chat-bubble-bot {
  align-self: flex-start;
  background: rgba(20, 28, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 4px 14px rgba(0, 0, 0, 0.4), inset 1px 1px 1px rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

[data-theme="light"] .chat-bubble-bot {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 4px 4px 12px rgba(166, 180, 202, 0.45), inset 1px 1px 1px rgba(255, 255, 255, 0.9);
}

.chat-bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
  border-bottom-right-radius: 4px;
}

.chat-bubble-bot strong {
  color: var(--accent-cyan);
}

.chat-bubble-bot a {
  color: var(--accent-cyan);
  text-decoration: underline;
  font-weight: 600;
}

.chat-bubble-bot ul {
  margin: 0.5rem 0 0.5rem 1.25rem;
}

.chat-bubble-bot li {
  margin-bottom: 0.3rem;
}

.chat-action-btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-action-btn-pill:hover {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 14px var(--accent-cyan-glow);
}

/* Typing Indicator Animation */
.chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  background: rgba(20, 28, 46, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  align-self: flex-start;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

/* Chat Input Bar */
.chatbot-input-form {
  padding: 0.85rem 1rem;
  background: rgba(8, 12, 22, 0.9);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

[data-theme="light"] .chatbot-input-form {
  background: rgba(240, 246, 255, 0.95);
}

.chatbot-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  box-shadow: var(--neu-shadow-inset);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

[data-theme="light"] .chatbot-input {
  background: rgba(255, 255, 255, 0.7);
}

.chatbot-input:focus {
  border-color: var(--accent-cyan);
}

.chatbot-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  border: none;
  box-shadow: 0 0 12px var(--accent-cyan-glow);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

.chatbot-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 640px) {
  #chatbot-window {
    right: 0.75rem;
    left: 0.75rem;
    bottom: 4.8rem;
    width: auto;
    max-width: none;
    height: 76vh;
    max-height: 560px;
    border-radius: 20px;
  }

  #chatbot-launcher {
    bottom: 1.25rem;
    right: 1.25rem;
    padding: 0.55rem 0.9rem 0.55rem 0.7rem;
    gap: 0.55rem;
  }

  .chatbot-launcher-avatar {
    width: 32px;
    height: 32px;
  }

  .launcher-title {
    font-size: 0.82rem;
  }

  .launcher-sub {
    font-size: 0.65rem;
  }

  .chatbot-chips-bar {
    padding: 0.5rem 0.75rem;
    gap: 0.4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

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

  .chatbot-chip {
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: 0.25rem 0.6rem;
  }

  .chat-bubble {
    max-width: 90%;
    font-size: 0.86rem;
    padding: 0.75rem 0.95rem;
    line-height: 1.48;
  }

  .chatbot-input {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    padding: 0.65rem 0.9rem;
  }

  .chatbot-input-form {
    padding: 0.65rem 0.85rem;
  }
}

@media (max-width: 380px) {
  .launcher-sub {
    display: none;
  }

  #chatbot-launcher {
    padding: 0.5rem 0.75rem 0.5rem 0.6rem;
  }
}
