/* 交流社区样式 */

/* 子分类筛选区域 */
.subcategory-filter {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-tab {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-tab:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #495057;
}

.filter-tab.active {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
}

/* 话题列表样式 */
.topics-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.topic-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.author-details {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.post-time {
    color: #6c757d;
    font-size: 12px;
}

.topic-category {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.topic-content {
    margin-bottom: 16px;
}

.topic-content .author-info {
    margin-bottom: 12px;
    margin-top: 8px;
}

.topic-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.4;
}

.topic-preview {
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

.topic-image {
    margin-bottom: 12px;
}

.topic-image img {
    width: 100%;
    max-width: 300px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.topic-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.latest-reply {
    flex: 1;
    color: #666;
    font-size: 14px;
}

.reply-author {
    font-weight: 500;
    color: #333;
}

.reply-content {
    margin-left: 4px;
}

.no-reply {
    color: #999;
    font-style: italic;
}

.enter-discussion {
    flex-shrink: 0;
}

.topic-stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #6c757d;
    font-size: 13px;
}

.stat-item i {
    font-size: 12px;
}

/* 讨论详情页样式 */
.back-navigation {
    margin-bottom: 20px;
}

.discussion-container {
    max-width: 800px;
    margin: 0 auto;
}

.topic-detail {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topic-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.author-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topic-author-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.post-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.post-time {
    color: #6c757d;
    font-size: 14px;
}

.topic-category-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.topic-actions {
    display: flex;
    gap: 8px;
}

.topic-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.4;
}

.topic-content {
    margin-bottom: 20px;
}

.content-body {
    color: #333;
    line-height: 1.8;
    font-size: 16px;
}

.content-body h1, .content-body h2, .content-body h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: #333;
}

.content-body h1 {
    font-size: 20px;
}

.content-body h2 {
    font-size: 18px;
}

.content-body h3 {
    font-size: 16px;
}

.content-body code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
}

.content-body pre {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
}

.topic-images {
    margin: 16px 0;
}

.content-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
}

.topic-tags {
    margin-bottom: 16px;
}

.topic-tag {
    display: inline-block;
    background: #f8f9fa;
    color: #666;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 8px;
    margin-bottom: 4px;
}

/* 评论区域样式 */
.comments-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.comment-count {
    color: #6c757d;
    font-size: 14px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    display: flex;
    gap: 16px;
}

.comment-avatar .avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.comment-time {
    color: #6c757d;
    font-size: 12px;
}

.comment-actions {
    display: flex;
    gap: 8px;
}

.comment-actions .btn {
    padding: 2px 8px;
    font-size: 12px;
}

.comment-body {
    color: #333;
    line-height: 1.6;
    margin-bottom: 12px;
}

.comment-replies {
    margin-top: 16px;
    padding-left: 20px;
    border-left: 2px solid #f0f0f0;
}

.reply-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.reply-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.reply-content {
    flex: 1;
}

.reply-author {
    font-weight: 600;
    color: #333;
    font-size: 13px;
    margin-right: 8px;
}

.reply-time {
    color: #6c757d;
    font-size: 11px;
}

.reply-body {
    color: #333;
    line-height: 1.5;
    font-size: 13px;
    margin-top: 4px;
}

