/* =====================================================
   blog.css — trang Tin tức (danh sách + chi tiết bài viết)
   Dữ liệu: blog_posts + blog_categories (admin web cũ quản trị).
   Bố cục: hero + lưới card + sidebar (danh mục, bài mới), pager server-side.
   ===================================================== */

.blog {
    padding: var(--stc-space-16, 64px) 0 var(--stc-space-20, 80px);
    min-height: 60vh;
    background:
        radial-gradient(900px 380px at 12% -8%, var(--stc-primary-a08, rgba(39, 164, 242, .08)), transparent 62%),
        var(--stc-page, #f5fafd);
}

.blog__inner {
    width: 100%;
    max-width: var(--stc-container, 1200px);
    margin-inline: auto;
    padding-inline: 20px;
    box-sizing: border-box;
}

/* ---------- Hero ---------- */
.blog__head {
    text-align: center;
    margin-bottom: var(--stc-space-10, 40px);
}

.blog__eyebrow {
    font-size: var(--stc-text-xs, 11px);
    font-weight: var(--stc-weight-semibold, 600);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--stc-primary, #27a4f2);
    margin-bottom: var(--stc-space-2, 8px);
}

.blog__title {
    font-size: var(--stc-text-4xl, 36px);
    font-weight: var(--stc-weight-extrabold, 800);
    color: var(--stc-text-strong, #16324a);
    line-height: var(--stc-leading-tight, 1.25);
    margin: 0 0 var(--stc-space-3, 12px);
}

.blog__title span {
    color: var(--stc-primary, #27a4f2);
}

.blog__subtitle {
    font-size: var(--stc-text-lg, 16px);
    color: var(--stc-text-muted, #6b93b1);
    max-width: 640px;
    margin-inline: auto;
    line-height: var(--stc-leading-normal, 1.55);
}

/* ---------- Layout 2 cột ---------- */
.blog__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--stc-space-8, 32px);
    align-items: start;
}

/* ---------- Toolbar + filter ---------- */
.blog__toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--stc-space-4, 16px);
    margin-bottom: var(--stc-space-5, 20px);
}

