/* =============================================
   社区页面 - 推特风格设计
   简约现代风格
   ============================================= */

/* 页面容器 - 居中布局 */
.community-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 72px 24px 24px;
    display: grid !important;
    grid-template-columns: 275px minmax(0, 1fr) 350px;
    gap: 24px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* =============================================
   左侧边栏 - 固定导航
   ============================================= */
.community-sidebar {
    position: sticky;
    top: 72px;
    height: fit-content;
    align-self: start;
    width: 275px;
    max-width: 275px;
}

.sidebar-nav {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 16px;
    box-shadow: none;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px;
    border-radius: 9999px;
    color: var(--text-primary, #0f1419);
    font-size: 1.25rem;
    font-weight: 500;
    transition: background-color 0.2s;
    margin-bottom: 4px;
    text-decoration: none;
}

.sidebar-nav .nav-item:hover {
    background: rgba(15, 20, 25, 0.1);
}

.sidebar-nav .nav-item.active {
    background: transparent;
    color: var(--text-primary, #0f1419);
    font-weight: 700;
}

.sidebar-nav .nav-item svg {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.post-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 32px;
    background: #1d9bf0;
    color: white;
    border: none;
    border-radius: 9999px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: none;
}

.post-btn:hover {
    background: #1a8cd8;
    transform: none;
    box-shadow: none;
}

/* =============================================
   中间内容区 - 信息流
   ============================================= */
.community-main {
    min-width: 0;
    border-left: 1px solid #eff3f4;
    border-right: 1px solid #eff3f4;
    background: #ffffff;
    max-width: 100%;
    overflow: hidden;
}

[data-theme="dark"] .community-main {
    border-left-color: #2f3336;
    border-right-color: #2f3336;
    background: #16181c;
}

/* 发布框 */
.compose-box {
    background: #ffffff !important;
    border-radius: 0;
    padding: 16px;
    margin-bottom: 0;
    box-shadow: none;
    border-bottom: 1px solid #eff3f4;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

[data-theme="dark"] .compose-box {
    background: #16181c !important;
    border-bottom-color: #2f3336;
}

.compose-box:hover {
    background: #f7f9f9 !important;
    box-shadow: none;
}

[data-theme="dark"] .compose-box:hover {
    background: #202327 !important;
}

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

.compose-input-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.compose-placeholder {
    padding: 12px 0;
    color: #536471;
    font-size: 1.25rem;
    min-height: auto;
    display: flex;
    align-items: center;
    cursor: text;
    background: transparent;
    border-radius: 0;
    border: none;
    transition: none;
}

[data-theme="dark"] .compose-placeholder {
    color: #71767b;
}

.compose-box:hover .compose-placeholder {
    border-color: transparent;
}

.compose-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
}

.compose-tools {
    display: flex;
    gap: 4px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #1d9bf0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tool-btn:hover {
    background: rgba(29, 155, 240, 0.1);
    color: #1d9bf0;
}

.publish-btn {
    padding: 0 16px;
    height: 36px;
    border-radius: 9999px;
    background: #1d9bf0;
    color: white;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.publish-btn:hover {
    background: #1a8cd8;
}

/* 建设中提示 - 隐藏 */
.construction-banner {
    display: none;
}

/* 信息流 */
.feed-list {
    display: flex;
    flex-direction: column;
}

/* 帖子卡片 - 推特风格 */
.feed-item {
    background: #ffffff;
    border-radius: 0;
    padding: 16px;
    box-shadow: none;
    border-bottom: 1px solid #eff3f4;
    transition: background-color 0.2s;
    cursor: pointer;
}

[data-theme="dark"] .feed-item {
    background: #16181c;
    border-bottom-color: #2f3336;
}

.feed-item:hover {
    background: #f7f9f9;
    box-shadow: none;
}

[data-theme="dark"] .feed-item:hover {
    background: #202327;
}

.feed-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 0;
}

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

.feed-user-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.feed-username {
    font-weight: 700;
    color: #0f1419;
    font-size: 0.95rem;
}

[data-theme="dark"] .feed-username {
    color: #e7e9ea;
}

.feed-username:hover {
    text-decoration: underline;
}

.feed-user-handle {
    color: #536471;
    font-size: 0.95rem;
}

[data-theme="dark"] .feed-user-handle {
    color: #71767b;
}

.feed-time {
    color: #536471;
    font-size: 0.95rem;
}

[data-theme="dark"] .feed-time {
    color: #71767b;
}

.feed-time::before {
    content: "·";
    margin: 0 4px;
}

.feed-more {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #536471;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: auto;
    flex-shrink: 0;
}

[data-theme="dark"] .feed-more {
    color: #71767b;
}

.feed-more:hover {
    background: rgba(29, 155, 240, 0.1);
    color: #1d9bf0;
}

/* 帖子内容 */
.feed-content {
    margin-top: 4px;
    padding-left: 52px;
}

.feed-content p {
    color: #0f1419;
    line-height: 1.5;
    margin-bottom: 12px;
    font-size: 0.95rem;
    word-wrap: break-word;
}

[data-theme="dark"] .feed-content p {
    color: #e7e9ea;
}

/* 话题标签 */
.feed-content .topic-tag {
    color: #1d9bf0;
    cursor: pointer;
}

.feed-content .topic-tag:hover {
    text-decoration: underline;
}

/* 图片展示 - 推特风格 */
.feed-images {
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
    display: grid;
    gap: 2px;
    border: 1px solid #eff3f4;
}

[data-theme="dark"] .feed-images {
    border-color: #2f3336;
}

/* 单张图片 */
.feed-images.single {
    grid-template-columns: 1fr;
}

.feed-images.single img {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s;
}

.feed-images.single img:hover {
    opacity: 0.9;
}

/* 两张图片 */
.feed-images.double {
    grid-template-columns: repeat(2, 1fr);
}

.feed-images.double img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    cursor: pointer;
}

/* 三张图片 */
.feed-images.triple {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: repeat(2, 1fr);
}

.feed-images.triple img:first-child {
    grid-row: span 2;
    height: 100%;
}

.feed-images.triple img:not(:first-child) {
    height: 140px;
}

/* 四张图片 - 2x2网格 */
.feed-images.quad {
    grid-template-columns: repeat(2, 1fr);
}

.feed-images.quad img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    cursor: pointer;
}

