/* 社区页面样式 */
:root {
    --primary-color: #FF6B81;
    --secondary-color: #FFF0F5;
    --accent-color: #FFC0CB;
    --text-dark: #333333;
    --text-light: #666666;
    --white: #FFFFFF;
    --shadow: 0 4px 20px rgba(255, 107, 129, 0.15);
    --shadow-hover: 0 8px 30px rgba(255, 107, 129, 0.25);
    --border-radius: 15px;
    --transition: all 0.3s ease;
}

/* 社区头部样式 */
.community-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--white) 100%);
    padding: 120px 0 60px;
    margin-top: 80px;
    position: relative;
    overflow: hidden;
}

.community-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="hearts" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><text x="10" y="15" text-anchor="middle" font-size="12" fill="%23FF6B81" opacity="0.1">♥</text></pattern></defs><rect width="100" height="100" fill="url(%23hearts)"/></svg>');
    opacity: 0.3;
}

.community-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.community-subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

/* 社区内容样式 */
.community-content {
    padding: 3rem 0;
    background: var(--white);
}

/* 侧边栏样式 */
.sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.sidebar-card:hover {
    box-shadow: var(--shadow-hover);
}

.sidebar-card h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

/* 话题列表样式 */
.topic-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.topic-item:last-child {
    border-bottom: none;
}

