/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* 登录页面样式 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 28px;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #fcc;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

/* 登录页面的按钮需要100%宽度 */
.login-box .btn-primary {
    width: 100%;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    margin-right: 5px;
}

.login-tips {
    margin-top: 20px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

/* 聊天室样式 */
.chat-container {
    display: flex;
    height: 100vh;
    background: white;
}

.sidebar {
    width: 280px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
}

.user-info {
    padding: 20px;
    background: #34495e;
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.user-details {
    flex: 1;
}

.nickname {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.username {
    font-size: 12px;
    color: #bdc3c7;
}

/* 聊天模式切换标签 */
.chat-mode-tabs {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid #34495e;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: #bdc3c7;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.online-count,
.unread-count,
.group-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    min-width: 20px;
    text-align: center;
}

.tab-btn.active .online-count,
.tab-btn.active .unread-count,
.tab-btn.active .group-count {
    background: rgba(255, 255, 255, 0.3);
}

.chat-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.btn-create-group {
    margin: 10px;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-create-group:hover {
    background: #5568d3;
}

.group-list-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 5px;
}

.group-list-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.group-list-item.active {
    background: #667eea;
}

.group-list-item .group-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 12px;
}

.group-list-item .group-info {
    flex: 1;
    overflow: hidden;
}

.group-list-item .group-name {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-list-item .group-meta {
    font-size: 12px;
    opacity: 0.7;
}

.online-users {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
}

.user-list-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 5px;
    position: relative;
}

.user-list-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-list-item.active {
    background: #667eea;
}

.user-list-item .avatar {
    width: 40px;
    height: 40px;
    font-size: 18px;
    margin-right: 12px;
}

.user-list-item .user-details {
    flex: 1;
}

.user-list-item .nickname {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}

.user-list-item .username {
    font-size: 12px;
    opacity: 0.7;
}

.user-list-item .unread-badge {
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    min-width: 20px;
    text-align: center;
}

.sidebar-actions {
    padding: 20px;
    border-top: 1px solid #34495e;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.chat-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    color: #333;
    font-size: 20px;
    margin: 0;
}

.btn-back {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-back:hover {
    background: #5a6268;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own-message {
    flex-direction: row-reverse;
}

.message .avatar {
    width: 40px;
    height: 40px;
    font-size: 18px;
}

.message-content {
    max-width: 60%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.message.own-message .message-content {
    align-items: flex-end;
}

.message-header {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.message-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.message.own-message .message-bubble {
    background: #667eea;
    color: white;
}

.message-bubble img {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}

.message.own-message .file-attachment {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.file-size {
    font-size: 12px;
    opacity: 0.8;
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.btn-icon:hover {
    background: #e0e0e0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

.chat-input-wrapper textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    max-height: 120px;
}

.chat-input-wrapper textarea:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input-wrapper .btn {
    width: auto;
    min-width: 70px;
    padding: 12px 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.system-message {
    text-align: center;
    color: #888;
    font-size: 13px;
    padding: 8px;
}

/* 管理后台样式 */
.admin-container {
    min-height: 100vh;
    background: white;
}

.admin-header {
    background: #2c3e50;
    color: white;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 24px;
}

.admin-header div {
    display: flex;
    gap: 10px;
}

.admin-content {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.admin-section {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.admin-form {
    max-width: 800px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 28px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.table-container {
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.user-table th,
.user-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.user-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.user-table tr:hover {
    background: #f8f9fa;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background: #667eea;
    color: white;
}

.badge-user {
    background: #6c757d;
    color: white;
}

.badge-active {
    background: #28a745;
    color: white;
}

.badge-inactive {
    background: #dc3545;
    color: white;
}

.text-muted {
    color: #888;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 模态对话框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.modal-close:hover {
    background: #e0e0e0;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.member-select-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
}

.member-select-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 5px;
}

.member-select-item:hover {
    background: #f8f9fa;
}

.member-select-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
}

.member-select-item .avatar {
    width: 36px;
    height: 36px;
    font-size: 16px;
    margin-right: 10px;
}

.member-select-item .user-details {
    flex: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 200px;
    }

    .message-content {
        max-width: 80%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}


