@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;1,400&family=Montserrat:wght@300;400;500;600&family=Playfair+Display:wght@400;500;700&display=swap');

/* === BIẾN MÀU SẮC & FONT CHẾ ĐỘ BAN ĐÊM (MẶC ĐỊNH) === */
:root {
    --primary-font: 'Montserrat', sans-serif;
    --heading-font: 'Playfair Display', serif;
    --body-font: 'Lora', serif;

    --text-color: #EFEFEF;
    --accent-color: rgba(255, 255, 255, 0.8);
    --accent-color-light: rgba(255, 255, 255, 0.5);

    --dark-bg: #1a1a1a;
    --light-bg: #242424;
    --overlay-color: rgba(0, 0, 0, 0.5);
    --header-bg-scrolled: rgba(26, 26, 26, 0.9);
    --border-color: #444;
}

/* === BIẾN MÀU SẮC CHẾ ĐỘ BAN NGÀY === */
body.light-mode {
    --text-color: #333333;
    --accent-color: rgba(51, 51, 51, 0.8);
    --accent-color-light: rgba(51, 51, 51, 0.5);

    --dark-bg: #f5f5f5;
    --light-bg: #ffffff;
    --overlay-color: rgba(255, 255, 255, 0.4);
    --header-bg-scrolled: rgba(255, 255, 255, 0.9);
    --border-color: #ccc;
}


* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--primary-font);
    background-color: var(--dark-bg);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--heading-font); font-weight: 500; }

#progress-bar { position: fixed; top: 0; left: 0; height: 4px; background-color: var(--accent-color); width: 0%; z-index: 2000; }

.main-header { position: fixed; top: 0; left: 0; width: 100%; padding: 20px 50px; display: flex; justify-content: space-between; align-items: center; z-index: 1000; transition: background-color 0.3s ease; }
.main-header.scrolled, .main-header.page-header { background-color: var(--header-bg-scrolled); backdrop-filter: blur(5px); }

.channel-logo {
    font-size: 1.5em;
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--heading-font);
    position: relative;
    z-index: 1011;
    margin-left: 40px;
    transition: margin-left 0.3s ease;
}

.main-nav ul { list-style: none; display: flex; }
.main-nav ul li { margin-left: 35px; }
.main-nav ul li a { color: var(--accent-color); text-decoration: none; font-weight: 300; transition: color 0.3s ease; }
.main-nav ul li a:hover, .main-nav ul li a.active { color: var(--text-color); font-weight: 500; }
.mobile-nav-toggle { display: none; }

.hero-section { height: 100vh; background-image: url('images/kevin-cochran-CPjkWSD0RM0-unsplash.jpg'); background-size: cover; background-position: center; display: flex; justify-content: center; align-items: center; text-align: center; position: relative; }
.hero-section::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--overlay-color); z-index: 1; }
.hero-content { max-width: 800px; padding: 0 20px; z-index: 2; }
.hero-title { font-size: 4.5rem; margin-bottom: 20px; }
.hero-subtitle { font-size: 1.3rem; font-weight: 300; max-width: 600px; margin: 0 auto 40px auto; color: var(--accent-color); }
.cta-button { display: inline-block; padding: 12px 30px; border: 1px solid var(--accent-color); color: var(--text-color); text-decoration: none; font-size: 1rem; border-radius: 5px; transition: background-color 0.3s ease, color 0.3s ease; }
.cta-button:hover { background-color: var(--accent-color); color: var(--dark-bg); }
body.light-mode .cta-button:hover { color: var(--light-bg); }

.philosophy-section { padding: 100px 50px; text-align: center; overflow: hidden; }
.philosophy-section h2 { font-size: 3rem; margin-bottom: 60px; }
.philosophy-grid { display: grid; grid-template-columns: 1fr; gap: 80px; max-width: 1200px; margin: 0 auto; align-items: center; }
.philosophy-text p { font-size: 1.1rem; margin-bottom: 25px; line-height: 1.8; color: var(--accent-color); font-family: var(--body-font); }
.philosophy-text strong { color: var(--text-color); }
.philosopher-intro { background-color: var(--light-bg); padding: 50px; border-radius: 10px; }
.philosopher-image-container { width: 180px; height: 180px; border-radius: 50%; overflow: hidden; margin: -100px auto 30px auto; border: 5px solid var(--dark-bg); box-shadow: 0 0 0 5px var(--accent-color); position: relative; z-index: 10; }
.philosopher-image-container img { width: 100%; height: 100%; object-fit: cover; }

