body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
}

.chat-container {
    display: flex;
    height: 100vh; /* 占满视口高度 */
    overflow: hidden; /* 隐藏浏览器的垂直滚动条 */
}

.chat-sidebar {
    position: relative; /* 设置相对定位，便于子元素绝对定位 */
    width: 80px; /* 左侧栏 */
    min-width: 70px;
    background-color: #075E54;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    height: 100vh; /* 确保占满视口高度 */
}


.sidebar-menu {
    display: flex;
    flex-direction: column; /* 垂直排列 */
    gap: 20px; /* 图标之间的间距 */
    width: 100%; /* 占满侧边栏宽度 */
    align-items: center; /* 图标居中 */
}
.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%; 
    object-fit: cover; /* 保持图片比例 */
    border: 1px solid #ddd; /* 添加边框 */
}

.user-name {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

.settings-button {
    margin-top: 20px;
    padding: 5px;
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.chat-list {
    flex: 1; /* 自适应宽度 */ 
    overflow-y: auto; /* 添加垂直滚动条 */
    height: 100%; /* 确保占满父容器高度 */
    border-right: 1px solid #ddd; /* 可选：分隔线 */
}


.menu-button {
    background: none;
    border: none;
    color: white;
    font-size: 24px; /* 图标大小 */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    border-radius: 50%; /* 圆形按钮 */
    transition: background-color 0.3s ease, transform 0.2s ease; /* 添加过渡效果 */
}

.menu-button:hover {
    background-color: #25D366; /* 悬停时背景颜色 */
}
.menu-button i {
    font-size: 24px; /* 图标大小 */
}
.product-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background-color: #f9f9f9;
}
/* 操作区样式 */ 
.product-actions {
    display: flex; /* 横向排列 */
    justify-content: space-between; /* 按钮均匀分布 */
    align-items: center; /* 垂直居中 */
    padding: 0;
    background-color: #f9f9f9;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */
}
 
/* 按钮样式 */
.product-action-button {
    flex: 1; /* 每个按钮占据相等宽度 */
    padding: 15px 0;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    background-color: #ffffff; /* 默认白色背景 */
    color: #000000; /* 默认黑色文字 */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

/* 悬停效果 */
.product-action-button:hover {
    background-color: #d4edda; /* 悬停时淡绿色背景 */
    transform: translateY(-3px); /* 上移效果 */
}

/* 选中状态 */
.product-action-button.selected {
    background-color:#075E54; /* 灰色背景 */
    color: white; /* 选中时文字为白色 */
}

/* 移动端样式 */
@media (max-width: 768px) {
    .product-action-button {
        font-size: 12px; /* 字体变小 */
        font-weight: normal; /* 去掉加粗 */
    }
}
/* 产品列表样式 */
.product-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* 自适应列宽 */
    gap: 20px;
}

/* 单个产品项 */
.product-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}


.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

/* 产品图片 */
.product-list-image {
    width: 100%; /* 图片宽度占满容器 */
    height: 200px; /* 固定高度 */
    object-fit: cover; /* 保持图片比例，裁剪多余部分 */
}

