/* ============================================================
   LATEST POSTS (BÀI VIẾT MỚI NHẤT)
   ============================================================ */

.uten-latest-posts-section {
    padding: 80px 15px;
    background: #f8fdf8;
}

.uten-latest-posts-section .uten-section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 50px;
}

/* ── TOPBAR: Tiêu đề + nút điều hướng ── */
.uten-latest-posts-topbar {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* Cụm 2 nút mũi tên - góc phải, ngang hàng tiêu đề */
.uten-posts-nav {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 12px;
    z-index: 5;
}

.uten-posts-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1.5px solid #d4e8d4;
    background: #fff;
    color: var(--uten-primary, #287b38);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 6px 18px rgba(40, 123, 56, 0.08);
    transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.uten-posts-nav-btn:hover {
    background: var(--uten-primary, #287b38);
    border-color: var(--uten-primary, #287b38);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(40, 123, 56, 0.25);
}

.uten-posts-nav-btn:active {
    transform: translateY(0);
}

/* Trạng thái vô hiệu (đầu/cuối slider) */
.uten-posts-nav-btn:disabled {
    opacity: 0.4;
    cursor: default;
    background: #fff;
    color: #999;
    border-color: #e5e5e5;
    box-shadow: none;
    transform: none;
}

.uten-posts-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 10px 40px; /* Padding để không bị cắt bóng đổ */
    scroll-behavior: smooth;
    
    scrollbar-width: thin;
    scrollbar-color: var(--uten-primary, #287b38) #f0f0f0;
}

.uten-posts-grid .uten-post-card {
    min-width: 340px; /* Chỉ áp dụng min-width cho slider trang chủ */
}

/* Custom scrollbar */
.uten-posts-grid::-webkit-scrollbar {
    height: 8px;
}
.uten-posts-grid::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}
.uten-posts-grid::-webkit-scrollbar-thumb {
    background-color: var(--uten-primary, #287b38);
    border-radius: 10px;
}

/* ── GRID CHO TRANG CHUYÊN MỤC BLOG (home.php / archive.php) ── */
.uten-blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

/* Thẻ Bài Viết */
.uten-post-card {
    flex: 0 0 calc(33.333% - 20px); /* Hiển thị 3 bài cùng lúc trên màn rộng */
    min-width: 0; /* Loại bỏ min-width cứng để grid có thể tự co dãn thẻ */
    scroll-snap-align: start;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #eef5ee;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
}

.uten-post-card.is-visible {
    animation: fadeInUpSmooth 2s ease-out forwards;
}

.uten-post-card:nth-child(1) { animation-delay: 0.1s; }
.uten-post-card:nth-child(2) { animation-delay: 0.3s; }
.uten-post-card:nth-child(3) { animation-delay: 0.5s; }

.uten-post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(40, 123, 56, 0.1);
}

.uten-post-img-link {
    display: block;
    overflow: hidden;
}

.uten-post-img-box {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.uten-post-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.uten-post-card:hover .uten-post-img-box img {
    transform: scale(1.08);
}

.uten-post-cat {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--uten-secondary, #f28200);
    color: #fff;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 3px 9px;
    border-radius: 50px;
    box-shadow: 0 3px 8px rgba(242, 130, 0, 0.25);
}

.uten-post-content {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.uten-post-meta {
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.uten-post-title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.4;
    margin: 0 0 12px;
}

.uten-post-title a {
    color: var(--uten-primary, #287b38);
    text-decoration: none;
    transition: color 0.3s ease;
}

.uten-post-title a:hover {
    color: var(--uten-secondary, #f28200);
}

.uten-post-excerpt {
    font-size: 14.5px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 20px;
    flex: 1;
}

.uten-post-readmore {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 14px;
    color: var(--uten-primary, #287b38);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.uten-post-readmore:hover {
    color: var(--uten-secondary, #f28200);
}

/* Footer Nút Bấm */
.uten-posts-footer {
    text-align: center;
    margin-top: 50px;
}

/* Responsive */
@media (max-width: 1100px) {
    /* Nút điều hướng về dạng tĩnh, căn giữa dưới tiêu đề */
    .uten-posts-nav {
        position: static;
        transform: none;
        justify-content: center;
        margin: 24px auto 0;
    }
}

@media (max-width: 992px) {
    .uten-post-card {
        flex: 0 0 45%;
    }
    .uten-blog-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .uten-latest-posts-section {
        padding: 50px 15px;
    }
    /* Ẩn nút mũi tên trên mobile - dùng vuốt tay */
    .uten-posts-nav {
        display: none;
    }
    .uten-blog-grid {
        grid-template-columns: 1fr;
    }
    .uten-posts-grid {
        gap: 16px;
        margin: 0 -15px; /* Để slider tràn viền màn hình điện thoại */
        padding: 10px 15px 30px;
        scrollbar-width: none; /* Ẩn scrollbar trên Firefox */
    }
    .uten-posts-grid::-webkit-scrollbar {
        display: none; /* Ẩn scrollbar trên Safari/Chrome */
    }
    .uten-post-card {
        flex: 0 0 85%;
        min-width: unset;
        scroll-snap-align: center;
    }
}

/* ============================================================
   THANH LỌC DANH MỤC BLOG (PILL BAR)
   ============================================================ */
.uten-blog-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 0 auto 40px;
    max-width: 900px;
}

.uten-blog-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 50px;
    background: #fff;
    border: 1.5px solid #d4e8d4;
    color: #444;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(40, 123, 56, 0.05);
}

.uten-blog-filter-pill:hover {
    border-color: var(--uten-primary, #287b38);
    color: var(--uten-primary, #287b38);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 123, 56, 0.12);
}

.uten-blog-filter-pill.is-active {
    background: linear-gradient(135deg, var(--uten-primary, #287b38) 0%, #1a5225 100%);
    border-color: var(--uten-primary, #287b38);
    color: #fff;
    box-shadow: 0 8px 20px rgba(40, 123, 56, 0.25);
}

.uten-blog-filter-pill .pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 50px;
    background: #eef5ee;
    color: var(--uten-primary, #287b38);
    font-size: 11px;
    font-weight: 700;
}

.uten-blog-filter-pill.is-active .pill-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

@media (max-width: 768px) {
    .uten-blog-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 8px;
        margin-bottom: 30px;
        padding-bottom: 8px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .uten-blog-filter::-webkit-scrollbar {
        display: none;
    }
    .uten-blog-filter-pill {
        flex: 0 0 auto;
        padding: 8px 15px;
        font-size: 13px;
    }
}
