/* 聊天容器 */
.chat-father {
    top: 6rem;
    z-index: 1;
    width: 100%;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px 20px 20px;
}

.chat-container {
    position: absolute;
    margin: 0 auto;
    width: 60%;
    max-width: 800px;
    height: 98%;
    max-height: calc(100vh - 100px);
    flex: 1;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    transition: top 0.3s ease;
}

.chat-header {
    background: linear-gradient(135deg, #6c5ce7, #8e7cff);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #fafafa;
}

.chat-header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 500;
}

.status {
    font-size: 1.2rem;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
}

.message-container {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    border-bottom: 1px solid #eee;
    min-height: 420px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.message {
    margin: 3px 0;
    display: flex;
    align-items: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;
    padding: 8px 18px;
    border-radius: 8px;
    position: relative;
}

.message.user .message-content {
    background: linear-gradient(135deg, #6c5ce7, #8e7cff);
    color: #fff;
}

.message.bot .message-content {
    background-color: #ffffff;
    color: #2D2D2D;
}

.chat-input-container {
    display: flex;
    padding: 16px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
}

.user-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    transition: all 0.3s;
    min-height: 45px;
    max-height: 120px;
}

.user-input:focus {
    outline: none;
    border-color: #8e7cff;
    box-shadow: 0 0 0 2px rgba(142, 124, 255, 0.1);
}

.send-button {
    margin-left: 12px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6c5ce7, #8e7cff);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.send-button:hover {
    background: linear-gradient(135deg, #6c5ce7, #8e7cff);
}

/* 加载动画样式 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top: 2px solid #6c5ce7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 代码块样式 */
pre {
    background-color: #f8f8f8;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
}

code {
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}

.message-timestamp {
    text-align: center;
    color: #888;
    font-size: 12px;
    position: relative;
    padding: 2px;
}

.message-timestamp::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 80%;
    height: 1px;
    background: #eee;
    transform: translate(-50%, -50%);
    z-index: -1;
}

.message-timestamp span {
    background: white;
    padding: 0 10px;
    position: relative;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-father {
        top: 5.5rem;
    }

    .chat-container {
        top: 0.5rem;
        height: auto;
        max-height: calc(100vh - 7rem);
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .input-area {
        flex-direction: row;
        padding: 10px;
        gap: 8px;
    }

    .user-input {
        font-size: 16px;
        padding: 10px;
    }

    .send-btn {
        padding: 12px 16px;
    }

}