/* --- CSS CHUNG --- */
.news-content-wrapper {
    margin-top: 50px;
    margin-bottom: 80px;
}

/* Grid Hero (1 To - 3 Nhỏ) */
.hero-grid-master {
    display: grid;
    grid-template-columns: 70% 27%;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 20px 3%;
    height: 550px;
    margin-bottom: 60px;
}

.hero-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.hero-item.big-post {
    grid-column: 1 / 2;
    grid-row: 1 / 4;
}

.hero-item.small-post {
    grid-column: 2 / 3;
}

.hero-link {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-img-cover {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    transition: transform 0.5s ease;
}

.hero-link:hover .hero-img-cover {
    transform: scale(1.05);
}

/* Overlay & Text */
.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 25px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    color: #fff;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.title-big {
    font-size: 20px;
    font-weight: 400;
    margin: 0 0 10px;
    color: #fff;
    line-height: 1.3;
}

.title-small {
    font-size: 16px;
    font-weight: 400;
    margin: 0;
    color: #fff;
    line-height: 1.35;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta Data */
.hero-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 16px;
    color: #ddd;
    margin-top: 5px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-item svg {
    width: 14px;
    height: 14px;
    fill: #ddd;
    position: relative;
    top: -1px;
}

/* Layout Content + Sidebar (Desktop) */
.news-list-layout {
    display: grid;
    grid-template-columns: 70% 27%;
    gap: 3%;
    align-items: start;
}

.news-row-item {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: none;
}

.news-row-thumb {
    width: 260px;
    flex-shrink: 0;
}

.news-row-thumb img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.news-row-info h3 {
    margin: -4px 0 10px;
    font-size: 20px;
    font-weight: 400;
    /* Giới hạn tiêu đề 2 dòng */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.news-row-info h3 a {
    color: #333;
    text-decoration: none;
}

.list-meta {
    display: flex;
    gap: 15px;
    font-size: 16px;
    color: #888;
    margin-bottom: 10px;
}

.list-meta .meta-item svg {
    fill: #888;
}

/* --- SIDEBAR CSS --- */
.custom-sidebar-area {
    position: sticky;
    /* Mặc định dính trên Desktop */
    top: 30px;
    z-index: 9;
}

.custom-sidebar-area .widget {
    margin-bottom: 40px;
}

/* QUAN TRỌNG: Ép ảnh widget không bao giờ tràn khung */
.custom-sidebar-area .widget img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    border-radius: 8px;
}

.custom-sidebar-area .widget-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
    position: relative;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.custom-sidebar-area .widget-title:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background-color: #2c9f45;
}

.custom-sidebar-area ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.custom-sidebar-area ul li {
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
    display: flex;
    align-items: center;
}

.custom-sidebar-area ul li a {
    color: #555;
    text-decoration: none;
    transition: 0.2s;
    font-size: 15px;
}

.custom-sidebar-area ul li a:hover {
    color: #2c9f45;
    padding-left: 5px;
}

/* Phân trang */
.custom-pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 50px;
    width: 100%;
    padding-bottom: 20px;
}

.pagination-group {
    display: flex;
    flex-direction: row;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fff;
}

.pagination-group .page-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 18px;
    height: 42px;
    border-right: 1px solid #ddd;
    color: #2c9f45;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}

.pagination-group .page-numbers:last-child {
    border-right: none;
}

.pagination-group a.page-numbers:hover {
    background-color: #f5f5f5;
}

.pagination-group .page-numbers.current {
    background-color: #2c9f45;
    color: #fff;
}

