/* css/chat.css */
.chat-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.6;
  max-width: 85%;
  word-break: break-word;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  position: relative;
}

.message-content {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  overflow-x: auto;
}

.message-content p {
  margin-top: 0;
  margin-bottom: 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message.user {
  background: linear-gradient(135deg, rgba(163, 130, 87, 0.15), var(--bg-ter));
  border: 1px solid rgba(163, 130, 87, 0.3);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.ai {
  background: var(--bg-sec);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  max-width: 90%;
}

.message.system-debug-msg {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  font-size: 13px;
}

.agent-state-box {
  background: rgba(163, 130, 87, 0.1);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 4px;
  font-size: 13px;
}

.thinking-loader {
  color: var(--accent);
  font-weight: 500;
}

.thinking-loader .dot {
  animation: dotBounce 1.4s infinite;
  margin-left: 1px;
  display: inline-block;
}

.thinking-loader .dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-loader .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
  40% { transform: translateY(-3px); opacity: 1; }
}

.reasoning-box {
  margin-bottom: 4px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
}

.reasoning-box summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  background: rgba(0,0,0,0.2);
}

.reasoning-content {
  padding: 12px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.1);
  border-top: 1px solid var(--border-light);
}

.custom-codeblock {
  background: #111111;
  border-radius: 16px;
  margin: 16px 0;
  border: 1px solid var(--border-light);
  position: relative;
  max-width: 100%;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.codeblock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  position: sticky;
  top: -1px;
  z-index: 10;
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
}

.code-lang {
  color: #e0e0e0;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.code-actions {
  display: flex;
  gap: 12px;
}

.code-btn {
  background: transparent;
  border: none;
  color: #a0a0a0;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.code-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}

.codeblock-body {
  padding: 16px;
  overflow-x: auto;
  max-width: 100%;
}

.custom-codeblock code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: transparent !important;
  padding: 0 !important;
}

.file-attachment {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 4px 0;
  transition: all 0.3s ease;
}

.file-attachment summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  outline: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-attachment pre {
  margin-top: 12px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-muted);
  background: #050505 !important;
  padding: 12px !important;
  border-radius: 8px;
  border: 1px solid #1a1a1a;
  white-space: pre-wrap;
  word-break: break-word;
}
