/*
 * mynews-grid.css
 * Layout Grid: trang chủ, category — dạng báo điện tử kiểu VNExpress
 *
 * @package MyNews_Theme
 * @since 1.0.0
 */

/* ============================================================
   RESET & UTILITY
   ============================================================ */
.mn-fullwidth-wrap {
    background: #f4f4f4;
    padding: 28px 0 40px;
    min-height: 60vh;
}

/* ============================================================
   HERO POST — bài nổi bật đầu trang chủ
   ============================================================ */
.mn-hero-post {
    position: relative;
    background: #FFF;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 32px;
    min-height: 460px;
    display: flex;
    align-items: flex-end;
}

.mn-hero-thumb {
    display: block;
    position: absolute;
    inset: 0;
}

.mn-hero-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform 0.5s ease;
}

.mn-hero-post:hover .mn-hero-thumb img {
    transform: scale(1.03);
}

/* gradient overlay */
.mn-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.82) 0%,
        rgba(0, 0, 0, 0.45) 50%,
        rgba(0, 0, 0, 0.05) 100%
    );
}

.mn-hero-content {
    position: relative;
    z-index: 2;
    padding: 32px 36px 36px;
    width: 100%;
    max-width: 800px;
}

.mn-hero-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.mn-cat-badge {
    display: inline-block;
    background: #029fb2;
    color: #fff !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 2px;
    text-decoration: none;
    transition: background 0.2s;
    line-height: 1.4;
}

.mn-cat-badge:hover {
    background: #028a9a;
    text-decoration: none;
    color: #fff !important;
}

.mn-hero-date {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mn-hero-title {
    font-size: clamp(22px, 3vw, 34px);
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 14px;
    letter-spacing: -0.3px;
}

.mn-hero-title a {
    color: #fff;
    text-decoration: none;
    transition: color 0.2s;
}

.mn-hero-title a:hover {
    color: rgba(255, 255, 255, 0.85);
}

.mn-hero-excerpt {
    color: rgba(255, 255, 255, 0.80);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 20px;
}

/* ============================================================
   READ MORE BUTTON (dùng chung)
   ============================================================ */
.mn-read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #029fb2;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 20px;
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.2px;
}

.mn-read-more-btn:hover {
    background: #028a9a;
    color: #fff !important;
    text-decoration: none;
    transform: translateY(-1px);
}

/* ============================================================
   SECTION HEADER
   ============================================================ */
.mn-section-header {
    margin-bottom: 20px;
}

.mn-section-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.mn-section-title span {
    position: relative;
}

.mn-section-title span::after {
    content: '';
    display: block;
    width: 100%;
    height: 3px;
    background: #029fb2;
    position: absolute;
    bottom: -10px;
    left: 0;
    border-radius: 2px;
}

/* horizontal rule dưới section title */
.mn-section-header::after {
    content: '';
    display: block;
    height: 1px;
    background: #e2e2e2;
    margin-top: 10px;
}

/* ============================================================
   POST GRID — 3 cột
   ============================================================ */
.mn-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-bottom: 32px;
}

/* ============================================================
   POST CARD
   ============================================================ */
.mn-post-card {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.mn-post-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
}

/* ---- Thumbnail ---- */
.mn-card-thumb-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #eaeaea;
    flex-shrink: 0;
}

.mn-card-thumb-link {
    display: block;
    width: 100%;
    height: 100%;
}

.mn-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease;
}

.mn-post-card:hover .mn-card-thumb {
    transform: scale(1.06);
}

/* placeholder khi không có ảnh */
.mn-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8e8e8, #d4d4d4);
    color: #bbb;
    font-size: 36px;
}

/* category badge on thumb */
.mn-card-cat-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #029fb2;
    color: #fff !important;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 2px;
    text-decoration: none;
    line-height: 1.4;
    z-index: 2;
    transition: background 0.2s;
    white-space: nowrap;
}

.mn-card-cat-badge:hover {
    background: #028a9a;
    text-decoration: none;
    color: #fff !important;
}

/* ---- Card Body ---- */
.mn-card-body {
    padding: 16px 18px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.mn-card-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 10px;
    /* 3 dòng rồi cắt */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mn-card-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s;
}

.mn-card-title a:hover {
    color: #029fb2;
}

.mn-card-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.55;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* ---- Card Footer ---- */
.mn-card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    font-size: 12px;
    color: #999;
    margin-top: auto;
}

