/**
 * BLOG/NEWS PAGES CSS - Reland Theme Compatible
 * Listing grid, cards, pagination, detail, sidebar
 */

/* ==========================================================================
   BLOG LIST SECTION
   ========================================================================== */
.blog-list-section {
    padding: 60px 0 80px;
    background: #fff;
}

/* ==========================================================================
   BLOG GRID — 3 columns desktop, 2 tablet, 1 mobile
   ========================================================================== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* ==========================================================================
   BLOG CARD
   ========================================================================== */
.blog-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-item:hover {
    box-shadow: 0 8px 30px rgba(26, 80, 145, 0.12);
    transform: translateY(-5px);
}

/* Thumbnail */
.blog-item-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
    /* CSS fallback: hiển thị khi ảnh chưa load hoặc lỗi */
    background: linear-gradient(135deg, #e8f0f9 0%, #d0e2f5 100%);
}

/* Icon placeholder giữa thumb khi ảnh lỗi */
.blog-item-thumb::before {
    content: '\f03e';
    font-family: 'FontAwesome';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    color: rgba(26, 80, 145, 0.18);
    z-index: 0;
    pointer-events: none;
}

.blog-item-thumb a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.blog-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    position: relative;
    z-index: 1;
}

/* SVG placeholder: căn giữa, không scale quá to */
.blog-item-thumb img.img-placeholder-fallback,
.blog-item-thumb img[src*="placeholders"] {
    object-fit: contain;
    padding: 20%;
    background: linear-gradient(135deg, #e8f0f9 0%, #d0e2f5 100%);
    opacity: 0.7;
}

.blog-item:hover .blog-item-thumb img:not(.img-placeholder-fallback):not([src*="placeholders"]) {
    transform: scale(1.05);
}

/* Date Badge */
.blog-date-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--tg-primary-color, #1a5091);
    color: #fff;
    padding: 8px 14px;
    text-align: center;
    border-radius: 8px;
    z-index: 2;
    line-height: 1;
}

.blog-date-badge .day {
    display: block;
    font-family: var(--tg-heading-font-family, 'Montserrat', sans-serif);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2px;
}

