/* static/css/chat.css */

.main-chat-ui {
}

/*  Adjusts the large adjustable box that contains the user input (prompt) and thread history */
#chat-root {
    justify-self: center;
    width: 60%;               /* Make it larger horizontally */
    /*height: 1100px; */            /* Set larger height */
    height: 90vh;             /* Set a larger height using relative adjustment instead of px */
    overflow-y: scroll;       /* Make it scrollable */
    resize: both;             /* Allow resizing */
    border: 1px solid #ccc;   /* Optional: Add a light border to make it visually stand out */
    padding: 15px;            /* Add some padding for better visuals */
}

.chat-container {
  width: 90%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 1rem;
}

.message {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 8px;
}

.user-message {
  background-color: #e3f2fd;
  margin-left: auto;
  margin-right: 0;
  max-width: 80%;
}

.assistant-message {
    color: #d3d3d3;
    background-color: #333333;
    margin-right: auto;
    margin-left: 0;
    max-width: 80%;
    padding: 1rem;
    border-radius: 8px;
    line-height: 1.6;
}

.chat-form {
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
  background-color: white;
}

.input-wrapper {
    display: flex;
    align-items: center; /* Center align them vertically */
    width: 100%; /* Ensure it takes the width of its container */
    padding: 1rem;
    box-sizing: border-box;
    background-color: white;
}

.input-container {
  flex: 1; /* This makes the input container take all the available space */
  position: relative;
  padding: 1.5rem;
  background-color: white;
  border-top: 1px solid #e2e8f0;
}

.chat-input {
  width: 100%;
  min-height: 100px;
  max-height: 400px;
  padding: 16px 45px 16px 15px;
  font-size: 18px;
  line-height: 1.5;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background-color: white;
  resize: vertical;
  overflow-y: auto;
  transition: min-height 0.2s ease;
}

.chat-input {
    width: 100%;
    min-height: 60px;  /* Increase height to provide a larger typing area, comparable to other models */  
    /* max-height: 400px;  /* Allow for scrolling within a defined max height */ 
    padding: 16px 45px 16px 15px;  /* Increase padding for better appearance */
    font-size: 18px;  /* Larger font size for better visibility */
    line-height: 1.5;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background-color: white;
    resize: vertical; /* Allow resizing */
    overflow-y: auto;
    transition: min-height 0.2s ease;
}

.chat-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-button {
    margin-left: 10px; /* Space between the input field and the button */
    padding: 0.75rem;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%; /* Make it round */
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
}

.send-button:hover {
    background-color: #2563eb; /* Darken on hover */
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-input {
  min-height: 24px;           /* Minimum height for the textarea */
  max-height: 200px;          /* Maximum height for the textarea */
  overflow-y: auto;           /* Adds a vertical scroll bar if the content exceeds max-height */
  resize: vertical;           /* Allow the textarea to be resized vertically only */
  width: 100%;                /* Full-width to fit its container */
  padding: 8px;               /* Padding for a comfortable typing area */
  font-size: 16px;            /* Set a comfortable font size */
  border: 1px solid #ccc;     /* Border styling */
  border-radius: 4px;         /* Slightly rounded corners for better aesthetics */
  box-sizing: border-box;     /* Ensures padding and border are included in width/height */
}


/* Responsive web design for mobile */
@media (max-width: 768px) {
    .main-chat-ui {
        width: 100%;            /* Occupy full width on mobile */
        max-width: none;        /* Remove the max-width constraint */
        padding: 0.5rem;        /* Optional: Adjust padding for mobile */
        margin: 0;              /* Remove automatic margins */
        box-sizing: border-box; /* Ensure padding is included in the width */
    }

    #chat-root {
        width: 100%;            /* Ensure chat-root also occupies full width */
    }

    /* Optional: Adjust other child elements if necessary */
    .chat-form, .input-wrapper, .input-container, .chat-input, .send-button {
        /* Example adjustments */
        padding: 0.5rem;
        font-size: 16px;
    }
}

/* markdown-body styles */
.markdown-body p {
  margin: 0 0 1.25rem 0;
  line-height: 1.55;
}

.markdown-body ul li,
.markdown-body ol li {
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 1.25rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 1.75rem 0 1rem 0;
  line-height: 1.3;
}

.markdown-body pre {
  margin-bottom: 1.5rem;
}

/* smooth expandable markdown container */
.transition-height {
  display: block;        /* ensures it participates in layout */
  position: relative;    /* prevents overlap glitches */
  overflow: hidden;      /* hides content when collapsed */
  transition: max-height 0.35s ease;
  max-height: 0;         /* collapsed state */
}

.transition-height.expand {
  max-height: 5000px;    /* expanded state */
}