/* =========================================================
   DIETMOIDANANG.VN
   NEWS.CSS - FINAL
   ---------------------------------------------------------
   Trang: /tin-tuc/

   Cấu trúc Gutenberg:
   .news-layout
      ├── Column
      │    └── .news-loop
      └── .news-sidebar
           ├── .sidebar-box
           ├── .sidebar-box
           └── .sidebar-box

   Màu thương hiệu:
   Xanh chính: #0e5739
   Xanh đậm:   #084f2d
   Đỏ:         #c90000
   ========================================================= */


/* =========================================================
   1. BIẾN MÀU
   ========================================================= */

body.page .news-layout {
    --news-green: #0e5739;
    --news-green-dark: #084f2d;
    --news-green-link: #006308;

    --news-red: #c90000;
    --news-red-dark: #a80000;

    --news-text: #292929;
    --news-muted: #667069;

    --news-border: #dce6df;

    --news-bg: #ffffff;
    --news-bg-soft: #f4f8f5;

    --news-radius: 10px;
}


/* =========================================================
   2. KHUNG TRANG TIN TỨC
   ---------------------------------------------------------
   Cùng chiều rộng 1180px với Header / Homepage.
   ========================================================= */

body.page
.entry-content.wp-block-post-content
.news-layout {
    display: grid !important;

    grid-template-columns:
        minmax(0, 2.6fr)
        minmax(270px, 1fr);

    gap: 38px;

    align-items: start;

    width: min(1180px, calc(100% - 40px)) !important;
    max-width: 1180px !important;

    margin-left: auto !important;
    margin-right: auto !important;

    padding: 0 !important;

    box-sizing: border-box;
}


/* Gutenberg Columns có thể ép flex.
   Ta chuyển sang grid riêng cho trang này. */

body.page
.news-layout.wp-block-columns {
    flex-wrap: unset !important;
}


/* Hai cột con không bị width Gutenberg chi phối */

body.page
.news-layout > .wp-block-column {
    min-width: 0;

    flex-basis: auto !important;

    margin: 0 !important;
}


/* =========================================================
   3. CỘT TRÁI - QUERY LOOP
   ========================================================= */

.news-loop {
    width: 100%;

    margin: 0 !important;
    padding: 0 !important;
}


/* =========================================================
   4. POST TEMPLATE - LƯỚI 2 CỘT
   ========================================================= */

.news-loop .wp-block-post-template {
    display: grid !important;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 28px 24px;

    width: 100%;

    margin: 0 !important;
    padding: 0 !important;

    list-style: none;
}


/* =========================================================
   5. MỖI BÀI VIẾT
   ========================================================= */

.news-loop .wp-block-post {
    display: flex;

    flex-direction: column;

    min-width: 0;

    margin: 0 !important;
    padding: 0 0 19px !important;

    overflow: hidden;

    background: var(--news-bg);

    border: 1px solid var(--news-border);

    border-radius: var(--news-radius);

    box-shadow: 0 3px 13px rgba(0, 0, 0, 0.035);

    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        border-color 0.22s ease;
}


.news-loop .wp-block-post:hover {
    transform: translateY(-4px);

    border-color: #cbdcd1;

    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.09);
}


/* =========================================================
   6. ẢNH ĐẠI DIỆN
   ========================================================= */

.news-loop .wp-block-post-featured-image {
    width: 100%;

    margin: 0 0 16px !important;

    padding: 0;

    overflow: hidden;

    background: #edf2ef;
}


.news-loop .wp-block-post-featured-image a {
    display: block;

    width: 100%;

    overflow: hidden;
}


.news-loop .wp-block-post-featured-image img {
    display: block;

    width: 100% !important;
    height: auto;

    aspect-ratio: 3 / 2;

    margin: 0 !important;

    object-fit: cover;

    border: 0;
    border-radius: 0 !important;

    transition: transform 0.32s ease;
}


.news-loop
.wp-block-post:hover
.wp-block-post-featured-image img {
    transform: scale(1.04);
}