/* --- MOBILE RESPONSIVE (KHẮC PHỤC LỖI) --- */
@media (max-width: 991px) {
    .hero-section .page-title {
        font-size: 28px !important;
    }

    /* Chuyển Grid thành dọc */
    .hero-grid-master {
        display: flex;
        flex-direction: column;
        height: auto;
        gap: 15px;
    }

    .hero-item.big-post {
        height: 280px;
    }

    .hero-item.small-post {
        display: block;
        height: 200px;
    }

    /* Chuyển List thành 1 cột */
    .news-list-layout {
        display: flex;
        flex-direction: column;
    }

    .news-row-item {
        flex-direction: column;
        gap: 10px;
        padding-bottom: 20px;
    }

    .news-row-thumb {
        width: 100%;
    }

    .news-row-thumb img {
        height: 200px;
        width: 100%;
    }

    /* --- SỬA LỖI SIDEBAR MOBILE --- */
    .custom-sidebar-area {
        position: relative !important;
        /* Tắt sticky */
        top: auto !important;
        margin-top: 40px;
        margin-bottom: 40px;
        /* Thêm khoảng cách dưới để không đè phân trang */
        width: 100% !important;
        clear: both;
        /* Ngắt dòng */
        z-index: 1;
        /* Đưa về layer thường */
    }

    /* Đảm bảo ảnh quảng cáo không bị zoom to quá mức */
    .custom-sidebar-area .widget img {
        width: 100% !important;
        height: auto !important;
    }
}

/* --- SINGLE POST LAYOUT --- */
.single-news-wrapper {
    margin-top: 50px;
    margin-bottom: 80px;
}

.news-layout-grid {
    display: grid;
    grid-template-columns: 70% 27%;
    gap: 3%;
    align-items: start;
}

.single-post-featured-image img {
    border-radius: 12px;
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.entry-content-body {
    line-height: 1.8;
    font-size: 17px;
    color: #333;
}

.entry-content-body h2,
.entry-content-body h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #2c9f45;
    font-weight: 700;
}

.entry-content-body p {
    margin-bottom: 20px;
}

.entry-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* --- NEW SIDEBAR STYLES --- */
.widget-news-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-news-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #eee;
}

.widget-news-item:last-child {
    border-bottom: none;
}

.widget-news-thumb-link {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
}

.widget-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.widget-news-title {
    font-size: 15px;
    margin: 0 0 5px;
    line-height: 1.4;
    font-weight: 600;
}

.widget-news-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.widget-news-title a:hover {
    color: #2c9f45;
}

.widget-news-date {
    font-size: 13px;
    color: #888;
}

/* RESPONSIVE SINGLE */
@media (max-width: 991px) {
    .news-layout-grid {
        display: flex;
        flex-direction: column;
    }

    .single-post-featured-image {
        margin-bottom: 20px;
    }
}

/* --- HERO SINGLE MODIFIERS --- */
.hero-title-truncated {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Adjust padding for single hero if description is missing */
.is-single .entry-header {
    padding-bottom: 60px;
    /* Keep balanced padding */
}

/* --- SIDEBAR MIXED LAYOUT (MATCHING IMAGE) --- */
/* --- SIDEBAR MIXED LAYOUT (MATCHING IMAGE) --- */
.news-sidebar {
    /* Container */
}

/* Header: Title + View More */
.news-sidebar .widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: none;
}

.news-sidebar .widget-title {
    font-size: 28px !important;
    font-weight: 400 !important;
    margin-bottom: 0;
    color: #333;
    padding-bottom: 0;
    border: none;
}

.news-sidebar .widget-title:after {
    display: none;
}

.news-sidebar .widget-view-more {
    font-size: 14px;
    color: #007bff;
    /* Màu cam giống hình */
    text-decoration: none;
    font-weight: 400;
    /* Khoảng cách icon và chữ */
}

.news-sidebar .widget-view-more:hover {
    text-decoration: underline;
    color: #ff9800;
}

/* Đổi màu icon SVG sang cam */
.news-sidebar .widget-view-more svg:hover {
    stroke: #ff9800;
}


