body { font-family: -apple-system, sans-serif; background: #eef2f3; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; }
.card { background: #fff; padding: 25px; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); width: 320px; }
.hidden { display: none !important; }

#chat-wrapper { display: flex; width: 90vw; height: 85vh; background: #fff; border-radius: 15px; box-shadow: 0 15px 40px rgba(0,0,0,0.1); overflow: hidden; }

/* 左侧边栏 */
#side-bar { width: 260px; background: #1c2938; color: #fff; display: flex; flex-direction: column; }
.side-header { padding: 20px; background: #121c26; font-weight: bold; text-align: center; border-bottom: 1px solid #2c3e50; }
#contact-list { flex: 1; overflow-y: auto; }
.contact-item { padding: 15px 20px; border-bottom: 1px solid #2c3e50; cursor: pointer; font-size: 13px; transition: 0.2s; }
.contact-item:hover { background: #34495e; }
.side-footer { padding: 15px; }
#btn-back-global { width: 100%; padding: 10px; background: #3498db; color: #fff; border: none; border-radius: 8px; cursor: pointer; }

/* 右侧主聊天区 */
#main-chat { flex: 1; display: flex; flex-direction: column; padding: 20px; }
#chat-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.header-btns button { padding: 5px 10px; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; color: #fff; margin-left: 5px; }
#btn-clear-chat { background: #f39c12; }
#btn-delete-acc { background: #8e44ad; }
#btn-logout { background: #e74c3c; }

#dm-input-bar { display: flex; gap: 8px; margin: 10px 0; padding: 10px; background: #f8f9fa; border-radius: 8px; }
#dm-input-bar input { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 5px; }
#dm-input-bar button { padding: 8px 15px; background: #57606f; color: #fff; border: none; border-radius: 5px; cursor: pointer; }

/* 核心：左右气泡布局 */
#messages { flex: 1; overflow-y: auto; padding: 15px; border: 1px solid #f1f1f1; margin-bottom: 15px; border-radius: 8px; display: flex; flex-direction: column; gap: 15px; }
.message-item { display: flex; flex-direction: column; max-width: 75%; }
.msg-right { align-self: flex-end; align-items: flex-end; }
.msg-left { align-self: flex-start; align-items: flex-start; }

.message-user { font-size: 11px; color: #7f8c8d; margin-bottom: 3px; }
.bubble { padding: 10px 14px; border-radius: 15px; font-size: 14px; word-break: break-all; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

.msg-right .bubble { background: #2ecc71; color: #fff; border-bottom-right-radius: 2px; }
.msg-left .bubble { background: #eee; color: #333; border-bottom-left-radius: 2px; }

.input-area { display: flex; gap: 10px; }
#msg-input { flex: 1; padding: 12px; border: 1px solid #ddd; border-radius: 8px; }
#btn-send { width: 80px; background: #2ed573; color: #fff; border: none; border-radius: 8px; cursor: pointer; }

/* 登录/注册卡片容器 */
#auth-container {
    background: #ffffff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    width: 350px;
    text-align: center;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

#auth-container h2 {
    margin-bottom: 25px;
    color: #1c2938;
    font-size: 24px;
    letter-spacing: 1px;
}

/* 输入框组合 */
.input-group {
    margin-bottom: 20px;
}

.input-group input {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 1.5px solid #eee;
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fdfdfd;
}

.input-group input:focus {
    border-color: #3498db;
    background: #fff;
    outline: none;
    box-shadow: 0 0 8px rgba(52,152,219,0.2);
}

/* 按钮组 */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.button-group button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
}

.button-group button:active {
    transform: scale(0.98);
}

/* 登录按钮 - 主色调 */
#btn-login {
    background: #3498db;
    color: #fff;
}

#btn-login:hover {
    background: #2980b9;
}

/* 注册按钮 - 辅助色 */
.secondary {
    background: #f1f2f6;
    color: #57606f;
}

.secondary:hover {
    background: #dfe4ea;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}