﻿/* General Resets and Body Styling */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    background-color: #f0f4f9;
    color: #333;
}

/* Main Two-Column Layout */
.main-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    padding: 1.5rem;
    flex-shrink: 0; /* Prevents sidebar from shrinking */
}

.sidebar h2 {
    font-size: 1.5rem;
    color: #444;
    margin-top: 0;
}
.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #f7f7f7;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: background-color 0.2s;
}

    .new-chat-btn:hover {
        background-color: #e9e9e9;
    }

.session-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.session-item {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 超出部分显示省略号 */
}

    .session-item:hover {
        background-color: #f0f4f9;
    }

    .session-item.active {
        background-color: #d1e3ff;
        font-weight: 500;
    }

.conversation-view-empty {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}
.chat-window {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    gap: 1rem;
}

    .chat-header h3 {
        margin: 0;
        font-weight: 500;
    }

.model-selector {
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: white;
    font-size: 0.9rem;
}

/* Conversation Area */
.conversation-view {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Message Bubble Styling */
.message-bubble {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-width: 90%;
}

    .message-bubble.user {
        margin-left: auto;
        flex-direction: row-reverse;
    }

.icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.user .icon {
    background-color: #d1e3ff;
    color: #0056b3;
}

.bot .icon {
    background: linear-gradient(135deg, #4285f4, #9b59b6);
    color: white;
}

.content-wrapper {
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    white-space: pre-wrap; /* Preserves whitespace and wraps text */
    word-wrap: break-word;
}

.content-markdown {
    line-height: 1.6;
}

    /* Markdown Specific Styles */
    .content-markdown pre {
        background-color: #282c34;
        color: #abb2bf;
        padding: 1rem;
        border-radius: 8px;
        overflow-x: auto;
        font-family: "Fira Code", "Courier New", monospace;
        font-size: 0.9em;
    }

    .content-markdown code {
        background-color: #eee;
        padding: 0.2em 0.4em;
        margin: 0;
        font-size: 85%;
        border-radius: 3px;
        font-family: "Fira Code", "Courier New", monospace;
    }

    .content-markdown pre code {
        background-color: transparent;
        padding: 0;
    }

    .content-markdown ul, .content-markdown ol {
        padding-left: 20px;
    }

    .content-markdown p {
        margin-top: 0;
        margin-bottom: 0.5rem;
    }


/* Input Area Styling */
.input-area-container {
    padding: 1.5rem 2rem;
    background-color: #f0f4f9;
}

.input-area {
    display: flex;
    align-items: flex-end;
    background-color: #ffffff;
    border-radius: 28px;
    padding: 0.5rem 0.5rem 0.5rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

    .input-area textarea {
        flex-grow: 1;
        border: none;
        resize: none;
        background-color: transparent;
        font-size: 1rem;
        line-height: 1.5;
        max-height: 150px; /* Limit growth */
        overflow-y: auto;
    }

        .input-area textarea:focus {
            outline: none;
        }

    .input-area button {
        border: none;
        background-color: #1a73e8;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.2s;
        flex-shrink: 0;
    }

        .input-area button:disabled {
            background-color: #a0c7ff;
            cursor: not-allowed;
        }

        .input-area button:hover:not(:disabled) {
            background-color: #0056b3;
        }