/* =========================================================
   7. TIÊU ĐỀ BÀI VIẾT
   ========================================================= */

.news-loop .wp-block-post-title {
    margin: 0 !important;

    padding: 0 18px !important;

    font-family: DMSans, sans-serif;

    font-size: 20px;
    font-weight: 700;

    line-height: 1.42;
}


.news-loop .wp-block-post-title a {
    color: var(--news-green-dark) !important;

    text-decoration: none !important;

    transition: color 0.2s ease;
}


.news-loop .wp-block-post-title a:hover {
    color: var(--news-red) !important;

    text-decoration: none !important;
}


/* =========================================================
   8. PHÂN TRANG
   ========================================================= */

.news-loop .wp-block-query-pagination {
    display: flex;

    align-items: center;
    justify-content: center;

    flex-wrap: wrap;

    gap: 8px;

    width: 100%;

    margin-top: 38px !important;
    margin-bottom: 10px !important;
}


/* Previous / Next */

.news-loop .wp-block-query-pagination-previous,
.news-loop .wp-block-query-pagination-next {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 42px;

    margin: 0 !important;

    padding: 8px 15px;

    color: #ffffff !important;

    background: var(--news-green);

    border: 1px solid var(--news-green);

    border-radius: 5px;

    font-size: 14px;
    font-weight: 700;

    line-height: 1.4;

    text-decoration: none !important;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}


.news-loop .wp-block-query-pagination-previous:hover,
.news-loop .wp-block-query-pagination-next:hover {
    color: #ffffff !important;

    background: var(--news-red);

    border-color: var(--news-red);

    text-decoration: none !important;
}


/* Các số trang */

.news-loop .wp-block-query-pagination-numbers {
    display: flex;

    align-items: center;

    gap: 6px;

    margin: 0 !important;
}


.news-loop
.wp-block-query-pagination-numbers
.page-numbers {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 42px;
    height: 42px;

    padding: 5px 10px;

    box-sizing: border-box;

    color: var(--news-green-dark) !important;

    background: #ffffff;

    border: 1px solid #ccd9d0;

    border-radius: 5px;

    font-size: 14px;
    font-weight: 700;

    text-decoration: none !important;
}


.news-loop
.wp-block-query-pagination-numbers
.page-numbers:hover {
    color: #ffffff !important;

    background: var(--news-green);

    border-color: var(--news-green);
}


/* Trang hiện tại */

.news-loop
.wp-block-query-pagination-numbers
.page-numbers.current {
    color: #ffffff !important;

    background: var(--news-red);

    border-color: var(--news-red);
}


/* Dấu ... */

.news-loop
.wp-block-query-pagination-numbers
.page-numbers.dots {
    color: var(--news-muted) !important;

    background: transparent;

    border-color: transparent;
}


/* =========================================================
   9. SIDEBAR BÊN PHẢI
   ========================================================= */

.news-sidebar {
    width: 100%;

    min-width: 0;

    margin: 0 !important;
    padding: 0 !important;
}


/* =========================================================
   10. BOX SIDEBAR
   ========================================================= */

.news-sidebar .sidebar-box {
    width: 100%;

    margin: 0 0 25px !important;

    padding: 22px !important;

    box-sizing: border-box;

    background: var(--news-bg-soft);

    border: 1px solid var(--news-border);

    border-radius: var(--news-radius);
}


.news-sidebar .sidebar-box:last-child {
    margin-bottom: 0 !important;
}


/* =========================================================
   11. HEADING SIDEBAR
   ========================================================= */

.news-sidebar
.sidebar-box > h2,

.news-sidebar
.sidebar-box > h3,

.news-sidebar
.sidebar-box > .wp-block-heading {
    margin: 0 0 16px !important;

    padding: 0 0 10px !important;

    color: var(--news-green-dark) !important;

    font-family: DMSans, sans-serif;

    font-size: 20px;
    font-weight: 700;

    line-height: 1.4;

    border-bottom: 2px solid var(--news-green);
}