/* 更多图片 */
.feed-images.multiple {
    grid-template-columns: repeat(3, 1fr);
}

.feed-images.multiple img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    cursor: pointer;
}

/* 图片数量提示 */
.image-count-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(15, 20, 25, 0.75);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 操作按钮 - 推特风格 */
.feed-actions {
    display: flex;
    gap: 0;
    margin-top: 12px;
    padding-top: 12px;
    border-top: none;
    padding-left: 52px;
}

.feed-actions .action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #536471;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
    max-width: 80px;
}

[data-theme="dark"] .feed-actions .action-btn {
    color: #71767b;
}

.feed-actions .action-btn:hover {
    background: transparent;
}

/* 评论按钮 */
.feed-actions .action-btn.comment:hover {
    color: #1d9bf0;
}

.feed-actions .action-btn.comment:hover svg {
    background: rgba(29, 155, 240, 0.1);
}

/* 转发按钮 */
.feed-actions .action-btn.retweet:hover {
    color: #00ba7c;
}

.feed-actions .action-btn.retweet:hover svg {
    background: rgba(0, 186, 124, 0.1);
}

/* 点赞按钮 */
.feed-actions .action-btn.like:hover {
    color: #f91880;
}

.feed-actions .action-btn.like:hover svg {
    background: rgba(249, 24, 128, 0.1);
}

.feed-actions .action-btn.liked {
    color: #f91880;
}

.feed-actions .action-btn.liked svg {
    fill: #f91880;
}

/* 分享按钮 */
.feed-actions .action-btn.share:hover {
    color: #1d9bf0;
}

.feed-actions .action-btn.share:hover svg {
    background: rgba(29, 155, 240, 0.1);
}

