/**
 * Silky Smooth Chat v2.0
 * Optimized chat interface with fluid animations
 */

/* ==================== Chat Container ==================== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
}

/* ==================== Message Styling ==================== */
.chat-message {
  max-width: 85%;
  margin-bottom: 16px;
  animation: message-enter 0.3s ease-out;
}

.chat-message-user {
  margin-left: auto;
}

.chat-message-assistant {
  margin-right: auto;
}

.chat-bubble {
  padding: 14px 18px;
  border-radius: 20px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-bubble-user {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-bottom-right-radius: 6px;
}

.chat-bubble-assistant {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
  border-bottom-left-radius: 6px;
}

@keyframes message-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== Typing Indicator ==================== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #6366f1;
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* ==================== Input Area ==================== */
.chat-input-container {
  padding: 12px 16px;
  background: #0f172a;
  border-top: 1px solid #1e293b;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 24px;
  padding: 8px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  max-height: 150px;
  min-height: 24px;
}

.chat-input:focus {
  outline: none;
}

.chat-input::placeholder {
  color: #64748b;
}

/* Send Button */
.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==================== Attachment Preview ==================== */
.attachment-preview {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.attachment-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #1e293b;
  border: 1px solid #334155;
}

.attachment-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  cursor: pointer;
}

/* ==================== Actions Bar ==================== */
.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.chat-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-action-btn:hover {
  background: #1e293b;
  color: #e2e8f0;
}

/* ==================== Suggestions ==================== */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
}

.chat-suggestion {
  padding: 10px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  color: #e2e8f0;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-suggestion:hover {
  background: #334155;
  border-color: #475569;
}

/* ==================== Code Block ==================== */
.chat-code-block {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  margin: 12px 0;
  overflow: hidden;
}

.chat-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  font-size: 12px;
  color: #94a3b8;
}

.chat-code-content {
  padding: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-code-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #e2e8f0;
}

/* ==================== Scroll to Bottom ==================== */
.scroll-to-bottom {
  position: absolute;
  bottom: 100px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s;
  z-index: 10;
}

.scroll-to-bottom.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-bottom:hover {
  background: #334155;
}

/* ==================== Message Actions ==================== */
.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-message:hover .message-actions {
  opacity: 1;
}

.message-action-btn {
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.message-action-btn:hover {
  background: rgba(100, 116, 139, 0.1);
  color: #e2e8f0;
}

