/**
 * Vigthoria Chat Container Fixes
 * Ensures chat container displays messages and form correctly
 * Version: 1.0.1 (May 2025)
 */

/* Fix container layout issues */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Ensure chat messages area has proper height and scrolling */
.chat-messages {
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 10px;
  height: calc(100% - 150px); /* Fixed height calculation to leave room for the chat form */
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Fix for chat form to prevent overlap with messages */
.chat-form {
  position: relative;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1rem;
  background-color: var(--bg-secondary, #1a1a2e);
  border-top: 1px solid var(--border-primary, rgba(50, 150, 200, 0.3));
  z-index: 10; /* Ensure the form stays on top */
  height: auto;
  min-height: 150px;
}

/* Ensure messages are displayed properly */
.message {
  max-width: 90%;
  margin-bottom: 15px;
  clear: both;
}

.user-message {
  margin-left: auto;
  margin-right: 10px;
  border-radius: 18px 18px 0 18px;
}

.assistant-message {
  margin-right: auto;
  margin-left: 10px;
  border-radius: 18px 18px 18px 0;
}

/* Fix message content overflow */
.message-content {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  padding: 8px;
}

/* Ensure code blocks are properly displayed */
.message-content pre {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 10px;
  overflow-x: auto;
  max-width: 100%;
}

.message-content code {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.9em;
}

/* Fix for mobile view */
@media (max-width: 768px) {
  .chat-messages {
    height: calc(100% - 120px);
  }
  
  .chat-form {
    min-height: 120px;
  }
  
  .message {
    max-width: 95%;
  }
}

/* Make sure chat area takes full height available */
.dashboard-content {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px); /* 60px for header */
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Ensure loading indicators are visible */
.loading .message-content:after {
  content: "...";
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}