.blog__toolbar h2 {
    font-size: var(--stc-text-2xl, 22px);
    font-weight: var(--stc-weight-bold, 700);
    color: var(--stc-text-strong, #16324a);
    margin: 0 0 4px;
}

.blog__toolbar p {
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text-muted, #6b93b1);
    margin: 0;
}

.blog__toolbar a {
    font-size: var(--stc-text-sm, 12px);
    font-weight: var(--stc-weight-semibold, 600);
    color: var(--stc-primary, #27a4f2);
    text-decoration: none;
}

.blog__toolbar a:hover { text-decoration: underline; }

.blog__filter {
    display: flex;
    gap: var(--stc-space-3, 12px);
    align-items: flex-end;
    background: var(--stc-surface, #ffffff);
    border: 1px solid var(--stc-border, #d9e8f3);
    border-radius: var(--stc-radius-md, 14px);
    padding: var(--stc-space-4, 16px);
    margin-bottom: var(--stc-space-6, 24px);
    box-shadow: var(--stc-shadow-xs);
}

.blog__filter label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.blog__filter label span {
    font-size: var(--stc-text-sm, 12px);
    font-weight: var(--stc-weight-semibold, 600);
    color: var(--stc-text, #24425c);
}

.blog__filter input[type="search"],
.blog__filter select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--stc-border, #d9e8f3);
    border-radius: var(--stc-radius-xs, 8px);
    font: inherit;
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text-strong, #16324a);
    background: var(--stc-surface-subtle, #fafcff);
    box-sizing: border-box;
}

.blog__filter input[type="search"]:focus,
.blog__filter select:focus {
    outline: 2px solid var(--stc-focus, rgba(39, 164, 242, .3));
    outline-offset: 1px;
    border-color: var(--stc-primary, #27a4f2);
}

.blog__filter button {
    padding: 10px 20px;
    border: none;
    border-radius: var(--stc-radius-xs, 8px);
    background: var(--stc-primary, #27a4f2);
    color: var(--stc-white, #ffffff);
    font: inherit;
    font-size: var(--stc-text-base, 14px);
    font-weight: var(--stc-weight-semibold, 600);
    cursor: pointer;
    transition: background var(--stc-duration-fast, 140ms) var(--stc-ease);
}

.blog__filter button:hover {
    background: var(--stc-primary-hover, #1b8fd9);
}

/* ---------- Grid bài viết ---------- */
.blog__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--stc-space-5, 20px);
}

.blog-card {
    background: var(--stc-surface, #ffffff);
    border: 1px solid var(--stc-border, #d9e8f3);
    border-radius: var(--stc-radius-md, 14px);
    overflow: hidden;
    box-shadow: var(--stc-shadow-xs);
    display: flex;
    flex-direction: column;
    transition: transform var(--stc-duration-normal, 220ms) var(--stc-ease),
                box-shadow var(--stc-duration-normal, 220ms) var(--stc-ease);
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--stc-shadow-md);
}

.blog-card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--stc-neutral-100, #ebf4fa);
    overflow: hidden;
}

.blog-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s var(--stc-ease, ease);
}

.blog-card:hover .blog-card__thumb img {
    transform: scale(1.05);
}

.blog-card__thumb--empty::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--stc-primary-soft, #e8f5fe), var(--stc-neutral-100, #ebf4fa));
}

.blog-card__icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-card__icon svg {
    width: 34px;
    height: 34px;
    padding: 10px;
    box-sizing: content-box;
    border-radius: var(--stc-radius-md, 14px);
    background: var(--stc-primary, #27a4f2);
    color: var(--stc-white, #ffffff);
    box-shadow: var(--stc-shadow-primary);
    transition: transform var(--stc-duration-normal, 220ms) var(--stc-ease);
}

.blog-card:hover .blog-card__icon svg {
    transform: scale(1.1);
}

.blog-card__pin {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--stc-primary, #27a4f2);
    box-shadow: var(--stc-shadow-xs);
}

.blog-card__pin svg {
    width: 15px;
    height: 15px;
}

.blog-card__body {
    padding: var(--stc-space-4, 16px);
    display: flex;
    flex-direction: column;
    gap: var(--stc-space-2, 8px);
    flex: 1;
}

.blog-card__meta {
    display: flex;
    align-items: center;
    gap: var(--stc-space-2, 8px);
    font-size: var(--stc-text-sm, 12px);
    color: var(--stc-text-muted, #6b93b1);
}

.blog-card__chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--stc-radius-pill, 999px);
    background: var(--stc-primary-soft, #e8f5fe);
    color: var(--stc-primary, #27a4f2);
    font-weight: var(--stc-weight-semibold, 600);
    text-decoration: none;
}

.blog-card__chip:hover {
    background: var(--stc-primary-a15, rgba(39, 164, 242, .15));
}

.blog-card__title {
    font-size: var(--stc-text-lg, 16px);
    font-weight: var(--stc-weight-bold, 700);
    line-height: var(--stc-leading-tight, 1.25);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__title a {
    color: var(--stc-text-strong, #16324a);
    text-decoration: none;
}

.blog-card__title a:hover {
    color: var(--stc-primary, #27a4f2);
}

.blog-card__desc {
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text-muted, #6b93b1);
    line-height: var(--stc-leading-normal, 1.55);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    font-size: var(--stc-text-base, 14px);
    font-weight: var(--stc-weight-semibold, 600);
    color: var(--stc-primary, #27a4f2);
    text-decoration: none;
}

.blog-card__more:hover { text-decoration: underline; }

/* ---------- Pager ---------- */
.blog__pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--stc-space-4, 16px);
    margin-top: var(--stc-space-6, 24px);
}

.blog__pager span {
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text-muted, #6b93b1);
}

.blog__pager .is-disabled {
    opacity: .45;
    pointer-events: none;
}

/* ---------- Empty state ---------- */
.blog__empty {
    background: var(--stc-surface, #ffffff);
    border: 1px dashed var(--stc-border-strong, #bfd8ea);
    border-radius: var(--stc-radius-md, 14px);
    text-align: center;
    padding: var(--stc-space-10, 40px) var(--stc-space-6, 24px);
}

.blog__empty svg {
    color: var(--stc-primary-a40, rgba(39, 164, 242, .4));
    margin-bottom: var(--stc-space-3, 12px);
}

.blog__empty h3 {
    font-size: var(--stc-text-xl, 18px);
    font-weight: var(--stc-weight-bold, 700);
    color: var(--stc-text-strong, #16324a);
    margin: 0 0 var(--stc-space-2, 8px);
}

.blog__empty p {
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text-muted, #6b93b1);
    margin: 0 0 var(--stc-space-4, 16px);
}

.blog__empty a {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--stc-radius-pill, 999px);
    background: var(--stc-primary, #27a4f2);
    color: var(--stc-white, #ffffff);
    font-size: var(--stc-text-base, 14px);
    font-weight: var(--stc-weight-semibold, 600);
    text-decoration: none;
    box-shadow: var(--stc-shadow-primary);
    transition: background var(--stc-duration-fast, 140ms) var(--stc-ease);
}

.blog__empty a:hover {
    background: var(--stc-primary-hover, #1b8fd9);
    color: var(--stc-white, #ffffff);
}

/* ---------- Sidebar ---------- */
.blog-side-card {
    background: var(--stc-surface, #ffffff);
    border: 1px solid var(--stc-border, #d9e8f3);
    border-radius: var(--stc-radius-md, 14px);
    padding: var(--stc-space-5, 20px);
    box-shadow: var(--stc-shadow-xs);
    margin-bottom: var(--stc-space-5, 20px);
}

.blog-side-card h2 {
    font-size: var(--stc-text-lg, 16px);
    font-weight: var(--stc-weight-bold, 700);
    color: var(--stc-text-strong, #16324a);
    margin: 0 0 var(--stc-space-3, 12px);
}

.blog-side-card__links {
    display: flex;
    flex-direction: column;
    gap: var(--stc-space-2, 8px);
}

.blog-side-card__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--stc-space-3, 12px);
    padding: 10px 14px;
    border-radius: var(--stc-radius-xs, 8px);
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text, #24425c);
    text-decoration: none;
    background: var(--stc-surface-subtle, #fafcff);
    border: 1px solid transparent;
    transition: border-color var(--stc-duration-fast, 140ms) var(--stc-ease),
                color var(--stc-duration-fast, 140ms) var(--stc-ease);
}

.blog-side-card__link:hover {
    border-color: var(--stc-border, #d9e8f3);
    color: var(--stc-primary, #27a4f2);
}

.blog-side-card__link--active {
    background: var(--stc-primary-soft, #e8f5fe);
    color: var(--stc-primary, #27a4f2);
    font-weight: var(--stc-weight-semibold, 600);
}

.blog-side-card__link b {
    font-size: var(--stc-text-base, 14px);
}

/* Bài mới ở sidebar */
.blog-side-latest {
    display: flex;
    flex-direction: column;
    gap: var(--stc-space-3, 12px);
}

.blog-side-latest a {
    display: flex;
    align-items: center;
    gap: var(--stc-space-3, 12px);
    text-decoration: none;
}

.blog-side-latest__thumb {
    position: relative;
    width: 76px;
    height: 46px;
    flex: 0 0 76px;
    border-radius: var(--stc-radius-xs, 8px);
    overflow: hidden;
    background: var(--stc-neutral-100, #ebf4fa);
}

.blog-side-latest__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-side-latest__thumb--empty::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--stc-primary-soft, #e8f5fe), var(--stc-neutral-100, #ebf4fa));
}

.blog-side-latest__thumb svg {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 14px;
    height: 14px;
    color: var(--stc-white, #ffffff);
    background: var(--stc-primary, #27a4f2);
    border-radius: 50%;
    padding: 4px;
    box-sizing: content-box;
}

.blog-side-latest b {
    font-size: var(--stc-text-base, 14px);
    font-weight: var(--stc-weight-semibold, 600);
    color: var(--stc-text-strong, #16324a);
    line-height: var(--stc-leading-tight, 1.25);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-side-latest a:hover b {
    color: var(--stc-primary, #27a4f2);
}

/* =====================================================
   Trang chi tiết bài viết
   ===================================================== */

.blog--detail {
    padding-top: var(--stc-space-10, 40px);
}

.blog__breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text-muted, #6b93b1);
    margin-bottom: var(--stc-space-6, 24px);
}

.blog__breadcrumb a {
    color: var(--stc-text-muted, #6b93b1);
    text-decoration: none;
}

.blog__breadcrumb a:hover {
    color: var(--stc-primary, #27a4f2);
}

.blog__breadcrumb span {
    color: var(--stc-text-strong, #16324a);
    font-weight: var(--stc-weight-semibold, 600);
}

.blog__breadcrumb svg {
    flex: 0 0 auto;
    opacity: .6;
}

/* ---------- Card thông tin bài ---------- */
.blog-info-card {
    background: var(--stc-surface, #ffffff);
    border: 1px solid var(--stc-border, #d9e8f3);
    border-radius: var(--stc-radius-md, 14px);
    padding: var(--stc-space-6, 24px);
    box-shadow: var(--stc-shadow-xs);
    margin-bottom: var(--stc-space-5, 20px);
}

.blog-info-card__title {
    font-size: var(--stc-text-3xl, 28px);
    font-weight: var(--stc-weight-extrabold, 800);
    color: var(--stc-text-strong, #16324a);
    line-height: var(--stc-leading-tight, 1.25);
    margin: 0 0 var(--stc-space-3, 12px);
}

.blog-info-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--stc-space-3, 12px);
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text-muted, #6b93b1);
    margin-bottom: var(--stc-space-4, 16px);
}

.blog-info-card__meta a {
    color: var(--stc-primary, #27a4f2);
    text-decoration: none;
    font-weight: var(--stc-weight-semibold, 600);
}

.blog-info-card__meta a:hover {
    text-decoration: underline;
}

.blog-info-card__share {
    display: flex;
    align-items: center;
    gap: var(--stc-space-2, 8px);
    font-size: var(--stc-text-base, 14px);
    color: var(--stc-text-muted, #6b93b1);
}

.blog-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--stc-border, #d9e8f3);
    background: var(--stc-surface-subtle, #fafcff);
    color: var(--stc-text, #24425c);
    font-size: var(--stc-text-base, 14px);
    font-weight: var(--stc-weight-bold, 700);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--stc-duration-fast, 140ms) var(--stc-ease),
                color var(--stc-duration-fast, 140ms) var(--stc-ease),
                border-color var(--stc-duration-fast, 140ms) var(--stc-ease);
}

.blog-share-btn--fb:hover {
    background: #1877f2;
    border-color: #1877f2;
    color: var(--stc-white, #ffffff);
}

.blog-share-btn--zalo:hover {
    background: #0068ff;
    border-color: #0068ff;
    color: var(--stc-white, #ffffff);
}

.blog-share-btn--copy:hover,
.blog-share-btn.is-copied {
    background: var(--stc-primary, #27a4f2);
    border-color: var(--stc-primary, #27a4f2);
    color: var(--stc-white, #ffffff);
}

/* ---------- Card nội dung ---------- */
.blog-content-card {
    background: var(--stc-surface, #ffffff);
    border: 1px solid var(--stc-border, #d9e8f3);
    border-radius: var(--stc-radius-md, 14px);
    overflow: hidden;
    box-shadow: var(--stc-shadow-xs);
    margin-bottom: var(--stc-space-5, 20px);
}

.blog-content-card__image {
    margin: 0;
    aspect-ratio: 16 / 9;
    background: var(--stc-neutral-100, #ebf4fa);
    position: relative;
    overflow: hidden;
}

.blog-content-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.blog-content-card__image--empty::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--stc-primary-soft, #e8f5fe), var(--stc-neutral-100, #ebf4fa));
}

.blog-content-card__body {
    padding: var(--stc-space-6, 24px);
    font-size: var(--stc-text-lg, 16px);
    line-height: var(--stc-leading-relaxed, 1.75);
    color: var(--stc-text, #24425c);
    overflow-wrap: break-word;
}

.blog-content-card__body h2 {
    font-size: var(--stc-text-2xl, 22px);
    font-weight: var(--stc-weight-bold, 700);
    color: var(--stc-text-strong, #16324a);
    line-height: var(--stc-leading-tight, 1.25);
    margin: var(--stc-space-8, 32px) 0 var(--stc-space-3, 12px);
}

.blog-content-card__body h3 {
    font-size: var(--stc-text-xl, 18px);
    font-weight: var(--stc-weight-bold, 700);
    color: var(--stc-text-strong, #16324a);
    margin: var(--stc-space-6, 24px) 0 var(--stc-space-2, 8px);
}

.blog-content-card__body p {
    margin: 0 0 var(--stc-space-4, 16px);
}

.blog-content-card__body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--stc-radius-sm, 10px);
}

.blog-content-card__body a {
    color: var(--stc-primary, #27a4f2);
}

.blog-content-card__body ul,
.blog-content-card__body ol {
    padding-left: 24px;
    margin: 0 0 var(--stc-space-4, 16px);
}

.blog-content-card__body blockquote {
    margin: 0 0 var(--stc-space-4, 16px);
    padding: var(--stc-space-3, 12px) var(--stc-space-4, 16px);
    border-left: 3px solid var(--stc-primary, #27a4f2);
    background: var(--stc-primary-softer, #f4fbff);
    border-radius: 0 var(--stc-radius-xs, 8px) var(--stc-radius-xs, 8px) 0;
    color: var(--stc-text-strong, #16324a);
}

.blog-content-card__body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--stc-space-4, 16px);
    font-size: var(--stc-text-base, 14px);
}

.blog-content-card__body th,
.blog-content-card__body td {
    border: 1px solid var(--stc-border, #d9e8f3);
    padding: 8px 12px;
    text-align: left;
}

.blog-content-card__body th {
    background: var(--stc-primary-softer, #f4fbff);
    color: var(--stc-text-strong, #16324a);
}

/* ---------- Điều hướng bài ---------- */
.blog-post-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--stc-space-3, 12px);
    flex-wrap: wrap;
}

.blog-post-nav__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--stc-radius-pill, 999px);
    font-size: var(--stc-text-base, 14px);
    font-weight: var(--stc-weight-semibold, 600);
    text-decoration: none;
    transition: background var(--stc-duration-fast, 140ms) var(--stc-ease),
                color var(--stc-duration-fast, 140ms) var(--stc-ease);
}

.blog-post-nav__btn--all {
    background: var(--stc-surface, #ffffff);
    border: 1px solid var(--stc-border, #d9e8f3);
    color: var(--stc-text, #24425c);
}

.blog-post-nav__btn--all:hover {
    border-color: var(--stc-primary, #27a4f2);
    color: var(--stc-primary, #27a4f2);
}

.blog-post-nav__btn--next {
    background: var(--stc-primary, #27a4f2);
    color: var(--stc-white, #ffffff);
    box-shadow: var(--stc-shadow-primary);
}

.blog-post-nav__btn--next:hover {
    background: var(--stc-primary-hover, #1b8fd9);
    color: var(--stc-white, #ffffff);
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .blog__layout {
        grid-template-columns: 1fr;
    }
    .blog__side {
        order: 2;
    }
}

@media (max-width: 720px) {
    .blog {
        padding: var(--stc-space-10, 40px) 0 var(--stc-space-16, 64px);
    }
    .blog__title {
        font-size: var(--stc-text-3xl, 28px);
    }
    .blog__filter {
        flex-direction: column;
        align-items: stretch;
    }
    .blog__toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .blog-info-card__title {
        font-size: var(--stc-text-2xl, 22px);
    }
    .blog-content-card__body {
        padding: var(--stc-space-4, 16px);
        font-size: var(--stc-text-base, 14px);
    }
}
