/*
Theme Name: NgayGioLong Edition
Theme URI: https://ngaygiolong.com
Author: NQC
Author URI: https://ngaygiolong.io.vn
Description: Giao diện web truyện, siêu nhẹ, chuẩn SEO, tích hợp Flexbox Grid mượt mà.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: ngaygiolong
*/

/* 1. IMPORT GOOGLE FONTS */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&display=swap');

/* 2. HỆ THỐNG BIẾN SỐ (VARIABLES) */
:root {
    --primary-pink: #ff6b81;
    /* Hồng Rose chủ đạo */
    --light-pink: #fff5f6;
    /* Hồng cực nhạt cho nền/hover */
    --accent-pink: #ff8e9d;
    /* Hồng sáng cho Gradient */
    --dark-bg: #181824;
    /* Nền card truyện */
    --body-bg: #fcfcfd;
    /* Nền website */
    --text-main: #333333;
    /* Chữ chính */
    --text-muted: #777777;
    /* Chữ phụ */
    --radius-main: 16px;
    /* Bo góc chính */
}

/* 3. RESET & GLOBAL STYLES */
body {
    background: var(--body-bg);
    font-family: 'Quicksand', sans-serif;
    /* Font chữ mới mượt hơn */
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary-pink);
    text-decoration: none;
    transition: 0.3s;
}

a:hover {
    color: var(--text-main);
    text-decoration: none;
}

.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* 4. HEADER & NAVIGATION */
.header-logo {
    color: var(--primary-pink) !important;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
}

#nav-main {
    background: #fff;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #e1e1e1;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.navbar-nav>li>a {
    color: #444 !important;
    font-weight: 700;
    text-transform: uppercase;
    padding: 15px 22px !important;
    font-size: 13px;
}

.navbar-nav>li>a:hover {
    color: var(--primary-pink) !important;
    background: var(--light-pink) !important;
}

/* --- HEADER CHUYÊN BIỆT --- */
#nav-main {
    background: #fff;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 30px;
    padding: 5px 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.03);
}

.navbar-brand-wrap {
    padding-top: 8px;
}

.header-logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-pink) !important;
    text-decoration: none !important;
    letter-spacing: -1px;
}

.navbar-nav>li>a {
    color: #555 !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    padding: 20px 15px !important;
    transition: 0.3s;
}

.navbar-nav>li>a:hover,
.navbar-nav>li.active-home>a {
    color: var(--primary-pink) !important;
    background: transparent !important;
}

/* Search Bar Modern */
.nav-search-item {
    padding: 12px 10px;
}

.search-group {
    display: flex;
    background: #f5f5f5;
    border-radius: 50px;
    padding: 0 15px;
    border: 1px solid #eee;
}

.search-field {
    border: none;
    background: transparent;
    height: 34px;
    outline: none;
    font-size: 13px;
    width: 140px;
    transition: 0.3s;
    font-family: 'Quicksand', sans-serif;
}

.search-field:focus {
    width: 180px;
}

.search-submit {
    background: none;
    border: none;
    color: var(--primary-pink);
    padding: 0;
    line-height: 34px;
}

/* Dropdown menu Thể loại */
.dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 10px;
}

.dropdown-menu li a {
    padding: 8px 20px;
    font-weight: 600;
    color: #666;
    border-radius: 8px;
    font-family: 'Quicksand', sans-serif;
}

.dropdown-menu li a:hover {
    background: var(--light-pink) !important;
    color: var(--primary-pink) !important;
}

@media (max-width: 767px) {
    .navbar-nav>li>a {
        padding: 12px 20px !important;
        border-bottom: 1px solid #f9f9f9;
    }

    .search-field {
        width: 100%;
    }

    .navbar-brand-wrap {
        padding-left: 15px;
    }
}

/* 5. NOVEL GRID & CARD (Sửa lỗi Scale hình) */
.home-wrapper-dark {
    background: #ffffff;
    border-radius: var(--radius-main);
    padding: 30px 25px;
    box-shadow: 0 4px 25px rgba(255, 107, 129, 0.06);
    margin-bottom: 35px;
}

.home-section-header {
    border-left: 5px solid var(--primary-pink);
    padding-left: 15px;
    margin-bottom: 25px;
}

/* --- FIX LỖI LƯỚI CARD INDEX --- */
.novel-grid {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
    /* Xóa bỏ float cũ */
}

.novel-grid::before, .novel-grid::after {
    display: none !important; /* Vô hiệu hóa clear-fix cũ của Bootstrap */
}

.novel-grid-col {
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 25px;
    float: none !important; /* Ép buộc bỏ float */
    display: flex; /* Giúp các card trong cột có chiều cao bằng nhau */
}
.novel-card {
    position: relative;
    display: block;
    background: var(--dark-bg);
    border-radius: 14px;
    overflow: hidden;
    /* Bắt buộc để ảnh không tràn ra khi phóng to */
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
    height: 100%;
}

