/* chat_dialog.css */

.sidebar.collapsed ~ .chat-area {
    left: 0;
    border-radius: 0;
}


.chat-area {
    display: flex;
    justify-content: center; /* 水平居中 */

    background-color: #0c2a3e;
}


/* 输入区域 */
.chat-input-container {
    display: flex;
    justify-content: center; /* 水平居中 */

    width: calc(100% - 10px); /* 全宽减去滚动条宽度 */
    padding: 6px 8px;
    background-color: #fff;
    border-top: 1px solid var(--border-color);
    position: fixed;
    bottom: 0;
    left: 0px; /*250px*/
    right: 0;
    z-index: 100;
    transition: left 0.3s ease;

    /* 设置透明度为0.8 */
    /*opacity: 0.6;*/
    /* 设置四个角的圆角半径为10px */
    border-radius: 1px;
}

.sidebar.collapsed ~ .chat-input-container {
    left: 0;
}


.chat-input-wrapper {
    display: flex;
    justify-content: center; /* 水平居中 */
    position: relative;
    width: 80%;
    left: auto;
    align-items: flex-end;
    background-color: #f5edf5;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 1px rgb(61, 1, 61)!important;
    transition: box-shadow 0.2s ease;

}

.chat-input-wrapper:focus-within {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chat-input {
    resize: none;
    border: none;
    box-shadow: none;
    min-height: 48px;
    max-height: 255px;
    overflow-y: auto;
    width: 100%;
    padding: 12px 50px 12px 16px;

    font-size: 15px;
    line-height: 1.5;
    border-radius: 20px; /* 添加圆角效果 */

    background-color: #afb0b0 !important;
}

.chat-input:focus {
    outline: none;
}

/* 无输入时的样式（占位符显示时） */
.chat-input:placeholder-shown {
    /* 示例样式：浅灰色边框，背景色浅蓝 */
    border: 2px solid #ddd;
    background-color: #f8f9fa;
}

/* 有输入时的样式（占位符隐藏时） */
.chat-input:not(:placeholder-shown) {
    /* 示例样式：蓝色边框，背景色白色 */
    border: 2px solid #800080;
    background-color: #ffffff;
    box-shadow: 0 0 1px rgb(61, 1, 61);
}

.send-button {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 24px; /* 添加圆角效果 */
}

.send-button:hover {
    background-color: var(--primary-color-hover);
}

.send-button:active {
    transform: scale(0.96);
}


/* 消息样式 */
.message {
    padding-top: 15px;
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.message.visible {
    opacity: 1;
    transform: translateY(0);
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 8px;
    flex-shrink: 0;
}

.ai-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}


.message-content {
    position: relative;
    min-width: 10em;
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    transition: all 0.2s ease;
}

.message-content:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.ai-message .message-content {
    background-color: var(--ai-message-bg);
    color: var(--ai-message-text);
}

.user-message .message-content {
    background-color: var(--user-message-bg);
    color: var(--user-message-text);
}

.message-text {
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.message-text p {
    margin: 0 0 8px 0;
    padding: 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

/* 时间和复制按钮 */
.time-and-copy {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.message-time {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.copy-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #777;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-content:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    color: #333;
}

/* 消息容器 内滚动条 */
.chat-messages {
    overflow-y: visible; /* 禁用内部滚动 */
    height: auto; /* 高度由内容撑开 */
    max-height: none; /* 移除最大高度限制 */
    width: 80%;
    max-width: 80%;
    display: flex;
    position: absolute; /* 或 fixed */
    left: 0;
    right: 0;
    /* 新增：水平居中 */

    /* 保留底部间距，避免输入框遮挡 */
    padding: 10px 10px 186px;
    /* 留出足够的空间给输入框 */
    margin: 0 auto 10px;;
    scroll-behavior: smooth;
    overflow-x: hidden;

    background-color: var(--chat-messages-bgcolor);

}

/* 针对Chrome、Safari和Opera 滚动条美化 */
.chat-messages::-webkit-scrollbar {
    display: none;
    /*width: 6px;*/
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.user-message .copy-button {
    color: rgba(255, 255, 255, 0.7);
}

.user-message .copy-button:hover {
    color: rgba(255, 255, 255, 1);
}


.start-chat-btn {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 24px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.start-chat-btn:hover {
    background-color: #3A5CE7;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.start-chat-btn:active {
    transform: translateY(0);
}

.footer-info {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    color: #888;
}


.new-chat-fab {
    display: none;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-area,
    .chat-messages {
        height: calc(100vh - 56px - 60px);
    }

    .chat-area {
        left: 0;
        border-radius: 0;
    }

    .chat-messages {
        padding: 10px;
        margin-bottom: 60px;
    }

    .chat-input-container {
        left: 0;
        padding: 4px 6px;
        width: 100%;

        /* 或者使用 opacity（如果子元素也需要透明） */
        /* opacity: 1; */

        background-color: var(--chat-input-container-bkcolor);
    }

    .chat-input-wrapper {
        border-radius: 20px;
    }

    .chat-input {
        min-height: 40px;
        padding-right: 45px;
        border-radius: 20px; /* 添加圆角效果 */
    }

    .send-button {
        width: 32px;
        height: 32px;
    }

    .message-content {
        max-width: 85%;
        padding: 10px 14px;
        border-radius: 14px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }


    /* 新对话按钮 - 移动端固定在右下角 */
    .new-chat-fab {
        position: fixed;
        right: 20px;
        bottom: 80px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: var(--primary-color);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .new-chat-fab:hover {
        background-color: var(--primary-color-hover);
        transform: translateY(-2px);
    }

    .new-chat-fab:active {
        transform: translateY(0);
    }
}