/* 回复编辑器样式 */
.reply-editor {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.editor-header {
    margin-bottom: 16px;
}

.editor-body {
    display: flex;
    gap: 16px;
}

.user-avatar .avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.editor-content {
    flex: 1;
}

.editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.editor-tools {
    display: flex;
    gap: 8px;
}

/* 发表话题页面样式 */
.create-topic-container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topic-form-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.topic-form-header h2 {
    color: #333;
    margin-bottom: 8px;
}

.form-section {
    margin-bottom: 24px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-label i {
    color: #007bff;
    font-size: 14px;
}

.form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
}

/* SimpleMDE编辑器自定义样式 */
.CodeMirror {
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
}

.CodeMirror-focused {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.editor-toolbar {
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.editor-preview {
    background: #fff;
    padding: 16px;
}

/* 预览模态框样式 */
.preview-topic {
    max-width: 100%;
}

.preview-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.preview-header h2 {
    color: #333;
    margin-bottom: 12px;
}

.preview-meta {
    display: flex;
    gap: 8px;
}

.preview-content {
    color: #333;
    line-height: 1.8;
    margin-bottom: 20px;
}

.preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: #f8f9fa;
    color: #666;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .topic-card {
        padding: 16px;
    }
    
    .topic-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .topic-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .topic-stats {
        justify-content: flex-start;
    }
    
    .discussion-container {
        margin: 0 16px;
    }
    
    .topic-detail,
    .comments-section,
    .reply-editor {
        padding: 16px;
    }
    
    .topic-meta {
        flex-direction: column;
        gap: 16px;
    }
    
    .author-section {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .create-topic-container {
        margin: 0 16px;
        padding: 24px 16px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .filter-tabs {
        justify-content: center;
    }
    
    .editor-body {
        flex-direction: column;
        gap: 12px;
    }
    
    .comment-item {
        flex-direction: column;
        gap: 8px;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* 空状态和错误状态样式 */
.empty-state,
.error-state,
.loading-state {
    padding: 60px 20px;
    text-align: center;
}

.empty-state i,
.error-state i,
.loading-state i {
    margin-bottom: 16px;
}

.no-comments {
    padding: 40px 20px;
    text-align: center;
}

/* 增强的图片查看器 */
.image-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.image-viewer-modal.show {
    opacity: 1;
    visibility: visible;
}

.image-viewer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 移除header样式，现在不需要了 */

.image-viewer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}

.image-viewer-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.image-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.image-viewer-btn:active {
    transform: translateY(0);
}

.zoom-level {
    color: white;
    font-size: 14px;
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

.image-viewer-close {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.image-viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    user-select: none;
}

.image-close-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.9);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    z-index: 10002;
    margin-bottom: 8px;
}

.image-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: white;
    transform: scale(1.1);
}

.image-viewer-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: 120px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 20px;
    z-index: 10001;
}

.image-viewer-tip {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    margin: 8px 0 0 0;
    text-align: center;
    font-weight: 500;
}

.image-viewer-tip i {
    margin-right: 5px;
}

/* 卡片可点击样式 */
.clickable-card {
    cursor: pointer;
}

.clickable-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 话题标题和评论数量布局 */
.topic-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.topic-title-row .topic-title {
    margin-bottom: 0;
    flex: 1;
    margin-right: 12px;
}

.topic-title-row .comment-count {
    color: #6b7280;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

.topic-title-row .comment-count i {
    margin-right: 4px;
}

/* 可放大图片样式 */
.zoomable-image {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.zoomable-image:hover {
    transform: scale(1.05);
}

/* 分类按钮组样式 */
.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.category-btn {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    color: #64748b;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.category-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.category-btn.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
}

.category-btn.active:hover {
    background: #4338ca;
    border-color: #4338ca;
}

/* 发布按钮样式 */
.publish-btn {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
}

.publish-btn:hover {
    background-color: #4338ca !important;
    border-color: #4338ca !important;
}

/* 修改上传按钮颜色 */
.upload-agent-btn {
    background-color: #4f46e5 !important;
}

.upload-agent-btn:hover {
    background-color: #4338ca !important;
}

/* markdown内容样式 */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.markdown-content h1 { font-size: 1.5em; }
.markdown-content h2 { font-size: 1.3em; }
.markdown-content h3 { font-size: 1.1em; }

.markdown-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-content ul {
    margin: 1em 0;
    padding-left: 1.5em;
}

.markdown-content li {
    margin: 0.3em 0;
}

.markdown-content strong {
    font-weight: 600;
}

.markdown-content em {
    font-style: italic;
}

/* 编辑器实时预览样式 */
.live-preview-container {
    margin-top: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.live-preview-header {
    background: #f8f9fa;
    padding: 8px 16px;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-preview-header i {
    color: #4f46e5;
}

.live-preview-content {
    padding: 16px;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
}

.live-preview-content.empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 32px 16px;
}

/* 简化编辑器容器样式 */
.editor-content {
    width: 100%;
    position: relative;
    box-sizing: border-box;
}

.reply-editor-container .editor-content,
.form-group .editor-content {
    width: 100%;
    max-width: none;
}

/* 回复编辑器样式更新 */
.reply-editor-container {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 移动端适配更新 */
@media (max-width: 768px) {
    .topic-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .topic-title-row .comment-count {
        align-self: flex-end;
    }
    
    .category-buttons {
        gap: 8px;
    }
    
    .category-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* 移动端图片查看器样式 */
    .image-viewer-footer {
        min-height: 100px;
        padding: 15px;
    }
    
    .image-viewer-controls {
        gap: 5px;
        margin: 10px 0;
    }
    
    .image-viewer-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .zoom-level {
        font-size: 12px;
        min-width: 40px;
    }
    
    .image-viewer-tip {
        font-size: 11px;
        padding: 0 15px;
        margin: 6px 0 0 0;
    }
    
    .image-close-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
        margin-bottom: 6px;
    }
    
    /* 编辑器移动端样式 */
    .CodeMirror {
        font-size: 13px;
    }
    
    .editor-toolbar {
        padding: 8px;
    }
    
    .editor-toolbar a {
        font-size: 13px;
        padding: 6px 8px;
    }
    
    /* 移动端预览容器样式 */
    .live-preview-container {
        margin-top: 12px;
    }
    
    .live-preview-content {
        max-height: 200px;
        font-size: 14px;
    }
}

/* 最新评论相关样式 */
.latest-reply-divider {
    margin: 0 10px;
    color: #ccc;
    font-size: 14px;
}

.latest-reply-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0; /* 允许内容收缩 */
}

.latest-reply-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.latest-reply-author {
    font-weight: 500;
    color: #666;
    font-size: 13px;
    flex-shrink: 0;
}

.latest-reply-content {
    color: #888;
    font-size: 13px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.latest-reply-time {
    color: #999;
    font-size: 12px;
    flex-shrink: 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .latest-reply-info {
        gap: 6px;
    }
    
    .latest-reply-content {
        max-width: 150px;
    }
    
    .latest-reply-avatar {
        width: 18px;
        height: 18px;
    }
} 