.floating-chat {
    position: fixed;
    right: 20px;
    bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

#chat-button {
    background-color: #007BFF;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

#chat-window {
    display: none; /* 初始隐藏 */
    background-color: #ffffff;
    border: 1px solid #ccc;
    padding: 15px;
    position: absolute;
    right: 0;
    bottom: 60px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#chat-window .hidden {
    display: none;
}



.button-box {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    position: fixed;
    /*bottom: 80px;*/
    bottom: auto;
    top: 50%; /* 垂直定位到50%位置 */
    transform: translateY(-50%); /* 上移自身高度50%实现垂直居中 */
    right: 50px;
    cursor: pointer;
    z-index: 888;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.button-box:hover {
    /*transform: scale(1.05);*/
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

.btn-bg-img {
    width: 50px;
    height: 50px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"/></svg>') center no-repeat;
}

.font-box {
    position: absolute;
    bottom: -25px;
    width: 100%;
    color: #3193ef;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

#box {
    position: fixed;
    width: 800px;
    height: 600px;
    top: 20%;
    left: 33%;
    z-index: 8888;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    overflow: hidden;
    /* border: 1px solid #e0e0e0;*/
}

.container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#header {
    height: 45px;
    padding: 8px 15px;
    color: #fff;
    font-size: 20px;
    background: linear-gradient(to right, #90dbf9, #64abec);
    display: flex;
    justify-content: flex-end;
    user-select: none;
}

#header span {
    cursor: pointer;
    font-size: 24px;
    margin-left: 15px;
    transition: transform 0.2s;
}

#header span:hover {
    transform: scale(1.1);
}

.cBox {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    height: 80%;
}

.contents {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background: linear-gradient(135deg, #64b3f4, #c2e59c);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.message {
    background: #f1f7fe;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80%;
    color: #2c5282;
}

.message p {
    margin: 5px 0;
}

.userQuestion {
    /*min-width: 120px; !* 添加最小宽度约束 *!*/
    align-self: flex-end;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
    display: inline-block; /* 让容器宽度随内容变化 */
    /*display: flex;*/
    /*justify-content: flex-start;*/
}

.question {
    display: inline-block; /* 让容器宽度随内容变化 */
    padding: 12px 18px;
    background: #3182ce;
    color: white;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    line-height: 30px;
    margin-right: 10px;
    min-width: 100px; /* 设置最小宽度 */
}

.robotAnswer {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

.rImg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.answerContent {
    background: #edf2f7;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80%;
}

.answerContent p {
    line-height: 1.6;
}

.userInput {
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    min-width: 400px; /* 添加最小宽度限制 */
}

.tBox {
    flex: 1;
    margin-right: 10px;
}

.ipt {
    width: 95%;
    padding: 12px 15px;
    border: 1px solid #cbd5e0;
    border-radius: 24px;
    resize: none;
    outline: none;
    font-size: 15px;
    transition: border 0.3s;
    /*height: 46px;*/
    /*max-height: 120px;*/
    /*overflow-y: auto;*/
    min-height: 46px; /* 改为min-height */
    max-height: 120px;
    overflow-y: auto;
    display: block; /* 明确显示方式 */
}

.ipt:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.sending {
    width: 46px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: white;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
}

.sending:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
}

.loading-img {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.loading-img img {
    width: 30px;
    height: 30px;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 滚动条样式 */
.contents::-webkit-scrollbar {
    width: 8px;
}

.contents::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.contents::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 4px;
}

.contents::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}