* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: #f0f2f5;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100%;
    height: 100%;
    background: white;
    /* 全屏时移除圆角和阴影，也可保留（视需求而定） */
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: #1e88e5;
    color: white;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
}

/* 消息整体容器 */
.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

/* 时间显示（位于消息上方居中） */
.message-time {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin: 0 0 8px 0;
    width: 100%;
}

/* 消息行（头像+气泡） */
.message-row {
    display: flex;
    width: 100%;
    align-items: flex-start;
}

/* 客服消息：头像在左，气泡在右 */
.message.kefu .message-row {
    justify-content: flex-start;
}

/* 用户消息：气泡在左，头像在右 */
.message.user .message-row {
    justify-content: flex-end;
}

/* 头像 */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin: 0 10px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 气泡 */
.bubble {
    max-width: 60%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.message.kefu .bubble {
    background: white;
    border: 1px solid #e0e0e0;
    border-top-left-radius: 4px;
}

.message.user .bubble {
    background: #1e88e5;
    color: white;
    border-top-right-radius: 4px;
}

/* 消息中的图片 */
.bubble img.content-img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
}

/* 链接消息 */
.bubble a.link-message {
    color: #1e88e5;
    text-decoration: underline;
    font-weight: 500;
}

.chat-input-area {
    border-top: 1px solid #e0e0e0;
    background: white;
    padding: 10px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

#messageInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.emoji-btn, .send-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.emoji-btn:hover, .send-btn:hover {
    background: #f0f0f0;
}

.send-btn {
    color: #1e88e5;
    font-weight: bold;
}

.emoji-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-panel span {
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.1s;
}

.emoji-panel span:hover {
    transform: scale(1.2);
}

.image-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.image-modal img {
    max-width: 90%;
    max-height: 80%;
    border-radius: 8px;
}

.image-modal a {
    margin-top: 20px;
    color: white;
    text-decoration: none;
    background: #1e88e5;
    padding: 10px 20px;
    border-radius: 20px;
}