.topic-tag {
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.topic-count {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* 统计样式 */
.stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* 内容头部样式 */
.content-header {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* 筛选标签样式 */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    background: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.filter-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

/* 排序选择器样式 */
.sort-options select {
    border: 2px solid var(--secondary-color);
    border-radius: 25px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.sort-options select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 129, 0.25);
}

/* 帖子容器样式 */
.posts-container {
    min-height: 400px;
}

/* 帖子卡片样式 */
.post-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.post-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.post-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    margin-right: 1rem;
}

.post-meta {
    flex-grow: 1;
}

.post-author {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.post-time {
    font-size: 0.8rem;
    color: var(--text-light);
}

.post-type {
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.post-content {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.post-tag {
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

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

.post-stats {
    display: flex;
    gap: 1.5rem;
}

.post-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.post-stat:hover {
    color: var(--primary-color);
}

.post-stat.liked {
    color: var(--primary-color);
}

.post-stat i {
    font-size: 1rem;
}

/* 加载动画样式 */
.loading-spinner {
    color: var(--text-light);
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.empty-state h4 {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

/* 分页样式 */
.pagination .page-link {
    color: var(--primary-color);
    border-color: var(--secondary-color);
    border-radius: 8px;
    margin: 0 0.25rem;
    transition: var(--transition);
}

.pagination .page-link:hover {
    background: var(--secondary-color);
    border-color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* 模态框增强样式 */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-hover);
}

.modal-header {
    border-bottom: 1px solid var(--secondary-color);
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

/* 表单样式增强 */
.form-control, .form-select {
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 129, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* 按钮样式增强 */
.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    border: none;
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    background: linear-gradient(45deg, #e55a6b, #ffa8b8);
}

.btn-primary:disabled {
    background: #cccccc;
    transform: none;
    box-shadow: none;
}

.btn-primary.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: auto !important; /* 确保可以点击 */
}

.btn-primary.btn-disabled:hover {
    transform: none;
    box-shadow: var(--shadow);
}

/* 确保按钮始终可点击 */
#createPostBtn {
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 25px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* 帖子详情样式 */
.post-detail {
    margin-bottom: 2rem;
}

.post-detail .post-content {
    -webkit-line-clamp: unset;
    overflow: visible;
    margin-bottom: 1.5rem;
}

.comments-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #f0f0f0;
}

.comment-form {
    background: var(--secondary-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.comment-item {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(255, 107, 129, 0.1);
}

.comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.comment-avatar {
    width: 30px;
    height: 30px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.75rem;
}

.comment-meta {
    flex-grow: 1;
}

.comment-author {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.comment-content {
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.comment-actions {
    display: flex;
    gap: 1rem;
}

.comment-action {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.comment-action:hover {
    color: var(--primary-color);
}

.comment-action.liked {
    color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .community-title {
        font-size: 2rem;
    }
    
    .community-subtitle {
        font-size: 1rem;
    }
    
    .sidebar {
        position: static;
        margin-bottom: 2rem;
    }
    
    .filter-tabs {
        justify-content: center;
    }
    
    .filter-tab {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .post-card {
        padding: 1rem;
    }
    
    .post-title {
        font-size: 1.1rem;
    }
    
    .post-stats {
        gap: 1rem;
    }
    
    .stats {
        gap: 1rem;
    }
    
    .stat-number {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .community-header {
        padding: 100px 0 40px;
    }
    
    .community-title {
        font-size: 1.8rem;
    }
    
    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .post-avatar {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .post-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .post-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeInUp 0.5s ease-out;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #e55a6b;
}

/* 发帖增强功能样式 */
.char-count {
    font-size: 0.85rem;
    color: var(--text-light);
}

.char-count.warning {
    color: #ff9800;
}

.char-count.danger {
    color: #f44336;
}

/* 帖子类型选择器 */
.post-type-selector {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-type-selector .btn {
    flex: 1;
    min-width: 120px;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: var(--transition);
}

.post-type-selector .btn-check:checked + .btn {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

/* 编辑器工具栏 */
.editor-toolbar {
    background: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 0.25rem;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--primary-color);
    opacity: 0.2;
}

.toolbar-btn {
    background: var(--white);
    border: 1px solid transparent;
    color: var(--text-dark);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.toolbar-btn:active, .toolbar-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

/* 编辑器文本区域 */
.post-editor {
    border-radius: 0 0 10px 10px !important;
    border-top: none !important;
    min-height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
}

.post-editor:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 129, 0.25) !important;
}

/* 预览区域 */
.post-preview {
    background: var(--white);
    border: 2px solid var(--secondary-color);
    border-radius: 0 0 10px 10px;
    padding: 1.5rem;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.post-preview.d-none {
    display: none !important;
}

.preview-content {
    line-height: 1.8;
    color: var(--text-dark);
}

.preview-content h1, 
.preview-content h2, 
.preview-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.preview-content p {
    margin-bottom: 1rem;
}

.preview-content code {
    background: var(--secondary-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.preview-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-light);
}

.preview-content ul, 
.preview-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.preview-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

/* 图片预览容器 */
.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.image-preview-item .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 107, 129, 0.9);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.image-preview-item .remove-image:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* 标签输入 */
.tag-input-wrapper {
    position: relative;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid var(--secondary-color);
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.tag-suggestions.show {
    display: block;
}

.tag-suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--secondary-color);
}

.tag-suggestion-item:last-child {
    border-bottom: none;
}

.tag-suggestion-item:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
}

/* 已选标签 */
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selected-tag {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeInScale 0.3s ease;
}

.selected-tag .remove-tag {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 0;
    margin-left: 0.25rem;
    font-size: 1rem;
    line-height: 1;
    transition: var(--transition);
}

.selected-tag .remove-tag:hover {
    transform: scale(1.2);
}

/* 热门标签 */
.popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tag-chip {
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 0.35rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.tag-chip:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* 草稿信息 */
.draft-info {
    padding: 0.5rem;
    text-align: center;
    color: var(--text-light);
}

.draft-info .text-success {
    color: #4caf50 !important;
}

/* Emoji 选择器 */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--white);
    border: 2px solid var(--secondary-color);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    display: none;
}

.emoji-picker.show {
    display: block;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    text-align: center;
    padding: 0.25rem;
    border-radius: 6px;
    transition: var(--transition);
}

.emoji-item:hover {
    background: var(--secondary-color);
    transform: scale(1.2);
}

/* 动画效果 */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .editor-toolbar {
        padding: 0.35rem;
    }
    
    .toolbar-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
    
    .post-type-selector .btn {
        min-width: 100px;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .image-preview-item {
        width: 80px;
        height: 80px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}