/* Thinking Indicator Styles - Inline within messages */
.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 20px;
  margin: 0 8px;
  opacity: 0;
  transform: scale(0.8);
  animation: fadeInScale 0.3s ease forwards;
  direction: ltr; /* Force LTR for consistent layout */
  vertical-align: middle;
}

.thinking-indicator.fade-out {
  animation: fadeOutScale 0.3s ease forwards;
}

.thinking-text {
  font-size: 12px;
  color: rgba(139, 92, 246, 0.8);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.thinking-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(45deg, #8b5cf6, #a855f7, #c084fc, #e879f9);
  background-size: 300% 300%;
  animation: thinkingPulse 1.5s ease-in-out infinite, gradientShift 2.5s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.thinking-circle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60%;
  height: 60%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: innerGlow 2s ease-in-out infinite;
}

/* Animations */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeOutScale {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes thinkingPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.6);
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes innerGlow {
  0%, 100% {
    opacity: 0.2;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.4;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* Dark theme adjustments */
body[data-theme="dark"] .thinking-indicator {
  background: var(--thinking-bg);
  border-color: var(--thinking-border);
}

/* Light theme adjustments */
body[data-theme="light"] .thinking-indicator {
  background: var(--thinking-bg);
  border-color: var(--thinking-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .thinking-circle {
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
  .thinking-indicator {
    padding: 10px 14px;
    gap: 10px;
  }
  
  .thinking-circle {
    width: 18px;
    height: 18px;
  }
  
  .thinking-text {
    font-size: 13px;
  }
}

/* RTL support */
[dir="rtl"] .thinking-indicator {
  direction: rtl;
}

[dir="rtl"] .thinking-text {
  text-align: right;
}