.philosopher-intro h3 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: #C9A86B;
}
.philosopher-intro p { font-size: 1.1rem; line-height: 1.7; color: var(--accent-color); font-family: var(--body-font); }

.content-page-section { padding: 150px 50px 100px; }
.pagination { margin-top: 5em; padding-top: 2em; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; }
.pagination a { text-decoration: none; color: var(--accent-color); padding: 15px 25px; border: 1px solid var(--border-color); border-radius: 8px; transition: background-color 0.3s ease, border-color 0.3s ease; max-width: 48%; }
.pagination a:hover { background-color: var(--light-bg); border-color: var(--accent-color); }
.pagination a span { display: block; font-size: 0.9rem; font-weight: 300; margin-bottom: 5px; }
.pagination a strong { font-family: var(--heading-font); font-size: 1.2rem; color: var(--text-color); }
.pagination a.next { text-align: right; }

.page-layout-container { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 250px 1fr; gap: 60px; }
.side-nav { position: sticky; top: 120px; height: calc(100vh - 150px); }
.side-nav-title { font-weight: 500; font-size: 1rem; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.side-nav ul { list-style: none; }
.side-nav ul li a { display: block; text-decoration: none; color: var(--accent-color-light); padding: 10px 0; font-size: 0.95rem; border-left: 2px solid transparent; padding-left: 15px; transition: all 0.3s ease; }
.side-nav ul li a:hover { color: var(--text-color); }
.side-nav ul li a.active { color: var(--text-color); font-weight: 500; transform: translateX(5px); border-left-color: var(--accent-color); }
.mobile-side-nav { display: none; background-color: var(--light-bg); color: var(--text-color); border: 1px solid var(--border-color); }

.page-content .section-title { text-align: center; font-size: 3rem; margin-bottom: 60px; }

.page-content p {
    font-family: var(--body-font);
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--accent-color);
    margin-bottom: 1.5em;
}

.page-content ol,
.page-content ul {
    font-family: var(--body-font);
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--accent-color);
    margin-bottom: 2em;
}
.page-content strong { color: var(--text-color); }
.page-content h2 { font-size: 2rem; margin-bottom: 1.8em; padding-bottom: 0.5em; border-bottom: 1px solid var(--border-color); }
.content-block { padding-top: 80px; margin-top: -80px; }
.content-block:first-of-type { padding-top: 0; margin-top: 0; }

.fade-in-on-scroll { opacity: 0; transform: translateY(30px); transition: opacity 1s ease-out, transform 1s ease-out; }
.fade-in-on-scroll.is-visible { opacity: 1; transform: translateY(0); }

@media (min-width: 1024px) { .philosophy-grid { grid-template-columns: 1fr 1fr; } }

@media (max-width: 900px) {
    .main-header { padding: 20px 25px; justify-content: center; }
    .channel-logo { margin-left: 0; }
    .main-nav { position: fixed; inset: 0 0 0 30%; background: rgba(10, 10, 10, 0.98); backdrop-filter: blur(15px); flex-direction: column; justify-content: flex-start; align-items: center; transform: translateX(100%); transition: transform 350ms ease-out; z-index: 1010; padding-top: 120px; height: 100vh; }
    body.light-mode .main-nav { background: rgba(255, 255, 255, 0.98); }
    .main-nav[data-visible="true"] { transform: translateX(0%); }
    .main-nav ul { flex-direction: column; gap: 25px; text-align: center; }
    .main-nav ul li { margin-left: 0; }
    .main-nav ul li a { font-size: 1.3rem; }
    .mobile-nav-toggle { display: block; position: absolute; top: 50%; transform: translateY(-50%); right: 25px; z-index: 1011; background: transparent; border: 0; cursor: pointer; }
    .hamburger { display: block; position: relative; width: 25px; height: 2px; background: var(--text-color); transition: background 150ms ease-in-out; }
    .hamburger::before, .hamburger::after { content: ''; position: absolute; width: 25px; height: 2px; background: var(--text-color); left: 0; transition: transform 300ms ease-in-out; }
    .hamburger::before { top: -8px; }
    .hamburger::after { bottom: -8px; }
    .mobile-nav-toggle[aria-expanded="true"] .hamburger { background: transparent; }
    .mobile-nav-toggle[aria-expanded="true"] .hamburger::before { transform: rotate(45deg) translate(5px, 6px); }
    .mobile-nav-toggle[aria-expanded="true"] .hamburger::after { transform: rotate(-45deg) translate(5px, -6px); }
    .philosophy-section, .content-page-section { padding: 80px 25px; }
    .philosophy-section h2, .page-content .section-title { font-size: 2.2rem; }
    .page-content h2 { font-size: 1.8rem; }
    .hero-title { font-size: 3rem; }
    .hero-subtitle { font-size: 1.1rem; }
    .page-layout-container { grid-template-columns: 1fr; }
    .side-nav {
        position: -webkit-sticky;
        position: sticky;
        top: 59px;
        height: auto;
        margin-bottom: 0;
        z-index: 990;
        background-color: var(--header-bg-scrolled);
        backdrop-filter: blur(5px);
        padding: 8px 0;
    }
    .side-nav ul, .side-nav-title { display: none; }
    .mobile-side-nav { display: block; width: 100%; padding: 12px; border-radius: 5px; font-family: var(--primary-font); font-size: 1rem; }
}

