/* ============================================
   新闻/文章页面样式
   ============================================ */

/* ── Hero ── */
.news-hero {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    padding: 80px 0 60px;
    text-align: center;
    color: #fff;
}

.news-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.news-hero p {
    font-size: 1.1rem;
    opacity: 0.85;
}

/* ── Filter Bar ── */
.filter-section {
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 64px;
    z-index: 100;
}

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 16px;
    flex-wrap: wrap;
}

.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    background: #fff;
    color: #64748B;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    border-color: #4F46E5;
    color: #4F46E5;
}

.tab-btn.active {
    background: #4F46E5;
    border-color: #4F46E5;
    color: #fff;
}

.tab-count {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 4px;
}

.search-box {
    display: flex;
    align-items: center;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    overflow: hidden;
    min-width: 240px;
}

.search-box input {
    flex: 1;
    padding: 8px 14px;
    border: none;
    outline: none;
    font-size: 0.85rem;
}

.search-box button {
    padding: 8px 12px;
    border: none;
    background: #fff;
    cursor: pointer;
    color: #64748B;
    transition: color 0.2s;
}

.search-box button:hover {
    color: #4F46E5;
}

/* ── Articles List ── */
.articles-section {
    padding: 40px 0 80px;
    min-height: 400px;
}

.articles-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #E2E8F0;
}

.list-loading {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}

/* ── Article List Item ── */
.article-item {
    display: flex;
    align-items: stretch;
    gap: 20px;
    padding: 24px 16px;
    border-bottom: 1px solid #E2E8F0;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.article-item:hover {
    background: #F8FAFC;
}

.article-item:hover .item-title {
    color: #4F46E5;
}

/* 日期区域 */
.item-date {
    flex-shrink: 0;
    width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 2px;
}

.item-date-day {
    font-size: 1.75rem;
    font-weight: 800;
    color: #4F46E5;
    line-height: 1;
}

.item-date-month {
    font-size: 0.75rem;
    color: #94A3B8;
    font-weight: 500;
    margin-top: 4px;
}

/* 内容区域 */
.item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.item-category {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    background: #EEF2FF;
    color: #4F46E5;
    font-size: 0.75rem;
    font-weight: 600;
}

.item-views {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #94A3B8;
}

.item-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1E293B;
    line-height: 1.4;
    transition: color 0.2s;
}

.item-summary {
    font-size: 0.9rem;
    color: #64748B;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 右侧箭头 */
.item-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: #CBD5E1;
    transition: color 0.2s, transform 0.2s;
}

.article-item:hover .item-arrow {
    color: #4F46E5;
    transform: translateX(4px);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #94A3B8;
}

.empty-state p {
    margin-top: 16px;
    font-size: 1rem;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    color: #475569;
    transition: all 0.2s;
    min-width: 36px;
}

.pagination button:hover:not(:disabled) {
    border-color: #4F46E5;
    color: #4F46E5;
}

.pagination button.active {
    background: #4F46E5;
    border-color: #4F46E5;
    color: #fff;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 0 4px;
    color: #94A3B8;
}

.page-info {
    font-size: 0.8rem;
    color: #94A3B8;
    margin-left: 8px;
}

/* ── Spinner ── */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #E2E8F0;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   文章详情页
   ============================================ */

.article-detail {
    padding: 60px 0 80px;
    display: none;
}

.article-header {
    max-width: 760px;
    margin: 0 auto 32px;
    text-align: center;
}

.article-meta-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.category-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 16px;
    background: #EEF2FF;
    color: #4F46E5;
    font-size: 0.8rem;
    font-weight: 600;
}

.article-date,
.article-views {
    font-size: 0.85rem;
    color: #94A3B8;
}

.article-title {
    font-size: 2rem;
    font-weight: 800;
    color: #1E293B;
    line-height: 1.3;
    margin-bottom: 12px;
}

.article-summary {
    font-size: 1.05rem;
    color: #64748B;
    line-height: 1.7;
}

/* 封面图 */
.article-cover {
    max-width: 900px;
    margin: 0 auto 40px;
    border-radius: 12px;
    overflow: hidden;
}

.article-cover img {
    width: 100%;
    height: auto;
    display: block;
}

/* 富文本内容区 */
.article-content {
    max-width: 760px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.8;
    color: #334155;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    color: #1E293B;
    margin: 1.5em 0 0.6em;
    line-height: 1.3;
}

.article-content h1 { font-size: 1.6rem; }
.article-content h2 { font-size: 1.4rem; }
.article-content h3 { font-size: 1.2rem; }
.article-content h4 { font-size: 1.05rem; }

.article-content p {
    margin: 0 0 1em;
}

.article-content ul,
.article-content ol {
    margin: 0 0 1em;
    padding-left: 1.5em;
}

.article-content li {
    margin-bottom: 0.4em;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
}

.article-content a {
    color: #4F46E5;
    text-decoration: underline;
}

.article-content blockquote {
    border-left: 4px solid #4F46E5;
    padding: 12px 20px;
    margin: 1.5em 0;
    background: #F8FAFC;
    border-radius: 0 8px 8px 0;
    color: #475569;
}

.article-content code {
    background: #F1F5F9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Fira Code', monospace;
}

.article-content pre {
    background: #1E293B;
    color: #E2E8F0;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
}

.article-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.9rem;
}

.article-content th,
.article-content td {
    border: 1px solid #E2E8F0;
    padding: 10px 14px;
    text-align: left;
}

.article-content th {
    background: #F8FAFC;
    font-weight: 600;
}

.article-content hr {
    border: none;
    border-top: 1px solid #E2E8F0;
    margin: 2em 0;
}

/* 文章导航 */
.article-nav {
    max-width: 760px;
    margin: 48px auto 0;
    padding-top: 32px;
    border-top: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.article-nav a {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    text-decoration: none;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    background: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-nav a:hover:not(.disabled) {
    border-color: #4F46E5;
    color: #4F46E5;
    background: #EEF2FF;
}

.article-nav a.next {
    text-align: right;
}

.article-nav a span {
    display: block;
    font-size: 0.75rem;
    color: #94A3B8;
    margin-bottom: 6px;
    font-weight: 400;
}

.article-nav a.disabled {
    color: #CBD5E1;
    background: #F8FAFC;
    cursor: default;
    pointer-events: none;
}

.article-nav a.disabled span {
    color: #CBD5E1;
}

/* 返回按钮 */
.article-back {
    max-width: 760px;
    margin: 24px auto 0;
    text-align: center;
}

/* ── Loading & Error States ── */
.loading-state,
.error-state {
    text-align: center;
    padding: 100px 20px;
}

.loading-state .spinner {
    margin: 0 auto 16px;
}

.loading-state p {
    color: #94A3B8;
}

.error-state p {
    margin: 16px 0 24px;
    color: #64748B;
    font-size: 1rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .news-hero {
        padding: 60px 0 40px;
    }

    .news-hero h1 {
        font-size: 1.8rem;
    }

    .filter-section {
        position: static;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

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

    .article-item {
        padding: 18px 8px;
        gap: 14px;
    }

    .item-date {
        width: 56px;
    }

    .item-date-day {
        font-size: 1.4rem;
    }

    .item-title {
        font-size: 1rem;
    }

    .item-summary {
        display: none;
    }

    .item-arrow {
        display: none;
    }

    .article-title {
        font-size: 1.5rem;
    }

    .article-nav {
        flex-direction: column;
    }

    .article-nav a.next {
        text-align: left;
    }
}