.blog-date-badge .month {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

/* Card Info */
.blog-item-info {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Category Badge */
.blog-item-category {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f4f9;
    color: var(--tg-primary-color, #1a5091);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    margin-bottom: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.blog-item-category:hover {
    background: var(--tg-primary-color, #1a5091);
    color: #fff;
}

/* Title */
.blog-item-title {
    font-family: var(--tg-heading-font-family, 'Montserrat', sans-serif);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
    text-transform: none;
}

.blog-item-title a {
    color: #1e2a3a;
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-item-title a:hover {
    color: var(--tg-primary-color, #1a5091);
}

/* Excerpt */
.blog-item-excerpt {
    font-size: 14px;
    color: #777;
    line-height: 1.7;
    margin-bottom: 16px;
    flex: 1;
}

/* Read More */
.blog-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-primary-color, #1a5091);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: color 0.3s ease;
    margin-top: auto;
}

.blog-read-more::after {
    content: '\f178';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.blog-read-more:hover {
    color: var(--dxmt-accent, #e8811c);
}

.blog-read-more:hover::after {
    transform: translateX(5px);
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 50px;
    padding-top: 30px;
}

.blog-pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    text-decoration: none;
    transition: all 0.3s ease;
}

.blog-pagination .page-link:hover {
    border-color: var(--tg-primary-color, #1a5091);
    color: var(--tg-primary-color, #1a5091);
    background: #f0f4f9;
}

.blog-pagination .page-link.active {
    background: var(--tg-primary-color, #1a5091);
    border-color: var(--tg-primary-color, #1a5091);
    color: #fff;
}

.blog-pagination .page-link.disabled {
    color: #ccc;
    border-color: #eee;
    pointer-events: none;
}

.blog-pagination .page-link i {
    font-size: 12px;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.blog-empty {
    text-align: center;
    padding: 80px 20px;
}

.blog-empty-icon {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.blog-empty h4 {
    font-family: var(--tg-heading-font-family, 'Montserrat', sans-serif);
    font-size: 20px;
    color: #1e2a3a;
    margin-bottom: 10px;
    text-transform: none;
}

.blog-empty p {
    color: #888;
    margin-bottom: 25px;
    font-size: 15px;
}

.blog-empty .btn-primary {
    background: var(--tg-primary-color, #1a5091);
    border-color: var(--tg-primary-color, #1a5091);
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.blog-empty .btn-primary:hover {
    background: #134075;
    transform: translateY(-2px);
}

/* ==========================================================================
   TAG FILTER — override inline styles from x_news.php
   ========================================================================== */
.tag-filter-info {
    border-left-color: var(--dxmt-accent, #e8811c);
}

.tag-filter-badge {
    background: var(--dxmt-accent, #e8811c);
}

/* ==========================================================================
   BLOG DETAIL PAGE
   ========================================================================== */
.blog-detail-section {
    padding: 60px 0;
    background: #fff;
}

.blog-detail-header {
    text-align: center;
    margin-bottom: 40px;
}

.blog-detail-category {
    display: inline-block;
    padding: 6px 16px;
    background: var(--tg-primary-color, #1a5091);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 20px;
    margin-bottom: 20px;
    text-decoration: none;
}

.blog-detail-title {
    font-family: var(--tg-heading-font-family, 'Montserrat', sans-serif);
    font-size: 32px;
    font-weight: 700;
    color: #1e2a3a;
    margin-bottom: 20px;
    line-height: 1.3;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    text-transform: none;
}

.blog-detail-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: #888;
}

.blog-detail-meta span,
.blog-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.blog-detail-meta i,
.blog-meta-item i {
    color: var(--tg-primary-color, #1a5091);
}

/* Featured Image */
.blog-featured-image {
    margin-bottom: 40px;
    border-radius: 12px;
    overflow: hidden;
}

.blog-featured-image img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
}

/* Blog Content */
.blog-content-wrap {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.06);
}

.blog-content {
    color: #555;
    line-height: 1.9;
    font-size: 16px;
}

.blog-content h2,
.blog-content h3,
.blog-content h4 {
    color: #1e2a3a;
    margin-top: 30px;
    margin-bottom: 15px;
    text-transform: none;
}

.blog-content h2 { font-size: 24px; }
.blog-content h3 { font-size: 20px; }
.blog-content h4 { font-size: 18px; }

.blog-content p { margin-bottom: 18px; }

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.blog-content blockquote {
    margin: 25px 0;
    padding: 20px 25px;
    background: #f8f9fa;
    border-left: 4px solid var(--tg-primary-color, #1a5091);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #444;
}

.blog-content a {
    color: var(--tg-primary-color, #1a5091);
}

.blog-content a:hover {
    color: var(--dxmt-accent, #e8811c);
}

/* Tags */
.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.blog-tag-chip,
.blog-tag {
    display: inline-block;
    padding: 5px 14px;
    background: #f0f4f9;
    color: #555;
    font-size: 13px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.blog-tag-chip:hover,
.blog-tag:hover {
    background: var(--tg-primary-color, #1a5091);
    color: #fff;
}

/* Excerpt/Summary Box */
.blog-excerpt {
    background: #f8f9fa;
    border-left: 4px solid var(--tg-primary-color, #1a5091);
    padding: 20px 25px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 30px;
    font-size: 15px;
    color: #555;
    line-height: 1.8;
}

/* Share Buttons */
.blog-share {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.blog-share span {
    font-size: 14px;
    color: #888;
}

.blog-share a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.blog-share a:hover {
    transform: translateY(-3px);
}

/* ==========================================================================
   BLOG SIDEBAR
   ========================================================================== */
.blog-sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-widget {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.06);
    margin-bottom: 25px;
}

.sidebar-widget-title,
.sidebar-widget h4 {
    font-family: var(--tg-heading-font-family, 'Montserrat', sans-serif);
    font-size: 17px;
    font-weight: 700;
    color: #1e2a3a;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--tg-primary-color, #1a5091);
    text-transform: none;
}

/* Sidebar Post Item */
.sidebar-post-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.sidebar-post-item:first-child {
    padding-top: 0;
}

.sidebar-post-item img {
    width: 75px;
    height: 55px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-post-item h5,
.sidebar-post-item .post-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
    text-transform: none;
}

.sidebar-post-item h5 a,
.sidebar-post-item .post-title a {
    color: #1e2a3a;
    text-decoration: none;
}

.sidebar-post-item h5 a:hover,
.sidebar-post-item .post-title a:hover {
    color: var(--tg-primary-color, #1a5091);
}

.sidebar-post-item .post-date {
    font-size: 12px;
    color: #999;
}

/* ==========================================================================
   TOC - Table of Contents
   ========================================================================== */
.blog-toc {
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 30px;
    overflow: hidden;
}

.toc-header {
    padding: 16px 20px;
    background: var(--tg-primary-color, #1a5091);
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}

.toc-content {
    padding: 15px 20px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}

.toc-list li:last-child {
    border-bottom: none;
}

.toc-list a {
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.toc-list a:hover {
    color: var(--tg-primary-color, #1a5091);
}

/* ==========================================================================
   BLOG GALLERY
   ========================================================================== */
.blog-gallery {
    margin: 30px 0;
}

.blog-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.blog-gallery-item {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.blog-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.blog-gallery-item:hover img {
    transform: scale(1.05);
}

/* ==========================================================================
   READING PROGRESS BAR
   ========================================================================== */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    background: transparent;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--tg-primary-color, #1a5091), var(--dxmt-accent, #e8811c));
    width: 0;
    transition: width 0.1s linear;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1199.98px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991.98px) {
    .blog-sidebar {
        position: static;
        margin-top: 40px;
    }

    .blog-content-wrap {
        padding: 25px;
    }

    .blog-detail-title {
        font-size: 26px;
    }
}

@media (max-width: 767.98px) {
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .blog-list-section {
        padding: 40px 0 60px;
    }

    .blog-item-info {
        padding: 20px;
    }

    .blog-item-title {
        font-size: 16px;
    }

    .blog-detail-title {
        font-size: 22px;
    }

    .blog-detail-meta {
        gap: 12px;
        font-size: 13px;
    }

    .blog-content-wrap {
        padding: 18px;
    }

    .blog-featured-image img {
        max-height: 250px;
    }

    .blog-pagination .page-link {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }

    .blog-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
