/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Roboto', sans-serif; }
body { background-color: #f9f9f9; color: #333; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* --- Colors --- */
:root {
    --primary: #ff9f1a; /* Màu cam chủ đạo */
    --primary-hover: #e68a00;
    --text-dark: #2c3e50;
    --text-gray: #666;
    --bg-white: #fff;
    --border: #eee;
}

/* --- Header --- */
header { background: var(--bg-white); border-bottom: 1px solid #ddd; padding: 15px 0; position: sticky; top: 0; z-index: 1000; }
.header-container { display: flex; align-items: center; justify-content: space-between; gap: 20px; }

/* Logo style mới */
.logo a { display: block; }
.logo img { height: 35px; width: auto; object-fit: contain; }

header nav ul { display: flex; gap: 20px; }
header nav ul li a { font-size: 14px; color: var(--text-dark); font-weight: 500; transition: 0.2s; }
header nav ul li a.active, header nav ul li a:hover { color: var(--primary); }

.header-actions { display: flex; gap: 10px; }
.btn-login { background: white; border: 1px solid #ccc; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-size: 13px; color: #666; white-space: nowrap; }
.btn-primary { background: var(--primary); color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 13px; white-space: nowrap; }
.btn-primary:hover { background: var(--primary-hover); }

/* --- Breadcrumb --- */
.breadcrumb-section { padding: 15px 0; font-size: 13px; color: #666; border-bottom: 1px solid #f0f0f0; margin-bottom: 20px; }
.breadcrumb-section .active { color: #999; }

/* --- Main Layout --- */
.main-layout { display: grid; grid-template-columns: 3fr 1fr; gap: 30px; padding-bottom: 50px; }

/* --- Featured Post --- */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 2px solid transparent; }
.section-header h2 { font-size: 16px; font-weight: 700; color: #444; text-transform: uppercase; }

.featured-card { background: var(--bg-white); padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.02); margin-bottom: 30px; }
.featured-img { position: relative; width: 100%; height: 350px; overflow: hidden; border-radius: 4px; margin-bottom: 15px; }
.featured-img img { width: 100%; height: 100%; object-fit: cover; }
.post-meta { font-size: 12px; color: #888; margin-bottom: 10px; }
.post-meta span { margin-right: 15px; }
.post-title-large { font-size: 24px; color: var(--text-dark); margin-bottom: 10px; font-weight: 700; }
.post-desc { font-size: 14px; color: var(--text-gray); line-height: 1.6; margin-bottom: 20px; }
.btn-outline { background: white; border: 1px solid #ccc; padding: 8px 20px; border-radius: 4px; color: #555; cursor: pointer; font-size: 13px; transition: 0.2s; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* --- Other Posts Grid --- */
.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.post-card { background: var(--bg-white); border: 1px solid #f0f0f0; border-radius: 8px; padding: 15px; display: flex; flex-direction: column; transition: transform 0.2s; }
.post-card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.post-card img { width: 100%; height: 150px; object-fit: cover; border-radius: 4px; margin-bottom: 10px; }
.post-title { font-size: 14px; font-weight: 700; color: var(--text-dark); margin-bottom: 8px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-excerpt { font-size: 12px; color: #777; margin-bottom: 10px; line-height: 1.5; flex-grow: 1; }
.post-date { font-size: 11px; color: #999; margin-top: auto; }
/* --- Sidebar & Category Animation --- */
.widget { 
    background: var(--bg-white); 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.02); 
    border: 1px solid #f0f0f0;
}

.widget-title { 
    font-size: 14px; 
    font-weight: 700; 
    color: #444; 
    text-transform: uppercase; 
    position: relative;
    padding-left: 12px;
}

/* Tạo dấu gạch đứng trang trí bên trái tiêu đề Widget */
.widget-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background-color: var(--primary);
    border-radius: 2px;
}

.widget-header-flex { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.view-all-sm { font-size: 11px; color: var(--primary); font-weight: 500;}

/* --- CATEGORY LIST STYLES --- */
.cat-list {
    padding: 0;
    margin: 0;
}

.cat-list li { 
    border-bottom: 1px dashed #eee; /* Đổi thành nét đứt cho nhẹ nhàng hơn */
    padding: 12px 0; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 14px; 
    color: #555; 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Hiệu ứng chuyển động mượt */
    position: relative;
    overflow: hidden; /* Để chứa các hiệu ứng loang màu nếu có */
}

.cat-list li:last-child { border-bottom: none; }

/* Link bao phủ toàn bộ li để dễ bấm */
.cat-list li a {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    color: inherit;
    text-decoration: none;
    z-index: 2;
}

.cat-list li span { 
    color: #999; 
    font-size: 12px; 
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 10px;
    transition: 0.3s;
}

.cat-list li i { 
    font-size: 12px; 
    color: #ccc; 
    margin-left: 10px;
    transition: transform 0.3s ease; /* Animation cho mũi tên */
}

/* --- HOVER EFFECTS (Hiệu ứng khi di chuột) --- */
.cat-list li:hover { 
    color: var(--primary); 
    padding-left: 10px; /* Trượt sang phải */
    background-color: #fffcf5; /* Màu nền cam rất nhạt */
    border-bottom-color: var(--primary); /* Đổi màu đường kẻ dưới */
}

.cat-list li:hover span {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.cat-list li:hover i {
    color: var(--primary);
    transform: translateX(5px); /* Mũi tên bay sang phải 5px */
}

/* --- ACTIVE STATE (Danh mục đang được chọn) --- */
/* Class này sẽ được PHP thêm vào khi vào trang category */
.cat-list li.active-cat {
    background: var(--primary);
    padding-left: 15px;
    border-radius: 4px;
    color: white;
    border-bottom: none;
    box-shadow: 0 4px 6px rgba(255, 159, 26, 0.2); /* Bóng mờ màu cam */
}

.cat-list li.active-cat a {
    color: white;
    font-weight: 500;
}

.cat-list li.active-cat span {
    background: rgba(255,255,255,0.2); /* Nền trắng trong suốt */
    color: white;
}

.cat-list li.active-cat i {
    color: white;
    transform: translateX(0); /* Mũi tên đứng yên ở state active */
}

/* --- PAGINATION STYLE (PHÂN TRANG) --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    gap: 5px;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
    font-size: 14px;
    transition: 0.2s;
    background: #fff;
}

.page-link:hover {
    background-color: #f0f0f0;
    color: var(--primary);
    border-color: var(--primary);
}

.page-link.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-dots {
    padding: 0 5px;
    color: #999;
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    /* 1. Header Mobile: Giữ nguyên cấu trúc dọc */
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 10px;
    }
    
    .logo { width: 100%; text-align: center; margin-bottom: 10px; }
    .logo a { display: inline-block; }

    header nav { width: 100%; overflow-x: auto; padding-bottom: 5px; }
    header nav ul { width: max-content; }

    .header-actions { width: 100%; justify-content: space-between; }
    .btn-login, .btn-primary { flex: 1; }

    /* 2. QUAN TRỌNG: Đảo vị trí Sidebar lên đầu */
    .main-layout {
        display: flex;          /* Chuyển sang Flexbox để dùng được lệnh order */
        flex-direction: column; /* Xếp dọc */
        gap: 30px;
    }

    .sidebar {
        order: -1; /* Số âm sẽ đẩy phần tử này lên vị trí đầu tiên */
        margin-bottom: 10px; /* Tạo khoảng cách với nội dung chính bên dưới */
    }

    .content-column {
        order: 2; /* Nội dung chính nằm sau */
    }

    /* 3. Style lại phần Danh mục cho đẹp trên Mobile (như ảnh bạn gửi) */
    .widget {
        padding: 15px; /* Giảm padding một chút cho gọn */
    }

    .widget-title {
        font-size: 16px; /* Tăng kích thước tiêu đề chút */
        border-bottom: 2px solid #eee; /* Kẻ đường gạch chân dưới tiêu đề cho rõ */
        padding-bottom: 10px;
        margin-bottom: 15px;
        width: 100%;
        display: block;
    }
    
    /* Ẩn nút 'Xem tất cả' nhỏ ở tiêu đề nếu muốn giống ảnh mẫu */
    .view-all-sm { display: none; } 

    .cat-list li {
        padding: 12px 0; /* Tăng khoảng cách để ngón tay dễ bấm */
        font-size: 15px; /* Chữ to hơn chút */
        border-bottom: 1px solid #f5f5f5; /* Đường kẻ mờ hơn */
    }
    
    .cat-list li a {
        display: flex;
        justify-content: space-between;
        width: 100%;
        align-items: center;
    }

    /* 4. Các phần khác */
    .featured-img { height: 200px; }
    .post-title-large { font-size: 18px; }
    .posts-grid { grid-template-columns: 1fr; }
}

/* Tablet (iPad) */
@media (min-width: 769px) and (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 bài viết trên 1 hàng */
    }
    .main-layout {
        grid-template-columns: 2fr 1fr; /* Thu nhỏ cột nội dung chút */
    }
}


/* Căn giữa và giới hạn chiều rộng nội dung */
.single-post-container {
    max-width: 800px; /* Độ rộng vừa phải để đọc báo */
    margin: 0 auto;
    padding: 0 15px 0px 15px;
}

/* Breadcrumb: Chữ 'Bài viết' màu vàng cam */
.breadcrumb-section .sep { margin: 0 8px; color: #ccc; font-size: 12px; }
.breadcrumb-section .highlight { color: #f59e0b; font-weight: 500; } /* Màu cam giống ảnh */

/* --- Post Header --- */
.post-category-label {
    color: #f59e0b; /* Màu cam thương hiệu */
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    display: inline-block;
}

.single-post-title {
    font-size: 34px;
    font-weight: 700;
    color: #111827; /* Màu đen đậm */
    margin-bottom: 20px;
    line-height: 1.3;
}

/* Meta info: Avatar + Tên + Ngày */
.single-post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    font-size: 13px;
    color: #6b7280; /* Màu xám chữ */
}

.author-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-weight: 600;
    color: #374151; /* Màu xám đậm hơn */
}

.post-time i {
    margin-right: 5px;
}

/* Sapo: Đoạn text mở đầu */
.post-sapo {
    font-size: 16px;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 30px;
}
/* --- TABLE OF CONTENTS (MỤC LỤC) --- */

/* Khung bao ngoài */
.toc-box {
    background-color: #f8f9fa; /* Màu nền xám rất nhạt */
    border: 1px solid #e9ecef; /* Viền nhẹ */
    border-radius: 8px; /* Bo góc */
    margin-bottom: 30px; /* Cách nội dung bài viết 30px */
    overflow: hidden; /* Để bo góc header không bị lòi ra */
    box-shadow: 0 2px 4px rgba(0,0,0,0.03); /* Đổ bóng nhẹ */
}

/* Phần tiêu đề (Header) của mục lục */
.toc-header {
    background-color: #f1f3f5; /* Nền header đậm hơn body một chút */
    padding: 12px 20px;
    display: flex;
    justify-content: space-between; /* Đẩy chữ sang trái, icon sang phải */
    align-items: center;
    cursor: pointer; /* Con trỏ chuột thành hình bàn tay */
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s;
}

.toc-header:hover {
    background-color: #e9ecef;
}

.toc-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #343a40;
    text-transform: uppercase; /* Chữ in hoa */
}

.toc-header i {
    color: #868e96;
    transition: transform 0.3s ease; /* Hiệu ứng xoay icon */
}

/* Phần nội dung danh sách */
.toc-content {
    padding: 15px 20px;
    max-height: 400px; /* Giới hạn chiều cao, dài quá thì cuộn */
    overflow-y: auto; /* Cho phép cuộn dọc */
    background-color: #fff;
}

.toc-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.toc-content a {
    text-decoration: none;
    color: #495057;
    font-size: 15px;
    display: block; /* Tăng diện tích click */
    transition: color 0.2s, padding-left 0.2s;
}

/* Hiệu ứng khi di chuột vào link */
.toc-content a:hover {
    color: #ff9f1a; /* Màu cam chủ đạo của bạn */
    padding-left: 5px; /* Trượt nhẹ sang phải */
}

/* Style cho thẻ H2 (Mục chính) */
.toc-bold {
    font-weight: 600;
    color: #212529 !important;
}

/* Style cho thẻ H3 (Mục con - Sub toc) */
.sub-toc {
    margin-top: 8px;
    margin-bottom: 8px;
    padding-left: 15px !important;
    border-left: 2px solid #dee2e6; /* Đường kẻ dọc chỉ dẫn */
    margin-left: 5px;
}

.sub-toc li {
    margin-bottom: 6px;
}

.sub-toc li a {
    font-size: 14px; /* Chữ nhỏ hơn chút */
    color: #6c757d;
}

.sub-toc li a:hover {
    color: #ff9f1a;
}

/* --- TÙY BIẾN THANH CUỘN (CUSTOM SCROLLBAR) --- */

.custom-scrollbar::-webkit-scrollbar {
    width: 6px; /* Độ rộng thanh cuộn */
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #ced4da; /* Màu thanh cuộn */
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #adb5bd; /* Màu khi di chuột vào thanh cuộn */
}

/* Phần nội dung mục lục có thanh cuộn */
.toc-content {
    padding: 15px 10px 15px 20px; /* Bên phải padding ít hơn để hiện scrollbar */
    max-height: 350px; /* Chiều cao cố định để hiện scrollbar */
    overflow-y: auto;  /* Cho phép cuộn dọc */
}

/* Tùy chỉnh thanh cuộn (Scrollbar) giống ảnh */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #9ca3af; /* Màu xám đậm của thanh cuộn */
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.toc-content ul { list-style: none; padding: 0; }
.toc-content ul li { margin-bottom: 12px; }

.toc-content ul li a {
    text-decoration: none;
    color: #374151;
    font-size: 15px;
    line-height: 1.5;
    display: block;
    transition: color 0.2s;
}
.toc-content ul li a:hover { color: #f59e0b; }
.toc-bold { font-weight: 600; color: #111 !important; }

/* Sub-toc (Mục con) */
.sub-toc {
    margin-top: 8px;
    padding-left: 20px !important;
    border-left: 2px solid #e5e7eb; /* Đường kẻ dọc chỉ mục con */
    margin-left: 5px;
}
.sub-toc li a { font-size: 14px; color: #4b5563; }

/* --- Post Body (Nội dung chính) --- */
.post-body {
    font-size: 16px; /* Cỡ chữ chuẩn đọc báo */
    line-height: 1.8; /* Khoảng cách dòng thoáng */
    color: #1f2937;
}
.post-body p { margin-bottom: 20px; text-align: justify; }
.post-body strong { color: #111; }
.post-body a { color: #2563eb; text-decoration: underline; }

.post-body h2 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 40px;
    margin-bottom: 15px;
    color: #111;
}

.post-body img {
    width: 100%;
    height: auto;
    border-radius: 4px; /* Bo góc nhẹ */
    margin: 20px 0;
    display: block;
}

/* --- TAGS (Giống ảnh mẫu 4c90fa.png) --- */
.post-tags-container {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.tag-item {
    display: inline-block;
    background-color: #eff6ff; /* Nền xanh dương nhạt (Light Indigo) */
    color: #1d4ed8;           /* Chữ xanh dương đậm */
    padding: 6px 16px;
    border-radius: 999px;     /* Bo tròn hình viên thuốc (Pill shape) */
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    transition: background 0.2s;
}

.tag-item:hover {
    background-color: #dbeafe;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .single-post-title { font-size: 24px; }
    .post-body { font-size: 15px; }
    .toc-content { max-height: 300px; }
}

footer{
    margin-top: 60px;
    background-color: #212529;
    padding: 5px 20px;
}
footer .contai p{
    color: white;
    text-align: center;
    padding: 15px 0;
    font-size: 14px;
}
.post-tags-container .tag-label{
    margin-bottom: 10px;
}
/* --- MOBILE RESPONSIVE (Màn hình điện thoại) --- */
@media (max-width: 768px) {
    
    /* Các code khác của mobile giữ nguyên... */

    /* Thêm đoạn này để ẩn nút */
    .header-actions {
        display: none !important;
    }

}

.menu-toggle {
    display: none;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
}
