/*
Theme Name: Chuyen Lam Bang Dai Hoc High-End SEO Theme
Theme URI: https://chuyenlambangdaihoconline.com/
Author: AI SEO & UI/UX Expert
Description: Theme WordPress tối ưu SEO SGE, Schema Rich Snippets chuyên sâu, tích hợp Glassmorphism, Parallax, Dark Mode và Typography Responsive cao cấp.
Version: 2.1.0
License: GNU General Public License v2 or later
Text Domain: clbdh-seo
*/

/* -------------------------------------------------------------
   HỆ THỐNG BIẾN TOÀN CỤC & THIẾT KẾ ĐA GIAO DIỆN (Light / Dark)
------------------------------------------------------------- */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(255, 255, 255, 0.4);
    --shadow-glass: rgba(15, 23, 42, 0.06);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #0284c7;
    --accent-hover: #0369a1;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --steam-color: rgba(2, 132, 199, 0.2);
}

[data-theme="dark"] {
    --bg-primary: #0b0f19;
    --bg-secondary: #1e293b;
    --bg-glass: rgba(30, 41, 59, 0.75);
    --border-glass: rgba(255, 255, 255, 0.08);
    --shadow-glass: rgba(0, 0, 0, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-hover: #7dd3fc;
}

/* -------------------------------------------------------------
   RESET & THIẾT LẬP NỀN TẢNG (CHỐNG LỖI TRÀN KHUNG MOBILE)
------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.65;
    overflow-x: hidden;
    transition: background-color 0.3s var(--transition-smooth), color 0.3s var(--transition-smooth);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s var(--transition-smooth);
}
a:hover { color: var(--accent-hover); }

/* PROGRESS TẢI TRANG HÌNH HƠI NƯỚC (LOADING STEAM) */
#loading-steam {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    background-size: 200% 100%;
    animation: steamLoader 1.5s infinite linear;
    z-index: 9999;
    pointer-events: none;
}
@keyframes steamLoader {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* -------------------------------------------------------------
   NÂNG CẤP TYPOGRAPHY & TRÌNH BÀY NỘI DUNG (CHUYÊN NGHIỆP)
------------------------------------------------------------- */
/* Sử dụng clamp() để tự động co giãn font-size mượt mà giữa Mobile và Desktop */
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; line-height: 1.25; color: var(--text-primary); margin-bottom: 1rem; }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 700; line-height: 1.3; color: var(--text-primary); margin-top: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: clamp(1.15rem, 2vw, 1.35rem); font-weight: 600; line-height: 1.4; color: var(--text-primary); margin-top: 1.2rem; margin-bottom: 0.8rem; }
h4, h5, h6 { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.5rem; }

p { margin-bottom: 1.25rem; text-align: justify; }

/* Định dạng Danh sách không thứ tự (ul - Listicle Snippet) */
ul {
    list-style: none;
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
}
ul li {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
}
ul li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Định dạng Danh sách có thứ tự (ol - Quy trình/Hồ sơ Snippet) */
ol {
    list-style: none;
    counter-reset: clbdh-counter;
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
}
ol li {
    counter-increment: clbdh-counter;
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.85rem;
}
ol li::before {
    content: counter(clbdh-counter);
    position: absolute;
    left: 0;
    top: 3px;
    width: 20px;
    height: 20px;
    background-color: var(--accent-color);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Khối trích dẫn / Cảnh báo rủi ro chuyên sâu (Blockquote) */
blockquote {
    background: rgba(239, 68, 68, 0.03);
    border-left: 4px solid var(--danger-color);
    padding: 18px 24px;
    margin: 1.5rem 0;
    border-radius: 0 12px 12px 0;
    font-style: normal;
}
blockquote p {
    margin-bottom: 0;
    color: var(--text-primary);
}
blockquote strong {
    color: var(--danger-color);
}

/* -------------------------------------------------------------
   HIỆU ỨNG KÍNH MỜ (GLASSMORPHISM) & CONTAINER
------------------------------------------------------------- */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 var(--shadow-glass);
    padding: clamp(15px, 3vw, 25px);
    transition: transform 0.3s var(--transition-smooth), box-shadow 0.3s var(--transition-smooth);
    box-sizing: border-box;
}
/* Touch-friendly active on Mobile, Hover on Desktop */
@media (min-width: 992px) {
    .glass-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px 0 var(--shadow-glass);
    }
}

