/* ==========================================================================
   AI ROBOT SMART CHATBOT FLOATING WIDGET
   ========================================================================== */

.ai-chatbot-container {
  position: fixed;
  bottom: 24px;
  z-index: 9999;
  font-family: inherit;
}

.chatbot-pos-right {
  right: 24px;
}

.chatbot-pos-left {
  left: 24px;
}

.chatbot-pos-right.chatbot-stacked-with-wa,
.chatbot-stacked-with-wa {
  bottom: 90px;
}

/* Floating Launcher Button */
.ai-chatbot-launcher {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.ai-chatbot-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6);
}

.ai-launcher-robot-icon,
.ai-robot-svg {
  width: 24px;
  height: 24px;
}

.ai-launcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #10b981;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  border: 2px solid #060913;
}

/* Interactive Dialog Window */
.ai-chatbot-window {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background: rgba(11, 17, 33, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.7), 0 0 30px rgba(99, 102, 241, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
}

.chatbot-pos-left .ai-chatbot-window {
  right: auto;
  left: 0;
}

.ai-chatbot-window.open {
  display: flex !important;
}

/* Header */
.ai-chatbot-header {
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-bot-identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ai-robot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 12px var(--accent-glow);
}

.ai-robot-avatar svg {
  width: 20px;
  height: 20px;
}

.ai-online-ping {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid #0b1120;
}

.ai-bot-title {
  font-weight: 800;
  font-size: 0.92rem;
  color: #ffffff;
  line-height: 1.2;
}

.ai-bot-status {
  font-size: 0.74rem;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.ai-status-indicator {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}

.ai-header-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.ai-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-soft);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  transition: all 0.2s ease;
  padding: 0;
}

.ai-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Messages Stream */
.ai-chatbot-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

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

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

.ai-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

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

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

.ai-msg-bubble {
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
}

.ai-msg-user .ai-msg-bubble {
  background: var(--accent-gradient);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-msg-bot .ai-msg-bubble {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.ai-msg-text {
  white-space: pre-wrap;
}

/* Quick Action Suggestion Chips */
.ai-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-quick-btn {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 8px;
  color: var(--accent-light);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: block;
  width: 100%;
}

.ai-quick-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #ffffff;
  transform: translateX(2px);
}

.ai-action-links {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.ai-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  background: var(--accent-gradient);
  color: #ffffff;
  transition: all 0.2s ease;
}

.ai-link-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.ai-link-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* Typing Indicator Animation */
.ai-typing-indicator {
  align-self: flex-start;
  padding: 0.5rem 0.85rem;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  margin: 0 1rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--accent-cyan);
  border-radius: 50%;
  animation: aiTyping 1.2s infinite ease-in-out;
}

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

@keyframes aiTyping {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* Input Bar */
.ai-chatbot-input-bar {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background: rgba(6, 9, 19, 0.85);
  border-top: 1px solid var(--border);
  gap: 0.5rem;
  flex-shrink: 0;
}

.ai-chatbot-input-bar input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.ai-chatbot-input-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.ai-chatbot-input-bar button {
  background: var(--accent-gradient);
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.ai-chatbot-input-bar button:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   LIGHT MODE DESIGN SPECIFICATIONS FOR AI CHATBOT ([data-theme="light"])
   ========================================================================== */

[data-theme="light"] .ai-chatbot-window {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.16), 0 0 1px rgba(15, 23, 42, 0.1) !important;
}

[data-theme="light"] .ai-chatbot-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .ai-bot-title {
  color: #0f172a !important;
}

[data-theme="light"] .ai-bot-status {
  color: #059669 !important;
}

[data-theme="light"] .ai-status-indicator {
  background: #10b981 !important;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4) !important;
}

[data-theme="light"] .ai-online-ping {
  border-color: #ffffff !important;
}

[data-theme="light"] .ai-icon-btn {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  color: #64748b !important;
}

[data-theme="light"] .ai-icon-btn:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .ai-chatbot-messages {
  background: #f8fafc !important;
}

[data-theme="light"] .ai-chatbot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
}

[data-theme="light"] .ai-msg-bot .ai-msg-bubble {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .ai-msg-bot .ai-msg-bubble .ai-msg-text,
[data-theme="light"] .ai-msg-bot .ai-msg-bubble p,
[data-theme="light"] .ai-msg-bot .ai-msg-bubble span,
[data-theme="light"] .ai-msg-bot .ai-msg-bubble li {
  color: #0f172a !important;
}

[data-theme="light"] .ai-msg-bot .ai-msg-bubble strong {
  color: #1e1b4b !important;
}

[data-theme="light"] .ai-msg-user .ai-msg-bubble {
  background: linear-gradient(135deg, #4f46e5 0%, #0284c7 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25) !important;
}

[data-theme="light"] .ai-msg-user .ai-msg-bubble .ai-msg-text,
[data-theme="light"] .ai-msg-user .ai-msg-bubble p,
[data-theme="light"] .ai-msg-user .ai-msg-bubble span {
  color: #ffffff !important;
}

[data-theme="light"] .ai-quick-actions {
  border-top: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .ai-quick-btn {
  background: #eef2ff !important;
  border: 1px solid #c7d2fe !important;
  color: #4338ca !important;
}

[data-theme="light"] .ai-quick-btn:hover {
  background: #4f46e5 !important;
  border-color: #4f46e5 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25) !important;
}

[data-theme="light"] .ai-action-links .ai-link-btn.secondary {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

[data-theme="light"] .ai-typing-indicator {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .ai-typing-indicator span {
  background: #4f46e5 !important;
}

[data-theme="light"] .ai-chatbot-input-bar {
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .ai-chatbot-input-bar input {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .ai-chatbot-input-bar input::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] .ai-chatbot-input-bar input:focus {
  background: #ffffff !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.18) !important;
}

[data-theme="light"] .ai-launcher-badge {
  border-color: #ffffff !important;
}
