/* SWARM Neural Assistant Widget Styles */

.swarm-assistant {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* Floating Action Button */
.assistant-fab {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #7B2FFF, #00E5FF);
  box-shadow: 0 4px 24px rgba(123, 47, 255, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: visible;
}

.assistant-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 36px rgba(0, 229, 255, 0.6);
}

/* Pulse Rings */
.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 229, 255, 0.5);
  animation: pulse-expand 2s ease-out infinite;
}

.pulse-ring:nth-child(2) { animation-delay: 0.6s; }
.pulse-ring:nth-child(3) { animation-delay: 1.2s; }

@keyframes pulse-expand {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}

/* FAB Circle */
.fab-circle {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a0a2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Electric Sparks */
.electric-spark {
  position: absolute;
  width: 3px;
  height: 10px;
  background: #00E5FF;
  border-radius: 2px;
  animation: spark-rotate 1.5s linear infinite;
}

.electric-spark:nth-child(1) { transform-origin: 0 20px; transform: rotate(0deg); }
.electric-spark:nth-child(2) { transform-origin: 0 20px; transform: rotate(90deg); animation-delay: 0.375s; }
.electric-spark:nth-child(3) { transform-origin: 0 20px; transform: rotate(180deg); animation-delay: 0.75s; }
.electric-spark:nth-child(4) { transform-origin: 0 20px; transform: rotate(270deg); animation-delay: 1.125s; }

@keyframes spark-rotate {
  0%   { opacity: 1; }
  50%  { opacity: 0.3; }
  100% { opacity: 1; }
}

/* AI Brain */
.ai-brain-container {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-brain {
  font-size: 22px;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.ai-brain::before {
  content: '⚡';
}

.neuron {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #00E5FF;
  border-radius: 50%;
  animation: neuron-pulse 1.5s ease-in-out infinite;
}

.neuron:nth-child(1) { top: 0; left: 50%; animation-delay: 0s; }
.neuron:nth-child(2) { top: 25%; right: 0; animation-delay: 0.2s; }
.neuron:nth-child(3) { bottom: 25%; right: 0; animation-delay: 0.4s; }
.neuron:nth-child(4) { bottom: 0; left: 50%; animation-delay: 0.6s; }
.neuron:nth-child(5) { bottom: 25%; left: 0; animation-delay: 0.8s; }
.neuron:nth-child(6) { top: 25%; left: 0; animation-delay: 1.0s; }
.neuron:nth-child(7) { top: 50%; left: 50%; animation-delay: 1.2s; }

@keyframes neuron-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50%       { opacity: 1; transform: scale(1.4); }
}

/* Particles */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.6);
  transform: translate(-50%, -50%);
  animation: particle-float 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes particle-float {
  0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  50%       { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
}

/* Chat Window */
.assistant-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  height: 520px;
  background: #0d0d1a;
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 229, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.assistant-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(123, 47, 255, 0.2), rgba(0, 229, 255, 0.1));
  border-bottom: 1px solid rgba(0, 229, 255, 0.15);
}

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

.assistant-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7B2FFF, #00E5FF);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.assistant-header-text h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.assistant-header-text p {
  margin: 0;
  font-size: 11px;
  color: #10B981;
}

.assistant-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.assistant-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Messages */
.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 229, 255, 0.2) transparent;
}

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

.assistant-message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  word-wrap: break-word;
}

.assistant-message.assistant {
  background: rgba(123, 47, 255, 0.15);
  border: 1px solid rgba(123, 47, 255, 0.3);
  color: #E5E7EB;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.assistant-message.user {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.15), rgba(0, 119, 255, 0.15));
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.assistant-message.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(123, 47, 255, 0.1);
  border: 1px solid rgba(123, 47, 255, 0.2);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #7B2FFF;
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* Quick Replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.quick-reply-btn {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
  color: #00E5FF;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-family: inherit;
}

.quick-reply-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: rgba(0, 229, 255, 0.4);
}

/* Input Area */
.assistant-input-container {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 229, 255, 0.1);
}

.assistant-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 12px;
  padding: 6px 6px 6px 14px;
  transition: border-color 0.2s;
}

.assistant-input-wrapper:focus-within {
  border-color: rgba(0, 229, 255, 0.4);
}

.assistant-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.assistant-input::placeholder { color: rgba(255, 255, 255, 0.3); }

.assistant-send {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7B2FFF, #00E5FF);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: opacity 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.assistant-send:hover { opacity: 0.85; transform: scale(1.05); }
.assistant-send:active { transform: scale(0.95); }

/* Footer */
.assistant-footer {
  text-align: center;
  padding: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.assistant-footer a {
  color: rgba(0, 229, 255, 0.6);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 480px) {
  .swarm-assistant { bottom: 16px; right: 16px; }
  .assistant-window { width: calc(100vw - 32px); right: -16px; }
}
