/* css/components/aiChatPanel.css */
:root {
    --ai-chat-input-height: 80px;
}

#aiChatLog .chat-message {
    padding: 8px 12px;
    border-radius: 18px;
    margin-bottom: 8px;
    max-width: 85%;
    line-height: 1.4;
    font-size: 0.9em;
}

#aiChatLog .user-message {
    background-color: #007bff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

#aiChatLog .ai-message {
    background-color: #e9ecef;
    color: #212529;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

#aiChatLog .chat-message.loading {
    font-style: italic;
    color: #6c757d;
}

/* --- [NEW] Styles for Markdown Content --- */

.ai-message {
    /* Make the message a positioning context for the copy button */
    position: relative;
}

.ai-message p {
    margin: 0 0 0.5em 0; /* Add space between paragraphs */
}
.ai-message p:last-child {
    margin-bottom: 0;
}

.ai-message ul,
.ai-message ol {
    padding-left: 20px; /* Indent lists */
    margin: 0.5em 0;
}
.ai-message li {
    margin-bottom: 0.25em;
    line-height: 1.5;
}

/* Inline code */
.ai-message code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    background-color: #f8f9fa; /* Light background */
    border: 1px solid #dee2e6;
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Code blocks */
.ai-message pre {
    background-color: #212529; /* Dark background for code blocks */
    color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto; /* Allow horizontal scrolling */
    font-size: 0.85em;
    line-height: 1.4;
}

/* --- [NEW] Styles for Copy Button --- */
.chat-copy-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: #6c757d; /* Muted gray */
    cursor: pointer;
    font-size: 0.9em;
    padding: 3px 6px;
    border-radius: 4px;
    opacity: 0; /* Hide by default */
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.ai-message:hover .chat-copy-button {
    opacity: 1; /* Show on hover */
}

.chat-copy-button:hover {
    background-color: #dee2e6; /* Light gray background on button hover */
    color: #212529;
}

.chat-copy-button .fa-check {
    color: #28a745; /* Green checkmark */
}

/* --- [NEW] Styles for Suggestion Pills with Icons --- */
.suggestion-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background-color: #f1f3f5;
    color: #212529;
    font-size: 0.85rem;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.suggestion-pill:hover {
    background-color: #e2e6ea;
    border-color: #c1c9d0;
}

.suggestion-pill .fa-image {
    color: #007bff;
}

/* --- [NEW] Styles for Generated Images in Chat --- */
.ai-message .chat-generated-image {
    max-width: 100%;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    margin-top: 5px;
}

.ai-message p:first-child {
    margin-top: 0;
}

.ai-chat-error {
    color: #c62828;
    font-weight: 600;
}

#aiChatInput {
    width: 100%;
    min-height: 70px;
    max-height: 280px;
    resize: vertical;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 8px;
    line-height: 1.4;
    font-size: 0.95em;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#aiChatInput:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
    outline: none;
}

#aiChatCommandPopup {
    position: absolute;
    bottom: calc(var(--ai-chat-input-height, 80px) + 20px);
    left: 10px;
    right: 10px;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 220px;
    overflow-y: auto;
    z-index: 5;
    padding: 6px 0;
}

.ai-command-option {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.ai-command-option:hover {
    background-color: #f1f3f5;
}

.ai-command-option.active {
    background-color: #e7f1ff;
}

#aiChatCommandPopup.keyboard-nav .ai-command-option:hover {
    background-color: inherit;
}

.ai-command-option .command-name {
    font-weight: 600;
    color: #212529;
}

.ai-command-option .command-desc {
    font-size: 0.85em;
    color: #495057;
}
# --- [NEW] Styles for Markdown Content ---

.ai-message {
    /* Make the message a positioning context for the copy button */
    position: relative;
    /* Remove padding, as it will be on the child */
}

/* [NEW] This container holds the rendered markdown */
.chat-content-container {
    padding-right: 30px; /* Space for the copy button */
}

.ai-message p {
    margin: 0 0 0.5em 0; /* Add space between paragraphs */
}
.ai-message p:last-child {
    margin-bottom: 0;
}

.ai-message ul,
.ai-message ol {
    padding-left: 20px; /* Indent lists */
    margin: 0.5em 0;
}
.ai-message li {
    margin-bottom: 0.25em;
    line-height: 1.5;
}

/* Inline code */
.ai-message code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    background-color: #f8f9fa; /* Light background */
    border: 1px solid #dee2e6;
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Code blocks */
.ai-message pre {
    background-color: #212529; /* Dark background for code blocks */
    color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto; /* Allow horizontal scrolling */
    font-size: 0.85em;
    line-height: 1.4;
    max-width: 100%;
    box-sizing: border-box;
}

/* Markdown Tables */
.ai-message table {
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.9em;
    width: 100%;
}
.ai-message th,
.ai-message td {
    border: 1px solid #dee2e6;
    padding: 6px 10px;
}
.ai-message th {
    background-color: #f8f9fa;
    font-weight: bold;
}
.ai-message tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* --- [NEW] Styles for Copy Button --- */
.chat-copy-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: #6c757d; /* Muted gray */
    cursor: pointer;
    font-size: 0.9em;
    padding: 3px 6px;
    border-radius: 4px;
    opacity: 0; /* Hide by default */
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.ai-message:hover .chat-copy-button {
    opacity: 1; /* Show on hover */
}

.chat-copy-button:hover {
    background-color: #dee2e6; /* Light gray background on button hover */
    color: #212529;
}

.chat-copy-button .fa-check {
    color: #28a745; /* Green checkmark */
}
.ai-chat-suggestions {
    padding: 8px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px solid #f1f1f1;
    border-bottom: 1px solid #ccc;
    background: #fff;
}
