/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

/* 登录界面 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    min-width: 350px;
}

.login-box h2 {
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.login-box input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

.login-box input:focus {
    outline: none;
    border-color: #667eea;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.login-box button:hover {
    background: #5568d3;
}

/* 颜色选择器 */
.color-picker {
    margin: 20px 0;
    text-align: left;
}

.color-picker label {
    display: block;
    margin-bottom: 10px;
    color: #666;
    font-size: 14px;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 0 2px #667eea;
    transform: scale(1.15);
}

.admin-link {
    margin-top: 15px;
}

.admin-link a {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
}

.admin-link a:hover {
    text-decoration: underline;
}

/* 聊天界面容器 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f5f5f5;
}

/* 顶部栏 */
.chat-header {
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.online-count {
    font-size: 12px;
    color: #999;
}

.user-info {
    font-size: 14px;
    color: #666;
}

/* 消息区域 */
.messages-container {
    flex: 1;
    overflow-y: auto;
    background: #f5f5f5;
    padding: 20px;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 消息项 */
.message {
    display: flex;
    gap: 12px;
    max-width: 70%;
    animation: fadeIn 0.3s ease-in;
}

.message-animation {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.other-message {
    align-self: flex-start;
}

.own-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* 头像 */
.message-avatar {
    flex-shrink: 0;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.own-avatar {
    /* 自己的头像颜色由用户选择 */
}

/* 消息内容 */
.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-username {
    font-size: 12px;
    color: #999;
    margin-bottom: 2px;
}

.message-text {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.own-message .message-text {
    background: #95ec69;
}

.message-image img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.message-image img:hover {
    transform: scale(1.02);
}

.message-file {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-file a {
    color: #576b95;
    text-decoration: none;
    font-size: 14px;
}

.message-file a:hover {
    text-decoration: underline;
}

.message-time {
    font-size: 11px;
    color: #b3b3b3;
    margin-top: 2px;
}

/* 输入区域 */
.input-container {
    background: white;
    border-top: 1px solid #e5e5e5;
    padding: 15px 20px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.tool-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.tool-btn:hover {
    background: #f5f5f5;
}

/* 表情选择器 */
.emoji-picker {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.emoji-item {
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    text-align: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.emoji-item:hover {
    background: #f5f5f5;
}

/* 输入框 */
.input-box {
    margin-bottom: 10px;
}

.input-box textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: border-color 0.3s;
}

.input-box textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 发送按钮 */
.send-container {
    display: flex;
    justify-content: flex-end;
}

#sendBtn {
    padding: 8px 30px;
    background: #95ec69;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: 500;
}

#sendBtn:hover {
    background: #7ed156;
}

/* 滚动条样式 */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.emoji-picker::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }
    
    .login-box {
        min-width: 300px;
        margin: 20px;
    }
    
    .emoji-picker {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .message-image img {
        max-width: 200px;
    }
    
    .color-options {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 管理员界面样式 */
.admin-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f5f5f5;
}

.admin-header {
    background: #fff;
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-header h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.admin-header button {
    padding: 8px 20px;
    background: #f5576c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.admin-header button:hover {
    background: #e04455;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.tab-btn:hover {
    background: #f5f5f5;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.admin-tab-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-tab-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.admin-filters {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-filters label {
    font-weight: 600;
    color: #333;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.filter-btn:hover {
    background: #5568d3;
}

.filter-btn.clear-btn {
    background: #999;
}

.filter-btn.clear-btn:hover {
    background: #777;
}

.admin-list {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.admin-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.admin-table tr:hover {
    background: #f9f9f9;
}

.message-content-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #e5e5e5;
}

.delete-btn {
    padding: 6px 12px;
    background: #f5576c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.delete-btn:hover {
    background: #e04455;
}