.mn-card-date {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.mn-card-date i,
.mn-card-comments i {
    font-size: 11px;
    color: #bbb;
}

.mn-card-comments {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mn-card-readmore {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #029fb2;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: gap 0.2s, color 0.2s;
}

.mn-card-readmore:hover {
    color: #028a9a;
    gap: 8px;
    text-decoration: none;
}

.mn-card-readmore i {
    font-size: 10px;
    transition: transform 0.2s;
}

.mn-post-card:hover .mn-card-readmore i {
    transform: translateX(3px);
}

/* ============================================================
   NO POSTS STATE
   ============================================================ */
.mn-no-posts-wrap {
    padding: 60px 0;
    text-align: center;
}

.mn-no-posts {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.mn-no-posts-icon {
    font-size: 56px;
    color: #ccc;
}

.mn-no-posts h2 {
    font-size: 20px;
    color: #444;
    margin: 0;
}

.mn-no-posts p {
    color: #888;
    font-size: 14px;
    margin: 0 0 16px;
}

/* ============================================================
   LOAD MORE BUTTON
   ============================================================ */
.mn-loadmore-wrap {
    text-align: center;
    padding: 10px 0 20px;
}

.mn-loadmore-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #fff;
    color: #029fb2;
    border: 2px solid #029fb2;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 32px;
    border-radius: 3px;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    min-width: 220px;
}

.mn-loadmore-btn:hover:not(:disabled) {
    background: #029fb2;
    color: #fff;
    transform: translateY(-1px);
}

.mn-loadmore-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    display: none;
}

.mn-loadmore-btn.loading .btn-text {
    display: none;
}

.mn-loadmore-btn.loading .btn-spinner {
    display: inline-flex;
    color: #029fb2;
}

.mn-loadmore-btn.loading {
    pointer-events: none;
}

/* "Đã tải hết" state */
.mn-loadmore-btn.all-loaded {
    background: #f5f5f5;
    border-color: #ddd;
    color: #999;
    cursor: default;
}

.mn-loadmore-btn.all-loaded:hover {
    transform: none;
}

/* ============================================================
   CATEGORY PAGE HEADER
   ============================================================ */
.mn-cat-header {
    background: #fff;
    border-radius: 4px;
    padding: 24px 28px;
    margin-bottom: 24px;
    border-left: 4px solid #029fb2;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.mn-breadcrumb {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.mn-breadcrumb a {
    color: #029fb2;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.mn-breadcrumb a:hover {
    color: #028a9a;
    text-decoration: none;
}

.mn-breadcrumb-sep {
    font-size: 10px;
    color: #ccc;
}

.mn-breadcrumb span[aria-current] {
    color: #555;
}

.mn-cat-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 8px;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
}

.mn-cat-icon {
    font-size: 22px;
    color: #029fb2;
}

.mn-cat-desc {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 10px;
}

.mn-cat-stats {
    display: flex;
    gap: 20px;
}

.mn-cat-count {
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mn-cat-count i {
    color: #029fb2;
    font-size: 12px;
}

/* ============================================================
   SKELETON LOADING (khi AJAX đang load)
   ============================================================ */
.mn-card-skeleton {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.skeleton-thumb {
    aspect-ratio: 16 / 9;
    background: linear-gradient(90deg, #ebebeb 25%, #f5f5f5 50%, #ebebeb 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
}

.skeleton-body {
    padding: 16px 18px 14px;
}

.skeleton-line {
    height: 14px;
    border-radius: 3px;
    background: linear-gradient(90deg, #ebebeb 25%, #f5f5f5 50%, #ebebeb 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    margin-bottom: 10px;
}

.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   FADE IN ANIMATION — các card mới load thêm
   ============================================================ */
@keyframes mn-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mn-post-card.mn-animate-in {
    animation: mn-fade-in-up 0.35s ease both;
}

/* stagger delay cho các card trong cùng batch */
.mn-post-card.mn-animate-in:nth-child(3n+1) { animation-delay: 0s; }
.mn-post-card.mn-animate-in:nth-child(3n+2) { animation-delay: 0.07s; }
.mn-post-card.mn-animate-in:nth-child(3n)   { animation-delay: 0.14s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet: 2 cột */
@media (max-width: 900px) {
    .mn-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .mn-hero-post {
        min-height: 360px;
    }

    .mn-hero-content {
        padding: 22px 24px 26px;
    }

    .mn-cat-header {
        padding: 18px 20px;
    }

    .mn-cat-title {
        font-size: 22px;
    }
}

/* Mobile: 1 cột */
@media (max-width: 580px) {
    .mn-posts-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .mn-fullwidth-wrap {
        padding: 16px 0 28px;
    }

    .mn-hero-post {
        min-height: 260px;
        border-radius: 0;
    }

    .mn-hero-content {
        padding: 16px 16px 20px;
    }

    .mn-hero-excerpt {
        display: none; /* ẩn excerpt trên mobile để tiết kiệm không gian */
    }

    .mn-hero-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .mn-cat-header {
        border-radius: 0;
        border-left: 3px solid #029fb2;
        padding: 14px 16px;
        margin-bottom: 14px;
    }

    .mn-cat-title {
        font-size: 18px;
    }

    .mn-card-title {
        font-size: 15px;
        -webkit-line-clamp: 2;
    }

    .mn-loadmore-btn {
        width: 100%;
        max-width: 320px;
    }
}

/* Extra small */
@media (max-width: 360px) {
    .mn-card-excerpt {
        display: none;
    }
}
