/* IM 聊天页面样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; height: 100vh; overflow: hidden; }

/* 登录页面样式 */
.login-container { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 380px; }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo svg { width: 60px; height: 60px; }
.login-title { text-align: center; font-size: 24px; color: #333; margin-bottom: 30px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #666; font-size: 14px; }
.form-group input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none; transition: border-color 0.3s; }
.form-group input:focus { border-color: #667eea; }
.btn-login { width: 100%; padding: 12px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; transition: opacity 0.3s; }
.btn-login:hover { opacity: 0.9; }
.login-error { color: #e74c3c; font-size: 14px; text-align: center; margin-bottom: 15px; }
.login-footer { text-align: center; margin-top: 20px; font-size: 14px; color: #999; }
.login-footer a { color: #667eea; text-decoration: none; }

/* 聊天页面样式 */
.chat-container { display: flex; height: 100vh; background: #fff; }

/* 左侧边栏 */
.sidebar { width: 60px; background: #2c2c2c; display: flex; flex-direction: column; align-items: center; padding: 12px 0; flex-shrink: 0; justify-content: space-between; }
.sidebar-top { display: flex; flex-direction: column; align-items: center; }
.sidebar-avatar { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; margin-bottom: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 16px; background: #667eea; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-nav { width: 40px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav-item { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; position: relative; color: #fff; }
.sidebar-nav-item:hover { background: rgba(255,255,255,0.1); }
.sidebar-nav-item.active { background: rgba(102,126,234,0.3); }
.sidebar-nav-item svg { width: 22px; height: 22px; }
.sidebar-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: #e74c3c; color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
/* 退出账号按钮 */
.sidebar-logout { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: rgba(255,255,255,0.45); transition: background 0.2s, color 0.2s; margin-bottom: 4px; }
.sidebar-logout:hover { background: rgba(231,76,60,0.25); color: #e74c3c; }

/* 好友列表 */
.friend-list { width: 280px; background: #f8f8f8; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; flex-shrink: 0; }
.friend-list-header { padding: 16px; border-bottom: 1px solid #e0e0e0; }
.friend-list-header h2 { font-size: 18px; color: #333; }
.friend-list-search { padding: 12px 16px; }
.friend-list-search input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none; }
.friend-list-items { flex: 1; overflow-y: auto; }
.friend-item { display: flex; align-items: center; padding: 12px 16px; cursor: pointer; transition: background 0.2s; }
.friend-item:hover { background: #e8e8e8; }
.friend-item.active { background: #e0e0e0; }
.friend-avatar { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; margin-right: 12px; flex-shrink: 0; background: #667eea; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 18px; }
.friend-avatar img { width: 100%; height: 100%; object-fit: cover; }
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-size: 15px; color: #333; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-msg { font-size: 13px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-time { font-size: 12px; color: #bbb; margin-left: 8px; }

/* 聊天主区域 */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header { height: 60px; padding: 0 20px; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; justify-content: space-between; background: #fff; }
.chat-header-title { font-size: 16px; color: #333; font-weight: 500; }
.chat-header-actions { display: flex; gap: 12px; }
.chat-header-actions button { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 6px; transition: background 0.2s; }
.chat-header-actions button:hover { background: #f0f0f0; }

.chat-messages { flex: 1; overflow-y: auto; padding: 20px; background: #f0f2f5; }
.message { display: flex; margin-bottom: 16px; }
.message.self { flex-direction: row-reverse; }
.message-avatar { width: 36px; height: 36px; border-radius: 6px; overflow: hidden; margin: 0 10px; flex-shrink: 0; background: #667eea; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; }
.message-avatar img { width: 100%; height: 100%; object-fit: cover; }
.message-content { max-width: 60%; }
.message-bubble { padding: 10px 14px; border-radius: 8px; background: #fff; font-size: 14px; line-height: 1.5; position: relative; word-break: break-word; }
.message.self .message-bubble { background: #667eea; color: #fff; }
.message-time { font-size: 11px; color: #bbb; margin-top: 4px; }
.message.self .message-time { text-align: right; }

.chat-input-area { padding: 16px 20px; border-top: 1px solid #e0e0e0; background: #fff; }
.chat-input-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.chat-input-tools button { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 4px; }
.chat-input-tools button:hover { background: #f0f0f0; }
.chat-input-wrapper { display: flex; gap: 12px; }
.chat-input { flex: 1; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; resize: none; outline: none; font-family: inherit; }
.chat-input:focus { border-color: #667eea; }
.chat-send-btn { padding: 8px 24px; background: #667eea; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; transition: opacity 0.2s; }
.chat-send-btn:hover { opacity: 0.9; }

.no-chat { flex: 1; display: flex; align-items: center; justify-content: center; color: #999; font-size: 14px; background: #f0f2f5; }
.logout-btn { color: #999; font-size: 13px; cursor: pointer; }
.logout-btn:hover { color: #e74c3c; }
.empty-list { padding: 40px; text-align: center; color: #999; }
.empty-list small { font-size: 12px; color: #bbb; }

/* 按钮样式 */
.btn-add-friend { width: 100%; padding: 10px; background: #667eea; color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.btn-create-group { width: 100%; padding: 10px; background: #2ecc71; color: #fff; border: none; border-radius: 6px; cursor: pointer; }