/* GRID HÌNH ẢNH SẢN PHẨM PHÔI THẬT (CHỐNG LỖI TỈ LỆ KHUNG HÌNH) */
.image-snippet-grid img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s var(--transition-smooth);
}
.image-snippet-grid img:active {
    transform: scale(0.98);
}

/* -------------------------------------------------------------
   HỆ THỐNG KIỂM SOÁT BẢNG BIỂU CHUYÊN NGHIỆP TRÁNH VỠ LAYOUT
------------------------------------------------------------- */
.snippet-table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
    background: var(--bg-secondary);
    margin: 0;
}

.snippet-table td, .snippet-table th {
    padding: 14px 16px;
    text-align: left;
    line-height: 1.5;
    vertical-align: top;
    /* Ép text tự động xuống dòng khi chạm biên cột, ngăn chặn đẩy phình ô */
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

/* Ép xử lý giao diện hiển thị mượt mà trên di động */
@media (max-width: 991px) {
    .glass-card div[style*="overflow-x: auto"] {
        border: 1px solid var(--border-glass);
        box-shadow: inset -10px 0 10px -10px rgba(0, 0, 0, 0.1); /* Hiệu ứng bóng đổ báo hiệu có thể vuốt ngang */
    }
}
/* -------------------------------------------------------------
   UNIVERSAL RESPONSIVE MENU SYSTEM & STICKY HEADER
------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0; z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
}
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
}
.logo-img {
    height: clamp(35px, 5vw, 48px);
    width: auto;
    object-fit: contain;
}
.nav-menu {
    display: flex;
    list-style: none;
    gap: 20px;
}
.nav-menu a {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
}
.nav-menu a:hover {
    background: rgba(2, 132, 199, 0.08);
    color: var(--accent-color);
}
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 26px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}
.theme-switch {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: var(--text-primary);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* -------------------------------------------------------------
   BỐ CỤC KHUNG CHÍNH (MAIN LAYOUT STRUCTURE)
------------------------------------------------------------- */
.main-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    box-sizing: border-box;
}
@media (min-width: 992px) {
    .main-wrapper { grid-template-columns: 8fr 4fr; }
}

/* -------------------------------------------------------------
   XỬ LÝ BREAKPOINTS & RESPONSIVE ĐỘC LẬP CHO MOBILE
------------------------------------------------------------- */
@media (max-width: 991px) {
    .nav-toggle { display: block; }
    .nav-menu {
        position: absolute;
        top: 100%; left: 0; width: 100%;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-glass);
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    }
    .nav-menu.active { max-height: 100vh; overflow-y: auto; }
    .nav-menu li a {
        display: block;
        padding: 14px 20px;
        border-bottom: 1px solid var(--border-glass);
        border-radius: 0;
    }
    .nav-menu li a:hover { background: none; }
    
    /* Ép tất cả bảng trên di động phải xuất hiện thanh cuộn vuốt chạm mượt */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* HOẠT ẢNH FADEIN CHỐNG GIẬT KHUNG */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   MÃ VÁ LỖI HIỂN THỊ SINGLE PAGE TRÊN THIẾT BỊ DI ĐỘNG
   ============================================================= */

/* Ép toàn bộ ảnh nội dung không được vượt quá chiều rộng màn hình di động */
.entry-content-single img,
.entry-content-single .wp-block-image img {
    max-width: 100% !important;
    height: auto !important;
    box-sizing: border-box;
}

/* Xử lý khung nhúng Video (Youtube/Iframe) tự động co giãn theo tỉ lệ 16:9 chuẩn */
.entry-content-single iframe,
.entry-content-single video,
.entry-content-single embed {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    box-sizing: border-box;
}

/* Biến đổi khối tác giả từ hàng ngang thành hàng dọc trên màn hình nhỏ */
@media (max-width: 767px) {
    .author-profile-box {
        --flex-dir: column !important;
        text-align: center !important;
        padding: 20px 15px !important;
    }
    .author-profile-box div p {
        text-align: center !important;
    }
}