/* ==========================================================================
   VORTEX-SDN Enterprise NOC AI Assistant Styling
   Dark Navy, Cyan / Electric Blue Accents, Glassmorphism, Micro-Animations
   ========================================================================== */

/* Floating Launcher FAB */
#chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full, 9999px);
  background: linear-gradient(135deg, #00f2fe 0%, #0284c7 100%);
  color: #070a13;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(0, 242, 254, 0.4), 0 0 12px rgba(2, 132, 199, 0.3);
  cursor: pointer;
  z-index: 500;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
  outline: none;
}

#chatbot-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 242, 254, 0.6), 0 0 20px rgba(0, 242, 254, 0.4);
}

#chatbot-launcher:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.5), 0 6px 24px rgba(0, 242, 254, 0.5);
}

.launcher-pulse {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 9999px;
  border: 2px solid rgba(0, 242, 254, 0.6);
  animation: launcherRingPulse 2.5s infinite;
  pointer-events: none;
}

@keyframes launcherRingPulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.22); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

/* Chatbot Floating Window */
#chatbot-window {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 430px;
  height: 610px;
  max-height: calc(100vh - 110px);
  background: rgba(13, 19, 34, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 242, 254, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.95);
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.25s ease;
}

#chatbot-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

#chatbot-window.minimized {
  height: 58px !important;
  max-height: 58px !important;
}

#chatbot-window.minimized .chatbot-body,
#chatbot-window.minimized .chatbot-suggestions,
#chatbot-window.minimized .chatbot-input-area {
  display: none !important;
}

/* Chatbot Header */
.chatbot-header {
  padding: 12px 16px;
  background: rgba(17, 25, 43, 0.95);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #00f2fe 0%, #38bdf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 242, 254, 0.3);
}

.chatbot-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.chatbot-subbadge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 242, 254, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  letter-spacing: 0.5px;
}

.chatbot-status {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  margin-top: 1px;
}

.chatbot-status .status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.chatbot-status.online { color: #34d399; }
.chatbot-status.online .status-indicator-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite;
}

.chatbot-status.analyzing { color: #38bdf8; }
.chatbot-status.analyzing .status-indicator-dot {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulseDot 1s infinite;
}

.chatbot-status.degraded { color: #fbbf24; }
.chatbot-status.degraded .status-indicator-dot {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.chatbot-status.offline { color: #f87171; }
.chatbot-status.offline .status-indicator-dot {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

@keyframes pulseDot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-action-icon-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chatbot-action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.chatbot-action-icon-btn:active {
  transform: scale(0.92);
}

/* Chat Messages Body */
.chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: radial-gradient(circle at 50% 0%, rgba(15, 23, 42, 0.9) 0%, rgba(10, 15, 28, 0.98) 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.25) transparent;
}

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

.chatbot-body::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.25);
  border-radius: 4px;
}

/* Message Bubbles */
.chat-bubble {
  max-width: 90%;
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  animation: bubbleFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #00f2fe 0%, #0ea5e9 100%);
  color: #070a13;
  font-weight: 500;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.25);
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(21, 30, 50, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #e2e8f0;
  border-bottom-left-radius: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.chat-bubble.assistant strong {
  color: #ffffff;
}

.chat-bubble.assistant code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.assistant-msg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.source-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  letter-spacing: 0.4px;
}

.source-badge.demo {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.assistant-msg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10.5px;
  color: #64748b;
}

.copy-response-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.copy-response-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.copy-response-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

/* Chat Flow Table Styling */
.chat-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 8px 0;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  text-align: left;
}

.chat-table th {
  background: rgba(10, 16, 30, 0.85);
  color: #38bdf8;
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  white-space: nowrap;
}

.chat-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  white-space: nowrap;
}

.chat-table tr:last-child td {
  border-bottom: none;
}

/* Typing Indicator */
.typing-indicator-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 12.5px;
  font-style: italic;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Suggested Quick Action Chips */
.chatbot-suggestions {
  padding: 8px 12px;
  background: rgba(14, 20, 35, 0.95);
  border-top: 1px solid rgba(56, 189, 248, 0.12);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.chatbot-suggestions::-webkit-scrollbar {
  display: none;
}

.suggestion-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.suggestion-chip:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: rgba(0, 242, 254, 0.5);
  color: #ffffff;
  transform: translateY(-1px);
}

.suggestion-chip:active {
  transform: scale(0.96);
}

/* Chat Input Bar */
.chatbot-input-area {
  padding: 10px 14px;
  background: rgba(17, 24, 40, 0.98);
  border-top: 1px solid rgba(56, 189, 248, 0.18);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-input-area input {
  flex: 1;
  background: rgba(10, 15, 28, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 9px 12px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chatbot-input-area input::placeholder {
  color: #64748b;
}

.chatbot-input-area input:focus {
  border-color: #00f2fe;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}

.chatbot-send-btn {
  background: linear-gradient(135deg, #00f2fe 0%, #0284c7 100%);
  border: none;
  border-radius: 8px;
  color: #070a13;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s;
  outline: none;
}

.chatbot-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 242, 254, 0.4);
}

.chatbot-send-btn:active {
  transform: scale(0.95);
}

/* ==========================================================================
   Responsive Viewports
   ========================================================================== */

@media (max-width: 768px) {
  #chatbot-window {
    width: 380px;
    height: 540px;
    bottom: 80px;
    right: 16px;
  }
}

@media (max-width: 480px) {
  #chatbot-launcher {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }

  #chatbot-window {
    width: calc(100vw - 24px);
    height: calc(100vh - 90px);
    bottom: 12px;
    right: 12px;
    border-radius: 12px;
  }
}

/* ==========================================================================
   Light Mode Overrides for Chatbot
   ========================================================================== */
[data-theme="light"] #chatbot-window {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border-medium);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15), 0 0 12px rgba(2, 132, 199, 0.1);
}

[data-theme="light"] .chatbot-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .chatbot-title {
  color: var(--text-primary);
}

[data-theme="light"] .chatbot-message.bot {
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] .chatbot-message.user {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
}

[data-theme="light"] .chatbot-input-area {
  background: #f8fafc;
  border-top: 1px solid var(--border-subtle);
}

[data-theme="light"] .chatbot-input-area input {
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
}

[data-theme="light"] .suggestion-chip {
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
}

[data-theme="light"] .suggestion-chip:hover {
  background: #f1f5f9;
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

