/* css/chat.css */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word; /* Fallback */
    overflow-wrap: break-word; /* Standard */
    white-space: pre-wrap; /* Preserve whitespace and wrap lines */
}

.chat-message.user {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.ai {
    background-color: #f1f1f1;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Styling for code blocks */
.chat-message pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto; /* Allow horizontal scrolling for long code lines */
    white-space: pre; /* Do not wrap lines in code blocks */
}

/* Styling for inline code snippets */
.chat-message code {
    font-family: monospace;
    background-color: rgba(0,0,0,0.05);
    padding: 2px 4px;
    border-radius: 4px;
}

/* Reset styles for code inside a pre block */
.chat-message pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.chat-form {
    display: flex;
    padding: 15px;
    border-top: 1px solid #ddd;
}

.chat-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    margin-right: 10px;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
}

.chat-send-btn {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
}

.chat-send-btn:hover {
    background-color: #0056b3;
}

/* Override padding for the AI chat modal */
#top-sheet .modal-content, #rules-top-sheet .modal-content {
    padding: 0;
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0; /* Prevent flexbox overflow issues */
}

/* Position the modal header for absolute child elements */
#top-sheet .modal-header,
#rules-top-sheet .modal-header {
    position: relative;
    justify-content: center; /* Keep title centered */
}
