* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: #3498db;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

nav a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav a.active, nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

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

.user-info span {
    margin-right: 15px;
}

.user-info a.logout {
    color: white;
    text-decoration: none;
    background-color: #e74c3c;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.user-info a.logout:hover {
    background-color: #c0392b;
}

/* 聊天框样式 */
.chat-box {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    overflow: hidden;
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.message {
    margin-bottom: 15px;
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
}

.message.sent {
    background-color: #3498db;
    color: white;
    margin-left: auto;
}

.message.received {
    background-color: #ecf0f1;
    color: #333;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.message-header .username {
    font-weight: bold;
}

.message-header .time {
    opacity: 0.7;
}

.message-content {
    word-wrap: break-word;
}

.chat-image, .chat-video {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 5px;
}

/* 消息操作按钮 */
.message-actions {
    margin-top: 5px;
    display: flex;
    gap: 5px;
    justify-content: flex-end;
}

.action-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: rgba(0,0,0,0.1);
}

.quote-btn {
    position: absolute;
    bottom: 5px;
    left: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.message:hover .quote-btn {
    opacity: 1;
}

/* 引用消息样式 */
.quoted-message {
    padding: 5px 10px;
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    border-left: 2px solid #3498db;
}

/* 编辑模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    position: relative;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

#editForm textarea {
    width: 100%;
    height: 100px;
    margin: 10px 0;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 撤回和编辑标记 */
.recalled-message {
    color: #999;
    font-style: italic;
}

.edited-mark {
    font-size: 0.7rem;
    color: #666;
    margin-left: 5px;
}

/* 引用指示器 */
.cancel-quote {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 10px;
}

.cancel-quote:hover {
    color: #e74c3c;
}

.message-form {
    padding: 15px;
    border-top: 1px solid #eee;
}

.message-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    height: 60px;
    margin-bottom: 10px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-upload {
    position: relative;
    overflow: hidden;
}

.file-upload label {
    display: inline-block;
    background-color: #2ecc71;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.file-upload label:hover {
    background-color: #27ae60;
}

.file-upload input {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 100%;
    min-height: 100%;
    font-size: 100px;
    opacity: 0;
    cursor: pointer;
}

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.send-btn {
    background-color: #3498db;
    color: white;
}

.send-btn:hover {
    background-color: #2980b9;
}

/* 认证页面样式 */
.auth-box {
    max-width: 400px;
    margin: 50px auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #3498db;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.auth-box .btn {
    width: 100%;
    background-color: #3498db;
    color: white;
    padding: 10px;
    font-size: 1rem;
}

.auth-box .btn:hover {
    background-color: #2980b9;
}

.auth-box p {
    text-align: center;
    margin-top: 15px;
}

/* 文件页面样式 */
h1 {
    margin-bottom: 20px;
    color: #333;
}

.file-filters {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.file-item {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.file-item:hover {
    transform: translateY(-5px);
}

.file-preview {
    height: 150px;
    overflow: hidden;
    background-color: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-info {
    padding: 15px;
}

.file-name {
    font-weight: bold;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.file-actions {
    display: flex;
    gap: 5px;
}

.view-btn {
    background-color: #3498db;
    color: white;
}

.view-btn:hover {
    background-color: #2980b9;
}

.download-btn {
    background-color: #2ecc71;
    color: white;
}

.download-btn:hover {
    background-color: #27ae60;
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background-color: #c0392b;
}

.no-files {
    text-align: center;
    padding: 50px;
    background-color: white;
    border-radius: 8px;
    color: #666;
}

/* 管理员页面样式 */
.admin-container {
    padding-top: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-title {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 10px;
}

.stat-link {
    color: #3498db;
    text-decoration: none;
}

.stat-link:hover {
    text-decoration: underline;
}

.admin-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.admin-section h2 {
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.role-switch {
    color: #3498db;
    text-decoration: none;
    font-size: 0.9rem;
}

.role-switch:hover {
    text-decoration: underline;
}

.disabled-btn {
    color: #999;
    cursor: not-allowed;
    font-size: 0.9rem;
}

.admin-actions {
    margin-bottom: 20px;
    text-align: right;
}

.danger-btn {
    background-color: #e74c3c;
    color: white;
}

.danger-btn:hover {
    background-color: #c0392b;
}

.settings-form .form-group {
    margin-bottom: 20px;
}

.settings-form input, .settings-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.settings-form textarea {
    height: 100px;
    resize: vertical;
}

/* 提示框样式 */
.alert {
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
}

.alert.success {
    background-color: #d4edda;
    color: #155724;
}

/* 上传进度条 */
#uploadProgress {
    display: none;
    margin: 10px 0;
}

/* 图片链接样式 */
.image-link {
    display: inline-block;
    text-decoration: none;
}

.chat-image {
    transition: transform 0.3s;
    cursor: zoom-in;
    max-width: 100%;
    height: auto;
}

.chat-image:hover {
    transform: scale(1.02);
}