.search-bar {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.search-input {
    width: 90%; /* 搜索框宽度为90% */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.chat-list-container {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    justify-content: space-between; /* 左右对齐 */
    position: relative; /* 确保子元素可以绝对定位 */
}

.chat-item:hover {
    background-color: #f0f0f0;
}

.chat-avatar {
    width: 40px; /* 固定宽度 */
    height: 40px; /* 固定高度 */
    border-radius: 50%; /* 圆形 */
    object-fit: cover; /* 保持图片比例 */
    border: 1px solid #ddd; /* 添加边框 */
}

.chat-info {
    position: relative;
    flex-grow: 1; /* 占据剩余空间 */
}

.chat-name {
    display: block; /* 强制换行 */
    font-weight: bold; /* 可选：加粗名字 */
    font-size: 14px; /* 设置字体大小 */
    color: #333; /* 设置字体颜色 */
    white-space: nowrap; /* 防止换行 */
}

.chat-product {
    display: block; /* 强制换行 */
    font-size: 12px; /* 设置字体大小 */
    color: #666; /* 设置字体颜色 */
    margin-top: 2px; /* 可选：增加与名字的间距 */
}

.chat-content {
    flex: 2; /* 自适应宽度 */
    display: flex;
    flex-direction: column;
    height: 100%; /* 确保占满父容器高度 */
    background-color: #e5ddd5;
}

#chatHistory {
    flex: 1; /* 自动扩展 */
    overflow-y: auto; /* 添加垂直滚动条 */
    padding: 10px;
}

.chat-input-div {
    position: sticky; /* 保持在底部 */
    bottom: 0; 
    padding: 10px;
    border-top: 1px solid #ddd;
    z-index: 10; /* 确保在滚动时显示在最上层 */
    background-color: #ffffff; /* 设置背景颜色 */
}

.chat-header {
    display: flex; /* 使用 flexbox 布局 */
    justify-content: space-between; /* 子元素两端对齐 */
    align-items: center; /* 垂直居中 */
    padding: 10px 10px 0px 10px; /* 上下左右内边距 */
    background-color: #f9f9f9;
    border-bottom: 1px solid #ddd;
    gap: 10px; /* 设置头像和名称之间的间距 */
}

.chat-header-info {
    display: flex;
    flex-direction: column; /* 垂直排列 */
    gap: 5px; /* 子元素之间的间距 */
}

/* 右侧产品信息 */
.product-header-info {
    display: flex;
    align-items: center; /* 垂直居中 */
    gap: 10px; /* 子元素之间的间距 */
    text-align: right; /* 文本靠右对齐 */
}

/* 产品详情样式 */
.product-header-details {
    flex: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column; /* 垂直排列名称和价格 */
    gap: 5px; /* 名称和价格之间的间距 */
    text-align: right; /* 文本靠右对齐 */
}

/* 产品图片 */
.product-header-image {
    width: 60px; /* 固定宽度 */
    height: 60px; /* 固定高度 */
    object-fit: cover; /* 保持图片比例 */
    border-radius: 5px; /* 圆角 */ 
}





.product-info {
    padding: 10px;
    text-align: center;
}
.product-image-container {
    flex-shrink: 0; /* 防止图片被压缩 */
    margin-left: 10px;
}

.product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.product-details {
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.product-price {
    font-size: 14px;
    color: #b12704; /* Amazon 风格的价格颜色 */
    margin-bottom: 10px;
}

/* 添加到购物车按钮 */
.product-add-to-cart {
    background-color: #ffa41c;
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.product-add-to-cart:hover {
    background-color: #cc8500;
}

.chat-history {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
}
.hidden {
    display: none !important; /* 确保元素完全隐藏 */
}

.chat-message {
    display: block; /* 让消息框根据内容宽度调整 */ 
    margin-bottom: 1px;
    padding-left: 10px;
    padding-right: 10px;
}
.chat-message.left {
    text-align: left; /* 默认左对齐 */
}
.chat-message.right {
    text-align: right; /* 右对齐 */
}

.chat-bubble {
    display: inline-block;
    max-width: 70%; /* 限制消息框的最大宽度 */
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word; /* 自动换行 */
    word-break: break-word; /* 防止长单词溢出 */
    margin-bottom: 10px;
}

/* 自己的消息（右侧） */
.chat-bubble.self {
    background-color: #DCF8C6;
    margin-left: auto;
    text-align: right;
    position: relative;
}

.chat-bubble.self::before {
    content: '';
    position: absolute; 
    right: -10px; /* 尖角的位置 */
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 10px; /* 右上角的尖角 */
    border-color: transparent transparent transparent #DCF8C6; /* 颜色与背景一致 */
}

/* 对方的消息（左侧） */
.chat-bubble.other {
    background-color: white;
    margin-right: auto;
    text-align: left;
    position: relative;
}

.chat-bubble.other::before {
    content: '';
    position: absolute; 
    left: -10px; /* 尖角的位置 */
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 10px 0; /* 左上角的尖角 */
    border-color: transparent #ffffff transparent transparent; /* 颜色与背景一致 */
}
.chat-time,
.chat-status {
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
    color: gray;
    vertical-align: middle;
}
.chat-status {
    margin-left: 5px; /* 添加间距 */
}

.chat-bubble.self .chat-status {
    text-align: right;
}
.chat-time {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    margin-right: 5px; /* 添加间距 */
}


 
.chat-date-separator {
    text-align: center;
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

.chat-input-container {
    display: flex;
    align-items: center;
    padding: 10px; 
    border-top: 1px solid #ddd;
}

.chat-input {
    flex: 1;
    height: 40px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    resize: none;
}

.chat-send-button {
    margin-left: 10px;
    padding: 10px 20px;
    background-color: #075E54;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
/* 搜索栏容器样式 */
.search-container {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 5px 10px;
}

/* 放大镜图标样式 */
.search-icon {
    font-size: 16px;
    color: #666;
    margin-right: 5px;
}

/* 搜索输入框样式 */
.search-input {
    flex: 1; /* 占据剩余空间 */
    border: none;
    outline: none;
    font-size: 14px;
}

#Search-btn{
  color: #171717;
  position: relative;
  transition:all .3s cubic-bezier(.22,.61,.36,1);
  font-size: 20px;
  padding:0;
  border:0;
  background:none;
  line-height: 1;
} 

 

.unread-count {
    position: absolute;
    top: 0;
    right: 0;
    background-color: red;
    color: white;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 6px;
    z-index: 1; /* 确保未读消息显示在最上层 */
}

/* 默认布局 */
 /* 非移动端布局 */
@media (min-width: 769px) {
    .chat-list {
max-width: 30%;
}
.back-button {
    display: none; /* 隐藏返回按钮 */
}
}
 

 

/* 移动端布局 */
@media (max-width: 768px) {
     /* 修改 chat-content 的布局 */
     .chat-content.active {
        display: flex; /* 改为弹性布局 */
        flex-direction: column;
        height: 100vh; /* 确保占满视口 */
    }
    .chat-container {
        display: block;
    }

    .chat-sidebar {
        flex-direction: row; /* 横向排列 */
        justify-content: space-around; /* 按钮均匀分布 */
        align-items: center;
        height: 60px; /* 固定高度 */
        width: 100%; /* 占满屏幕宽度 */
        position: fixed;
        bottom: 0; /* 固定在屏幕底部 */
        left: 0;
    }
    .chat-sidebar .menu-button {
        flex: 1; /* 每个按钮占据相等宽度 */
    }

    .chat-list {
        width: 100%;
        display: block;
    }

    .chat-content {
        display: flex; /* 设置为弹性容器 */
        flex-direction: column; /* 垂直排列子元素 */
        height: 100vh; /* 确保占满视口高度 */
        width: 100%; 
    }

  

    .chat-list.hidden {
        display: none; /* 隐藏聊天人列表 */
    }

    .back-button {
        display: block;
        margin: 10px;
        font-size: 16px;
        background: none;
        border: none;
        cursor: pointer;
    }

     /* 为 #chatHistory 添加垂直滚动条 */
     #chatHistory {
        flex: 1;
        overflow-y: auto; /* 添加垂直滚动条 */
        padding: 10px;
        background-color: #e5ddd5; 
        min-height: 0; /* 修复弹性容器滚动问题 */ 
        -webkit-overflow-scrolling: touch; /* 优化移动端滚动 */
    }

    /* 为 chat-input-div 添加背景颜色 */
    .chat-input-div {
        position: sticky; /* 保持在底部 */
        bottom: 0;
        background-color: #ffffff; /* 设置背景颜色 */
        padding: 10px;
        border-top: 1px solid #ddd;
        z-index: 10; /* 确保在滚动时显示在最上层 */
    }

    .user-info {
        flex-direction: row; /* 横向排列 */
        justify-content: space-around; /* 均匀分布 */
        align-items: center;
        padding: 10px;
        gap: 10px; /* 元素之间的间距 */
    }
    .user-avatar{ 
        display: none;
    }

.user-name{
    display: none;
}

    .sidebar-menu {
        flex-direction: row; /* 横向排列 */
        justify-content: space-around; /* 均匀分布 */
        align-items: center;
        gap: 10px; /* 按钮之间的间距 */
        padding: 10px;
    }

    .menu-button {
        flex: 1; /* 每个按钮占据相等宽度 */
        text-align: center;
    }
    
}

 
.logout {
    position: absolute; /* 绝对定位 */
    bottom: 10px; /* 距离底部 10px */ 
    text-align: center; /* 居中显示 */
}
.logout-button {
    margin-top: 20px;
    padding: 5px;
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
 

/* 标题样式 */
.user-info-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

/* 用户信息容器 */
.user-info-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* 表单样式 */
.user-info-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 15px;
}

/* 标签样式 */
.user-info-label {
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

/* 输入框样式 */
.user-info-input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}

/* 按钮样式 */
.user-info-button {
    background-color: #075E54;
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.user-info-button:hover {
    background-color: #25D366;
}

/* 用户信息容器 */
.user-info-2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 20px auto;
}