/* =========================================================
   12. BÀI VIẾT MỚI NHẤT
   ========================================================= */

.news-sidebar
.wp-block-latest-posts {
    width: 100%;

    margin: 0 !important;

    padding: 0 !important;

    list-style: none;
}


.news-sidebar
.wp-block-latest-posts li {
    position: relative;

    margin: 0 !important;

    padding: 11px 0 11px 17px !important;

    border-bottom: 1px solid #dbe5de;

    line-height: 1.5;
}


.news-sidebar
.wp-block-latest-posts li:first-child {
    padding-top: 0 !important;
}


.news-sidebar
.wp-block-latest-posts li:last-child {
    padding-bottom: 0 !important;

    border-bottom: 0;
}


/* Bullet xanh */

.news-sidebar
.wp-block-latest-posts li::before {
    content: "";

    position: absolute;

    top: 19px;
    left: 1px;

    width: 6px;
    height: 6px;

    background: var(--news-green);

    border-radius: 50%;
}


.news-sidebar
.wp-block-latest-posts li:first-child::before {
    top: 8px;
}


/* Link bài mới */

.news-sidebar
.wp-block-latest-posts a {
    color: var(--news-text) !important;

    font-size: 15px;
    font-weight: 600;

    line-height: 1.5;

    text-decoration: none !important;

    transition: color 0.2s ease;
}


.news-sidebar
.wp-block-latest-posts a:hover {
    color: var(--news-red) !important;
}


/* Nếu có ngày đăng */

.news-sidebar
.wp-block-latest-posts__post-date {
    display: block;

    margin-top: 4px;

    color: var(--news-muted);

    font-size: 13px;
}


/* =========================================================
   13. CATALOG SẢN PHẨM / DỊCH VỤ
   ---------------------------------------------------------
   Anh đang dùng List block.
   ========================================================= */

.news-sidebar
.sidebar-box ul:not(.wp-block-latest-posts) {
    width: 100%;

    margin: 0 !important;

    padding: 0 !important;

    list-style: none;
}


.news-sidebar
.sidebar-box ul:not(.wp-block-latest-posts) > li {
    position: relative;

    margin: 0 !important;

    padding: 0 !important;

    border-bottom: 1px solid #dbe5de;
}


.news-sidebar
.sidebar-box ul:not(.wp-block-latest-posts) > li:last-child {
    border-bottom: 0;
}


/* Link catalog */

.news-sidebar
.sidebar-box ul:not(.wp-block-latest-posts) > li > a {
    position: relative;

    display: block;

    width: 100%;

    padding: 10px 22px 10px 3px;

    box-sizing: border-box;

    color: var(--news-text) !important;

    font-size: 15px;
    font-weight: 600;

    line-height: 1.5;

    text-decoration: none !important;

    transition:
        color 0.2s ease,
        padding-left 0.2s ease;
}


/* Mũi tên */

.news-sidebar
.sidebar-box ul:not(.wp-block-latest-posts) > li > a::after {
    content: "›";

    position: absolute;

    top: 50%;
    right: 3px;

    transform: translateY(-50%);

    color: var(--news-green);

    font-size: 20px;
    font-weight: 700;

    line-height: 1;
}


.news-sidebar
.sidebar-box ul:not(.wp-block-latest-posts) > li > a:hover {
    padding-left: 7px;

    color: var(--news-red) !important;
}


.news-sidebar
.sidebar-box ul:not(.wp-block-latest-posts) > li > a:hover::after {
    color: var(--news-red);
}


/* =========================================================
   14. LINK KHÔNG CÓ TRONG LI
   ========================================================= */

.news-sidebar .sidebar-box a {
    overflow-wrap: break-word;
}


/* =========================================================
   15. KHÔNG ĐỂ ARTICLE.CSS GHI ĐÈ SIDEBAR
   ========================================================= */