.novel-thumb-wrap {
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    /* Cực kỳ quan trọng để hiệu ứng Scale hoạt động */
    position: relative;
}

.novel-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
    /* Thời gian phóng to mượt mà */
    display: block;
}

/* HIỆU ỨNG KHI RÊ CHUỘT (HOVER) */
.novel-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(255, 107, 129, 0.25);
}

.novel-card:hover .novel-thumb-img {
    transform: scale(1.12);
    /* Phóng to hình ảnh 12% */
}

.novel-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 80%);
    z-index: 1;
}

.novel-card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 12px;
    z-index: 2;
}

.novel-title {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.novel-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #ddd;
    font-weight: 500;
}

/* Huy hiệu (Badge) */
.badge-rank,
.badge-new,
.full-label-badge {
    position: absolute;
    z-index: 10;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
}

.badge-rank {
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.65);
}

.rank-1 {
    background: #ff4757;
    box-shadow: 0 0 12px #ff4757;
}

.badge-new {
    top: 10px;
    left: 10px;
    background: var(--primary-pink);
    box-shadow: 0 0 10px rgba(255, 107, 129, 0.5);
}

.full-label-badge {
    top: 10px;
    left: 10px;
    background: #2ed573;
}

/* 6. TRANG CHI TIẾT TRUYỆN (Single.php) */
.truyen-wrapper-dark {
    background: #fff !important;
    padding: 35px !important;
}

.truyen-title-custom {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-main);
}

.btn-read-now {
    background: linear-gradient(135deg, var(--primary-pink) 0%, var(--accent-pink) 100%) !important;
    color: #fff !important;
    border-radius: 50px;
    padding: 14px 50px;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(255, 107, 129, 0.4);
}

/* Fix lỗi lệch hàng Chương 9 */
.list-chapter-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.chap-grid-item {
    width: 50%;
    padding: 8px;
}

.chap-grid-item a {
    display: block;
    padding: 14px 18px;
    background: var(--light-pink);
    border-radius: 12px;
    color: #555;
    font-weight: 600;
    border: 1px solid #fff0f2;
}

.chap-grid-item a:hover {
    border-color: var(--primary-pink);
    color: var(--primary-pink);
    padding-left: 22px;
}

/* 7. TRANG ĐỌC CHƯƠNG (Reading Mode) */
.chapter-content-area {
    font-size: 22px;
    line-height: 1.9;
    color: #2b2b2b;
    max-width: 820px;
    margin: 40px auto;
    text-align: justify;
}

.chapter-wrapper-rose {
    background: #fff;
    border-radius: 24px;
    padding: 50px 40px;
}

/* 8. FOOTER TỔNG HỢP */
.footer-main {
    background: #fff;
    border-top: 1px solid #f0f0f0;
    margin-top: 80px;
    padding: 60px 0 30px;
    clear: both;
}

.footer-logo a {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary-pink) !important;
    text-decoration: none;
    font-family: 'Quicksand', sans-serif;
}

.footer-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-top: 15px;
    max-width: 450px;
}

.footer-contact-info p {
    font-size: 14px;
    color: #555;
    margin-bottom: 15px;
}

.btn-footer-contact {
    display: inline-block;
    padding: 10px 25px;
    background: var(--light-pink);
    color: var(--primary-pink) !important;
    border: 1px solid var(--primary-pink);
    border-radius: 50px;
    font-weight: 700;
    font-size: 13px;
    transition: 0.3s;
}

.btn-footer-contact:hover {
    background: var(--primary-pink);
    color: #fff !important;
    box-shadow: 0 5px 15px rgba(255, 107, 129, 0.2);
}

.footer-divider {
    border-top: 1px solid #f5f5f5;
    margin: 40px 0 25px;
}

.footer-bottom {
    font-size: 13px;
    color: #999;
}

.footer-bottom-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: 20px;
}

.footer-bottom-links li a {
    color: #888;
    transition: 0.3s;
}

.footer-bottom-links li a:hover {
    color: var(--primary-pink);
}

.copyright strong {
    color: var(--primary-pink);
}

/* Responsive Footer */
@media (max-width: 767px) {
    .footer-main {
        margin-top: 50px;
        padding-top: 40px;
    }

    .footer-brand-col,
    .footer-links-col {
        text-align: center;
        margin-bottom: 30px;
    }

    .footer-desc {
        margin-left: auto;
        margin-right: auto;
    }

    .footer-bottom {
        text-align: center;
    }

    .footer-bottom-links {
        justify-content: center;
        width: 100%;
        margin-top: 15px;
        flex-wrap: wrap;
    }

    .footer-links-col.text-right {
        text-align: center !important;
    }
}

