/**
 * Global Component Styles
 * These styles apply to all components across the application
 */

/* Chat Components */

/* Message wrapper and bubbles */
.message-wrapper {
  display: flex;
  width: 100%;
}

.message-left {
  justify-content: flex-start;
}

.message-right {
  justify-content: flex-end;
}

.message-center {
  justify-content: center;
}

.message {
  max-width: 80%;
  border-radius: 12px;
  padding: 12px 16px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-user {
  background-color: #3b82f6;
  color: white;
  border-bottom-right-radius: 4px;
}

.message-assistant {
  background-color: #f0f2f5;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

.message-system {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  text-align: center;
}

/* Message timestamp */
.message-timestamp {
  font-size: 0.75rem;
  margin-top: 4px;
  opacity: 0.7;
}

.message-user .message-timestamp {
  text-align: right;
  color: rgba(255, 255, 255, 0.8);
}

.message-assistant .message-timestamp {
  color: #6c757d;
}

.message-system .message-timestamp {
  text-align: center;
  color: #856404;
}

/* Message content */
.message-content {
  word-break: break-word;
}

/* Message actions */
.message-actions {
  display: none;
  position: absolute;
  bottom: -24px;
  right: 0;
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  padding: 2px;
  z-index: 10;
}

.message-right .message-actions {
  right: 0;
}

.message-left .message-actions {
  left: 0;
}

.message:hover .message-actions {
  display: flex;
}

.btn-action {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  background-color: transparent;
  border: none;
  margin: 0 2px;
  transition: color 0.2s, background-color 0.2s;
}

.btn-action:hover {
  color: #495057;
  background-color: rgba(0,0,0,0.05);
}

/* Chat container */
.chat-container-wrapper {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  background-color: #fff;
  overflow: hidden;
}

.chat-header {
  background-color: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.chat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  background-color: #f8f9fa;
}

/* Chat input */
.chat-input-container {
  border-top: 1px solid rgba(0,0,0,0.1);
  background-color: #fff;
}

/* Button styles */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #6c757d;
  background-color: transparent;
  transition: background-color 0.2s, color 0.2s;
}

.btn-icon:hover {
  background-color: rgba(0,0,0,0.05);
  color: #495057;
}

.btn-icon:active,
.btn:active {
  transform: none !important;
}

.btn-link {
  text-decoration: none;
  transition: color 0.2s;
}

.btn-link:hover {
  text-decoration: none;
}

.btn-link i {
  transition: none;
}

/* Typing indicator animation */
.typing-dots {
  display: flex;
  align-items: center;
}

.typing-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #9ca3af;
  margin: 0 2px;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Markdown content styling */
.markdown-body {
  font-size: 0.95rem;
}

.markdown-body pre {
  background-color: #f6f8fa;
  border-radius: 6px;
  padding: 16px;
  overflow: auto;
}

.markdown-body code {
  background-color: rgba(175, 184, 193, 0.2);
  border-radius: 6px;
  padding: 0.2em 0.4em;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
}

.markdown-body pre code {
  background-color: transparent;
  padding: 0;
}

/* Dark mode support */
body.dark-version .message-assistant {
  background-color: #2d3748;
  color: #e2e8f0;
}

body.dark-version .message-assistant .message-timestamp {
  color: #a0aec0;
}

body.dark-version .chat-container-wrapper {
  background-color: #1a2035;
  border-color: rgba(255,255,255,0.1);
}

body.dark-version .chat-header {
  background-color: #1a2035;
  border-color: rgba(255,255,255,0.1);
}

body.dark-version .chat-messages {
  background-color: #141727;
}

body.dark-version .chat-input-container {
  background-color: #1a2035;
  border-color: rgba(255,255,255,0.1);
}

body.dark-version .btn-icon {
  color: #a0aec0;
}

body.dark-version .btn-icon:hover {
  background-color: rgba(255,255,255,0.1);
  color: #e2e8f0;
}

body.dark-version .message-actions {
  background-color: #1a2035;
}

body.dark-version .btn-action {
  color: #a0aec0;
}

body.dark-version .btn-action:hover {
  color: #e2e8f0;
  background-color: rgba(255,255,255,0.1);
}

body.dark-version .typing-dots span {
  background-color: #a0aec0;
}

body.dark-version .markdown-body {
  color: #e2e8f0;
}

body.dark-version .markdown-body pre {
  background-color: #1f2937;
}

body.dark-version .markdown-body code {
  background-color: rgba(255, 255, 255, 0.1);
}
