/**
 * 聊天室样式（浅色系）
 */

/* 聊天室容器 */
.chat-container {
    display: flex;
    height: calc(100vh - 70px);
    background: #F9FAFB;
    overflow: hidden;
}

/* 左侧区域：房间/用户列表 */
.chat-sidebar {
    width: 300px;
    background: #FFFFFF;
    border-right: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #E5E7EB;
}

.sidebar-title {
    font-size: 18px;
    font-weight: bold;
    color: #1F2937;
    margin-bottom: 15px;
}

.room-info {
    background: #EFF6FF;
    padding: 15px;
    border-radius: 8px;
}

.room-name {
    font-size: 16px;
    font-weight: bold;
    color: #0EA5E9;
    margin-bottom: 5px;
}

.room-users-count {
    font-size: 14px;
    color: #6B7280;
}

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background 0.2s;
}

.user-item:hover {
    background: #F3F4F6;
}

.user-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10B981;
}

.user-status.offline {
    background: #9CA3AF;
}

.user-nickname {
    font-size: 14px;
    color: #374151;
}

/* 中间区域：消息展示 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
}

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

.chat-title {
    font-size: 18px;
    font-weight: bold;
    color: #1F2937;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #F9FAFB;
}

.message-wrapper {
    margin-bottom: 20px;
    display: flex;
}

.message-wrapper.self {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    position: relative;
}

.message-wrapper.other .message-bubble {
    background: #E5E7EB;
    color: #374151;
    border-bottom-left-radius: 4px;
}

.message-wrapper.self .message-bubble {
    background: #DBEAFE;
    color: #1E40AF;
    border-bottom-right-radius: 4px;
}

.message-sender {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 4px;
}

.message-content {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.message-time {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 4px;
    text-align: right;
}

/* 文件消息卡片 */
.file-message-card {
    background: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-message-card:hover {
    border-color: #0EA5E9;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
}

.file-icon {
    font-size: 32px;
    color: #0EA5E9;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
    word-break: break-all;
}

.file-size {
    font-size: 12px;
    color: #6B7280;
}

/* 系统消息 */
.system-message {
    text-align: center;
    margin: 15px 0;
}

.system-message-text {
    display: inline-block;
    padding: 6px 12px;
    background: #F3F4F6;
    color: #6B7280;
    font-size: 12px;
    border-radius: 12px;
}

/* 底部输入区 */
.chat-input-area {
    border-top: 1px solid #E5E7EB;
    padding: 15px 20px;
    background: #FFFFFF;
}

.input-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #D1D5DB;
    background: #FFFFFF;
    color: #6B7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: #F3F4F6;
    color: #0EA5E9;
    border-color: #0EA5E9;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 15px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.message-input:focus {
    outline: none;
    border-color: #0EA5E9;
}

.send-btn {
    padding: 10px 24px;
    height: 40px;
    background: #0EA5E9;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.send-btn:hover {
    background: #0284C7;
}

.send-btn:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
}

/* 加入房间弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-title {
    font-size: 24px;
    font-weight: bold;
    color: #1F2937;
    margin-bottom: 20px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

/* 创建房间界面 */
.create-room-page {
    max-width: 600px;
    margin: 40px auto;
    padding: 20px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-sidebar {
        position: fixed;
        left: 0;
        top: 70px;
        height: calc(100vh - 70px);
        z-index: 100;
        transform: translateX(-100%);
    }
    
    .chat-sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
    }
    
    .message-bubble {
        max-width: 80%;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .message-input {
        width: 100%;
    }
    
    .send-btn {
        width: 100%;
        justify-content: center;
    }
    
    .toolbar-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* 滚动条样式 */
.messages-container::-webkit-scrollbar,
.users-list::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-thumb,
.users-list::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.users-list::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

