/* 🎨 Message Animations - Hafif ve Güzel */

/* Mesaj Fade-in & Slide-up */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message {
  animation: messageSlideIn 0.3s ease-out;
}

/* Mesaj gönderme animasyonu */
.message.sending {
  opacity: 0.6;
  transform: scale(0.98);
  transition: all 0.2s ease;
}

.message.sent {
  opacity: 1;
  transform: scale(1);
  transition: all 0.3s ease;
}

/* Typing Indicator - AI yazıyor */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin: 8px 0;
  animation: messageSlideIn 0.3s ease-out;
}

.typing-indicator-text {
  font-size: 0.9em;
  color: var(--text-secondary);
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typingDot 1.4s infinite;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Send Button Animation */
.send-btn {
  transition: all 0.2s ease;
}

.send-btn:hover {
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn.sending {
  animation: sendPulse 1s infinite;
}

@keyframes sendPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

/* Input Focus Animation */
.question-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
  transition: all 0.3s ease;
}

/* Message Content Fade-in (streaming) */
.message-content {
  animation: contentFadeIn 0.2s ease-out;
}

@keyframes contentFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Streaming Cursor */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--text-primary);
  margin-left: 2px;
  animation: cursorBlink 1s infinite;
  vertical-align: text-bottom;
}

@keyframes cursorBlink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/* Message Hover Effect */
.message:hover {
  transform: translateX(2px);
  transition: transform 0.2s ease;
}

.message.user-message:hover {
  transform: translateX(-2px);
}

/* Delete Animation */
.message.deleting {
  animation: messageSlideOut 0.3s ease-out forwards;
}

@keyframes messageSlideOut {
  to {
    opacity: 0;
    transform: translateX(-100%);
    height: 0;
    margin: 0;
    padding: 0;
  }
}

/* New Chat Button Pulse */
.new-chat-btn {
  transition: all 0.2s ease;
}

.new-chat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.new-chat-btn:active {
  transform: translateY(0);
}

/* Chat Item Hover */
.chat-history-item {
  transition: all 0.2s ease;
}

.chat-history-item:hover {
  transform: translateX(4px);
}

/* 
 * NOT: Global * transition kaldırıldı - performans için zararlıydı.
 * Sadece gerekli elementlere transition ekliyoruz.
 */

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-primary);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success Checkmark */
.success-checkmark {
  display: inline-block;
  animation: checkmarkPop 0.3s ease-out;
}

@keyframes checkmarkPop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* Error Shake */
.error-shake {
  animation: errorShake 0.5s ease;
}

@keyframes errorShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Fade In/Out */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.fade-out {
  animation: fadeOut 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Slide Down (for notifications) */
.slide-down {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Bounce (for success) */
.bounce {
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-10px);
  }
  50% {
    transform: translateY(0);
  }
  75% {
    transform: translateY(-5px);
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .message:hover {
    transform: none;
  }

  .message.user-message:hover {
    transform: none;
  }

  .chat-history-item:hover {
    transform: none;
  }
}
