/* ========== 首頁佈局 ========== */
.home-container {
    padding: 1.5rem 0;
}

/* ========== 熱門貼文幻燈片 ========== */
.featured-slider {
    display: grid;
    grid-template-columns: 1fr 300px;
    background: var(--color-surface, #fff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

/* 左側大圖區域 */
.slider-main {
    position: relative;
    overflow: hidden;
}

.slider-container {
    overflow: hidden;
    height: 100%;
}

.slider-wrapper {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}

.slider-slide {
    flex: 0 0 100%;
    min-width: 100%;
    height: 100%;
}

.slide-link {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
    height: 100%;
    min-height: 450px;
}

.slide-image {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--color-surface-soft, #f1f5f9);
}

.slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.slide-link:hover .slide-image img {
    transform: scale(1.05);
}

/* 圖片上的文字覆蓋層 */
.slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 1.5rem 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
    color: #fff;
}

.slide-category {
    display: inline-block;
    background: #e53935;
    color: #fff;
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.slide-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 幻燈片控制按鈕 */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text, #0f172a);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    z-index: 10;
}

.slider-btn:hover {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.05);
}

.slider-btn-prev {
    left: 0.75rem;
}

.slider-btn-next {
    right: 0.75rem;
}

/* 右側熱門文章列表 */
.slider-sidebar {
    background: #fff;
    border-left: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
    display: flex;
    flex-direction: column;
}

.slider-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.slider-list-item {
    flex: 1;
    display: flex;
    border-bottom: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
    transition: background-color 0.2s;
}

.slider-list-item:last-child {
    border-bottom: none;
}

.slider-list-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: var(--color-text, #0f172a);
    font-size: 1.4rem;
    line-height: 1.5;
    width: 100%;
    transition: color 0.2s, background-color 0.2s;
}

.slider-list-link:hover {
    color: var(--color-primary, #4f46e5);
    background-color: rgba(0, 0, 0, 0.02);
}

.slider-list-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 選中狀態 - 橘紅色高亮 */
.slider-list-item.active {
    background-color: #ffede6;
}

.slider-list-item.active .slider-list-link {
    color: #e53935;
}

/* 主要內容區 - 單欄佈局 */
.home-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* 跑馬燈區域 */
.home-marquee {
    grid-column: 1 / -1;
    background: var(--color-surface, #fff);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 0.5rem;
}

.marquee-label {
    flex-shrink: 0;
    background: var(--color-primary, #4f46e5);
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.marquee-content {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
}

.marquee-scroll {
    display: inline-block;
    animation: marquee 30s linear infinite;
}

.marquee-scroll a {
    color: var(--color-text, #0f172a);
    text-decoration: none;
    margin-right: 3rem;
    font-size: 0.9rem;
}

.marquee-scroll a:hover {
    color: var(--color-primary, #4f46e5);
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* ========== 熱門文章側邊欄 ========== */
.popular-section {
    background: var(--color-surface, #fff);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 1rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text, #0f172a);
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-primary, #4f46e5);
}

.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-item {
    border-bottom: 1px dashed var(--color-border, rgba(0, 0, 0, 0.08));
}

.popular-item:last-child {
    border-bottom: none;
}

.popular-link {
    display: block;
    padding: 0.85rem 0;
    text-decoration: none;
    color: var(--color-text, #0f172a);
    font-size: 0.9rem;
    line-height: 1.5;
    transition: color 0.2s, background 0.2s;
    position: relative;
    padding-left: 0.75rem;
}

.popular-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--color-primary, #4f46e5);
    transition: height 0.2s;
    border-radius: 2px;
}

.popular-link:hover {
    color: var(--color-primary, #4f46e5);
}

.popular-link:hover::before {
    height: 100%;
}

.popular-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 選中狀態的熱門文章 */
.popular-item.active .popular-link {
    background: rgba(79, 70, 229, 0.05);
    color: var(--color-primary, #4f46e5);
}

.popular-item.active .popular-link::before {
    height: 100%;
}

/* ========== 最新文章區塊 ========== */
.latest-section {
    grid-column: 1;
}

.latest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.latest-header .section-title {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ========== 文章卡片增強 ========== */
.post-card {
    position: relative;
}

.post-card-views {
    font-size: 0.8rem;
    color: var(--color-text-muted, rgba(15, 23, 42, 0.55));
}

.post-card-views::before {
    content: "👁️ ";
}

/* ========== 響應式設計 ========== */
@media (max-width: 991.98px) {

    /* 熱門輪播響應式 - 平板版 */
    .featured-slider {
        grid-template-columns: 1fr 250px;
    }

    .slide-link {
        min-height: 300px;
    }

    .home-main {
        grid-template-columns: 1fr;
    }

    .popular-section {
        position: static;
        order: -1;
    }

    .popular-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0 1rem;
    }

    .popular-item {
        border-bottom: none;
        border-left: 1px dashed var(--color-border, rgba(0, 0, 0, 0.08));
        padding-left: 1rem;
    }

    .popular-item:nth-child(odd) {
        border-left: none;
        padding-left: 0;
    }
}

@media (max-width: 767.98px) {

    /* 熱門輪播響應式 - 手機版隱藏右側列表 */
    .featured-slider {
        grid-template-columns: 1fr;
    }

    .slider-sidebar {
        display: none;
    }

    .slide-link {
        min-height: 250px;
    }

    .slide-overlay {
        padding: 2rem 1rem 1rem;
    }

    .slide-title {
        font-size: 1rem;
    }
}

@media (max-width: 575.98px) {
    .home-marquee {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .marquee-label {
        width: 100%;
        text-align: center;
    }

    .popular-list {
        grid-template-columns: 1fr;
    }

    .popular-item {
        border-left: none;
        padding-left: 0;
        border-bottom: 1px dashed var(--color-border, rgba(0, 0, 0, 0.08));
    }

    .popular-item:last-child {
        border-bottom: none;
    }

    /* 幻燈片響應式 - 手機版 */
    .slide-link {
        min-height: 200px;
    }

    .slider-btn {
        width: 32px;
        height: 32px;
    }

    .slider-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* 平板響應式 */
@media (max-width: 991.98px) and (min-width: 768px) {
    .slider-list-link {
        padding: 0.65rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* ========== 分類頁面提示 ========== */
.category-alert {
    background-color: var(--color-surface-soft, #f1f5f9);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
    border: 1px dashed var(--color-border, #cbd5e1);
}

.category-alert h3 {
    color: var(--color-primary, #4f46e5);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.category-alert p {
    color: var(--color-text-muted, #64748b);
    margin: 0;
    font-size: 1rem;
}