/* =====================================================================
   TEAM CODE DẠO - HOMEPAGE STYLES (FRONT-PAGE CSS)
   Tách riêng hoàn toàn từ front-page.php, chuẩn Flat Modern 1400px
   ===================================================================== */

.home-wrap {
    max-width: 1400px;
    margin: 25px auto 60px;
    padding: 0 16px;
}

/* Tiêu đề từng Section */
.home-sec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 38px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}
.home-sec-header.first-sec {
    margin-top: 0;
}
.home-sec-title {
    font-size: 22.5px;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.home-sec-link {
    font-size: 14.5px;
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.15s;
}
.home-sec-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ===================================================
   1. TIN NỔI BẬT: 3 BÀI NGANG FULL CHIỀU RỘNG
   =================================================== */
.featured-three-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-bottom: 40px;
}
.featured-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}
.featured-card:hover {
    border-color: #2563eb;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.08);
    transform: translateY(-2px);
}
.featured-thumb-wrap {
    width: 100%;
    height: 205px;
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
}
.featured-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.featured-card:hover .featured-thumb-img {
    transform: scale(1.05);
}
.featured-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 4px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 0.3px;
}
.featured-body {
    padding: 18px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.featured-title {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.45;
    color: #111827;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 52px;
}
.featured-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.15s;
}
.featured-title a:hover {
    color: #2563eb;
}
.featured-excerpt {
    font-size: 14.5px;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.featured-meta {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===================================================
   2. BỐ CỤC 2 CỘT TRANG CHỦ (CỘT CHÍNH + SIDEBAR)
   =================================================== */
.home-body-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.home-main-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.home-sidebar-col {
    width: 330px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Khung Tin tức mới nhất */
.news-list-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.home-news-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px 20px;
    display: flex;
    gap: 20px;
    transition: all 0.2s ease;
}
.home-news-item:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}
.home-news-thumb {
    width: 210px;
    height: 135px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.home-news-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.home-news-title {
    font-size: 18.5px;
    font-weight: 700;
    line-height: 1.45;
    color: #111827;
    margin-bottom: 8px;
}
.home-news-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.15s;
}
.home-news-title a:hover {
    color: #2563eb;
}
.home-news-excerpt {
    font-size: 14.5px;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Khung Truyện tranh mới cập nhật: 1 hàng 4 truyện */
.home-manga-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    width: 100%;
}
.home-manga-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.home-manga-card:hover {
    border-color: #2563eb;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.12);
    transform: translateY(-3px);
}
.home-manga-poster-wrap {
    width: 100%;
    aspect-ratio: 3 / 4;
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
}
.home-manga-poster-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.home-manga-card:hover .home-manga-poster-img {
    transform: scale(1.05);
}
.home-manga-badge-hot {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.home-manga-badge-time {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}
.home-manga-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}
.home-manga-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: #111827;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 45px;
}
.home-manga-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.15s;
}
.home-manga-title a:hover {
    color: #2563eb;
}

/* 1 Chap mới nhất */
.home-manga-chaps {
    border-top: 1px solid #f3f4f6;
    padding-top: 10px;
}
.home-chap-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    padding: 7px 11px;
    border-radius: 6px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    transition: all 0.15s ease;
}
.home-chap-pill:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}
.home-chap-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    font-weight: 700;
    font-size: 13px;
}
.home-chap-time {
    font-size: 11.5px;
    color: #6b7280;
    font-weight: 500;
}
.home-chap-empty {
    font-size: 12px;
    color: #9ca3af;
    display: block;
    text-align: center;
    padding: 4px 0;
    font-style: italic;
}

/* ===================================================
   3. HÀNG CHUYÊN MỤC TỰ ĐỘNG (DYNAMIC CATEGORY ROWS)
   =================================================== */
