@import '../css/sub.css';

/* ============================================
   新闻中心页面样式 - News Center Styles
   ============================================
   遵循BEM命名规范，确保样式隔离性和可维护性
   设计系统基于现有变量：--color-primary, --color-text等
   ============================================ */

/* --------------------------------------------
   新闻页面容器 - News Container
   -------------------------------------------- */
.p-news {
    padding: 3rem 1rem;
    max-width: 1500px;
    margin: 0 auto;
}

@media screen and (max-width: 768px) {
    .p-news {
        padding: 2rem 1rem;
    }
}

/* --------------------------------------------
   新闻分类导航 - News Categories
   -------------------------------------------- */
.news-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

/* 分类链接基础样式 */
.news-grid a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 2rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
    background-color: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: 2rem;
    transition: all var(--transition-normal);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

/* 分类链接悬停效果 */
.news-grid a:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background-color: rgba(0, 91, 172, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 当前激活分类 */
.news-grid a.active,
.news-grid a[class*="active"] {
    color: var(--color-text-white);
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.news-grid a.active:hover,
.news-grid a[class*="active"]:hover {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    transform: translateY(-2px);
}

/* 响应式：移动端分类导航 */
@media screen and (max-width: 768px) {
    .news-grid {
        gap: 0.75rem;
        margin-bottom: 2rem;
        padding: 0;
    }

    .news-grid a {
        padding: 0.625rem 1.5rem;
        font-size: 0.875rem;
    }
}

@media screen and (max-width: 480px) {
    .news-grid {
        gap: 0.5rem;
    }

    .news-grid a {
        padding: 0.5rem 1.25rem;
        font-size: 0.8125rem;
    }
}

/* --------------------------------------------
   新闻列表容器 - News List Container
   -------------------------------------------- */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --------------------------------------------
   新闻列表项 - News Item
   -------------------------------------------- */
.news-item {
    display: flex;
    gap: 3rem;
    padding: 1.5rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 0.75rem;
    transition: all var(--transition-normal);
    cursor: pointer;
    overflow: hidden;
}

/* 新闻项悬停效果 */
.news-item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

/* 新闻项激活状态 */
.news-item:active {
    transform: translateY(-2px);
}

/* 响应式：平板端新闻项 */
@media screen and (max-width: 768px) {
    .news-item {
        gap: 1rem;
        padding: 1.25rem;
    }
}

/* 响应式：移动端新闻项 */
@media screen and (max-width: 480px) {
    .news-item {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
}

/* --------------------------------------------
   新闻日期区域 - News Date
   -------------------------------------------- */
.news-item__date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 1rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 0.5rem;
    color: var(--color-text-white);
    text-align: center;
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

/* 日期区域悬停效果 */
.news-item:hover .news-item__date {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    transform: scale(1.02);
}

/* 日期数字 */
.news-item__date-day {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

/* 日期年月 */
.news-item__date-ym {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

/* 响应式：平板端日期 */
@media screen and (max-width: 768px) {
    .news-item__date {
        min-width: 70px;
        padding: 0.875rem;
    }

    .news-item__date-day {
        font-size: 1.75rem;
    }

    .news-item__date-ym {
        font-size: 0.6875rem;
    }
}

/* 响应式：移动端日期 */
@media screen and (max-width: 480px) {
    .news-item__date {
        flex-direction: row;
        gap: 0.5rem;
        min-width: auto;
        padding: 0.625rem 1rem;
        width: fit-content;
    }

    .news-item__date-day {
        font-size: 1.25rem;
        margin-bottom: 0;
    }

    .news-item__date-ym {
        font-size: 0.75rem;
    }
}

/* --------------------------------------------
   新闻内容区域 - News Content
   -------------------------------------------- */
.news-item__content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    gap: 0.75rem;
    min-width: 0;
    /* 防止flex子项溢出 */
}

/* --------------------------------------------
   新闻标题 - News Title
   -------------------------------------------- */
.news-item__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.5;
    transition: color var(--transition-fast);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 标题悬停效果 */
.news-item:hover .news-item__title {
    color: var(--color-primary);
}

/* 响应式：平板端标题 */
@media screen and (max-width: 768px) {
    .news-item__title {
        font-size: 1.125rem;
        -webkit-line-clamp: 2;
    }
}

/* 响应式：移动端标题 */
@media screen and (max-width: 480px) {
    .news-item__title {
        font-size: 1rem;
        -webkit-line-clamp: 2;
    }
}

/* --------------------------------------------
   新闻摘要 - News Summary
   -------------------------------------------- */
.news-item__summary {
    font-size: 0.9375rem;
    color: var(--color-text-light);
    line-height: 1.7;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 响应式：摘要 */
@media screen and (max-width: 768px) {
    .news-item__summary {
        font-size: 0.875rem;
        -webkit-line-clamp: 2;
    }
}

@media screen and (max-width: 480px) {
    .news-item__summary {
        font-size: 0.8125rem;
        -webkit-line-clamp: 3;
    }
}

/* --------------------------------------------
   查看更多链接 - Read More Link
   -------------------------------------------- */
.news-item__link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
    align-self: flex-start;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* 链接悬停效果 */
.news-item__link:hover {
    color: var(--color-primary-dark);
    gap: 0.75rem;
}

/* 链接箭头图标 */
.news-item__link::after {
    content: '→';
    font-size: 1rem;
    transition: transform var(--transition-fast);
}

.news-item__link:hover::after {
    transform: translateX(4px);
}

/* 响应式：移动端链接 */
@media screen and (max-width: 480px) {
    .news-item__link {
        font-size: 0.8125rem;
        padding-top: 0.25rem;
    }
}

/* --------------------------------------------
   加载动画 - Loading Animation
   -------------------------------------------- */
@keyframes newsFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 新闻项入场动画 */
.news-item {
    opacity: 0;
    animation: newsFadeInUp 0.5s ease forwards;
}

/* 交错动画延迟 */
.news-item:nth-child(1) {
    animation-delay: 0.1s;
}

.news-item:nth-child(2) {
    animation-delay: 0.2s;
}

.news-item:nth-child(3) {
    animation-delay: 0.3s;
}

.news-item:nth-child(4) {
    animation-delay: 0.4s;
}

.news-item:nth-child(5) {
    animation-delay: 0.5s;
}

.news-item:nth-child(6) {
    animation-delay: 0.6s;
}

.news-item:nth-child(7) {
    animation-delay: 0.7s;
}

.news-item:nth-child(8) {
    animation-delay: 0.8s;
}

.news-item:nth-child(9) {
    animation-delay: 0.9s;
}

.news-item:nth-child(10) {
    animation-delay: 1s;
}

/* --------------------------------------------
   空状态提示 - Empty State
   -------------------------------------------- */
.news-list--empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.news-list--empty-icon {
    font-size: 4rem;
    color: var(--color-border);
    margin-bottom: 1rem;
}

.news-list--empty-text {
    font-size: 1rem;
    color: var(--color-text-light);
}

/* --------------------------------------------
   分页样式 - Pagination (预留)
   -------------------------------------------- */
.news-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border-light);
}

.news-pagination__item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.news-pagination__item:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background-color: rgba(0, 91, 172, 0.05);
}

.news-pagination__item--active {
    color: var(--color-text-white);
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.news-pagination__item--disabled {
    color: var(--color-border);
    cursor: not-allowed;
    pointer-events: none;
}

/* 响应式：分页 */
@media screen and (max-width: 480px) {
    .news-pagination {
        gap: 0.375rem;
        margin-top: 2rem;
    }

    .news-pagination__item {
        min-width: 2.25rem;
        height: 2.25rem;
        font-size: 0.8125rem;
    }
}