/* 健康社区页面样式 */

/* 主内容区域 */
.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* 社区横幅 */
.community-banner {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2.5rem 0;
    background: linear-gradient(135deg, #3498db, #9b59b6);
    border-radius: 12px;
    color: #fff;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
}

.community-banner::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.community-banner::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.community-banner h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.community-banner p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    opacity: 0.9;
}

/* 标签页导航 */
.community-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 2rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: #666;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.tab-btn:hover {
    color: #3498db;
}

.tab-btn.active {
    color: #3498db;
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: #3498db;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* 标签页内容 */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 话题标签栏 */
.topics-bar {
    margin-bottom: 1.5rem;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f9fa;
    padding: 0.5rem;
}

.topics-scroll {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem;
    gap: 0.8rem;
}

.topic-tag {
    background: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.topic-tag:hover {
    background: #edf2f7;
}

.topic-tag.active {
    background: #3498db;
    color: #fff;
}

.topic-tag.hot {
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    color: #fff;
    position: relative;
}

.topic-tag.hot::after {
    content: '热门';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* 发布按钮 */
.post-action {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.post-btn {
    display: flex;
    align-items: center;
    background: #3498db;
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
}

.post-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.4);
}

.post-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

/* 动态内容流 */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.post-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.user-info {
    display: flex;
    align-items: center;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1rem;
    border: 2px solid #f0f0f0;
}

.username {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.3rem 0;
}

.post-time {
    font-size: 0.8rem;
    color: #999;
}

.more-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.more-btn:hover {
    background-color: #f0f0f0;
}

.post-content {
    padding: 1rem;
}

.post-content p {
    color: #333;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

.post-images.single {
    grid-template-columns: 1fr;
}

.post-images img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.post-images img:hover {
    transform: scale(1.02);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.content-tag {
    background: #f0f0f0;
    color: #666;
    padding: 0.3rem 0.8rem;
    border-radius: 16px;
    font-size: 0.8rem;
}

.post-stats {
    display: flex;
    padding: 0.5rem 1rem;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-btn {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    color: #666;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: color 0.3s ease;
    flex: 1;
    justify-content: center;
}

.stat-btn:hover {
    color: #3498db;
}

.stat-btn.like:hover {
    color: #e74c3c;
}

.stat-btn svg {
    margin-right: 0.5rem;
}

.post-comments {
    padding: 1rem;
}

.comment {
    display: flex;
    margin-bottom: 1rem;
}

.avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0.8rem;
}

.comment-content {
    flex: 1;
    background: #f8f9fa;
    padding: 0.8rem;
    border-radius: 8px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-header h4 {
    font-size: 0.9rem;
    margin: 0;
    color: #333;
}

.comment-time {
    font-size: 0.75rem;
    color: #999;
}

.comment-content p {
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
    color: #666;
}

.comment-actions {
    display: flex;
    gap: 1rem;
}

.comment-like, .comment-reply {
    background: none;
    border: none;
    color: #999;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
}

.comment-like:hover, .comment-reply:hover {
    color: #3498db;
}

.add-comment {
    display: flex;
    align-items: center;
    margin-top: 1rem;
}

.comment-input-wrapper {
    display: flex;
    flex: 1;
    background: #f8f9fa;
    border-radius: 20px;
    padding: 0.3rem;
    margin-left: 0.8rem;
}

.comment-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    outline: none;
    font-size: 0.9rem;
}

.send-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.send-btn:hover {
    background: #2980b9;
}

.view-comments {
    padding: 0.5rem 1rem 1rem;
    text-align: center;
}

.view-comments-btn {
    background: none;
    border: none;
    color: #3498db;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: background 0.3s ease;
}

.view-comments-btn:hover {
    background: #f0f7fb;
}

.load-more {
    text-align: center;
    margin: 2rem 0;
}

.load-more-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    color: #666;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    background: #edf2f7;
    color: #3498db;
    border-color: #3498db;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .community-banner {
        padding: 1.5rem 0;
    }
    
    .community-banner h1 {
        font-size: 1.8rem;
    }
    
    .community-tabs {
        padding-bottom: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .post-images {
        grid-template-columns: 1fr;
    }
    
    .post-stats {
        flex-wrap: wrap;
    }
    
    .stat-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}

/* 暗黑模式 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }
    
    .tab-btn {
        color: #a0a0a0;
    }
    
    .tab-btn.active {
        color: #3498db;
    }
    
    .topics-bar {
        background: #1e1e1e;
    }
    
    .topic-tag {
        background: #2a2a2a;
        color: #a0a0a0;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    .topic-tag:hover {
        background: #333;
    }
    
    .post-card {
        background: #1e1e1e;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .post-header {
        border-bottom: 1px solid #2a2a2a;
    }
    
    .username {
        color: #e0e0e0;
    }
    
    .post-time {
        color: #777;
    }
    
    .more-btn:hover {
        background-color: #2a2a2a;
    }
    
    .post-content p {
        color: #e0e0e0;
    }
    
    .content-tag {
        background: #2a2a2a;
        color: #a0a0a0;
    }
    
    .post-stats {
        border-top: 1px solid #2a2a2a;
        border-bottom: 1px solid #2a2a2a;
    }
    
    .stat-btn {
        color: #a0a0a0;
    }
    
    .comment-content {
        background: #2a2a2a;
    }
    
    .comment-header h4 {
        color: #e0e0e0;
    }
    
    .comment-content p {
        color: #a0a0a0;
    }
    
    .comment-input-wrapper {
        background: #2a2a2a;
    }
    
    .comment-input {
        color: #e0e0e0;
    }
    
    .load-more-btn {
        background: #2a2a2a;
        border-color: #333;
        color: #a0a0a0;
    }
    
    .load-more-btn:hover {
        background: #333;
        color: #3498db;
        border-color: #3498db;
    }
}

/* 挑战活动 */
.challenges-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.challenge-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.challenge-card:hover {
    transform: translateY(-5px);
}

.challenge-banner {
    position: relative;
}

.challenge-banner img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.challenge-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #fff;
    font-weight: 600;
}

.challenge-status.active {
    background: #2ecc71;
}

.challenge-status.upcoming {
    background: #3498db;
}

.challenge-status.completed {
    background: #95a5a6;
}

.challenge-info {
    padding: 1.5rem;
}

.challenge-info h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.challenge-info p {
    color: #666;
    margin-bottom: 1.2rem;
}

.challenge-progress {
    margin-bottom: 1.2rem;
}

.progress-bar {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: #3498db;
    border-radius: 4px;
}

.challenge-time {
    display: flex;
    align-items: center;
    color: #666;
    margin-bottom: 1.2rem;
}

.challenge-time .icon {
    margin-right: 0.5rem;
}

.challenge-result {
    display: flex;
    align-items: center;
    color: #2ecc71;
    font-weight: 600;
    margin-bottom: 1.2rem;
}

.challenge-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.stat-label {
    font-size: 0.9rem;
    color: #888;
}

.join-btn {
    width: 100%;
    background: #3498db;
    color: #fff;
    border: none;
    padding: 0.8rem 0;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.join-btn:hover {
    background: #2980b9;
}

.join-btn.secondary {
    background: #95a5a6;
}

.join-btn.secondary:hover {
    background: #7f8c8d;
}

/* 经验分享 */
.experiences-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.experience-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.experience-card:hover {
    transform: translateY(-5px);
}

.experience-header {
    display: flex;
    margin-bottom: 1rem;
}

.experience-header .avatar {
    width: 60px;
    height: 60px;
}

.experience-header h3 {
    font-size: 1.2rem;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: #e8f4fd;
    color: #3498db;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.experience-content {
    margin-bottom: 1.5rem;
}

.experience-content p {
    color: #666;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.experience-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.stats {
    display: flex;
    gap: 1rem;
    color: #888;
    font-size: 0.9rem;
}

.read-more {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
}

.read-more:hover {
    text-decoration: underline;
}

/* 专家问答 */
.experts-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.ask-question {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.ask-question textarea {
    width: 100%;
    height: 100px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 1rem;
    resize: none;
}

.ask-btn {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ask-btn:hover {
    background: #2980b9;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.question-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.question {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.question-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.question-header .username {
    margin-right: 1rem;
}

.question-time {
    font-size: 0.9rem;
    color: #888;
}

.question p {
    color: #333;
    margin: 0;
}

.answer {
    padding: 1.5rem;
    background: #f8f9fa;
}

.answer-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.answer-header .username {
    color: #3498db;
}

.answer p {
    color: #666;
    margin: 0;
}

/* 响应式调整 */
@media (max-width: 992px) {
    .challenges-container,
    .experiences-container {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .community-banner {
        padding: 1.5rem 1rem;
    }
    
    .community-banner h1 {
        font-size: 2rem;
    }
    
    .community-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 0.8rem;
    }
    
    .post-images {
        flex-direction: column;
    }
    
    .challenge-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #f0f0f0;
    }
    
    .tab-pane h2 {
        color: #f0f0f0;
    }
    
    .section-desc {
        color: #ccc;
    }
    
    .post-card,
    .challenge-card,
    .experience-card,
    .question-card {
        background: #2c3e50;
    }
    
    .username {
        color: #f0f0f0;
    }
    
    .post-content p,
    .question p {
        color: #f0f0f0;
    }
    
    .comment-content h4 {
        color: #f0f0f0;
    }
    
    .comment-content p,
    .challenge-info p,
    .experience-content p,
    .answer p {
        color: #ccc;
    }
    
    .post-tag,
    .tag {
        background: #34495e;
        color: #3498db;
    }
    
    .post-stats,
    .post-comments,
    .experience-footer {
        border-color: #34495e;
    }
    
    .ask-question,
    .answer {
        background: #34495e;
    }
    
    .stat-value {
        color: #f0f0f0;
    }
} 