/* Reset khoảng cách thẻ bao Flatsome */
#flatsome-custom-related-section,
#flatsome-custom-related-section .large-12 {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 2. KHUNG NỀN TRÀN FULL MÀN HÌNH (100VW) */
.custom-related-wrapper {
    background-color: var(--soft-off-white);
    width: 100vw !important;
    margin-top: 60px;
    padding: 60px 0 70px 0;
    box-sizing: border-box;
}

/* 3. KHUNG CHỨA NỘI DUNG (CĂN GIỮA) */
.related-main-title,
.related-posts-grid {
    max-width: 1300px;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

/* 4. TIÊU ĐỀ: "TIN TỨC LIÊN QUAN" */
.related-main-title {
    color: var(--color-main);
    font-size: 26px;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    margin-bottom: 30px !important;
}

/* 5. LƯỚI BÀI VIẾT (GRID SYSTEM) */
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* 6. THẺ BÀI VIẾT (CARD) */
.related-post-card {
    background-color: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0, 27, 68, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 27, 68, 0.1);
}

/* Hình ảnh đại diện */
.related-thumb-link {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-color: #eee;
}

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

.related-post-card:hover .related-thumb-img {
    transform: scale(1.05);
}

/* Phần nội dung của card */
.related-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Tiêu đề bài viết */
.related-card-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
    margin: 0 0 12px 0;
}

.related-card-title a {
    color: var(--color-black);
    text-decoration: none;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card-title a:hover {
    color: var(--color-electric);
}

/* Đoạn trích bài viết */
.related-card-excerpt {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--deep-cool-gray);
    margin: 0 0 16px 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta: Thời gian đọc & Ngày đăng */
.related-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12.5px;
    color: #718096;
    margin-bottom: 20px;
}

.related-card-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.related-card-meta .meta-item i {
    font-size: 13px;
    color: #a0aec0;
}

/* Nút đọc bài viết */
.related-btn-readmore {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-electric);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    width: fit-content;
}

.related-btn-readmore .arrow-icon {
    font-size: 13px;
    transition: transform 0.2s ease;
}

.related-btn-readmore:hover .arrow-icon {
    transform: translateX(5px);
}

/* 7. RESPONSIVE THIẾT BỊ DI ĐỘNG */
/* Tablet (Dưới 1024px) */
@media (max-width: 1024px) {
    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile (Dưới 650px) */
@media (max-width: 650px) {
    .custom-related-wrapper {
        padding: 40px 0 50px 0;
        margin-top: 40px;
    }
    .related-main-title {
        font-size: 20px;
        margin-bottom: 20px !important;
    }
    .related-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .related-card-content {
        padding: 18px;
    }
}