body.page
.entry-content.wp-block-post-content
.news-sidebar p {
    margin-top: 0;

    color: var(--news-text);

    font-size: 15px;

    line-height: 1.65;
}


body.page
.entry-content.wp-block-post-content
.news-sidebar h3 {
    scroll-margin-top: 100px;
}


/* =========================================================
   16. TABLET 992 - 1200
   ========================================================= */

@media (min-width: 992px) and (max-width: 1200px) {

    body.page
    .entry-content.wp-block-post-content
    .news-layout {
        width: calc(100% - 36px) !important;

        grid-template-columns:
            minmax(0, 2.35fr)
            minmax(250px, 1fr);

        gap: 28px;
    }


    .news-loop .wp-block-post-template {
        gap: 24px 20px;
    }


    .news-loop .wp-block-post-title {
        font-size: 19px;
    }


    .news-sidebar .sidebar-box {
        padding: 19px !important;
    }

}


/* =========================================================
   17. TABLET <= 991px
   ---------------------------------------------------------
   Vẫn giữ sidebar bên phải,
   nhưng danh sách bài về 1 cột.
   ========================================================= */

@media (max-width: 991px) {

    body.page
    .entry-content.wp-block-post-content
    .news-layout {
        width: calc(100% - 30px) !important;

        grid-template-columns:
            minmax(0, 1.8fr)
            minmax(230px, 1fr);

        gap: 25px;
    }


    .news-loop .wp-block-post-template {
        grid-template-columns: 1fr;
    }


    .news-loop .wp-block-post-title {
        font-size: 19px;
    }


    .news-sidebar .sidebar-box {
        padding: 18px !important;
    }


    .news-sidebar
    .sidebar-box > h3,
    .news-sidebar
    .sidebar-box > .wp-block-heading {
        font-size: 19px;
    }

}


/* =========================================================
   18. MOBILE <= 767px
   ---------------------------------------------------------
   Bài viết lên trên.
   Sidebar xuống dưới.
   ========================================================= */

@media (max-width: 767px) {

    body.page
    .entry-content.wp-block-post-content
    .news-layout {
        display: grid !important;

        grid-template-columns: 1fr;

        width: calc(100% - 30px) !important;

        gap: 38px;
    }


    /* Cột bài viết */

    .news-loop .wp-block-post-template {
        grid-template-columns: 1fr;

        gap: 24px;
    }


    .news-loop .wp-block-post-title {
        padding-left: 16px !important;
        padding-right: 16px !important;

        font-size: 19px;
    }


    .news-loop .wp-block-post-featured-image {
        margin-bottom: 14px !important;
    }


    /* Pagination */

    .news-loop .wp-block-query-pagination {
        gap: 6px;

        margin-top: 30px !important;
    }


    .news-loop .wp-block-query-pagination-previous,
    .news-loop .wp-block-query-pagination-next {
        min-height: 40px;

        padding: 7px 12px;

        font-size: 13px;
    }


    .news-loop
    .wp-block-query-pagination-numbers
    .page-numbers {
        min-width: 40px;
        height: 40px;

        font-size: 13px;
    }


    /* Sidebar */

    .news-sidebar {
        width: 100%;
    }


    .news-sidebar .sidebar-box {
        margin-bottom: 20px !important;

        padding: 20px !important;
    }


    .news-sidebar .sidebar-box:last-child {
        margin-bottom: 0 !important;
    }

}


/* =========================================================
   19. MOBILE NHỎ <= 480px
   ========================================================= */

@media (max-width: 480px) {

    body.page
    .entry-content.wp-block-post-content
    .news-layout {
        width: calc(100% - 24px) !important;
    }


    .news-loop .wp-block-post-title {
        font-size: 18px;
    }


    .news-sidebar .sidebar-box {
        padding: 17px !important;
    }


    .news-sidebar
    .sidebar-box > h3,
    .news-sidebar
    .sidebar-box > .wp-block-heading {
        font-size: 18px;
    }


    .news-sidebar
    .wp-block-latest-posts a,

    .news-sidebar
    .sidebar-box ul:not(.wp-block-latest-posts) > li > a {
        font-size: 14px;
    }


    .news-loop
    .wp-block-query-pagination-numbers {
        gap: 4px;
    }

}


