/**
 * 聊天应用主样式
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", sans-serif;
    background: #f5f5f5;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ========== 左侧边栏 ========== */
.sidebar {
    width: 320px;
    background: #2e3238;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e6e6e6;
}

/* 用户信息区域 */
.user-info {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #282c33;
    border-bottom: 1px solid #3d4147;
}

.avatar {
    position: relative;
    margin-right: 12px;
}

.avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.online-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #52c41a;
    border: 2px solid #282c33;
    border-radius: 50%;
}

.user-detail {
    flex: 1;
}

.username {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
}

.user-status {
    color: #999;
    font-size: 12px;
    margin-top: 4px;
}

.user-actions {
    display: flex;
    gap: 5px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.icon-btn i {
    font-size: 18px;
}

/* 搜索框 */
.search-box {
    position: relative;
    padding: 15px 20px;
}

.search-box input {
    width: 100%;
    height: 36px;
    padding: 0 40px 0 15px;
    background: #3d4147;
    border: none;
    border-radius: 5px;
    color: #fff;
    font-size: 14px;
}

.search-box input::placeholder {
    color: #999;
}

.search-box i {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
}

/* Tab标签页 */
.layui-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.layui-tab-title {
    border-bottom: 1px solid #3d4147;
}

.layui-tab-title li {
    padding: 0 20px;
    min-width: 0;
    color: #999;
}

.layui-tab-title li.layui-this {
    color: #fff;
    border-bottom: 2px solid #1e9fff;
}

.layui-tab-title li span {
    position: relative;
}

.badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background: #ff4d4f;
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    display: none;
}

.layui-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #2e3238;
}

.layui-tab-content::-webkit-scrollbar {
    width: 5px;
}

.layui-tab-content::-webkit-scrollbar-thumb {
    background: #3d4147;
    border-radius: 3px;
}

/* 聊天列表 */
.chat-list,
.contact-list,
.group-list {
    padding: 10px 0;
}

.chat-item,
.list-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.3s;
    position: relative;
}

.chat-item:hover,
.list-item:hover {
    background: #3d4147;
}

.chat-item.active {
    background: #3d4147;
}

.chat-avatar {
    position: relative;
    margin-right: 12px;
}

.chat-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 5px;
}

/* 群组列表头像 */
.item-avatar {
    width: 45px;
    height: 45px;
    border-radius: 5px;
    margin-right: 12px;
    object-fit: cover;
}

.user-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.user-status.online {
    background: #52c41a;
}

.user-status.offline {
    background: #999;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    color: #fff;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-preview {
    color: #999;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
}

.unread-badge {
    background: #ff4d4f;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
}

.add-group {
    color: #999;
    text-align: center;
    justify-content: center;
}

.add-group i {
    font-size: 24px;
    margin-right: 8px;
}

/* ========== 中间聊天区域 ========== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}

.empty-state i {
    font-size: 80px;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 16px;
}

.chat-window {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

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

.chat-info h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 4px;
}

.chat-status {
    color: #999;
    font-size: 13px;
}

.chat-actions {
    display: flex;
    gap: 5px;
}

/* 消息区域 */
.message-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    min-height: 0;
}

.message-area::-webkit-scrollbar {
    width: 6px;
}

.message-area::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.message-time {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin: 15px 0;
}

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

.message-self {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    margin: 0 10px;
}

.message-content {
    max-width: 60%;
}

.message-text {
    background: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    word-break: break-word;
    line-height: 1.5;
}

.message-self .message-text {
    background: #1e9fff;
    color: #fff;
}

.message-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

.message-file {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-file i {
    font-size: 32px;
    color: #1e9fff;
}

.message-reply {
    background: #fff;
    padding: 10px 15px;
    border-radius: 8px;
}

.reply-content {
    color: #666;
    border-left: 3px solid #1e9fff;
    padding-left: 10px;
}

/* 输入区域 */
.input-area {
    background: #fff;
    border-top: 1px solid #e6e6e6;
    flex-shrink: 0;
}

.toolbar {
    display: flex;
    gap: 5px;
    padding: 10px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.input-box {
    padding: 15px 20px;
}

.input-box textarea {
    width: 100%;
    border: none;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
}

.tip {
    color: #999;
    font-size: 12px;
}

.send-btn {
    padding: 8px 30px;
    background: #1e9fff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.send-btn:hover {
    background: #0c84e8;
}

/* ========== 右侧信息面板 ========== */
.info-panel {
    width: 300px;
    background: #fff;
    border-left: 1px solid #e6e6e6;
    display: flex;
    flex-direction: column;
}

.info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #e6e6e6;
}

.info-header h3 {
    font-size: 16px;
    font-weight: 500;
}

.close-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #999;
}

.info-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.info-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 15px;
}

.info-user,
.info-group {
    text-align: center;
}

.info-user h4,
.info-group h4 {
    font-size: 18px;
    margin-bottom: 5px;
}

.info-status,
.info-desc {
    color: #999;
    font-size: 14px;
    margin-bottom: 20px;
}

.info-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
}

.info-actions .layui-btn {
    width: 100% !important;
    display: block;
    margin: 0;
    box-sizing: border-box;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }

    .info-panel {
        display: none !important;
    }

    .message-content {
        max-width: 80%;
    }
}
