/**
 * @name: new.css
 * @description: 新聞導覽頁面樣式（左右分欄 + 側邊欄）
 * @version: 2.0.0
 */

/* ========== Hero 橫幅 ========== */
.news-hero {
    position: relative;
    padding: 3rem 0 2.5rem;
    overflow: hidden;
    background: var(--bg-secondary, #f5f6f8);
    color: var(--text-primary);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.news-hero-bg {
    display: none;
}

.news-hero-badge {
    display: inline-block;
    padding: 0.3rem 1rem;
    background: var(--primary-color, #0d6efd);
    color: #fff;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.news-hero-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.news-hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.15rem);
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.news-hero-desc {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ========== 區塊標題 ========== */
.news-section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========== 篩選按鈕 ========== */
.news-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.btn-news-filter {
    padding: 0.3rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.825rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-news-filter:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-news-filter.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ========== 精選新聞卡片（垂直卡片 Grid） ========== */
.news-featured-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.news-featured-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
    color: inherit;
    text-decoration: none;
}

.news-featured-image {
    width: 100%;
    height: 200px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.news-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-featured-card:hover .news-featured-image img {
    transform: scale(1.05);
}

.news-featured-image .news-featured-icon {
    font-size: 2.5rem;
    color: var(--text-tertiary);
    opacity: 0.5;
}

.news-featured-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.news-featured-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.news-featured-tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #fff;
}

.news-featured-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.news-featured-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.news-featured-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.news-featured-pinned {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: var(--primary-color);
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* ========== 新聞卡片列表（取代時間線） ========== */
.news-card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-card-item {
    display: flex;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.25s ease;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.news-card-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    color: inherit;
    text-decoration: none;
}

.news-card-image {
    width: 160px;
    min-height: 130px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-card-item:hover .news-card-image img {
    transform: scale(1.05);
}

.news-card-image .news-card-icon {
    font-size: 2rem;
    color: var(--text-tertiary);
    opacity: 0.4;
}

.news-card-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.news-card-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.news-card-tag {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    color: #fff;
}

.news-card-date {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.news-card-views {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.news-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.news-card-summary {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

/* ========== 側邊欄 ========== */
.news-sidebar {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sidebar-widget {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sidebar-widget-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color, #0d6efd);
}

/* 搜尋框 */
.sidebar-search-wrap {
    position: relative;
}

.sidebar-search-input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary, #f5f6f8);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.sidebar-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 13, 110, 253), 0.1);
}

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

.sidebar-search-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 0.9rem;
    pointer-events: none;
}

/* 分類列表 */
.sidebar-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

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

.sidebar-category-item:hover {
    color: var(--primary-color);
}

.sidebar-category-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-category-name {
    font-size: 0.875rem;
    color: inherit;
}

.sidebar-category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 0.5rem;
    background: var(--bg-secondary, #f5f6f8);
    color: var(--text-secondary);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

.sidebar-category-item.active .sidebar-category-count {
    background: var(--primary-color);
    color: #fff;
}

/* 熱門文章 */
.sidebar-popular-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-popular-item {
    display: flex;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.sidebar-popular-item:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.sidebar-popular-rank {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--bg-secondary, #f5f6f8);
    color: var(--text-secondary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.sidebar-popular-item:nth-child(1) .sidebar-popular-rank {
    background: var(--primary-color, #0d6efd);
    color: #fff;
}

.sidebar-popular-item:nth-child(2) .sidebar-popular-rank {
    background: var(--primary-color, #0d6efd);
    color: #fff;
    opacity: 0.85;
}

.sidebar-popular-item:nth-child(3) .sidebar-popular-rank {
    background: var(--primary-color, #0d6efd);
    color: #fff;
    opacity: 0.7;
}

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

.sidebar-popular-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: inherit;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 0.15rem;
}

.sidebar-popular-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* 標籤雲 */
.sidebar-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.sidebar-tag-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-tag-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #fff;
    text-decoration: none;
}

/* ========== 空資料狀態 ========== */
.news-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-tertiary);
}

.news-empty-state i {
    opacity: 0.4;
}

/* ========== 載入更多按鈕 ========== */
.btn-load-more {
    border-radius: 50px;
    padding: 0.5rem 2rem;
    font-weight: 500;
}

/* ========== 暗黑主題 ========== */
[data-theme="dark"] .news-hero {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .news-featured-card,
[data-theme="dark"] .news-card-item,
[data-theme="dark"] .sidebar-widget {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .news-featured-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .news-card-item:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .sidebar-search-input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .sidebar-search-input:focus {
    border-color: var(--primary-color);
}

[data-theme="dark"] .sidebar-category-count {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .sidebar-popular-rank {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .sidebar-popular-item:nth-child(1) .sidebar-popular-rank,
[data-theme="dark"] .sidebar-popular-item:nth-child(2) .sidebar-popular-rank,
[data-theme="dark"] .sidebar-popular-item:nth-child(3) .sidebar-popular-rank {
    background: var(--primary-color);
}

/* ========== 響應式 ========== */
@media (max-width: 991.98px) {
    /* lg 以下：側邊欄移至主內容下方 */
    .news-sidebar {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .news-hero {
        padding: 2rem 0 1.5rem;
    }

    .news-hero-title {
        font-size: 1.5rem;
    }

    /* 精選卡片：單欄 */
    .news-featured-image {
        height: 160px;
    }

    /* 新聞卡片：隱藏圖片 */
    .news-card-image {
        display: none;
    }

    .news-card-body {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .news-filters {
        gap: 0.3rem;
    }

    .btn-news-filter {
        padding: 0.25rem 0.7rem;
        font-size: 0.75rem;
    }

    .news-section-title {
        font-size: 1.1rem;
    }
}