@media (max-width: 500px) {
    .main-header { padding: 15px 20px; }
    .channel-logo { font-size: 1.3em; }
    .hero-title { font-size: 2.5rem; }
    .philosophy-section, .content-page-section { padding-left: 20px; padding-right: 20px; }
    .pagination { flex-direction: column; gap: 15px; }
    .pagination a { max-width: 100%; }
}

/* --- CẢI TIẾN TRÌNH BÀY NỘI DUNG --- */
.page-content h3 { font-family: var(--heading-font); font-size: 1.8rem; font-weight: 600; color: var(--text-color); margin-top: 3.5em; margin-bottom: 1.5em; position: relative; padding-left: 15px; }
.page-content h3::before { content: "▪"; color: var(--accent-color); position: absolute; left: 0; top: 20px; transform: translateY(-50%); font-size: 1.2em; }
hr.section-divider { border: 0; height: 1px; background-image: linear-gradient(to right, transparent, var(--accent-color-light), transparent); margin: 5em 0; }

.page-content ul { list-style: none; padding-left: 0; }
.page-content ul li { background-color: transparent; padding: 0; border-left: none; margin-bottom: 0.8em; font-family: var(--body-font); font-size: 1.125rem; line-height: 1.8; color: var(--accent-color); position: relative; padding-left: 0; }
.page-content ul li::before { content: "—"; color: var(--accent-color); position: absolute; left: 0; top: 10px; font-weight: bold; }
.page-content ul ul { margin-left: 0px; margin-top: 1em; }
/*.page-content ul ul li::before { content: "•"; }*/

.content-block ol,
.content-block ul {
    padding-left: 40px; 
}
.content-block ul {
    list-style: disc; 
}
.content-block ul li::before,
.content-block ol li::before {
    content: none; 
}

.page-content blockquote {
    font-family: var(--body-font);
    font-style: italic;
    font-size: 1.25rem;
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--light-bg);
    padding: 30px 40px;
    margin: 3em auto;
    border-left: 5px solid var(--accent-color);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    max-width: 800px;
}

@media (max-width: 900px) {
    .page-content p, .page-content ol, .page-content ul { font-size: 1rem; line-height: 1.8; }
    .page-content blockquote { font-size: 1.1rem; padding: 25px 30px; margin: 2.5em auto; }
    .page-content h3 { font-size: 1.5rem; margin-top: 3em; }
    .page-content ul li { font-size: 1rem; line-height: 1.7; }
}
@media (max-width: 500px) {
    .page-content p, .page-content ol, .page-content ul { font-size: 0.95rem; }
    .page-content blockquote { font-size: 1rem; padding: 20px 25px; margin: 2em auto; }
    .page-content h3 { font-size: 1.3rem; margin-top: 2.5em; }
    .page-content ul li { font-size: 0.95rem; }
}

/* === SỬA LỖI & TỐI ƯU GIAO DIỆN MOBILE === */
.scroll-indicator { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); color: var(--accent-color); font-size: 0.9rem; font-weight: 300; z-index: 2; animation: bobble 2s infinite ease-in-out; }
@keyframes bobble { 0% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -8px); } 100% { transform: translate(-50%, 0); } }

@media (max-width: 900px) {
    .main-header.page-header { padding-top: 15px; padding-bottom: 15px; }
    .content-page-section { padding-top: 40px; }
}

/* === HÌNH NỀN & NÚT CHUYỂN ĐỔI CHẾ ĐỘ === */
body.light-mode .hero-section { background-image: url('images/b_itna-k3xvUQKKECE-unsplash.jpg'); }

