:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --text-muted: #6c757d;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background-color: var(--light-bg);
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ============ 导航条样式 ============ */
.navbar-main {
    background: white;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    padding: 0;
}

.navbar-main .container-lg {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    gap: 20px;
}

/* 左侧容器 */
.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    margin: 0 !important;
    white-space: nowrap;
}

.navbar-brand i {
    font-size: 20px;
}

.navbar-nav {
    display: flex !important;
    align-items: center;
    margin: 0 !important;
}

.nav-link {
    color: var(--text-light) !important;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 6px;
}

.nav-link:hover {
    color: var(--primary-color) !important;
    background: var(--bg-light);
}

/* 右侧容器 */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: flex-end;
}

.navbar-right .btn {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* 搜索框 */
.search-box {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-light);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    padding: 0;
    min-width: 200px;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    color: var(--text-dark);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.search-btn:hover {
    color: var(--primary-color);
}



/* 图标按钮 */
.nav-icon-btn {
    position: relative;
    color: var(--text-light) !important;
    padding: 8px 12px !important;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.nav-icon-btn:hover {
    color: var(--primary-color) !important;
    background: var(--bg-light);
}

.nav-icon-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* 用户头像导航 */
.user-avatar-nav {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.navbar-user-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: var(--text-dark);
    font-size: 14px;
}

.navbar-user-btn:hover {
    background: var(--bg-light);
}

/* 下拉菜单 */
.dropdown-menu-custom {
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
}

.dropdown-item {
    padding: 10px 16px;
    color: var(--text-dark);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.dropdown-divider {
    margin: 4px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar-main .container-lg {
        flex-wrap: wrap;
        padding: 12px 0;
    }

    .navbar-left {
        width: 100%;
        justify-content: space-between;
    }

    .navbar-right {
        width: 100%;
        margin-top: 12px;
        order: 3;
        justify-content: space-between;
    }

    .search-box {
        min-width: auto;
        flex: 1;
    }

    .write-btn span {
        display: none;
    }

    .nav-icon-btn span {
        display: none;
    }

    .navbar-user-btn span {
        display: none;
    }
}

/* ============ 主体布局 ============ */
.main-wrapper {
    padding: 24px 0;
    min-height: calc(100vh - 70px);
}

.container-lg {
    max-width: 1400px;
}

/* ============ 侧栏卡片 ============ */
.sidebar-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title i {
    color: var(--primary-color);
    font-size: 16px;
}

/* ============ 分类列表 ============ */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    padding: 10px 12px;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.category-item:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.category-item.active {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.category-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--border-color);
    padding: 2px 8px;
    border-radius: 12px;
}

/* 发布卡片 */
.moment-publish-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.moment-publish-header {
    display: flex;
    gap: 12px;
}

/* 输入框容器 */
.moment-textarea-wrapper {
    position: relative;
}

/* 输入框样式 */
.moment-publish-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    background-color: #f8f9fa;
}

.moment-publish-textarea:focus {
    outline: none;
    border-color: #0d6efd;
    background-color: white;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* 字数计数 */
.moment-char-count {
    position: absolute;
    right: 8px;
    bottom: 8px;
    font-size: 12px;
    color: #999;
}

/* ============ 图片预览网格 - 9宫格，每行3张 ============ */
.moment-image-preview {
    display: none;
    width: 50%;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.moment-image-preview[style*="display: grid"] {
    display: grid;
}

/* 加载占位符 */
.moment-image-loading {
    aspect-ratio: 1;
    border: 2px dashed #ddd;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    color: #666;
}

/* 工具栏 */
.moment-publish-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.moment-tool-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.moment-tool-btn:hover {
    color: #666;
}

.moment-tool-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}



@media (max-width: 768px) {
    .moment-image-preview {
        grid-template-columns: repeat(2, 1fr);
    }

    .moment-publish-footer {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .moment-publish-btn {
        width: 100%;
    }
}

/* ============ Toast 样式和动画 ============ */
.toast-container {
    z-index: 1050;
    top: 20px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%);
    width: auto !important;
    padding: 0 !important;
}

.toast {
    min-width: auto;
    max-width: 400px;
    width: fit-content;
    border: none;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideInDown 0.3s ease-out;
    background: white;
    margin-bottom: 8px;
}

.toast.hide {
    animation: slideOutUp 0.3s ease-in forwards;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Toast 主体 - 只显示消息 */
.toast-body {
    padding: 10px 16px;
    font-size: 14px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.toast-body i {
    font-size: 16px;
    flex-shrink: 0;
}

/* Toast 头部隐藏 */
.toast .toast-header {
    display: none;
}

/* Toast 背景色 - 简化，只用背景色 */
.toast.toast-success {
    background-color: #d4edda;
}

.toast.toast-success .toast-body {
    color: #155724;
}

.toast.toast-error {
    background-color: #f8d7da;
}

.toast.toast-error .toast-body {
    color: #721c24;
}

.toast.toast-warning {
    background-color: #fff3cd;
}

.toast.toast-warning .toast-body {
    color: #856404;
}

.toast.toast-info {
    background-color: #d1ecf1;
}

.toast.toast-info .toast-body {
    color: #0c5460;
}

/* ============ 帖子列表 ============ */
.thread-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.thread-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.thread-header {
    padding: 12px 16px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.thread-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 8px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--primary-color);
    text-transform: uppercase;
}

.thread-meta {
    flex: 1;
    min-width: 0;
}

.thread-author {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}


.thread-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.thread-time:hover {
    color: var(--primary-color);
}

.thread-body {
    padding: 0 16px 16px;
}

.thread-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: color 0.3s ease;
}

.thread-title:hover {
    color: var(--primary-color);
}

.thread-content {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thread-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.thread-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.thread-stat:hover {
    color: var(--primary-color);
}

.thread-stat i {
    font-size: 14px;
}

/* ============ 帖子内容中的图片网格 ============ */
.thread-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.thread-image {
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.thread-image:hover {
    transform: scale(1.02);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .thread-images-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .thread-images-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* ============ 详情页布局 ============ */
.back-button {
    margin-bottom: 16px;
}

.back-button a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-button a:hover {
    gap: 10px;
    color: var(--primary-dark);
}

.breadcrumb-container {
    margin-bottom: 20px;
}

.breadcrumb-custom {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 0;
}

.breadcrumb-custom .breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-custom .breadcrumb-item a:hover {
    text-decoration: underline;
}

/* ============ 帖子详情卡片 ============ */
.thread-detail-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: visible; /* 防止下拉被截断 */
}




.thread-detail-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.thread-detail-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
    line-height: 1.4;
    word-break: break-word;
}

.thread-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
    align-items: center;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: white;
    background-color: var(--primary-color);
    text-transform: uppercase;
    flex-shrink: 0;
}

.meta-author {
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: color 0.3s ease;
}

.meta-author:hover {
    color: var(--primary-color);
}

.thread-detail-content {
    padding: 20px;
    line-height: 1.8;
    font-size: 15px;
    color: #333;
}

.thread-detail-content p {
    margin-bottom: 16px;
}

.thread-detail-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.thread-detail-content a:hover {
    text-decoration: underline;
}

.thread-detail-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.action-btn:hover {
    background: var(--light-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-btn i {
    font-size: 16px;
}

/* ============ 评论区域 ============ */
.comments-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-top: 20px;
}

.comments-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.comments-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comments-count {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.comments-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    padding: 16px;
    background: var(--light-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.comment-item:hover {
    border-color: var(--primary-color);
}

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

.comment-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: white;
    background-color: var(--primary-color);
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comment-avatar:hover {
    opacity: 0.8;
}

.comment-info {
    flex: 1;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: color 0.3s ease;
}

.comment-author:hover {
    color: var(--primary-color);
}

.comment-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.comment-content {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    word-break: break-word;
    margin-bottom: 12px;
}

.comment-actions {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.comment-action {
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-action:hover {
    color: var(--primary-color);
}

.comments-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.comment-form {
    display: flex;
    gap: 12px;
}

.comment-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s ease;
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.comment-submit {
    display: flex;
    align-items: flex-end;
}

.comment-submit button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.comment-submit button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ============ 统计信息 ============ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: var(--light-bg);
    border-radius: 8px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-value-small {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 4px;
    word-break: break-all;
}

/* ============ 用户信息 ============ */
.user-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-stat-item {
    padding: 12px;
    background: var(--light-bg);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.info-item .label {
    color: var(--text-muted);
    font-size: 12px;
}

.info-item .value {
    font-weight: 600;
    color: #333;
    text-align: right;
}

/* ============ 表单 ============ */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    font-size: 14px;
    background-color: white;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

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

.auth-form {
    display: block;
}

/* ============ 模态框 ============ */
.modal-content {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: white;
}

.modal-title {
    font-weight: 700;
    color: #333;
    font-size: 16px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.btn-close {
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 0.8;
}

/* ============ 工具类 ============ */
.text-muted {
    color: var(--text-muted);
}

.small {
    font-size: 12px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mb-4 {
    margin-bottom: 24px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 24px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 16px;
}

.gap-4 {
    gap: 24px;
}

.error-message {
    padding: 16px;
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.error-message i {
    font-size: 18px;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

/* ============ 用户主页卡片 ============ */
.profile-card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.profile-header {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-color);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
    font-weight: bold;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.profile-username {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.profile-group {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 8px;
}

.profile-bio {
    color: var(--text-light);
    font-size: 14px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.profile-stats .stat-item {
    text-align: center;
}

.profile-stats .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.profile-stats .stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.profile-actions .action-btn {
    flex: 1;
    max-width: 150px;
}

.profile-threads-card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.profile-threads-card .card-header {
    padding: 16px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.profile-threads-card .card-header h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-threads-card .card-body {
    padding: 20px 16px;
}

/* ============ 推荐用户卡片 ============ */
.recommend-user-card {
    margin-bottom: 12px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.user-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

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

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-name:hover {
    color: var(--primary-color);
}

.user-group {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.follow-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.follow-btn:hover {
    background: var(--primary-hover);
}

/* ============ 响应式 - 用户主页 ============ */
@media (max-width: 768px) {
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-actions {
        flex-direction: column;
    }

    .profile-actions .action-btn {
        max-width: 100%;
    }
}



/* ============ 动画 ============ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ 响应式设计 ============ */
@media (max-width: 992px) {
    .main-wrapper {
        padding: 16px 0;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .thread-detail-meta {
        gap: 8px;
    }

    .col-lg-3 {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar-brand span {
        display: none;
    }

    .navbar-nav .nav-link span {
        display: none;
    }

    .navbar-nav .nav-link {
        padding: 8px 8px !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .thread-detail-meta {
        flex-direction: column;
        gap: 12px;
    }

    .thread-detail-actions {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }

    .thread-detail-title {
        font-size: 20px;
    }

    .comment-form {
        flex-direction: column;
    }

    .comment-submit {
        align-items: stretch;
    }

    .comment-submit button {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .container-lg {
        padding-left: 12px;
        padding-right: 12px;
    }

    .sidebar-card,
    .publish-card,
    .thread-card,
    .thread-detail-card,
    .comments-card {
        border-radius: 8px;
    }

    .thread-title {
        font-size: 14px;
    }

    .thread-content {
        font-size: 12px;
    }

    .publish-footer {
        flex-direction: column;
    }

    .publish-btn {
        width: 100%;
    }

    .thread-detail-actions,
    .comments-header {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }

    .thread-detail-title {
        font-size: 18px;
    }
}

/* ============ 菜单样式 ============ */
.thread-menu-container {
    position: relative;
    margin-left: auto;
    z-index: 10;
}



.thread-menu-toggle {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.3s;
    font-size: 18px;
    color: #999;
}

.thread-menu-toggle:hover {
    background: #f0f0f0;
    color: #333;
}

.thread-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.thread-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.thread-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}

.thread-menu-item:hover {
    background: #f5f5f5;
    color: #667eea;
}

.thread-menu-item:first-child {
    border-radius: 6px 6px 0 0;
}

.thread-menu-item:last-child {
    border-radius: 0 0 6px 6px;
}

.thread-menu-item i {
    font-size: 16px;
}

/* ============ 九宫格图片样式 ============ */
.thread-images-grid {
    display: grid;
    gap: 2px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.thread-images-grid.grid-1 {
    grid-template-columns: 1fr;
    max-width: 300px;
}

.thread-images-grid.grid-1 a {
    display: block;
}

.thread-images-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 300px;
}

.thread-images-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
    width: 50%;
}

.thread-images-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
}

.thread-images-grid.grid-9 {
    grid-template-columns: repeat(3, 1fr);
    width: 50%;
}

.thread-images-grid a {
    display: block;
    overflow: hidden;
    background: #f0f0f0;
    aspect-ratio: 1;
    transition: transform 0.3s ease;
}

.thread-images-grid a:hover {
    transform: scale(1.05);
}

.thread-images-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

img.size-thumb {
    max-width: 100%;
    max-height: 550px;
}

img.size-thumb, img.size-small {
    display: inline-block;
    height: auto;
    border: 1px solid #f0f0f0;
    border-radius: 3px;
    margin-bottom: 0.5rem;
}

/* 帖子类型（post）的列表卡片样式增强 */
.thread-post-activity {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.thread-post-activity a {
  color: var(--primary-color);
  text-decoration: none;
}
.thread-post-activity a:hover { text-decoration: underline; }

.post-preview-card {
    display: flex;
    align-items: center;
    padding-right: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.post-preview-text {
  flex: 1;
  padding: 12px 14px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-preview-title a {
  color: var(--text-dark);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  text-decoration: none;
}
.post-preview-title a:hover { color: var(--primary-color); }

.post-preview-abstract {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 板块标签样式 */
.post-preview-tag {
    margin-top: 10px;
    font-size: 12px;
    color: #888;
    border-radius: 20px;
    background: #eee;
    width: max-content;
    padding-right: 8px;
    border: 1px solid #ececec;
    display: flex;
    align-items: center;
    gap: 2px;
}

.post-preview-tag .forum-icon {
  width: 20px; height: 20px;
  border-radius: 100%;
  object-fit: cover;
  background: #eee;
  margin-right: 3px;
  box-shadow: 0 1px 2px #0001;
}

.post-preview-image {
  width: 100px;
  height: 100px;
  display: block;
  position: relative;
  background: #f6f7f9;
      border-radius: 10px;
}
.post-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
 border-radius: 10px;
}

@media (max-width: 576px) {
  .post-preview-card { flex-direction: column; }
  .post-preview-image { width: 100%; min-width: 0; height: 180px; }
}