/* =================================================================
   SBM FORUM STYLES (Fixed Layout)
   ================================================================= */

/* [YÊU CẦU 3] Sửa hình nền bị cắt: Đảm bảo container trong suốt */
.sbm-forum-page {
    background: transparent !important; /* Cho phép hình nền body hiện ra */
}
.sbm-forum-page .sbmalpha-wrapper {
    background: transparent !important; /* Xóa nền trắng của wrapper cũ */
    max-width: 1000px;
    margin: 0 auto;
    padding-top: 0;
}

/* [YÊU CẦU 2] Header chuẩn, bỏ nền trắng cũ */
.sbm-forum-header {
    display: none; /* Ẩn header cũ nếu còn sót lại */
}

/* [YÊU CẦU 5] Nút Tạo chủ đề */
.sbm-forum-actions-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}
#sbm-create-topic-btn {
    width: auto !important; /* Không chiếm hết chiều ngang */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    /* [YÊU CẦU 4] Giảm kích thước cho giống trang chủ */
    padding: 0.6rem 2rem; 
    font-size: 0.9rem; 
    font-weight: 600;
    
    border-radius: 50px; /* Bo tròn hoàn toàn */
    background: var(--sbm-primary-color);
    color: #fff;
    border: none;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
    transition: transform 0.2s;
    cursor: pointer;
}
#sbm-create-topic-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.4);
}

.sbm-forum-cats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.sbm-forum-cat-btn {
    /* Giảm padding và font size */
    padding: 0.8rem 0.5rem;
    font-size: 0.85rem; 
    
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 12px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sbm-forum-cat-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    color: var(--sbm-primary-color);
}
.sbm-forum-cat-btn.is-active {
    background: var(--sbm-primary-color);
    color: #fff;
    border-color: var(--sbm-primary-color);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

/* [YÊU CẦU 4] Danh sách chủ đề: 2 cột desktop */
.sbm-topic-list {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 cột */
    gap: 1rem;
}

/* Card bài viết */
.sbm-topic-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 1rem; /* Giảm padding */
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sbm-topic-item:hover {
    transform: translateY(-3px);
    border-color: var(--sbm-primary-color);
}

.topic-header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.topic-cat-badge {
    font-size: 0.65rem; /* Nhỏ hơn */
    padding: 3px 8px;
    background: #f3f4f6; color: #6b7280; border-radius: 4px; font-weight: 600;
}

.topic-title {
    font-size: 1rem; /* Nhỏ hơn */
    font-weight: 700; color: #111; margin: 0 0 0.4rem 0; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.topic-stats-mini { font-size: 0.7rem; color: #9ca3af; display: flex; gap: 6px; }

.topic-excerpt {
    font-size: 0.85rem; color: #6b7280; margin: 0 0 0.8rem 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    flex-grow: 1;
}

.topic-footer-row {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid #f3f4f6; padding-top: 0.6rem;
}

.topic-author-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.topic-avatar-small { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.topic-author-name { font-size: 0.75rem; font-weight: 600; color: #4b5563; margin-left: 6px; }
.topic-date-small { font-size: 0.7rem; color: #9ca3af; }

/* [YÊU CẦU 6 - Mobile] Slide ngang cho danh mục & 1 cột cho bài viết */
@media (max-width: 768px) {
    .sbm-forum-cats-container {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 5px;
        scrollbar-width: none;
    }
    .sbm-forum-cat-btn {
        flex: 0 0 auto;
        min-width: 110px;
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
    }
    .sbm-topic-list { grid-template-columns: 1fr; }
    
    .sbmalpha-wrapper {
        padding: 1rem; /* Giảm padding trên mobile */
    }
}

/* [YÊU CẦU - Bài viết chi tiết] Dàn đều, không co cụm */
.sbm-topic-detail-wrapper {
    background: #fff; border-radius: 16px; padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.topic-big-title { font-size: 1.6rem; margin-bottom: 0.8rem; }

.topic-body-content { font-size: 1rem; line-height: 1.6; }
.topic-body-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

/* [YÊU CẦU - Nút Back] Chỉnh lại đẹp hơn */
.sbm-back-btn {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.8);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}
.sbm-back-btn:hover {
    background: #fff;
    color: var(--sbm-primary-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
/* [THÊM MỚI] CSS cho Popup Tạo Chủ Đề */
.sbm-forum-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 20000;
    display: none; /* Mặc định ẩn */
    align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}

/* Kích hoạt hiển thị khi dùng toggleModal */
.sbm-forum-modal-overlay.sbmalpha-active,
.sbm-forum-modal-overlay.is-visible {
    display: flex !important;
}

/* Style cho container bên trong */
.sbm-forum-modal-container {
    background: #fff;
    width: 90%; max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    display: flex; flex-direction: column;
    max-height: 90vh;
}

.sbm-forum-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 700; font-size: 1.1rem;
}

.sbm-forum-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.sbm-forum-form-group { margin-bottom: 15px; }
.sbm-forum-form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; }
.sbm-forum-input, .sbm-forum-select, .sbm-forum-textarea {
    width: 100%; padding: 10px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-family: inherit; box-sizing: border-box;
}
.sbm-forum-textarea { min-height: 150px; resize: vertical; }