.feed-actions .action-btn svg {
    width: 18px;
    height: 18px;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

/* =============================================
   右侧边栏
   ============================================= */
.community-right {
    position: sticky;
    top: 72px;
    height: fit-content;
    display: flex !important;
    flex-direction: column;
    gap: 16px;
    width: 350px;
    max-width: 350px;
}

/* 搜索框 */
.search-section {
    position: sticky;
    top: 0;
    background: #ffffff;
    padding: 12px 0;
    z-index: 10;
}

[data-theme="dark"] .search-section {
    background: #16181c;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: #eff3f4;
    border: none;
    border-radius: 9999px;
    font-size: 0.95rem;
    color: #0f1419;
    outline: none;
    transition: all 0.2s;
}

[data-theme="dark"] .search-input {
    background: #202327;
    color: #e7e9ea;
}

.search-input:focus {
    background: #ffffff;
    border: 1px solid #1d9bf0;
}

[data-theme="dark"] .search-input:focus {
    background: #16181c;
}

.search-input::placeholder {
    color: #536471;
}

/* 卡片通用样式 */
.trending-section,
.recommend-section {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #eff3f4;
}

[data-theme="dark"] .trending-section,
[data-theme="dark"] .recommend-section {
    background: #16181c;
    border-color: #2f3336;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f1419;
    margin-bottom: 0;
    padding: 12px 16px;
}

[data-theme="dark"] .section-title {
    color: #e7e9ea;
}

.section-title svg {
    color: #1d9bf0;
    width: 20px;
    height: 20px;
}

/* 热门话题 */
.trending-list {
    display: flex;
    flex-direction: column;
}

.trending-item {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-bottom: 1px solid #eff3f4;
    transition: background-color 0.2s;
    cursor: pointer;
}

[data-theme="dark"] .trending-item {
    border-bottom-color: #2f3336;
}

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

.trending-item:hover {
    background: #f7f9f9;
}

[data-theme="dark"] .trending-item:hover {
    background: #202327;
}

.trending-category {
    font-size: 0.8rem;
    color: #536471;
    margin-bottom: 2px;
}

[data-theme="dark"] .trending-category {
    color: #71767b;
}

.trending-title {
    font-weight: 700;
    color: #0f1419;
    font-size: 0.95rem;
}

[data-theme="dark"] .trending-title {
    color: #e7e9ea;
}

.trending-count {
    font-size: 0.8rem;
    color: #536471;
    margin-top: 2px;
}

[data-theme="dark"] .trending-count {
    color: #71767b;
}

.trending-rank {
    display: none;
}

/* 推荐关注 */
.recommend-list {
    display: flex;
    flex-direction: column;
}

.recommend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.recommend-item:hover {
    background: #f7f9f9;
}

[data-theme="dark"] .recommend-item:hover {
    background: #202327;
}

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

.recommend-info {
    flex: 1;
    min-width: 0;
}

.recommend-name {
    display: block;
    font-weight: 700;
    color: #0f1419;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .recommend-name {
    color: #e7e9ea;
}

.recommend-name:hover {
    text-decoration: underline;
}

.recommend-desc {
    display: block;
    font-size: 0.85rem;
    color: #536471;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .recommend-desc {
    color: #71767b;
}

.follow-btn {
    padding: 0 16px;
    height: 32px;
    background: #0f1419;
    border: none;
    border-radius: 9999px;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

[data-theme="dark"] .follow-btn {
    background: #ffffff;
    color: #0f1419;
}

.follow-btn:hover {
    background: #0a0a0a;
}

[data-theme="dark"] .follow-btn:hover {
    background: #d4d4d4;
}

/* 显示更多链接 */
.show-more {
    padding: 16px;
    color: #1d9bf0;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.show-more:hover {
    background: #f7f9f9;
}

[data-theme="dark"] .show-more:hover {
    background: #202327;
}

/* =============================================
   响应式设计
   ============================================= */
@media (max-width: 1280px) {
    .community-container {
        grid-template-columns: 275px minmax(0, 1fr);
        max-width: 100%;
    }
    
    .community-right {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .community-container {
        grid-template-columns: 1fr;
        padding: 72px 0 24px;
    }
    
    .community-sidebar {
        display: none !important;
    }
    
    .community-main {
        border-left: none;
        border-right: none;
    }
}

@media (max-width: 768px) {
    .community-container {
        padding: 56px 0 calc(70px + env(safe-area-inset-bottom, 0));
    }
    
    .feed-content {
        padding-left: 0;
    }
    
    .feed-actions {
        padding-left: 0;
    }
    
    .feed-images.double img,
    .feed-images.triple img:not(:first-child),
    .feed-images.quad img,
    .feed-images.multiple img {
        height: 150px;
    }
    
    .feed-images.triple {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    
    .feed-images.triple img:first-child {
        grid-row: span 1;
        height: 200px;
    }
}

/* =============================================
   深色主题
   ============================================= */
[data-theme="dark"] .community-main {
    border-left-color: #2f3336;
    border-right-color: #2f3336;
}

[data-theme="dark"] .feed-item:hover {
    background: #202327;
}

[data-theme="dark"] .compose-box:hover {
    background: #202327 !important;
}

/* =============================================
   隐藏桌面端不需要的元素
   ============================================= */

/* 桌面端隐藏发帖弹窗（默认隐藏） */
.post-modal-overlay {
    display: none !important;
}

.post-modal-overlay.show {
    display: flex !important;
}

/* 桌面端隐藏移动端底部导航栏 */
.mobile-bottom-nav {
    display: none !important;
}

/* 移动端显示底部导航栏 */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: #ffffff;
        border-top: 1px solid #eff3f4;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    [data-theme="dark"] .mobile-bottom-nav {
        background: #16181c;
        border-top-color: #2f3336;
    }
    
    .mobile-bottom-nav .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px;
        color: #536471;
        text-decoration: none;
        transition: color 0.2s;
    }
    
    [data-theme="dark"] .mobile-bottom-nav .nav-item {
        color: #71767b;
    }
    
    .mobile-bottom-nav .nav-item.active {
        color: #1d9bf0;
    }
    
    .mobile-bottom-nav .nav-item svg {
        width: 24px;
        height: 24px;
    }
    
    .mobile-bottom-nav .nav-item span {
        font-size: 0.65rem;
    }
}

/* =============================================
   加载状态
   ============================================= */
.loading-state {
    display: flex;
    justify-content: center;
    padding: 32px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eff3f4;
    border-top-color: #1d9bf0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

[data-theme="dark"] .loading-spinner {
    border-color: #2f3336;
    border-top-color: #1d9bf0;
}

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #536471;
}

[data-theme="dark"] .empty-state {
    color: #71767b;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin: 0;
}

/* =============================================
   Tab 切换样式
   ============================================= */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eff3f4;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
}

