/**
 * CSS fixes for thinking animation
 * Created: May 13, 2025
 */

/* Thinking animation in sidebar */
.sidebar-thinking {
  display: none;
  position: relative;
  margin: 12px auto;
  width: 20px;
  height: 20px;
  transform: translateY(0px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-thinking.active {
  display: block;
  opacity: 1;
  animation: pulse-glow 1.5s infinite alternate;
}

.sidebar-thinking::before,
.sidebar-thinking::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-color, #00f0ff);
  transition: all 0.2s;
}

.sidebar-thinking::after {
  animation: thinking-ripple 1.2s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.sidebar-thinking::before {
  animation: thinking-ripple 1.2s cubic-bezier(0, 0.2, 0.8, 1) 0.3s infinite;
}

/* Thinking animation in main chat area */
.thinking-animation {
  display: none;
  margin: 8px 0;
  position: relative;
  height: 24px;
}

.thinking-animation.active {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.thinking-dot {
  background-color: var(--accent-color, #00f0ff);
  border-radius: 50%;
  height: 8px;
  width: 8px;
  margin: 0 4px;
  opacity: 0.6;
}

.thinking-dot:nth-child(1) {
  animation: thinking-bounce 1.4s ease-in-out 0s infinite;
}

.thinking-dot:nth-child(2) {
  animation: thinking-bounce 1.4s ease-in-out 0.2s infinite;
}

.thinking-dot:nth-child(3) {
  animation: thinking-bounce 1.4s ease-in-out 0.4s infinite;
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
  .sidebar-thinking {
    margin: 8px auto;
    width: 16px;
    height: 16px;
  }
  
  .thinking-animation {
    height: 20px;
    margin: 6px 0;
  }
  
  .thinking-dot {
    height: 6px;
    width: 6px;
  }
}

/* Animations */
@keyframes thinking-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes thinking-ripple {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes pulse-glow {
  0% {
    filter: brightness(0.8) drop-shadow(0 0 1px var(--accent-color, #00f0ff));
  }
  100% {
    filter: brightness(1.2) drop-shadow(0 0 8px var(--accent-color, #00f0ff));
  }
}

/* Cross-browser compatibility fixes */
.sidebar-thinking.active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Fix for Safari and Mobile browsers */
@supports (-webkit-hyphens:none) {
  .sidebar-thinking.active {
    opacity: 1 !important;
    display: block !important;
  }
  
  .sidebar-thinking::before,
  .sidebar-thinking::after {
    border-radius: 50% !important;
    border: 2px solid var(--accent-color, #00f0ff) !important;
  }
}

/* Fix for Firefox */
@-moz-document url-prefix() {
  .sidebar-thinking.active {
    opacity: 1;
  }
}
