/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
.header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #1890ff;
}

.btn-link {
    color: #1890ff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.3s;
}

.btn-link:hover {
    background: #f0f0f0;
}

/* 主要内容 */
.main {
    padding: 20px 0;
    min-height: calc(100vh - 140px);
}

/* 顶部区域 */
.top-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 关键词选择器 */
.keyword-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.keyword-label {
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.keyword-select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #1890ff;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    background: #fff;
    transition: all 0.3s;
}

.keyword-select:hover {
    border-color: #40a9ff;
}

.keyword-select:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.search-input:focus {
    border-color: #1890ff;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-success {
    background: #52c41a;
    color: #fff;
}

.btn-success:hover {
    background: #73d13d;
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-danger:hover {
    background: #ff7875;
}

/* 统计栏 */
.stats-bar {
    display: flex;
    gap: 30px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    color: #8c8c8c;
    font-size: 14px;
}

.stat-value {
    color: #1890ff;
    font-weight: bold;
    font-size: 16px;
}

/* 排序栏 */
.sort-bar {
    background: #fff;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sort-btn {
    padding: 8px 16px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
}

.sort-btn:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.sort-btn.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

/* 讨论列表 */
.discussions-wrapper {
    min-height: 400px;
}

.discussions-list {
    display: flex;
    flex-direction: column;
    gap: 0; /* 间距移到 .discussion-card-link 的 margin-bottom */
}

/* 讨论卡片 */
/* 讨论卡片外层链接 */
.discussion-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    margin-bottom: 20px;
}

/* 讨论卡片 */
.discussion-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s;
    position: relative; /* 为绝对定位的序号准备 */
}

.discussion-card-link:hover .discussion-card {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* 已访问链接样式 - 整个卡片变色 */
.discussion-card-link:visited .discussion-card {
    background: #c9c9c9; /* 深灰背景 */
    border-left: 4px solid #bfbfbf; /* 左侧灰色边框 */
}

/* 已访问链接样式 - 标题颜色加深 */
.discussion-card-link:visited .discussion-title {
    color: #595959; /* 从 #8c8c8c 加深到 #595959 */
}

/* 已访问链接样式 - 内容颜色加深 */
.discussion-card-link:visited .discussion-content {
    color: #8c8c8c; /* 从 #999 加深到 #8c8c8c */
}

/* 讨论序号 - 专业卡片样式 */
.discussion-index {
    position: absolute;
    top: 20px;
    left: -65px;  /* 放在卡片左侧外部 */
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: #ff6b35;  /* 鲜艳的橙红色 */
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 45px;
    text-align: center;
    box-shadow: 0 3px 6px rgba(255, 107, 53, 0.3);
    border: 2px solid #fff;
    line-height: 1;
}

/* 序号前添加 # 符号效果 */
.discussion-index::before {
    content: '#';
    font-size: 12px;
    opacity: 0.8;
    margin-right: 2px;
}

/* 已访问 - 序号变浅灰 */
.discussion-card-link:visited .discussion-index {
    background: #d9d9d9;  /* 浅灰色 */
    color: #8c8c8c;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: #f0f0f0;
}

.discussion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 专栏标识 */
.article-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 12px;
    font-weight: normal;
    border-radius: 3px;
    line-height: 1.5;
}

.article-icon {
    font-size: 18px;
    margin-right: 5px;
}

.discussion-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #8c8c8c;
    font-size: 13px;
}

.discussion-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
}

.discussion-content {
    color: #666;
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 15px;
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.discussion-content.expanded {
    max-height: none;
}

.discussion-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    max-height: 500px;
    margin: 10px 0;
}

.discussion-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.discussion-actions {
    display: flex;
    gap: 20px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #8c8c8c;
    font-size: 13px;
}

.action-item .icon {
    font-size: 16px;
}

/* 查看详情提示文字 */
.view-detail-hint {
    color: #1890ff;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.discussion-card-link:hover .view-detail-hint {
    color: #40a9ff;
    transform: translateX(4px);
}

/* 已访问的提示文字变淡 */
.discussion-card-link:visited .view-detail-hint {
    color: #8c8c8c;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #8c8c8c;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    outline: none;
}

.page-btn:hover:not(:disabled) {
    color: #e8d312;
    border-color: #1890ff;
}

.page-btn.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    color: #8c8c8c;
    font-size: 14px;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-size-selector select {
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

/* 页脚 */
.footer {
    background: #fff;
    border-top: 1px solid #e5e5e5;
    padding: 20px 0;
    text-align: center;
    color: #8c8c8c;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .search-bar {
        flex-direction: column;
    }

    .stats-bar {
        flex-direction: column;
        gap: 10px;
    }

    .sort-bar {
        flex-wrap: wrap;
    }

    .discussion-footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .pagination {
        flex-wrap: wrap;
    }
}

/* 消息提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #52c41a;
}

.toast.error {
    border-left: 4px solid #ff4d4f;
}

.toast.info {
    border-left: 4px solid #1890ff;
}

