/**
 * BK Post Widget Styles
 * Author: Bùi Đức Hạnh (https://buhaweb.com/)
 * Prefix: bdh-bk-
 * Kit 4 Global Design System Compliant (Tông Xanh Lá Chủ Đạo)
 */

:root {
    --bdh-post-cols: 3;
    --bdh-post-col-gap: 24px;
    --bdh-post-row-gap: 30px;
    --bdh-post-hover-zoom: 1.08;
    --bdh-post-pagination-align: center;
}

/* ===================================================
   1. GRID CONTAINER
=================================================== */
.bdh-bk-post-grid {
    display: grid;
    grid-template-columns: repeat(var(--bdh-post-cols, 3), minmax(0, 1fr));
    column-gap: var(--bdh-post-col-gap, 24px);
    row-gap: var(--bdh-post-row-gap, 30px);
    width: 100%;
}

/* ===================================================
   2. CARD BOX & HOVER SCALE
=================================================== */
.bdh-bk-post-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--e-global-color-8d5d81d, #ffffff);
    border: 1px solid var(--e-global-color-fcc82ce, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s ease;
    box-sizing: border-box;
}

.bdh-bk-post-card:hover {
    transform: translateY(-4px);
    border-color: var(--e-global-color-5c987e6, #7fcb98);
    box-shadow: 0 12px 24px -6px rgba(42, 145, 80, 0.12),
                0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

/* 2.1 Thumbnail Wrap & Scale In / Out (Không tràn box) */
.bdh-bk-post-card__thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 10px;
    background-color: var(--e-global-color-14ec4f2, #f8f9fa);
    isolation: isolate;
}

.bdh-bk-post-card__thumb-link {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.bdh-bk-post-card__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1);
    transform-origin: center center;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Khi hover vào box thì ảnh scale in, khi ra chuột tự scale out mượt mà */
.bdh-bk-post-card:hover .bdh-bk-post-card__thumb {
    transform: scale(var(--bdh-post-hover-zoom, 1.08));
}

.bdh-bk-post-card__thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #9ca3af;
}

/* ===================================================
   3. CARD BODY & CONTENT
=================================================== */
.bdh-bk-post-card__body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 16px 14px 18px 14px;
    box-sizing: border-box;
}

