/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-image: url('../images/bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wechat-container {
    width: 900px;
    height: 600px;
    display: flex;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
}

/* 左侧导航栏 */
.window-controls {
    display: flex;
    gap: 6px;
    padding: 8px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    align-items: center;
}

.control-button {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
    display: inline-block;
}

.control-button:hover {
    opacity: 0.8;
}

.control-button.close {
    background-color: #ff5f57;
}

.control-button.minimize {
    background-color: #febc2e;
}

.control-button.maximize {
    background-color: #28c840;
}

.sidebar {
    width: 60px;
    height: 100%;
    background-color: #2f2f2f;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 0;
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c7c7c;
    cursor: pointer;
    transition: all 0.3s;
}
.sidebar-icon {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c7c7c;
    cursor: pointer;
    transition: all 0.3s;
}

.sidebar-icon:hover {
    background-color: #3e3e3e;
    color: #ffffff;
}

.sidebar-icon.active {
    background-color: #3e3e3e;
    color: #12d56d;
}

.sidebar-avatar img {
    width: 34px;
    height: 34px;
    border-radius: 4px;
}

.sidebar-icon img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* 聊天列表面板 */
.chat-list-panel {
    width: 250px;
    height: 100%;
    background-color: #f5f5f5;
    border-right: 1px solid #e6e6e6;
}

.search-bar {
    padding: 13px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e6e6e6;
}

.search-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid transparent;
    background-color: #e6e6e6;
    font-size: 13px;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: #0CC160;
    background-color: #ffffff;
}

.chat-list {
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100% - 60px);
}

.chat-item {
    padding: 12px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;  /* 为未读消息标记添加定位上下文 */
}

.chat-item:hover {
    background-color: #e6e6e6;
}

.chat-item.active {
    background-color: #e6e6e6;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    margin-right: 10px;
}

/* 未读消息红点样式 */
.unread-badge {
    position: absolute;
    top: 8px;  /* 调整到头像上方 */
    left: 38px;  /* 调整到头像右侧 */
    background-color: #FA5151;
    color: white;
    border-radius: 50%;
    min-width: 16px;  /* 稍微调小一点 */
    height: 16px;  /* 稍微调小一点 */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;  /* 稍微调小字体 */
    font-weight: 400;
    padding: 0 4px;
    box-sizing: border-box;
    z-index: 1;  /* 确保显示在最上层 */
}

.chat-info {
    flex: 1;
    min-width: 0;  /* 这个属性很重要，它允许flex子项在必要时缩小到比其内容更小 */
    width: 100%;   /* 确保占满剩余空间 */
}

.chat-name {
    font-size: 14px;
    color: #000000;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-preview {
    font-size: 12px;
    color: #999999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s ease;
    display: none;  /* 默认隐藏 */
}

/* 聊天窗口 */
.chat-window {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

.chat-header {
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e6e6e6;
}

.chat-title {
    font-size: 16px;
    font-weight: 400;
}

.chat-actions {
    display: flex;
    gap: 24px;
    color: #2F2F2F;
}

.chat-messages {
    flex: 1;
    padding: 20px 8px 20px 20px;
    overflow-y: auto;
    background-color: #f5f5f5;
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

.message.sent {
    flex-direction: row;
    justify-content: flex-end;
    padding: 0px 0px;
}

.message.sent .message-content {
    margin-right: 10px;
    background-color: #95ec69;
}

.message.received .message-content {
    margin-left: 10px;
    background-color: #ffffff;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    margin: 0px;
}

.message-content {
    max-width: 60%;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.message.received .message-content {
    background-color: #ffffff;
}

.message.sent .message-content {
    background-color: #95ec69;
}

.chat-input-area {
    padding: 8px;
    background-color: #f5f5f5;
    border-top: 1px solid #e6e6e6;
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 4px;
    background-color: #f5f5f5;
    border-radius: 0;
}

.tool-button {
    color: #7c7c7c;
    cursor: pointer;
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    border-radius: 4px;
}

.tool-button:hover {
    background-color: #e6e6e6;
}

.input-container {
    background: #f5f5f5;
    border-radius: 0px;
    padding: 8px 8px;
    position: relative;
}

.send-button {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 0 16px;
    height: 32px;
    border: none;
    background-color: #07C160;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.send-button:hover {
    background-color: #06ae56;
}

.send-button:active {
    background-color: #059349;
    transform: scale(0.98);
}

.message-input {
    width: 100%;
    border: none;
    resize: none;
    height: 80px;
    font-size: 14px;
    line-height: 1.5;
    background: transparent;
    caret-color: #03C160;
}

.message-input:focus {
    outline: none;
}

.dropdown-toggle::after {
    content: '';
    display: inline-block;
    margin-left: 4px;
    vertical-align: middle;
    border-top: 4px solid #9e9e9e;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 18px;
    height: 1%;
    margin-right: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
    margin-right: 6px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
    border: 6px solid transparent;
    background-clip: content-box;
    margin-right: 6px;
    min-height: 4px;
    max-height: 20px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
    border: 6px solid transparent;
    background-clip: content-box;
}