.theme-toggle { background: none; border: none; cursor: pointer; font-size: 1.5rem; color: var(--accent-color); transition: color 0.3s ease, transform 0.3s ease; padding: 0; display: flex; align-items: center; position: absolute; left: 50px; top: 50%; transform: translateY(-50%); z-index: 1001; }
.theme-toggle:hover { color: var(--text-color); transform: translateY(-50%) scale(1.1); }
@media (max-width: 900px) { .theme-toggle { left: 25px; font-size: 1.3rem; } }
@media (max-width: 500px) { .theme-toggle { left: 20px; } }
.theme-toggle.animate-spin { animation: spin 0.5s ease-in-out; }
@keyframes spin { 0% { transform: translateY(-50%) rotate(0deg); } 100% { transform: translateY(-50%) rotate(360deg); } }

/* === TỐI ƯU MÀU SẮC CHẾ ĐỘ BAN NGÀY === */
body.light-mode .philosophy-section h2 { color: #2c3e50; }
body.light-mode .philosophy-section .philosophy-text p { color: #2c3e50; }
body.light-mode .philosophy-section .philosophy-text strong { color: #2c3e50; }
body.light-mode .philosophy-section .philosopher-intro h3 { color: #C9A86B; }
body.light-mode .philosophy-section .philosopher-intro p { color: #2c3e50; }
body.light-mode .page-content .section-title,
body.light-mode .page-content h2,
body.light-mode .page-content h3 { color: #2c3e50; }
body.light-mode .page-content p,
body.light-mode .page-content ul li,
body.light-mode .page-content ol { color: #2c3e50; }
body.light-mode .page-content strong { color: #2c3e50; }
body.light-mode .page-content blockquote { color: #34495e; border-left-color: #85929E; }
body.light-mode .page-content h3::before,
body.light-mode .page-content ul li::before { color: #85929E; }

/* === NÂNG CẤP THẨM MỸ CHO CÁC TRANG NỘI DUNG CHI TIẾT === */
.page-content h4 { font-family: var(--primary-font); font-weight: 600; font-size: 1.3rem; color: var(--text-color); margin-top: 2.8em; margin-bottom: 1.2em; padding-bottom: 0.5em; border-bottom: 1px dashed var(--border-color); }
.example-card { background-color: var(--light-bg); border-radius: 8px; padding: 30px; margin: 2.5em 0; border-left: 4px solid var(--accent-color); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
body.light-mode .example-card { background-color: #ffffff; box-shadow: 0 4px 15px rgba(0,0,0,0.07); border-color: #85929E; }
.example-card h5 { font-family: var(--primary-font); font-weight: 600; font-size: 1.1rem; color: var(--text-color); margin-top: 0; margin-bottom: 1em; text-transform: capitalize; letter-spacing: 0.5px; }
.example-card p { font-size: 1.05rem; color: var(--accent-color); }
.example-card p strong { color: var(--text-color); font-family: var(--primary-font); font-weight: 600; }
.example-card em { font-style: italic; color: var(--text-color); }
.insight-block { margin: 2.5em 0; padding: 25px 30px; border-left: 3px solid var(--accent-color-light); background-color: rgba(255,255,255,0.03); border-radius: 0 8px 8px 0; }
body.light-mode .insight-block { background-color: rgba(0,0,0,0.03); border-color: #f1f1f1; }
.insight-block h5 { margin-top: 0; margin-bottom: 1em; font-size: 1.2rem; }
.insight-block ul { list-style-type: circle; padding-left: 25px; margin-left: 10px; }
.insight-block ul li::before { content: none; }
.example-card .insight-block {
    margin-top: 2em;
    margin-bottom: 2em;
    box-shadow: none;
    border-radius: 4px;
    border-left: 3px solid rgb(87 87 87 / 50%);
}
.insight-block blockquote { background-color: transparent; box-shadow: none; max-width: none; border-left: 2px solid var(--text-color); font-size: 1.1rem; line-height: 1.7; color: var(--text-color); padding: 15px 20px; margin: 1.8em 0; border-radius: 0 5px 5px 0; font-family: var(--body-font); }
body.light-mode .insight-block blockquote { border-color: #4A6572; color: #2c3e50; }

/* === ĐỊNH DẠNG HÌNH ẢNH MINH HỌA === */
.section-illustrative-image { width: 60%; max-width: 700px; height: auto; display: block; margin: 2em auto 3em auto; border-radius: 8px; box-shadow: 0 6px 15px rgba(0,0,0,0.2); object-fit: cover; }
body.light-mode .section-illustrative-image { box-shadow: 0 6px 15px rgba(0,0,0,0.1); }


/* === TỐI ƯU HIỂN THỊ BẢNG BIỂU (TABLE) TRÊN MỌI THIẾT BỊ === */

/* --- 1. Thiết lập cho màn hình lớn (Desktop) --- */
.table-container {
    overflow-x: auto; /* Cho phép cuộn ngang BÊN TRONG khung chứa nếu cần */
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 2em 0; /* Tăng khoảng cách trên dưới cho dễ thở */
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* Đặt chiều rộng tối thiểu cho bảng trên desktop */
}

.custom-table th, 
.custom-table td {
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    text-align: left;
    vertical-align: top;
}

.custom-table thead th {
    background-color: var(--light-bg);
    font-family: var(--primary-font);
    font-weight: 600;
}

body.light-mode .custom-table thead th {
    background-color: #f0f0f0;
}

.custom-table tbody td {
    font-family: var(--body-font);
    color: var(--accent-color);
}

.custom-table td ul {
    margin-top: 0.5em; 
    margin-bottom: 0; 
    padding-left: 20px; 
    list-style-type: disc;
}

.custom-table td ul li::before {
    content: none;
}


/* --- 2. Thiết lập cho màn hình nhỏ (Mobile & Tablet) --- */
/* Breakpoint ở 800px sẽ bao phủ hầu hết điện thoại và máy tính bảng dọc */
@media (max-width: 800px) {
    .table-container {
        /* Bỏ viền của khung chứa trên mobile, vì mỗi hàng sẽ có viền riêng */
        border: none; 
    }

    .custom-table {
        width: 100%; /* Buộc bảng chiếm toàn bộ chiều rộng cho phép */
        min-width: 100%; /* Ghi đè lên min-width: 700px của desktop */
    }

    /* Ẩn đi hàng tiêu đề gốc (Tên cột) */
    .custom-table thead {
        display: none;
    }

    /* Biến mỗi hàng thành một "thẻ" riêng biệt */
    .custom-table tr {
        display: block;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 1em;
        margin-bottom: 1.5em;
        background-color: var(--light-bg);
    }
    
    body.light-mode .custom-table tr {
        background-color: #ffffff;
    }

    /* Biến mỗi ô thành một dòng, và loại bỏ các đường viền cũ */
    .custom-table td {
        display: block;
        border: none;
        border-bottom: 1px dashed var(--border-color); /* Tạo đường phân cách giữa các dòng */
        padding: 12px 0;
        text-align: right; /* Đẩy nội dung sang phải */
        position: relative;
        padding-left: 50%; /* Tạo không gian bên trái cho tiêu đề */
    }

    /* Bỏ đường phân cách ở dòng cuối cùng của mỗi thẻ */
    .custom-table td:last-child {
        border-bottom: none;
    }

    /* Phép màu xảy ra ở đây: Lấy nội dung từ thuộc tính `data-label` làm tiêu đề */
    .custom-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--text-color);
        font-family: var(--primary-font);
    }
    
    body.light-mode .custom-table td::before {
        color: #2c3e50;
    }

    /* Căn lề trái lại cho danh sách trong bảng trên di động */
    .custom-table td ul {
        text-align: left; 
    }
}


/* === TỐI ƯU HIỂN THỊ TRÊN DI ĐỘNG CÁC PHẦN KHÁC === */
@media (max-width: 600px) {
    .section-illustrative-image { width: 90%; }
    .example-card { padding: 25px 20px; }
    .page-content h4 { font-size: 1.15rem; }
    .example-card h5 { font-size: 1.05rem; }
    .page-content p, .page-content ul, .page-content ol, .page-content .table-container { margin-bottom: 1.5em; }
}

/* === SỬA LỖI LINK DÀI & LÀM NỔI BẬT LINK TRONG DARK MODE === */
.page-content a {
    /* Fix lỗi tràn lề trên mobile */
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;

    /* Làm màu link sáng & nổi bật hơn */
    color: #a0d8f0; /* Một màu xanh da trời sáng, dễ nhìn trên nền tối */
    text-decoration: none; /* Bỏ gạch chân cho giao diện gọn gàng hơn */
    transition: color 0.2s ease;
}

.page-content a:hover {
    color: #ffffff; /* Chuyển thành màu trắng tinh khi hover */
    text-decoration: underline; /* Thêm lại gạch chân khi hover để tăng tính tương tác */
}

/* === TỐI ƯU MÀU LINK TRONG LIGHT MODE === */
body.light-mode .page-content a {
    color: #0056b3; /* Một màu xanh đậm, dễ đọc trên nền sáng */
}

body.light-mode .page-content a:hover {
    color: #003d80; /* Màu xanh đậm hơn một chút khi hover */
}