/* 3.1 Danh mục tin tức */
.bdh-bk-post-card__category-wrap {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.bdh-bk-post-card__cat-badge {
    display: inline-block;
    font-size: var(--e-global-typography-79e5d5b-font-size, 13px);
    font-weight: 600;
    line-height: 1.2;
    color: var(--e-global-color-97923db, #1e6b3a);
    background-color: var(--e-global-color-d9c2012, #e8f6ec);
    padding: 5px 11px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.bdh-bk-post-card__cat-badge:hover {
    color: #ffffff;
    background-color: var(--e-global-color-1070229, #2cac55);
    box-shadow: 0 4px 10px rgba(44, 172, 85, 0.25);
}

/* 3.2 Tên bài viết */
.bdh-bk-post-card__title {
    margin: 0 0 10px 0;
    font-size: var(--e-global-typography-fc3ef67-font-size, 18px);
    font-weight: 600;
    line-height: var(--e-global-typography-fc3ef67-line-height, 1.45em);
    color: var(--e-global-color-d27c3cc, #1f2328);
}

.bdh-bk-post-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.bdh-bk-post-card:hover .bdh-bk-post-card__title a,
.bdh-bk-post-card__title a:hover {
    color: var(--e-global-color-1070229, #2cac55);
}

/* 3.3 Tóm tắt */
.bdh-bk-post-card__excerpt {
    font-size: var(--e-global-typography-afd6f4d-font-size, 14px);
    line-height: 1.6;
    color: var(--e-global-color-76ff1c6, #4b5563);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

/* 3.4 Ngày đăng */
.bdh-bk-post-card__meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid rgba(229, 231, 235, 0.6);
}

.bdh-bk-post-card__date {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: var(--e-global-typography-79e5d5b-font-size, 13px);
    color: var(--e-global-color-76ff1c6, #4b5563);
}

.bdh-bk-post-card__date-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--e-global-color-1070229, #2cac55);
    font-size: 13px;
    line-height: 1;
}

.bdh-bk-post-card__date-icon svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
}

/* ===================================================
   4. SLIDER / CAROUSEL MODE
=================================================== */
.bdh-bk-post-slider-wrap {
    position: relative;
    width: 100%;
}

.bdh-bk-post-slider {
    width: 100%;
    overflow: hidden;
    padding-bottom: 4px;
}

.bdh-bk-post-slider .swiper-wrapper {
    display: flex;
    align-items: stretch;
}

.bdh-bk-post-slider .swiper-slide {
    height: auto;
    display: flex;
    flex-direction: column;
}

/* Nút Mũi Tên Navigation */
.bdh-bk-post-arrows {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    top: -50px;
    right: 0;
    z-index: 5;
}

.bdh-bk-post-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--e-global-color-8d5d81d, #ffffff);
    color: var(--e-global-color-d27c3cc, #1f2328);
    border: 1px solid var(--e-global-color-fcc82ce, #e5e7eb);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: all 0.25s ease;
    padding: 0;
    margin: 0;
}

.bdh-bk-post-arrow svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    display: block;
    transition: fill 0.2s ease;
}

.bdh-bk-post-arrow:hover {
    background-color: var(--e-global-color-1070229, #2cac55);
    color: #ffffff;
    border-color: var(--e-global-color-1070229, #2cac55);
    box-shadow: 0 4px 12px rgba(44, 172, 85, 0.3);
    transform: translateY(-1px);
}

.bdh-bk-post-arrow:hover svg {
    fill: #ffffff;
}

.bdh-bk-post-arrow.swiper-button-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Chấm Tròn Pagination Dots */
.bdh-bk-post-slider-wrap .swiper-pagination {
    position: relative;
    margin-top: 24px;
    text-align: center;
}

.bdh-bk-post-slider-wrap .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background-color: var(--e-global-color-fcc82ce, #e5e7eb);
    opacity: 1;
    border-radius: 50%;
    margin: 0 5px !important;
    transition: all 0.3s ease;
    cursor: pointer;
}

.bdh-bk-post-slider-wrap .swiper-pagination-bullet-active {
    width: 24px;
    border-radius: 12px;
    background-color: var(--e-global-color-1070229, #2cac55);
    box-shadow: 0 2px 6px rgba(44, 172, 85, 0.4);
}

/* ===================================================
   5. PHÂN TRANG (PAGINATION)
=================================================== */
.bdh-bk-post-pagination {
    display: flex;
    align-items: center;
    justify-content: var(--bdh-post-pagination-align, center);
    gap: 8px;
    margin-top: 36px;
    flex-wrap: wrap;
}

.bdh-bk-post-pagination .bdh-bk-page-item {
    display: inline-flex;
}

.bdh-bk-post-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: var(--e-global-typography-79e5d5b-font-size, 14px);
    font-weight: 600;
    color: var(--e-global-color-d27c3cc, #1f2328);
    background-color: var(--e-global-color-8d5d81d, #ffffff);
    border: 1px solid var(--e-global-color-fcc82ce, #e5e7eb);
    text-decoration: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.bdh-bk-post-pagination .page-numbers:hover:not(.current):not(.dots) {
    color: #ffffff;
    background-color: var(--e-global-color-938e6c1, #2a9150);
    border-color: var(--e-global-color-938e6c1, #2a9150);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(42, 145, 80, 0.25);
}

.bdh-bk-post-pagination .page-numbers.current {
    color: #ffffff;
    background-color: var(--e-global-color-1070229, #2cac55);
    border-color: var(--e-global-color-1070229, #2cac55);
    box-shadow: 0 4px 14px rgba(44, 172, 85, 0.3);
    cursor: default;
}

.bdh-bk-post-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: default;
}

.bdh-bk-post-empty {
    padding: 30px;
    text-align: center;
    color: var(--e-global-color-76ff1c6, #4b5563);
    background-color: var(--e-global-color-14ec4f2, #f8f9fa);
    border: 1px dashed var(--e-global-color-fcc82ce, #e5e7eb);
    border-radius: 12px;
}

/* ===================================================
   6. RESPONSIVE BREAKPOINTS (Tablet <= 1024px, Mobile <= 767px)
=================================================== */
@media (max-width: 1024px) {
    .bdh-bk-post-arrows {
        position: static;
        margin-top: 16px;
        justify-content: center;
    }
}

@media (max-width: 767px) {
    .bdh-bk-post-card__body {
        padding: 14px 12px 16px 12px;
    }
    .bdh-bk-post-pagination {
        gap: 6px;
    }
    .bdh-bk-post-pagination .page-numbers {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }
}
