/* 客服系统整体样式 */
/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面主体样式 */
body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 登录容器样式 */
.login-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

/* 登录表单样式 */
.login-form {
    width: 100%;
}

/* 表单标题样式 */
.login-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.5rem;
}

/* 输入组样式 */
.input-group {
    margin-bottom: 1rem;
}

/* 标签样式 */
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

/* 输入框样式 */
.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

/* 输入框聚焦样式 */
.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 登录按钮样式 */
.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

/* 登录按钮悬停样式 */
.btn-login:hover {
    transform: translateY(-2px);
}

/* 注册链接样式 */
.register-link {
    text-align: center;
    margin-top: 1rem;
}

/* 注册链接中的链接样式 */
.register-link a {
    color: #667eea;
    text-decoration: none;
}

/* 注册链接中的链接悬停样式 */
.register-link a:hover {
    text-decoration: underline;
}

/* 微信聊天界面样式 */
.wechat-chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f0f2f5;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.chat-header {
    background: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-header-info {
    display: flex;
    align-items: center;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    margin-right: 15px;
}

.header-text h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.header-text p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 70%;
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.client {
    background-color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    color: #333;
    position: relative;
}

.message.admin {
    background-color: #9eea6a;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    color: #333;
    position: relative;
}

.message-time {
    font-size: 10px;
    color: #999;
    margin-top: 5px;
    display: block;
    text-align: center;
    width: 100%;
    position: absolute;
    bottom: -20px;
    left: 0;
}

.message.client .message-time {
    text-align: center;
}

.message.admin .message-time {
    text-align: center;
}

/* 图片和视频消息样式 */
.message img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    margin-top: 5px;
}

.message video {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    margin-top: 5px;
}

.message-input-area {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

#messageInput {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

#messageInput:focus {
    border-color: #667eea;
}

#sendButton {
    padding: 12px 25px;
    margin-left: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s;
}

#sendButton:hover {
    transform: scale(1.05);
}

/* 容器样式 */
.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: 90vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    background-color: #4a90e2;
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
}

header p {
    font-size: 1em;
    opacity: 0.9;
}

/* 聊天容器样式 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.admin-panel {
    flex: 1;
    display: flex;
    padding: 20px;
}

.customer-list {
    width: 250px;
    border-right: 1px solid #eee;
    padding-right: 20px;
}

.customer-list h3 {
    margin-bottom: 15px;
    color: #4a90e2;
}

#customerList {
    list-style: none;
}

#customerList li {
    padding: 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

#customerList li:hover {
    background-color: #f0f8ff;
}

#customerList li.active {
    background-color: #4a90e2;
    color: white;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 20px;
}

/* 聊天消息区域样式 */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 15px;
    background-color: #fafafa;
}

/* 消息输入区域样式 */
.message-input {
    display: flex;
    gap: 10px;
}

#adminMessageInput {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

#adminSendButton {
    padding: 12px 20px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

#adminSendButton:hover {
    background-color: #357ae8;
}

/* 用户管理样式 */
.user-management {
    width: 40%;
    padding: 20px;
    border-right: 1px solid #eee;
    overflow-y: auto;
}

.user-list table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.user-list th, .user-list td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
}

.user-list th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.user-list td {
    padding-right: 40px;
    padding-left: 10px;
}

.refresh-btn {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.refresh-btn:hover {
    background-color: #0069d9;
}

/* 文件上传区域样式 */
.file-upload-area {
    display: flex;
    gap: 5px;
    margin: 0 10px;
}

.file-upload-area button {
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.file-upload-area button:hover {
    background-color: #e0e0e0;
}

/* 状态栏样式 */
.status-bar {
    padding: 15px 20px;
    background-color: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
}

#status, #adminStatus {
    color: #666;
}

#connectButton, #adminConnectButton {
    padding: 8px 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#connectButton:hover, #adminConnectButton:hover {
    background-color: #218838;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container, .admin-container {
        height: 100vh;
        border-radius: 0;
    }
    
    .admin-panel {
        flex-direction: column;
    }
    
    .user-management {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        margin-bottom: 15px;
    }
    
    .customer-list {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-right: 0;
        margin-bottom: 15px;
    }
    
    .chat-area {
        margin-left: 0;
    }
    
    /* 微信聊天界面移动端适配 */
    .wechat-chat-container {
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    .login-container, .register-container, .admin-login-container {
        height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .login-box, .register-box, .admin-login-box {
        border-radius: 0;
        padding: 20px;
        max-width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}