/* home.css - Fix hiển thị nội dung và giữ hiệu ứng loading */

.home-news-wrapper {
    background-color: #f8fafc;
    padding: 40px 0;
    font-family: 'Be Vietnam Pro', sans-serif !important;
}

.news-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 35px;
    align-items: start;
}

.news-grid-custom {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 25px;
}

/* Cấu trúc link chung - Đảm bảo hiệu ứng loading không bị lỗi */
.card-full-link {
    text-decoration: none !important;
    display: block; /* Chuyển về block để không làm hỏng layout tin dưới */
    height: 100%;
}

/* TIN MỚI NHẤT (FIRST POST) */
.news-card.first-post {
    grid-column: span 3;
    height: 480px;
    position: relative;
    background-size: cover;
    background-position: center;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 10px;
}

.news-card.first-post::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0) 100%);
    z-index: 1;
}

.first-post .card-full-link {
    display: flex;
    align-items: flex-end; /* Đẩy chữ xuống đáy */
}

.first-post .card-body {
    position: relative;
    z-index: 2;
    padding: 40px;
    width: 100%;
    color: #fff !important;
}

.first-post .card-category {
    position: static;
    display: inline-block;
    background: #f87316;
    color: #fff;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.first-post .card-title {
    font-size: 36px;
    line-height: 1.2;
    font-weight: 800;
    color: #fff !important;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.first-post .card-meta {
    color: rgba(255,255,255,0.8) !important;
    font-size: 14px;
    margin-bottom: 10px;
}

/* TIN TIÊU CHUẨN (FIX LỖI CHỮ BỊ ĐÈ) */
.news-card.standard-post {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
}

.standard-post .card-thumb {
    height: 200px;
    position: relative;
    overflow: hidden;
}

.standard-post .card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.standard-post .card-body {
    padding: 20px;
    display: block; /* Đảm bảo chữ xếp theo luồng dọc chuẩn */
}

.standard-post .card-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    color: #1e293b !important;
    margin: 10px 0;
    height: 48px;
    overflow: hidden;
}

.standard-post .card-meta {
    font-size: 12px;
    color: #64748b !important;
}

.standard-post .card-excerpt {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
}

/* HIỆU ỨNG LOADING VÀ HOVER */
.news-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

/* SIDEBAR */
.news-sidebar { position: sticky; top: 20px; }
.sidebar-widget { background: #fff; padding: 25px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.widget-title { font-size: 18px; font-weight: 800; border-left: 5px solid #f87316; padding-left: 15px; margin-bottom: 20px; }
.popular-item { display: flex; gap: 12px; text-decoration: none; margin-bottom: 15px; align-items: center; }
.popular-thumb { width: 70px; height: 55px; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.popular-title { font-size: 14px; font-weight: 700; color: #334155; margin: 0; line-height: 1.4; }

/* 1. Thiết lập chung cho card để chuẩn bị hiệu ứng */
.news-card {
    background: #fff;
    border-radius: 16px; /* Bo tròn mượt hơn */
    overflow: hidden;
    border: 1px solid #f1f5f9;
    /* transition: mượt mà cho cả bóng, vị trí và màu sắc */
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); 
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

/* 2. Hiệu ứng khi Hover vào card */
.news-card:hover {
    transform: translateY(-10px); /* Nhấc card lên cao hơn một chút */
    border-color: #f87316; /* Đổi màu viền sang cam của bạn */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12); /* Đổ bóng sâu và rộng hơn */
}

/* 3. Hiệu ứng Zoom ảnh mượt (Dành cho tin tiêu chuẩn) */
.card-thumb {
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Transition riêng cho ảnh để zoom từ từ */
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.news-card:hover .card-thumb img {
    transform: scale(1.1); /* Phóng to ảnh nhẹ nhàng */
}

/* 4. Hiệu ứng cho Tin mới nhất (First Post) */
/* Vì tin này dùng background-image trực tiếp trong PHP, ta dùng pseudo-element để zoom */
.news-card.first-post {
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.news-card.first-post:hover {
    box-shadow: 0 25px 50px rgba(248, 115, 22, 0.2); /* Bóng đổ pha chút màu cam */
}

/* 5. Hiệu ứng cho tiêu đề (Title) */
.card-title {
    transition: color 0.3s ease;
}

.news-card:hover .card-title {
    color: #f87316 !important; /* Tiêu đề chuyển sang màu cam khi hover */
}

/* Sidebar Popular Posts - Nâng cấp Thumbnail */

.popular-item {
    display: flex;
    gap: 15px;
    text-decoration: none;
    margin-bottom: 20px;
    align-items: center;
    padding: 5px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.popular-item:hover {
    background: #f1f5f9; /* Hiệu ứng nền nhẹ khi hover cả dòng */
}

.popular-thumb {
    width: 75px;  /* Cố định chiều rộng */
    height: 75px; /* Cố định chiều cao (tỉ lệ 1:1 trông sẽ chuyên nghiệp hơn) */
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.popular-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Quan trọng: Giúp ảnh không bị méo, tự căn giữa */
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Hiệu ứng hover riêng cho ảnh trong sidebar */
.popular-item:hover .popular-thumb img {
    transform: scale(1.1);
}

.popular-info {
    flex: 1;
}

.popular-title {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    line-height: 1.5;
    margin: 0;
    /* Giới hạn tiêu đề trong 2 dòng để đều layout */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.popular-item:hover .popular-title {
    color: #f87316; /* Đổi màu chữ sang cam khi hover */
}

