/* 
 * 多用户聊天系统样式表
 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

a {
    color: #1e88e5;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 15px;
    font-weight: 600;
}

/* 加载状态 */
.loading {
    position: relative;
    min-height: 100px;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1e88e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 错误提示 */
.error {
    padding: 20px;
    text-align: center;
    color: #d32f2f;
    background-color: #ffebee;
    border-radius: 4px;
    margin: 20px;
}

.error p {
    margin-bottom: 15px;
}

.error .btn {
    background-color: #d32f2f;
    color: white;
}

.error .btn:hover {
    background-color: #b71c1c;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #d0d0d0;
    text-decoration: none;
}

.btn-primary {
    background-color: #1e88e5;
    color: #fff;
}

.btn-primary:hover {
    background-color: #1976d2;
}

.btn-danger {
    background-color: #e53935;
    color: #fff;
}

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

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

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

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

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

.form-actions {
    margin-top: 20px;
}

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

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

.alert-danger {
    background-color: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

/* 表格样式 */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.admin-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.admin-table tr:hover {
    background-color: #f9f9f9;
}

/* 状态徽章 */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.status-badge.active {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.status-badge.inactive {
    background-color: #ffebee;
    color: #c62828;
}

/* 权限管理页面样式 */
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.checkbox-item {
    flex: 0 0 calc(33.333% - 10px);
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px;
    transition: all 0.3s;
}

.checkbox-item:hover {
    background-color: #f0f0f0;
    border-color: #ddd;
}

.checkbox-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    cursor: pointer;
}

.checkbox-item small {
    display: block;
    color: #666;
    font-size: 12px;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 5px;
}

/* 通用的user-info样式 */
.user-info {
    border-left: 4px solid #1e88e5;
    padding: 10px 15px;
    margin-bottom: 20px;
}

/* 主页和普通页面的user-info样式 - 深色背景 */
.main-container .user-info {
    background-color: #292929;
    color: #ffffff;
}

/* 管理后台的user-info样式 - 浅色背景 */
.admin-container .user-info {
    background-color: #f5f5f5;
    color: #333333;
}

/* 用户权限分组样式 */
.user-permissions-group {
    margin-bottom: 30px;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
}

.user-permissions-group h3 {
    background-color: #f5f5f5;
    padding: 10px 15px;
    margin: 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-permissions-group h3 a {
    color: #1e88e5;
    text-decoration: none;
}

.user-permissions-group h3 a:hover {
    text-decoration: underline;
}

.user-permissions-group .user-role {
    color: #666;
    font-size: 14px;
    font-weight: normal;
    margin-left: 10px;
}

.user-permissions-group .table-responsive {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .checkbox-item {
        flex: 0 0 calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .checkbox-item {
        flex: 0 0 100%;
    }
}

/* 认证页面样式 */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.auth-form {
    margin-top: 20px;
}

/* 聊天页面样式 */
.chat-page {
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    display: flex;
    height: 100%;
    width: 100%; /* 确保容器占满整个宽度 */
    overflow: hidden; /* 防止内容溢出 */
}

.sidebar {
    width: 250px;
    min-width: 250px; /* 添加最小宽度，防止被挤压 */
    background-color: #263238;
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止内容溢出 */
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0; /* 防止头部被压缩 */
}

.sidebar-header h1 {
    font-size: 18px;
    margin-bottom: 10px;
}

/* 聊天页面的user-info样式 */
.chat-sidebar .user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    background-color: #292929;
    color: #ffffff;
}



.user-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.user-btn {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    background-color: #455a64;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.user-btn:hover {
    background-color: #546e7a;
    text-decoration: none;
}

.tab-list {
    flex: 1;
    overflow: auto; /* 允许滚动但隐藏滚动条 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    padding: 15px;
}

/* 隐藏Webkit浏览器的滚动条 */
.tab-list::-webkit-scrollbar {
    display: none;
}

.tab-list h2 {
    font-size: 14px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.7);
}

.tab-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px; /* 使用gap替代margin控制间距 */
}

.tab-list li {
    margin-bottom: 0; /* 移除底部边距，使用gap控制间距 */
}

.tab-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    color: #fff;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-list li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.tab-list li.active a {
    background-color: #1e88e5;
}

.nav-menu {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0; /* 防止导航菜单被压缩 */
}

.nav-menu ul {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 5px;
}

.nav-menu li a {
    display: block;
    padding: 8px 10px;
    color: #fff;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 14px;
}

.nav-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    min-width: 0; /* 防止内容溢出导致父容器被撑开 */
    overflow: hidden; /* 防止内容溢出 */
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-left {
    flex: 1;
}

.chat-header h2 {
    margin-bottom: 5px;
}

.chat-header p {
    color: #666;
    font-size: 13px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px; /* 添加间距 */
}

/* 主题切换按钮样式 */
.theme-toggle {
    display: flex;
    align-items: center;
}

/* 主题切换滑块样式 */
.theme-toggle {
    margin-top: 5px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    -moz-transition: .4s;
    -o-transition: .4s;
    transition: .4s;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    padding: 0 5px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    -moz-transition: .4s;
    -o-transition: .4s;
    transition: .4s;
    z-index: 2;
}

input:checked + .slider {
    background-color: #2a2a2a;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2a2a2a;
}

input:checked + .slider:before {
    -webkit-transform: translateX(30px);
    -ms-transform: translateX(30px);
    transform: translateX(30px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.theme-icon {
    font-size: 16px;
    line-height: 1;
    z-index: 1;
}

.theme-icon.light {
    color: #ff9800;
}

.theme-icon.dark {
    color: #f5f5f5;
}

/* 黑夜模式样式 */
body.dark-theme {
    background-color: #1a1a1a;
    color: #dddddd;
}

/* 黑夜模式下的各元素样式 */
body.dark-theme .sidebar {
    background-color: #2a2a2a;
    border-right: 1px solid #3a3a3a;
}

body.dark-theme .chat-header {
    background-color: #2a2a2a;
    border-bottom: 1px solid #3a3a3a;
}

body.dark-theme .chat-header h2,
body.dark-theme .chat-header p,
body.dark-theme .connection-status,
body.dark-theme #connectionText {
    color: #ffffff;
}

body.dark-theme .message-area {
    background-color: #1a1a1a;
}

body.dark-theme .message-input {
    background-color: #2a2a2a;
    border-top: 1px solid #3a3a3a;
}

body.dark-theme .message-input textarea {
    background-color: #333;
    color: #f5f5f5;
    border: 1px solid #444;
}

body.dark-theme .message-bubble {
    background-color: #2d2d2d;
    color: #f5f5f5;
    border: 1px solid #444;
}

body.dark-theme .message-bubble.outgoing {
    background-color: #1a3a5a;
    border: 1px solid #2c5a8f;
}

body.dark-theme .message.outgoing .message-content {
    background-color: #353739;
}

body.dark-theme .message-bubble.incoming {
    background-color: #2d2d2d;
    border: 1px solid #444;
}

body.dark-theme .message-bubble .message-content {
    color: #f5f5f5;
}

body.dark-theme .message-bubble .markdown-body {
    color: #f5f5f5;
}

body.dark-theme .message-bubble .markdown-body pre {
    background-color: #1a1a1a;
    border: 1px solid #444;
}

body.dark-theme .message-bubble .markdown-body code {
    background-color: #1a1a1a;
    color: #e6e6e6;
}

body.dark-theme .tab-item {
    border-bottom: 1px solid #3a3a3a;
}

body.dark-theme .tab-item:hover,
body.dark-theme .tab-item.active {
    background-color: #333;
}

body.dark-theme .theme-toggle-btn {
    color: #f5f5f5;
}

body.dark-theme .theme-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.connection-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.connection-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

.connection-indicator.connected {
    background-color: #4CAF50; /* 绿色 - 连接成功 */
    box-shadow: 0 0 5px #4CAF50;
}

.connection-indicator.connecting {
    background-color: #FFC107; /* 黄色 - 连接中 */
    box-shadow: 0 0 5px #FFC107;
    animation: pulse 1.5s infinite;
}

.connection-indicator.disconnected {
    background-color: #F44336; /* 红色 - 断开连接 */
    box-shadow: 0 0 5px #F44336;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.message-area {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f5f5f5;
    height: calc(100vh - 200px); /* 设置固定高度，确保可以滚动 */
    -webkit-overflow-scrolling: touch; /* 改善iOS滚动体验 */
    display: flex;
    flex-direction: column;
    min-width: 0; /* 防止内容溢出导致父容器被撑开 */
}

/* 消息列表样式 */
#messageList {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 加载更多消息指示器样式 */
.load-more-container {
    text-align: center;
    margin-bottom: 15px;
    padding: 5px 0;
    transition: opacity 0.3s;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: #666;
    font-size: 14px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top: 2px solid #1e88e5;
    border-radius: 50%;
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-more-messages {
    padding: 10px;
    color: #999;
    font-size: 13px;
    font-style: italic;
}

#loadMoreBtn {
    background-color: #1e88e5;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#loadMoreBtn:hover {
    background-color: #1565c0;
}

#loadMoreBtn:disabled {
    background-color: #90caf9;
    cursor: not-allowed;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
}

.message {
    margin-left: auto;
    margin-right: auto;
}

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

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

.message-header .timestamp {
    color: #666;
}

.message-content {
    padding: 10px 15px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
}

/* 消息内容中的图片样式 */
.message-content img, .clickable-image {
    /* 悬停效果 */
    &:hover {
        transform: scale(1.02);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    cursor: pointer;
    transition: transform 0.2s ease;
    max-width: 100%;
    max-height: 300px; /* 限制图片高度 */
    border-radius: 4px;
    object-fit: contain; /* 保持长宽比 */
    margin: 5px 0;
    display: block;
}

.message-content.markdown-content {
    padding: 10px 15px 10px 15px;
}

.message-content .markdown-body {
    padding-right: 15px;
    box-sizing: border-box;
}

.message .message-content {
    background-color: #e3f2fd;
}

/* 发送中消息样式 */
.message.sending .message-content {
    opacity: 0.8;
    background-color: #f0f8ff;
    border: 1px dashed #90caf9;
}

.message.sending .message-status {
    color: #1e88e5;
    font-style: italic;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Markdown 样式 */
.markdown-content .markdown-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    max-width: 100%;
    overflow: hidden;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 16px;
    margin-bottom: 10px;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 {
    font-size: 1.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #eaecef;
}

.markdown-body h2 {
    font-size: 1.3em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #eaecef;
}

.markdown-body h3 {
    font-size: 1.2em;
}

.markdown-body h4 {
    font-size: 1.1em;
}

.markdown-body h5, .markdown-body h6 {
    font-size: 1em;
}

.markdown-body p {
    margin-top: 0;
    margin-bottom: 10px;
}

.markdown-body blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
    margin: 0 0 16px 0;
    max-width: 100%;
    box-sizing: border-box;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 2em;
    margin-top: 0;
    margin-bottom: 16px;
    max-width: 100%;
    box-sizing: border-box;
}

.markdown-body code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: rgba(27,31,35,0.05);
    border-radius: 3px;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.markdown-body pre {
    padding: 16px;
    overflow-x: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f6f8fa;
    border-radius: 3px;
    margin-top: 0;
    margin-bottom: 16px;
    word-wrap: normal;
    max-width: 100%;
}

.markdown-body pre code {
    display: inline;
    max-width: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    line-height: inherit;
    word-wrap: normal;
    background-color: transparent;
    border: 0;
}

.markdown-body a {
    color: #0366d6;
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-top: 0;
    margin-bottom: 16px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

.markdown-body table tr {
    background-color: #fff;
    border-top: 1px solid #c6cbd1;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

.markdown-body img {
    max-width: 100%;
    box-sizing: border-box;
    background-color: #fff;
    border-style: none;
    height: auto;
    display: block;
    margin: 10px 0;
}

.message-input {
    padding: 15px;
    border-top: 1px solid #ddd;
}

.message-input form {
    display: flex;
}

.message-input textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    min-height: 60px;
    max-height: 300px; /* 最大高度限制，避免占用过多空间 */
    overflow-y: auto; /* 当内容超过最大高度时显示滚动条 */
    line-height: 1.5;
    transition: height 0.1s ease;
}

.message-input button {
    margin-left: 10px;
    align-self: flex-end;
}

.no-tab-selected {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #666;
}

/* 管理后台样式 */
.admin-page {
    min-height: 100vh;
    background-color: #f5f5f5;
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-container .sidebar {
    width: 250px;
    background-color: #263238;
    color: #fff;
}

.admin-menu {
    padding: 15px;
}

.admin-menu ul {
    list-style: none;
}

.admin-menu li {
    margin-bottom: 5px;
}

.admin-menu li a {
    display: block;
    padding: 8px 10px;
    color: #fff;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.admin-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.admin-menu li.active a {
    background-color: #1e88e5;
}

.back-to-front {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.back-to-front a {
    display: block;
    padding: 8px 10px;
    color: #fff;
    border-radius: 4px;
    text-align: center;
    transition: background-color 0.3s;
}

.back-to-front a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.admin-container .main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.admin-header {
    margin-bottom: 20px;
}

.admin-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.admin-section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

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

.admin-form {
    max-width: 600px;
}

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

.stat-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    margin-bottom: 10px;
    color: #666;
}

.stat-number {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 10px;
}

.stat-link {
    display: block;
    margin-top: 10px;
    font-size: 13px;
}

.recent-section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

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

.info-box {
    background-color: #f9f9f9;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.info-box h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.info-box pre {
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}

.info-box code {
    background-color: #f0f0f0;
    padding: 2px 4px;
    border-radius: 2px;
}

.inline-form {
    display: inline;
}

/* 响应式样式 */
/* 移动端菜单切换按钮 */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background-color: #1e88e5;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    /* 显示移动端菜单按钮 */
    .mobile-menu-toggle {
        display: block;
    }
    
    /* 修改容器布局为垂直方向 */
    .chat-container {
        flex-direction: column;
    }
    
    /* 侧边栏在移动端默认完全隐藏 */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px; /* 默认隐藏，增加距离确保完全不可见 */
        width: 250px;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }
    
    /* 当添加active类时显示侧边栏 */
    .sidebar.active {
        left: 0; /* 显示侧边栏 */
    }
    
    /* 主内容区域占据全宽 */
    .main-content {
        margin-left: 0;
        width: 100%;
        position: relative;
        z-index: 1;
    }
    
    /* 管理后台容器布局 */
    .admin-container {
        flex-direction: column;
    }
    
    /* 管理后台侧边栏处理 */
    .admin-container .sidebar {
        width: 100%;
        position: relative;
        left: 0;
    }
    
    /* 统计卡片布局 */
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    /* 确保消息输入框在移动端正常显示 */
    .message-input {
        padding: 10px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: white;
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    /* 调整消息区域，避免被输入框遮挡 */
    .message-area {
        padding-top: 0; /* 移除顶部填充，确保紧贴chat-header */
        padding-bottom: 70px; /* 增加底部填充，为输入框预留空间 */
        height: calc(100vh - 102px); /* 调整高度计算，适合所有移动端 */
        max-height: 100%;
        overflow-y: hidden !important; /* 隐藏消息区域的滚动条，使用消息列表的滚动条 */
        -webkit-overflow-scrolling: touch; /* 改善iOS滚动体验 */
        margin-top: 0; /* 移除顶部边距 */
    }
    
    /* 移动端消息列表样式 */
    #messageList {
        flex: 1;
        overflow-y: scroll !important; /* 强制显示滚动条 */
        -webkit-overflow-scrolling: touch; /* 改善iOS滚动体验 */
        max-height: calc(100vh - 182px); /* 调整最大高度，适合所有移动端 */
        padding-top: 10px; /* 添加顶部填充，避免文字被遮挡 */
    }
    
    /* 菜单按钮活动状态 */
    .mobile-menu-toggle.active {
        background-color: #f44336; /* 变成关闭按钮的颜色 */
    }
}

/* 图片模态框样式 */
.image-modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden; /* 添加可见性控制 */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-modal.show {
    opacity: 1;
    visibility: visible; /* 显示时改变可见性 */
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    background-color: transparent;
    border-radius: 4px;
    overflow: hidden;
}

.image-modal-content img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.image-modal-close {
    position: absolute;
    top: -30px;
    right: 0;
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
}

.image-modal-close:hover {
    background-color: rgba(255, 0, 0, 0.7);
}

/* 暗色模式下的模态框样式 */
body.dark-theme .image-modal {
    background-color: rgba(0, 0, 0, 0.9);
}

body.dark-theme .image-modal-close {
    background-color: rgba(50, 50, 50, 0.8);
}
