/* 引入通用樣式 */
@import url('common-buttons.css');
@import url('common-rating.css');

.forum-grid-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* 控制區樣式 */
.forum-controls {
    display: flex;
    justify-content: space-between;
    /* align-items: center; */
    padding: 0 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

/* 排序按鈕樣式 */
.sort-container {
    position: relative;
}

.sort-buttons {
    display: flex;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
}

.sort-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    background: #FFFFFF;
    border: none;
    border-right: 1px solid #E5E7EB;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sort-btn:last-child {
    border-right: none;
}

.sort-btn.active {
    background: #F9FAFB;
    color: #111827;
    font-weight: 600;
}

.sort-btn:hover:not(.active) {
    background: #F9FAFB;
}

.sort-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* 禁用狀態的排序按鈕樣式 */
.sort-btn:disabled,
.sort-btn.disabled {
    background: #F3F4F6 !important;
    color: #9CA3AF !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    pointer-events: none;
}

.sort-btn:disabled:hover,
.sort-btn.disabled:hover {
    background: #F3F4F6 !important;
    color: #9CA3AF !important;
    transform: none !important;
}

.sort-btn:disabled svg,
.sort-btn.disabled svg {
    stroke: #9CA3AF !important;
}

.sort-btn:disabled.active,
.sort-btn.disabled.active {
    background: #F3F4F6 !important;
    color: #9CA3AF !important;
    font-weight: 500 !important;
}

/* 發布貼文按鈕 - 新樣式 */
.create-post-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--primary-color, #B89B5E);
    color: #FFFFFF;
    border: 2px solid transparent;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0px 1px 2px 0px rgba(10, 13, 18, 0.05), 
                inset 0px -2px 0px 0px rgba(10, 13, 18, 0.05), 
                inset 0px 0px 0px 1px rgba(10, 13, 18, 0.18);
    white-space: nowrap;
}

.create-post-btn:hover {
    background: var(--primary-dark, #8C7747);
    transform: translateY(-1px);
}

.create-post-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* 按鈕樣式已移至 common-buttons.css */

/* 貼文容器 - 修復手機版居中問題 */
.posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    padding: 0 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    justify-content: center;
}

/* 無內容樣式 - 香檳金配色 */
.empty-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    background: var(--background-light, #F5F5F7);
    border-radius: 12px;
    border: 1px solid var(--border-color, #E9EAEB);
}

.empty-icon {
    font-size: 36px;
    color: var(--text-muted, #A4A7AE);
    margin-bottom: 12px;
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark, #181D27);
    margin-bottom: 6px;
}

.empty-description {
    color: var(--text-light, #414651);
    margin-bottom: 12px;
}

/* 載入更多容器樣式 */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    margin-bottom: 88px;
}

/* 加載中動畫 - 香檳金色調 */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-light, #414651);
    font-size: 14px;
}

.spinner-circle {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #E9EAEB);
    border-top-color: var(--primary-color, #B89B5E);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

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

/* 響應式設計 - 確保在所有設備上正確顯示並居中 */
@media (max-width: 1200px) {
    .posts-container {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        padding: 0 12px;
        max-width: 1000px;
    }
}

/* 中等屏幕優化 - 1280px 到 1051px */
@media (max-width: 1280px) and (min-width: 1051px) {
    .forum-grid-container {
        width: 100% !important;
        max-width: 900px !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }
    
    .posts-container {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 16px;
        max-width: 900px !important;
        justify-content: center;
        margin: 0 auto;
    }
}

@media (max-width: 1100px) and (min-width: 1051px) {
    .forum-grid-container {
        max-width: 800px !important;
    }
    
    .posts-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        padding: 0 16px !important;
        max-width: 800px !important;
    }
}

/* 擴展1fr佈局到800px-1050px範圍 */
@media (max-width: 1050px) and (min-width: 801px) {
    .forum-grid-container {
        width: 100% !important;
        max-width: 700px !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }
    
    .posts-container {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        padding: 0 16px !important;
        max-width: 700px !important;
        justify-content: center;
        margin: 0 auto;
    }
}

/* 小屏幕800px以下 - 配合全屏Detail佈局 */
@media (max-width: 800px) {
    .forum-grid-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    .sort-buttons, .create-post-btn {
        width: 100%;
    }

    .sort-buttons {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .sort-btn {
        min-width: 80px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .posts-container {
        grid-template-columns: 1fr !important;
        padding: 0 12px !important;
        width: 100%;
        max-width: 100% !important;
    }
    
    .empty-posts {
        padding: 30px 16px;
    }
}

@media (max-width: 991px) {
    .forum-grid-container {
        width: 100% !important;
        max-width: 800px !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }
    
    .posts-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        padding: 0 16px !important;
        max-width: 800px !important;
        justify-content: center;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .forum-grid-container {
        max-width: 100% !important;
    }
    
    .forum-controls {
        /* flex-direction: column; */
        align-items: center;
        /* justify-content: center; */
        padding: 0 12px !important;
        /* gap: 12px; */
    }

    .sort-buttons, .create-post-btn {
        width: 100%;
    }

    .sort-buttons {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .sort-btn {
        min-width: 80px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .posts-container {
        grid-template-columns: 1fr !important;
        padding: 0 12px !important;
        width: 100%;
        max-width: 100% !important;
    }
}

/* 確保貼文卡片在小屏幕上正確顯示 */
@media (max-width: 480px) {
    .sort-btn {
        min-width: 70px;
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
    }
    
    .sort-btn svg {
        width: 14px;
        height: 14px;
    }
} 