/**
 * Layout fixes for the chat interface on both mobile and desktop
 * Focused on reducing excess space and improving the overall layout
 */

/* Common fixes for both mobile and desktop */
.chat-messages {
  padding: 0 !important;
}

.message-container {
  padding: 12px 16px !important;
  margin-bottom: 8px !important;
  border-radius: 0 !important;
  border-top: 1px solid var(--border-color, rgba(0,0,0,0.05)) !important;
  border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.05)) !important;
  max-width: none !important;
  width: 100% !important;
}

.message {
  max-width: 100% !important;
  width: 100% !important;
  padding: 0 !important;
}

/* Fix for excessive padding in the message content */
.message-content {
  padding: 0 !important;
}

/* Fix the user avatar sizing and alignment */
.message-avatar {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  margin-right: 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Improve text alignment and spacing in messages */
.message-content p {
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}

.message-content p:last-child {
  margin-bottom: 0 !important;
}

/* Optimize input area */
.chat-input-container {
  padding: 10px !important;
  border-top: 1px solid var(--border-color, rgba(0,0,0,0.1)) !important;
}

/* Desktop-specific fixes */
@media (min-width: 769px) {
  /* Remove excessive horizontal spacing on desktop */
  .message-container {
    padding: 16px !important;
  }
  
  /* Center-align chat content with reasonable max width */
  .message {
    max-width: 900px !important;
    margin: 0 auto !important;
  }
  
  /* Optimize input area on desktop */
  .chat-input-form {
    max-width: 900px !important;
    margin: 0 auto !important;
  }
  
  /* Improve feature buttons layout */
  .input-features {
    max-width: 900px !important;
    margin: 8px auto 0 !important;
  }
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
  /* Fix top header for better mobile layout */
  .app-header {
    padding: 8px !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
  }
  
  .logo h1 {
    font-size: 1.1rem !important;
  }
  
  /* Make model selector more compact on mobile */
  .model-selection {
    max-width: 120px !important;
  }
  
  /* Fix message container spacing */
  .message-container {
    padding: 10px 12px !important;
  }
  
  /* Improve avatar sizing on mobile */
  .message-avatar {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    margin-right: 8px !important;
  }
  
  /* Fix input area on mobile */
  .chat-input-container {
    padding: 8px !important;
  }
  
  #user-input {
    padding: 10px 36px 10px 12px !important;
    min-height: 44px !important;
    border-radius: 22px !important;
  }
}

/* Fix code block display */
.message-content pre {
  margin: 0.5rem 0 !important;
  padding: 0.8rem !important;
  border-radius: 4px !important;
  max-width: 100% !important;
  overflow-x: auto !important;
}

/* Fix image display in chat */
.message-content img {
  max-width: 100% !important;
  border-radius: 4px !important;
  margin: 0.5rem 0 !important;
}
