/* ============ 全局 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, 'Microsoft YaHei', sans-serif; font-size: 14px; color: #1f2329; background: #f5f6f7; height: 100vh; overflow: hidden; }

/* ============ 登录页 ============ */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, #3370ff 0%, #4e83fd 100%); }
.login-card { background: #fff; border-radius: 12px; padding: 40px; width: 360px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
.login-logo { width: 56px; height: 56px; background: #3370ff; color: #fff; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; font-weight: bold; margin-bottom: 12px; }
.login-card h2 { font-size: 20px; margin-bottom: 4px; }
.login-subtitle { color: #8f959e; font-size: 13px; margin-bottom: 20px; }
.login-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid #dee0e3; }
.tab-btn { flex: 1; padding: 8px; border: none; background: none; cursor: pointer; font-size: 14px; color: #8f959e; border-bottom: 2px solid transparent; transition: all 0.2s; }
.tab-btn.active { color: #3370ff; border-bottom-color: #3370ff; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid #dee0e3; border-radius: 6px; margin-bottom: 12px; font-size: 14px; outline: none; transition: border-color 0.2s; }
.login-card input:focus { border-color: #3370ff; }
.btn-primary { width: 100%; padding: 10px; background: #3370ff; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; transition: background 0.2s; }
.btn-primary:hover { background: #2860e0; }
.error-msg { color: #f54a45; font-size: 12px; margin-top: 8px; min-height: 18px; }

/* ============ 主布局 ============ */
#app { display: flex; height: 100vh; }

/* ============ 左侧导航 ============ */
.sidebar { width: 64px; background: #1f2329; display: flex; flex-direction: column; align-items: center; padding: 12px 0; flex-shrink: 0; }
.sidebar-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; }
.avatar-small { width: 36px; height: 36px; background: #3370ff; color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: bold; }
.my-name { color: #fff; font-size: 10px; margin-top: 4px; max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; width: 100%; }
.nav-item { display: flex; flex-direction: column; align-items: center; padding: 8px 0; cursor: pointer; color: #8f959e; font-size: 10px; transition: all 0.2s; border-radius: 0; position: relative; }
.nav-item:hover { color: #c9cdd4; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: rgba(51,112,255,0.15); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: #3370ff; border-radius: 0 2px 2px 0; }
.nav-icon { font-size: 20px; margin-bottom: 2px; }
.online-count { background: #3370ff; color: #fff; border-radius: 8px; font-size: 10px; padding: 1px 5px; margin-top: 2px; }
.sidebar-footer { margin-top: auto; }
.btn-text { background: none; border: none; color: #8f959e; cursor: pointer; font-size: 12px; padding: 8px; }
.btn-text:hover { color: #fff; }

/* ============ 聊天视图 ============ */
.main-content { flex: 1; display: flex; }
.room-list { width: 220px; background: #fff; border-right: 1px solid #dee0e3; display: flex; flex-direction: column; }
.room-list-header { padding: 16px; font-size: 15px; font-weight: 600; border-bottom: 1px solid #dee0e3; }
.room-item { padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background 0.15s; }
.room-item:hover { background: #f5f6f7; }
.room-item.active { background: #e8f0ff; color: #3370ff; }
.room-item .room-icon { font-size: 16px; }
.add-room { padding: 12px 16px; text-align: left; color: #8f959e; }

.chat-area { flex: 1; display: flex; flex-direction: column; background: #f5f6f7; }
.chat-header { padding: 14px 20px; background: #fff; border-bottom: 1px solid #dee0e3; display: flex; align-items: center; gap: 8px; }
.chat-header .room-id-hint { color: #8f959e; font-size: 12px; margin-left: auto; }
.messages { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.msg-item { display: flex; gap: 10px; max-width: 70%; }
.msg-item.self { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; background: #3370ff; color: #fff; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.msg-body { display: flex; flex-direction: column; }
.msg-name { font-size: 12px; color: #8f959e; margin-bottom: 2px; }
.msg-bubble { background: #fff; padding: 8px 12px; border-radius: 8px; line-height: 1.5; word-break: break-all; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.msg-item.self .msg-bubble { background: #3370ff; color: #fff; }
.msg-time { font-size: 11px; color: #c0c4cc; margin-top: 2px; }
.msg-file { display: flex; align-items: center; gap: 8px; padding: 8px; background: #f5f6f7; border-radius: 6px; cursor: pointer; }
.msg-file:hover { background: #e8e8e8; }
.msg-file-icon { font-size: 24px; }
.msg-file-info { font-size: 12px; }
.msg-file-size { color: #8f959e; }

.chat-input-area { padding: 12px 20px; background: #fff; border-top: 1px solid #dee0e3; display: flex; align-items: center; gap: 8px; }
.btn-icon { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; border-radius: 4px; }
.btn-icon:hover { background: #f5f6f7; }
#msg-input { flex: 1; padding: 8px 12px; border: 1px solid #dee0e3; border-radius: 6px; font-size: 14px; outline: none; }
#msg-input:focus { border-color: #3370ff; }
.btn-send { width: auto; padding: 8px 20px; }

/* ============ 文件视图 ============ */
.files-sidebar { width: 200px; background: #fff; border-right: 1px solid #dee0e3; display: flex; flex-direction: column; }
.folder-list-header { padding: 16px; font-size: 15px; font-weight: 600; border-bottom: 1px solid #dee0e3; }
.folder-item { padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background 0.15s; }
.folder-item:hover { background: #f5f6f7; }
.folder-item.active { background: #e8f0ff; color: #3370ff; }
.add-folder { padding: 12px 16px; text-align: left; color: #8f959e; }
.files-area { flex: 1; display: flex; flex-direction: column; }
.files-header { padding: 14px 20px; background: #fff; border-bottom: 1px solid #dee0e3; display: flex; align-items: center; gap: 12px; }
.files-header .btn-primary { width: auto; padding: 6px 16px; font-size: 13px; }
.file-list { flex: 1; overflow-y: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.file-card { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); cursor: pointer; transition: box-shadow 0.2s; position: relative; }
.file-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.file-card-icon { font-size: 36px; margin-bottom: 8px; }
.file-card-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card-meta { font-size: 11px; color: #8f959e; margin-top: 4px; }
.file-card-del { position: absolute; top: 8px; right: 8px; background: none; border: none; color: #c0c4cc; cursor: pointer; font-size: 14px; }
.file-card-del:hover { color: #f54a45; }
.empty-hint { color: #8f959e; text-align: center; padding: 40px; grid-column: 1/-1; }

/* ============ 成员视图 ============ */
.members-area { flex: 1; padding: 20px; }
.members-header { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
#member-list { display: flex; flex-wrap: wrap; gap: 12px; }
.member-card { background: #fff; border-radius: 8px; padding: 16px; width: 200px; display: flex; align-items: center; gap: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.member-card .avatar-small { width: 40px; height: 40px; font-size: 16px; }
.member-info { font-size: 13px; }
.member-role { font-size: 11px; color: #8f959e; }

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dee0e3; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #c0c4cc; }
