/* 社区圈子样式 */

.community-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f5f5f5;
    min-height: 100vh;
}

/* 顶部导航栏 */
.community-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.community-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

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

.search-box {
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 8px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

/* 导航标签 */
.community-tabs {
    display: flex;
    gap: 20px;
    padding: 10px 15px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tab-btn {
    background: none;
    border: none;
    padding: 8px 15px;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #ff3b30;
    border-bottom-color: #ff3b30;
}

.tab-btn:hover {
    color: #ff3b30;
}

/* 发布按钮 */
.community-publish-btn {
    text-align: center;
    margin-bottom: 20px;
}

.publish-btn {
    background: #ff3b30;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(255,59,48,0.3);
    transition: all 0.3s;
}

.publish-btn:hover {
    background: #ff1f14;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255,59,48,0.4);
}

/* 内容区域 */
.community-content {
    display: grid;
    gap: 15px;
}

/* 文章卡片 */
.post-card {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

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

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.post-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.post-user-info {
    flex: 1;
}

.post-username {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.post-level {
    display: inline-block;
    background: #ff3b30;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 5px;
}

.post-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #999;
    margin-top: 3px;
}

.post-title {
    font-size: 16px;
    font-weight: 600;
    margin: 10px 0;
    color: #333;
}

.post-content {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* 更多链接：跳转到推文详情页 */
.post-more-link {
    display: inline-block;
    color: #f44336;
    font-size: 14px;
    text-decoration: none;
    margin-top: 4px;
    margin-bottom: 8px;
}
.post-more-link:hover {
    color: #d32f2f;
    text-decoration: underline;
}

/* 视频容器 */
.post-video-container {
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.post-video-container video {
    width: 100%;
    max-height: 500px;
    display: block;
}

/* 图片网格 */
.post-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin: 15px 0;
}

.post-image-item {
    position: relative;
    padding-top: 100%;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.post-image-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 图片单张显示 */
.post-image-single {
    max-width: 100%;
    border-radius: 8px;
    margin: 15px 0;
    cursor: pointer;
}

/* 三张图片横向排列 */
.post-images-three {
    display: flex;
    gap: 8px;
    margin: 15px 0;
}

.post-images-three .post-image-item {
    flex: 1;
    padding-top: 0;
    height: 200px;
}

/* 互动按钮 */
.post-actions {
    display: flex;
    gap: 20px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    margin-top: 10px;
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
}

.post-action-btn:hover {
    color: #ff3b30;
}

.post-action-btn.active {
    color: #ff3b30;
}

.post-sticky-btn {
    color: #999;
}
.post-sticky-btn:hover {
    color: #1890ff;
}
.post-sticky-btn.active {
    color: #1890ff;
}

.post-share-btn {
    color: #999;
}
.post-share-btn:hover {
    color: #07c160;
}

/* 发布弹窗 */
.publish-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    overflow-y: auto;
}

.publish-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 30px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.upload-btn {
    background: #ff3b30;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 8px;
}

.upload-btn:hover {
    background: #ff1f14;
}

/* 视频预览容器 */
.video-preview-container {
    position: relative;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.video-preview-container video {
    width: 100%;
    max-height: 400px;
    display: block;
}

.video-controls-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
}

.video-settings-btn {
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.video-settings-btn:hover {
    background: rgba(0,0,0,0.8);
}

/* 封面预览 */
.cover-preview {
    position: relative;
    display: inline-block;
    margin-top: 10px;
}

.cover-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.remove-cover-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff3b30;
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
}

/* 图片预览列表 */
.image-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.image-preview-item {
    position: relative;
    padding-top: 100%;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
}

.image-preview-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.image-preview-item .remove-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255,59,48,0.9);
    color: #fff;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.submit-btn {
    background: #ff3b30;
    color: #fff;
    border: none;
    padding: 10px 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.submit-btn:hover {
    background: #ff1f14;
}

.cancel-btn {
    background: #f0f0f0;
    color: #666;
    border: none;
    padding: 10px 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.cancel-btn:hover {
    background: #e0e0e0;
}

/* 图片查看器 */
.image-viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.image-viewer-modal.active {
    display: flex;
}

.image-viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.image-viewer-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.close-viewer-btn {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    line-height: 40px;
}

/* 加载状态 */
.loading-posts {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 评论区域 */
.comments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.comment-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.comment-username {
    font-weight: 600;
    font-size: 14px;
}

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

.comment-text {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.comment-actions {
    display: flex;
    gap: 15px;
    margin-top: 5px;
}

.comment-action-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.comment-action-btn:hover {
    color: #ff3b30;
}

/* 评论区域样式优化 */
.comments-list {
    margin-bottom: 15px;
}

.no-comments {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 14px;
}

.comment-form-area {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.comment-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 10px;
}

.comment-submit-btn {
    background: #ff3b30;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    float: right;
}

.comment-submit-btn:hover {
    background: #ff1f14;
}

.comment-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 瀑布流布局 */
.community-content {
    column-count: 1;
    column-gap: 15px;
}

@media (min-width: 768px) {
    .community-content {
        column-count: 2;
    }
}

@media (min-width: 1200px) {
    .community-content {
        column-count: 3;
    }
}

.post-card {
    break-inside: avoid;
    margin-bottom: 15px;
    display: inline-block;
    width: 100%;
}

/* 响应式 */
@media (max-width: 768px) {
    .community-container {
        padding: 10px;
    }

    .community-header-left {
        flex-direction: column;
        gap: 10px;
    }

    .search-box {
        max-width: 100%;
    }

    .modal-content {
        max-width: 100%;
        margin: 10px;
    }

    .post-images-three {
        flex-direction: column;
    }

    .post-images-three .post-image-item {
        height: auto;
        padding-top: 100%;
    }

    .community-content {
        column-count: 1;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .community-container {
        background: #1a1a1a;
    }

    .community-header,
    .community-tabs,
    .post-card {
        background: #2a2a2a;
        color: #fff;
    }

    .post-title,
    .post-username {
        color: #fff;
    }

    .post-content,
    .post-meta {
        color: #ccc;
    }

    .modal-content {
        background: #2a2a2a;
        color: #fff;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        background: #333;
        color: #fff;
        border-color: #444;
    }
}

/* 视频轮播相关样式 */
.video-carousel-container {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

.video-carousel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.carousel-icon {
    font-size: 24px;
}

.enter-community-btn {
    background: #ff3b30;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.enter-community-btn:hover {
    background: #ff1f14;
    transform: translateY(-1px);
}

.video-carousel-content {
    position: relative;
    width: 100%;
    height: 500px;
    background: #000;
    overflow: hidden;
}

.video-carousel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
    padding: 40px;
}

.placeholder-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.placeholder-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #666;
}

.placeholder-subtext {
    font-size: 14px;
    color: #999;
}

.video-carousel-player {
    position: relative;
    width: 100%;
    height: 100%;
}

#carousel-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.video-carousel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 20px;
    color: #fff;
}

.video-carousel-info {
    margin-bottom: 15px;
    cursor: pointer;
    transition: opacity 0.3s;
}

.video-carousel-info:hover {
    opacity: 0.9;
}

.video-carousel-title-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.video-carousel-meta {
    display: flex;
    gap: 15px;
    font-size: 14px;
    opacity: 0.9;
}

.video-carousel-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.carousel-control-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.carousel-control-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.1);
}

.video-carousel-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
}

.carousel-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 14px;
}

.carousel-action-btn:hover {
    background: #f5f5f5;
    color: #ff3b30;
}

.action-icon {
    font-size: 24px;
}

/* 加载状态 */
.carousel-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 错误提示 */
.carousel-error {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,59,48,0.9);
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10;
}