/* =========================================================
   20. ACCESSIBILITY
   ========================================================= */

.news-layout a:focus-visible {
    outline: 2px solid var(--news-red);

    outline-offset: 3px;
}


/* =========================================================
   21. GIẢM CHUYỂN ĐỘNG
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .news-loop .wp-block-post,
    .news-loop .wp-block-post-featured-image img,
    .news-sidebar a {
        transition: none;
    }

}

/* =========================================================
   FIX NGÀY ĐĂNG + TIÊU ĐỀ BÀI VIẾT TRANG TIN TỨC
   ========================================================= */


/* =========================================================
   1. NGÀY ĐĂNG
   Căn thẳng mép trái với tiêu đề bài viết
   ========================================================= */

.news-loop .wp-block-post-date {
    margin: 8px 0 0 !important;

    padding-left: 18px !important;
    padding-right: 18px !important;

    color: #6b746e;

    font-size: 14px;
    font-weight: 400;

    line-height: 1.5;
}


/* Nếu ngày đăng là link */

.news-loop .wp-block-post-date a {
    color: #6b746e !important;

    font-size: 14px;
    font-weight: 400;

    text-decoration: none !important;
}


.news-loop .wp-block-post-date a:hover {
    color: #c90000 !important;
}


/* =========================================================
   2. BỎ ĐƯỜNG LINE DƯỚI TIÊU ĐỀ
   article.css có thể đang áp border cho H2
   ========================================================= */

.news-loop .wp-block-post-title {
    margin: 0 !important;

    padding: 0 18px !important;

    border: 0 !important;
    border-bottom: 0 !important;

    background: transparent;

    font-size: 20px;
    line-height: 1.42;
}


/* Đề phòng theme / article.css áp border lên H2 */

.news-loop h2.wp-block-post-title,
.news-loop h3.wp-block-post-title {
    border: 0 !important;
    border-bottom: 0 !important;

    padding-bottom: 0 !important;
}


/* =========================================================
   3. MOBILE
   ========================================================= */

@media (max-width: 767px) {

    .news-loop .wp-block-post-title {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }


    .news-loop .wp-block-post-date {
        padding-left: 16px !important;
        padding-right: 16px !important;

        font-size: 13px;
    }

}

/* =========================================================
   FIX PHÂN TRANG - ĐỒNG BỘ KÍCH THƯỚC
   ========================================================= */

.news-loop .wp-block-query-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 7px;

    margin-top: 38px !important;
}


/* =========================================================
   Ô SỐ TRANG 1, 2, 3...
   ========================================================= */

.news-loop
.wp-block-query-pagination-numbers
.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    min-width: 42px;
    height: 42px;

    padding: 0 !important;
    margin: 0 !important;

    box-sizing: border-box;

    color: #084f2d !important;
    background: #ffffff;

    border: 1px solid #ccd9d0;
    border-radius: 5px;

    font-size: 14px;
    font-weight: 600;
    line-height: 1;

    text-decoration: none !important;
}


/* Hover số trang */

.news-loop
.wp-block-query-pagination-numbers
.page-numbers:hover {
    color: #ffffff !important;

    background: #0e5739;
    border-color: #0e5739;
}


/* Trang hiện tại */

.news-loop
.wp-block-query-pagination-numbers
.page-numbers.current {
    color: #ffffff !important;

    background: #c90000;
    border-color: #c90000;

    font-weight: 700;
}


/* =========================================================
   TRANG TRƯỚC / TRANG KẾ
   ========================================================= */