.home-video-grid, .home-cat-post-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    width: 100%;
}
.video-ai-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}
.video-ai-card:hover {
    border-color: #2563eb;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.12);
    transform: translateY(-3px);
}
.video-thumb-link {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    overflow: hidden;
}
.video-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.video-ai-card:hover .video-thumb-img {
    transform: scale(1.05);
}
.video-fhd-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(37, 99, 235, 0.92);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: rgba(37, 99, 235, 0.95);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.45);
    transition: transform 0.2s ease, background 0.2s ease;
}
.video-ai-card:hover .video-play-btn {
    transform: translate(-50%, -50%) scale(1.1);
    background: #2563eb;
}
.video-card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.video-card-title {
    font-size: 15.5px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.4;
    min-height: 44px;
}
.video-card-title a {
    color: #111827;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
}
.video-card-title a:hover {
    color: #2563eb;
}
.video-card-meta {
    margin-top: auto;
    font-size: 12.5px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f3f4f6;
    padding-top: 10px;
}
.video-card-btn {
    color: #2563eb;
    font-weight: 700;
    font-size: 13px;
}

/* Article Card in Dynamic Rows */
.dyn-article-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}
.dyn-article-card:hover {
    border-color: #2563eb;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.12);
    transform: translateY(-3px);
}
.dyn-article-thumb-link {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: #f3f4f6;
    overflow: hidden;
}
.dyn-article-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}
.dyn-article-card:hover .dyn-article-thumb-img {
    transform: scale(1.05);
}
.dyn-article-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.dyn-article-title {
    font-size: 15.5px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.4;
    min-height: 44px;
}
.dyn-article-title a {
    color: #111827;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
}
.dyn-article-title a:hover {
    color: #2563eb;
}
.dyn-article-excerpt {
    font-size: 13.5px;
    color: #4b5563;
    line-height: 1.55;
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dyn-article-meta {
    margin-top: auto;
    font-size: 12.5px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f3f4f6;
    padding-top: 10px;
}
.dyn-article-btn {
    color: #2563eb;
    font-weight: 700;
    font-size: 13px;
}

/* Empty Placeholder for Dynamic Categories */
.dyn-empty-box {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 28px 24px;
    text-align: center;
}
.dyn-empty-text {
    margin: 0 0 10px;
    color: #4b5563;
    font-size: 15px;
    line-height: 1.5;
}
.dyn-empty-btn {
    display: inline-block;
    font-size: 13.5px;
    font-weight: 700;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 7px 18px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
}
.dyn-empty-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* ===================================================
   SIDEBAR WIDGETS
   =================================================== */
.home-sidebar-box {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px 22px;
}
.home-sidebar-title {
    font-size: 17px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #f3f4f6;
}
.sidebar-item-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.sidebar-rank-badge {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}
.rank-1 { background: #fee2e2; color: #dc2626; }
.rank-2 { background: #fef3c7; color: #d97706; }
.rank-3 { background: #fef9c3; color: #ca8a04; }
.rank-other { background: #f3f4f6; color: #4b5563; }

.sidebar-item-content {
    flex: 1;
    min-width: 0;
}
.sidebar-item-link {
    font-size: 14.5px;
    font-weight: 700;
    color: #111827;
    text-decoration: none;
    line-height: 1.45;
    transition: color 0.15s;
}
.sidebar-item-link:hover {
    color: #2563eb;
}
.sidebar-item-date {
    font-size: 12px;
    color: #6b7280;
    display: block;
    margin-top: 3px;
}

/* ===================================================
   RESPONSIVE DESIGN
   =================================================== */
@media (max-width: 1100px) {
    .home-body-layout {
        flex-direction: column;
    }
    .home-sidebar-col {
        width: 100%;
        position: static;
    }
    .home-manga-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 850px) {
    .featured-three-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .home-manga-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .home-video-grid, .home-cat-post-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 600px) {
    .featured-three-grid {
        grid-template-columns: 1fr;
    }
    .home-manga-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
        gap: 12px;
    }
    .home-video-grid, .home-cat-post-grid {
        grid-template-columns: 1fr !important;
    }
    .home-news-item {
        flex-direction: column;
    }
    .home-news-thumb {
        width: 100%;
        height: 180px;
    }
}