/* 播放按钮覆盖层 */
.carousel-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    cursor: pointer;
}

.carousel-play-btn {
    background: rgba(255,255,255,0.9);
    color: #333;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-play-btn:hover {
    background: #fff;
    transform: scale(1.05);
}

/* 进度条 */
.carousel-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.2);
    z-index: 10;
}

.carousel-progress-fill {
    height: 100%;
    background: #ff3b30;
    transition: width 0.1s linear;
    width: 0%;
}

/* 视频指示器 */
.carousel-indicators {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-indicator:hover {
    background: rgba(255,255,255,0.6);
    transform: scale(1.2);
}

.carousel-indicator.active {
    background: #fff;
    width: 24px;
    border-radius: 4px;
}

/* 高亮文章 */
.post-card.highlight-post {
    animation: highlightPost 2s ease-in-out;
    border: 2px solid #ff3b30;
}

@keyframes highlightPost {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255,59,48,0.5);
    }
}

/* 封面提示 */
#cover-hint {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .video-carousel-content {
        height: 300px;
    }
    
    .video-carousel-title-text {
        font-size: 16px;
    }
    
    .video-carousel-meta {
        font-size: 12px;
        gap: 10px;
    }
    
    .carousel-control-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .video-carousel-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .carousel-action-btn {
        font-size: 12px;
        padding: 8px;
    }
    
    .action-icon {
        font-size: 20px;
    }
}

/* 返回顶部按钮：固定于右侧，随屏保持 */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 80px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 52px;
    padding: 10px 8px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}
.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}
.back-to-top:hover {
    border-color: #7c3aed;
    box-shadow: 0 6px 16px rgba(124,58,237,0.25);
}
.back-to-top .back-to-top-icon {
    font-size: 22px;
    font-weight: bold;
    color: #7c3aed;
    line-height: 1;
}
.back-to-top .back-to-top-text {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
}
.back-to-top:hover .back-to-top-text {
    color: #7c3aed;
}

/* 返回首页按钮样式 */
.tab-btn-home {
    margin-left: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab-btn-home:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