.news-loop .wp-block-query-pagination-previous,
.news-loop .wp-block-query-pagination-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 42px;
    min-height: 42px;

    width: auto;
    min-width: 42px;

    margin: 0 !important;
    padding: 0 12px !important;

    box-sizing: border-box;

    color: #ffffff !important;
    background: #0e5739;

    border: 1px solid #0e5739;
    border-radius: 5px;

    font-family: "Open Sans", Arial, sans-serif;

    font-size: 13px !important;
    font-weight: 600 !important;

    line-height: 1 !important;

    white-space: nowrap;

    text-decoration: none !important;
}


/* Hover Trang trước / Trang kế */

.news-loop .wp-block-query-pagination-previous:hover,
.news-loop .wp-block-query-pagination-next:hover {
    color: #ffffff !important;

    background: #c90000;
    border-color: #c90000;

    text-decoration: none !important;
}


/* =========================================================
   DẤU ...
   ========================================================= */

.news-loop
.wp-block-query-pagination-numbers
.page-numbers.dots {
    width: 42px;
    min-width: 42px;
    height: 42px;

    color: #667069 !important;
    background: transparent;

    border-color: transparent;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 767px) {

    .news-loop
    .wp-block-query-pagination-numbers
    .page-numbers {
        width: 38px;
        min-width: 38px;
        height: 38px;

        font-size: 13px;
    }


    .news-loop .wp-block-query-pagination-previous,
    .news-loop .wp-block-query-pagination-next {
        height: 38px;
        min-height: 38px;

        padding: 0 9px !important;

        font-size: 12px !important;
    }


    .news-loop
    .wp-block-query-pagination-numbers
    .page-numbers.dots {
        width: 38px;
        min-width: 38px;
        height: 38px;
    }

}

/* =========================================================
   NEWS SIDEBAR - DANH MỤC SẢN PHẨM WOOCOMMERCE
   Tên danh mục bên trái - số lượng bên phải
   ========================================================= */

.news-sidebar
.wc-block-product-categories-list-item {
    display: grid !important;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    align-items: center;

    column-gap: 10px;

    width: 100%;

    margin: 0 !important;
    padding: 0 !important;

    border-bottom: 1px solid #dbe5de;
}


/* Mục cuối bỏ đường kẻ */

.news-sidebar
.wc-block-product-categories-list-item:last-child {
    border-bottom: 0;
}


/* Link tên danh mục */

.news-sidebar
.wc-block-product-categories-list-item > a {
    display: block !important;

    min-width: 0;

    width: auto !important;

    margin: 0 !important;
    padding: 10px 0 !important;

    color: #292929 !important;

    font-family: "Open Sans", Arial, Helvetica, sans-serif !important;

    font-size: 15px;
    font-weight: 600;

    line-height: 1.5;

    text-decoration: none !important;
}


/* Hover */

.news-sidebar
.wc-block-product-categories-list-item > a:hover {
    color: #c90000 !important;
}


/* Nếu CSS sidebar cũ có dấu > thì bỏ
   để dành vị trí bên phải cho số lượng */

.news-sidebar
.wc-block-product-categories-list-item > a::after {
    display: none !important;
    content: none !important;
}


/* =========================================================
   SỐ LƯỢNG SẢN PHẨM
   ========================================================= */

.news-sidebar
.wc-block-product-categories-list-item-count {
    display: inline-flex !important;

    align-items: center;
    justify-content: center;

    min-width: 28px;
    height: 24px;

    margin: 0 !important;
    padding: 0 7px !important;

    box-sizing: border-box;

    color: #0e5739 !important;

    background: #e6f0e9;

    border-radius: 20px;

    font-size: 12px !important;
    font-weight: 700;

    line-height: 1 !important;

    white-space: nowrap;
}


/* =========================================================
   DANH MỤC CON
   ========================================================= */

.news-sidebar
.wc-block-product-categories-list
.wc-block-product-categories-list {
    grid-column: 1 / -1;

    width: 100%;

    margin: 0 !important;
    padding-left: 15px !important;

    box-sizing: border-box;
}
/* =========================================================
   END NEWS.CSS
   ========================================================= */