/* 基本样式设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", sans-serif;
    line-height: 1.5;
    color: #333;
    background-color: #ededed;
    padding: 0;
    max-width: 600px;
    margin: 0 auto;
    font-size: 14px;
}

/* 头部样式 */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    max-width: 600px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #ddd;
    padding: 10px 15px;
    z-index: 100;
    display: flex;
    align-items: center;
}

/* 搜索框样式 */
.search-container {
    position: fixed;
    top: 45px; /* 头部高度 */
    width: 100%;
    max-width: 600px;
    background-color: #f7f7f7;
    padding: 10px 15px;
    z-index: 99;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.search-input {
    flex-grow: 1;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 18px;
    padding: 0 15px;
    font-size: 14px;
    outline: none;
    background-color: white;
}

.search-button {
    margin-left: 10px;
    height: 36px;
    background-color: #07c160;
    color: white;
    border: none;
    border-radius: 18px;
    padding: 0 15px;
    font-size: 14px;
    cursor: pointer;
}

.search-button:hover {
    background-color: #06b057;
}

.back-button {
    font-size: 16px;
    margin-right: 10px;
    color: #666;
    text-decoration: none;
}

.chat-title {
    font-size: 15px;
    font-weight: bold;
    flex-grow: 1;
    text-align: center;
}

.theme-toggle {
    font-size: 16px;
    color: #666;
    cursor: pointer;
}

/* 聊天容器样式 */
.chat-container {
    background-color: #ededed;
    padding: 100px 10px 20px; /* 从50px改为100px，为搜索框留出空间 */
    min-height: 100vh;
}

.message-list {
    list-style: none;
}

.message-item {
    margin-bottom: 16px;
    position: relative;
    display: flex;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    margin-right: 8px;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

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

.message-content-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    max-width: calc(100% - 44px);
}

.sender-name {
    font-size: 11px;
    color: #999;
    margin-bottom: 1px;
}

.message-content {
    background-color: white;
    padding: 8px 10px;
    border-radius: 4px;
    position: relative;
    max-width: fit-content;
    word-break: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    white-space: pre-wrap;
    font-size: 13px;
}

.timestamp {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    text-align: center;
}

/* 加载和状态提示 */
.loading {
    text-align: center;
    padding: 15px;
    color: #999;
    font-size: 13px;
}

.refresh-button {
    display: block;
    margin: 15px auto;
    background-color: #07c160;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.refresh-button:hover {
    background-color: #06b057;
}

.error {
    color: #f44336;
    text-align: center;
    padding: 15px;
    font-size: 13px;
}

.no-messages {
    text-align: center;
    color: #999;
    padding: 40px 0;
    font-size: 13px;
}

/* 功能按钮样式 */
.link-button {
    display: inline-block;
    background-color: #2a7af3;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 2px 0;
    text-decoration: none;
    font-size: 11px;
    text-align: center;
}

.link-button:hover {
    background-color: #1a66e0;
}

/* 京东链接按钮样式 */
.jd-link-button {
    background-color: #e93333;
}

.jd-link-button:hover {
    background-color: #d42b2b;
}

/* 淘宝链接按钮样式 */
.taobao-link-button {
    background-color: #fa8919;
}

.taobao-link-button:hover {
    background-color: #e67b15;
}

.code-button {
    display: inline-block;
    background-color: #fa8919;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 2px 0;
    text-decoration: none;
    font-size: 11px;
    text-align: center;
    cursor: pointer;
}

.code-button:hover {
    background-color: #e67800;
}

/* 复制成功提示 */
.copy-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.show-toast {
    opacity: 1;
}

/* 特殊文本样式 */
.currency {
    color: #ff9800;
    font-weight: bold;
}

.discount {
    color: #f44336;
    font-weight: bold;
}

/* 消息时间 */
.message-time {
    font-size: 10px;
    color: #888;
    display: inline-block;
    margin-left: 5px;
    font-weight: normal;
}

/* 微信风格个人资料卡片样式 */
.profile-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.profile-content {
    position: relative;
    background-color: #ffffff;
    margin: 15% auto;
    width: 90%;
    max-width: 350px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.profile-header {
    position: relative;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    border-bottom: 1px solid #f0f0f0;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    margin-right: 15px;
    flex-shrink: 0;
}

.profile-info {
    flex-grow: 1;
}

.profile-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    padding-right: 20px;
}

.profile-details {
    font-size: 12px;
    color: #666;
}

.profile-id, .profile-location {
    margin-bottom: 3px;
}

.close-profile {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #888;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
}

.profile-actions {
    padding: 15px 20px;
    text-align: center;
}

.action-button {
    background-color: #07c160;
    color: white;
    border: none;
    width: 100%;
    padding: 10px 0;
    border-radius: 5px;
    font-size: 15px;
    cursor: pointer;
}

.action-button:hover {
    background-color: #06b057;
}

/* 二维码弹出框样式 - 更新为微信风格 */
.qrcode-modal {
    display: none;
    position: fixed;
    z-index: 1002; /* 比个人资料卡片高一层 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.qrcode-content {
    position: relative;
    background-color: #ffffff;
    margin: 20% auto;
    padding: 25px 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.qrcode-title {
    font-size: 15px;
    color: #333;
    margin-bottom: 15px;
    font-weight: bold;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #888;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
}

#qrcodeImage {
    width: 100%;
    max-width: 220px;
    height: auto;
    display: block;
    margin: 0 auto;
    border: 1px solid #f0f0f0;
}

/* 消息中的图片样式 */
.message-image {
    max-width: 100%;
    border-radius: 8px;
    margin: 5px 0;
    cursor: pointer;
    display: block; /* 确保图片正确显示为块级元素 */
}

/* 加载更多按钮样式 */
.load-more-button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background-color: #f0f0f0;
    border: none;
    border-radius: 5px;
    color: #666;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
}

.load-more-button:hover {
    background-color: #e0e0e0;
}
.load-more-button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background-color: #f0f0f0;
    border: none;
    border-radius: 5px;
    color: #666;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
}

.load-more-button:hover {
    background-color: #e0e0e0;
}