[data-theme="dark"] .section-header {
    border-bottom-color: #2f3336;
    background: #16181c;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f1419;
    margin: 0;
}

[data-theme="dark"] .section-header h2 {
    color: #e7e9ea;
}

.section-desc {
    font-size: 0.85rem;
    color: #536471;
    margin: 0;
}

[data-theme="dark"] .section-desc {
    color: #71767b;
}

/* =============================================
   话题页面样式
   ============================================= */
.topic-header {
    padding: 16px;
    border-bottom: 1px solid #eff3f4;
    background: #ffffff;
}

[data-theme="dark"] .topic-header {
    border-bottom-color: #2f3336;
    background: #16181c;
}

.topic-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f1419;
    margin-bottom: 8px;
}

[data-theme="dark"] .topic-title {
    color: #e7e9ea;
}

.topic-stats {
    display: flex;
    gap: 16px;
    color: #536471;
    font-size: 0.85rem;
}

[data-theme="dark"] .topic-stats {
    color: #71767b;
}

/* =============================================
   图片预览弹窗
   ============================================= */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.image-preview-overlay img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.image-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* =============================================
   移动端底部导航栏优化
   ============================================= */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: #ffffff;
        border-top: 1px solid #eff3f4;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    [data-theme="dark"] .mobile-bottom-nav {
        background: #16181c;
        border-top-color: #2f3336;
    }
    
    .mobile-bottom-nav .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px;
        color: #536471;
        text-decoration: none;
        transition: color 0.2s;
    }
    
    [data-theme="dark"] .mobile-bottom-nav .nav-item {
        color: #71767b;
    }
    
    .mobile-bottom-nav .nav-item.active {
        color: #1d9bf0;
    }
    
    .mobile-bottom-nav .nav-item svg {
        width: 24px;
        height: 24px;
    }
    
    .mobile-bottom-nav .nav-item span {
        font-size: 0.65rem;
    }
}

/* =============================================
   移动端发布按钮（浮动）
   ============================================= */
@media (max-width: 768px) {
    .mobile-post-btn {
        position: fixed;
        bottom: calc(72px + env(safe-area-inset-bottom, 0));
        right: 16px;
        width: 56px;
        height: 56px;
        background: #1d9bf0;
        border: none;
        border-radius: 50%;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(29, 155, 240, 0.4);
        z-index: 999;
        transition: background-color 0.2s, transform 0.2s;
    }
    
    .mobile-post-btn:hover {
        background: #1a8cd8;
        transform: scale(1.05);
    }
    
    .mobile-post-btn svg {
        width: 24px;
        height: 24px;
    }
}