/* 9. RESPONSIVE (Cho Mobile) */
@media (max-width: 768px) {
    .novel-grid-col {
        width: 50%;
        padding: 6px;
    }

    /* Hiện 2 truyện/hàng trên mobile */
    .novel-title {
        font-size: 13px;
    }

    .chap-grid-item {
        width: 100%;
    }

    .chapter-content-area {
        font-size: 19px;
        padding: 0 10px;
    }

    .truyen-wrapper-dark {
        padding: 20px !important;
    }
}

/* --- TRANG DANH MỤC & TÌM KIẾM --- */
.archive-main-container {
    margin-top: 20px;
}

.archive-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #f9f9f9;
    transition: 0.3s;
}

.archive-item:hover {
    background: #fffcfd;
}

.item-thumb {
    width: 130px;
    flex-shrink: 0;
}

.item-thumb img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.item-info {
    flex-grow: 1;
}

.item-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px;
}

.item-title a {
    color: var(--text-main);
}

.item-title a:hover {
    color: var(--primary-pink);
}

.item-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    align-items: center;
}

.item-meta i {
    color: var(--primary-pink);
}

.item-status-badge {
    background: var(--light-pink);
    color: var(--primary-pink);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.item-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.btn-read-small {
    display: inline-block;
    padding: 6px 20px;
    background: var(--primary-pink);
    color: #fff !important;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
}

/* Sidebar Archive */
.archive-sidebar {
    background: var(--light-pink);
    padding: 20px;
    border-radius: var(--radius-main);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-pink);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-pink);
    display: inline-block;
}

.sidebar-cat-list {
    list-style: none;
    padding: 0;
}

.sidebar-cat-list li {
    margin-bottom: 8px;
    border-bottom: 1px dashed #ffdada;
    padding-bottom: 8px;
}

.sidebar-cat-list li a {
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.sidebar-cat-list li a:hover {
    color: var(--primary-pink);
    padding-left: 5px;
}

/* Responsive Archive */
@media (max-width: 767px) {
    .archive-item {
        flex-direction: column;
        gap: 15px;
    }

    .item-thumb {
        width: 120px;
        margin: 0 auto;
    }

    .item-info {
        text-align: center;
    }

    .item-meta {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Nút điều hướng chương */
.btn-nav-pink {
    background: linear-gradient(135deg, var(--primary-pink) 0%, var(--accent-pink) 100%) !important;
    color: #fff !important;
    border-radius: 50px !important;
    padding: 8px 22px !important;
    font-weight: 700;
    font-size: 14px;
    border: none !important;
    transition: 0.3s;
    box-shadow: 0 4px 12px rgba(255, 107, 129, 0.3);
}
.btn-nav-pink:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 107, 129, 0.4);
    color: #fff !important;
}
.btn-nav-pink.disabled {
    background: #eee !important;
    color: #bbb !important;
    box-shadow: none;
    cursor: not-allowed;
}

/* --- TRANG TRUYỆN HOT (RANKING STYLE) --- */

/* Màu sắc rực rỡ cho Top 3 */
.badge-rank.rank-1 { background: linear-gradient(135deg, #ff4757, #ff6b81) !important; box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4); }
.badge-rank.rank-2 { background: linear-gradient(135deg, #f0932b, #ffbe76) !important; box-shadow: 0 4px 12px rgba(240, 147, 43, 0.4); }
.badge-rank.rank-3 { background: linear-gradient(135deg, #2ed573, #7bed9f) !important; box-shadow: 0 4px 12px rgba(46, 213, 115, 0.4); }

/* Điều chỉnh lại Meta trên Card cho thoáng hơn */
.novel-meta-row {
    font-size: 11px;
    color: #cbd5e0;
}

.novel-meta-row i {
    color: var(--primary-pink);
    margin-right: 2px;
}

/* Hiệu ứng mượt mà cho tiêu đề Hot */
.home-section-title {
    font-family: 'Quicksand', sans-serif;
    letter-spacing: -0.5px;
}

/* Responsive Mobile cho trang Hot */
@media (max-width: 767px) {
    .novel-grid-col {
        padding: 0 8px; /* Giảm padding để card to hơn trên màn nhỏ */
    }
    .badge-rank {
        font-size: 9px;
        padding: 3px 8px;
    }
}

/* --- PHÂN TRANG (PAGINATION) --- */
.latest-pagination ul {
    display: inline-flex;
    list-style: none;
    padding: 0;
    gap: 8px;
}
.latest-pagination ul li a, .latest-pagination ul li span {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 50%;
    color: #555;
    font-weight: 700;
    transition: 0.3s;
}
.latest-pagination ul li span.current {
    background: var(--primary-pink);
    color: #fff;
    border-color: var(--primary-pink);
    box-shadow: 0 4px 10px rgba(255, 107, 129, 0.3);
}
.latest-pagination ul li a:hover {
    background: var(--light-pink);
    color: var(--primary-pink);
    border-color: var(--primary-pink);
}