/* Sidebar Wrapper */
.news-sidebar .widget-news-list-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 1. Featured Post (First Item) */
.news-sidebar .sidebar-featured-post {
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.news-sidebar .sidebar-feat-thumb {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    border-radius: 12px;
    overflow: hidden;
}

.news-sidebar .sidebar-feat-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.news-sidebar .sidebar-feat-thumb:hover .sidebar-feat-img {
    transform: scale(1.05);
}

.news-sidebar .sidebar-feat-title {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    margin: 0 0 8px;
}

.news-sidebar .sidebar-feat-title a {
    color: #111;
    text-decoration: none;
}

/* 2. List Post (Subsequent Items) */
.news-sidebar .sidebar-list-post {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.news-sidebar .sidebar-list-post:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-sidebar .sidebar-list-title {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
    margin: 0 0 6px;
}

.news-sidebar .sidebar-list-title a {
    color: #111;
    text-decoration: none;
}


/* Common Date Style */
.news-sidebar .sidebar-meta-date {
    font-family: inherit;
    font-size: 14px;
    color: #777;
    display: flex;
    align-items: center;
    gap: 5px;
}

.news-sidebar .sidebar-meta-date::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999' width='14px' height='14px'%3E%3Cpath d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zM9 14H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8 4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: middle;
    opacity: 0.7;
}

/* RESPONSIVE Sidebar */
@media (max-width: 1024px) {
    .news-sidebar .widget-title {
        font-size: 22px !important;
    }
}

@media (max-width: 768px) {
    .news-sidebar {
        margin-top: 40px;
    }

    /* Request: Fix image height to 210px on mobile */
    .single-post-full-width img {
        height: 210px !important;
        object-fit: cover;
        aspect-ratio: auto;
        /* Override inline aspect-ratio */
    }
}

/* =========================================
   CATEGORY FILTER BAR STYLES
   ========================================= */
.bv-filter-bar {
    margin-bottom: 30px;
    background: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
}

.bv-filter-form {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.bv-filter-item {
    position: relative;
    flex: 1;
    min-width: 200px;
}

/* Search Input */
.bv-filter-item.search-wrap input {
    width: 100%;
    height: 45px;
    line-height: normal;
    padding: 0 60px 0 15px;
    /* Increase right padding for button */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fcfcfc;
    display: flex;
    align-items: center;
    overflow: hidden;
    /* Ensure content stays inside radius */
}

.bv-filter-item.search-wrap input:focus {
    border-color: var(--theme-palette-color-1, #2c9f45);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(44, 159, 69, 0.1);
    outline: none;
}

/* Fix Search Button styling - Rectangular Block */
.bv-filter-item.search-wrap {
    position: relative;
}

.bv-filter-item.search-wrap .search-btn {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    background-color: var(--theme-palette-color-1, #FF8200) !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 !important;
    width: 50px !important;
    height: 100% !important;
    /* Full height */
    min-width: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: none !important;
    border-radius: 0 8px 8px 0 !important;
    /* Radius only on right side */
}

.bv-filter-item.search-wrap .search-btn:hover {
    opacity: 0.9;
    background-color: var(--theme-palette-color-2, #e67600) !important;
}

/* Date Select */
.bv-filter-item.date-wrap select {
    width: 100%;
    height: 45px !important;
    /* Fix height */
    line-height: 45px !important;
    /* Center text vertically */
    padding: 0 40px 0 15px !important;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    color: #333;
    font-weight: 500;
    background: #fcfcfc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 15px center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bv-filter-item.date-wrap select:focus {
    border-color: var(--theme-palette-color-2);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
    outline: none;
}

/* Desktop Filter Grid Alignment */
@media (min-width: 992px) {
    .bv-filter-form {
        display: grid;
        grid-template-columns: 71% 25%;
        gap: 3%;
        align-items: center;
        width: 100%;
        margin: 0;
    }

    .bv-filter-item.search-wrap {
        width: 100%;
        max-width: 100%;
        flex: none;
        /* Reset flex */
    }

    .bv-filter-item.date-wrap {
        width: 100%;
        max-width: 100%;
        flex: none;
        /* Reset flex */
    }
}

/* Responsive */
@media (max-width: 991px) {
    .bv-filter-form {
        flex-direction: column;
        gap: 15px;
        display: flex;
    }

    .bv-filter-item {
        width: 100%;
    }
}