/* =====================================================================
   TEAM CODE DẠO - GLOBAL STYLES (MAIN CSS)
   Phong cách: Flat Modern, Clean, Typography lớn, Tối ưu hiệu năng
   ===================================================================== */

:root {
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 6px 20px rgba(37, 99, 235, 0.08);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.15s ease;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

/* =====================================================================
   HEADER & NAVIGATION
   ===================================================================== */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 16px;
}

.site-logo {
    font-size: 23px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-logo:hover {
    color: var(--primary-hover);
}

.site-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-nav {
    display: flex;
    align-items: center;
}

.site-nav ul,
.site-nav .nav-list {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.site-nav li {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a,
.site-nav .nav-link {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #4b5563;
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.site-nav a:hover,
.site-nav li:hover > a,
.site-nav li.current-menu-item > a,
.site-nav li.current-menu-parent > a,
.site-nav li.current-post-ancestor > a,
.site-nav li.current_page_item > a,
.site-nav li.active > a,
.site-nav .nav-link:hover,
.site-nav .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* Sub-menu Dropdown */
.site-nav .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    padding: 6px 0;
    z-index: 1001;
    flex-direction: column;
}

.site-nav li:hover > .sub-menu {
    display: flex;
}

.site-nav .sub-menu li a {
    border-radius: 0;
    padding: 9px 16px;
    font-size: 14.5px;
    color: #374151;
}

/* Nút chuyển chế độ Dark Mode */
.btn-darkmode-toggle {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.btn-darkmode-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: #bfdbfe;
    transform: scale(1.06);
}

/* =====================================================================
   SEARCH BOX THỐNG NHẤT TOÀN THEME
   ===================================================================== */
.flat-search-box {
    display: flex;
    gap: 8px;
    align-items: center;
}
.flat-search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    outline: none;
    background: #ffffff;
    color: #0f172a;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.flat-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.flat-search-btn {
    padding: 10px 18px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.1s ease;
}
.flat-search-btn:hover {
    background: var(--primary-hover);
}
.flat-search-btn:active {
    transform: scale(0.98);
}

/* =====================================================================
   BREADCRUMBS CHUẨN FLAT MODERN
   ===================================================================== */
.tcd-breadcrumbs {
    font-size: 13.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}
.tcd-breadcrumbs a {
    color: var(--primary);
    font-weight: 600;
}
.tcd-breadcrumbs a:hover {
    text-decoration: underline;
}
.tcd-breadcrumbs .sep {
    color: var(--text-dim);
}
.tcd-breadcrumbs .current {
    color: var(--text-main);
    font-weight: 600;
}

/* =====================================================================
   WIDGET LỊCH SỬ ĐỌC & XEM GẦN ĐÂY (LOCALSTORAGE)
   ===================================================================== */
.recent-history-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}
.recent-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.recent-history-title {
    font-size: 15.5px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.recent-history-clear {
    font-size: 12px;
    color: var(--text-dim);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    text-decoration: underline;
}
.recent-history-clear:hover {
    color: #ef4444;
}
.recent-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.recent-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    transition: all 0.15s ease;
}
.recent-history-item:hover {
    background: var(--primary-light);
    border-color: #bfdbfe;
    color: var(--primary);
}

/* =====================================================================
   FOOTER FLAT MODERN
   ===================================================================== */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 38px 0 32px;
    margin-top: 60px;
    text-align: center;
    font-size: 14.5px;
    color: var(--text-muted);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}
.footer-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.footer-links a {
    color: #4b5563;
    font-weight: 600;
    font-size: 14.5px;
}
.footer-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}
.footer-links .sep {
    color: #cbd5e1;
    font-size: 12px;
}
.footer-copy {
    color: #374151;
    font-size: 14.5px;
}

/* =====================================================================
   COOKIE BANNER
   ===================================================================== */
.cookie-consent-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 20px 24px;
    z-index: 99999;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    text-align: left;
}
.cookie-consent-banner.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.cookie-consent-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.cookie-consent-icon {
    font-size: 24px;
    line-height: 1;
}
.cookie-consent-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}
.cookie-consent-text {
    font-size: 13.5px;
    color: #475569;
    line-height: 1.55;
    margin-bottom: 16px;
}
.cookie-consent-text a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
}
.cookie-consent-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.cookie-btn-accept {
    flex: 1;
    padding: 10px 18px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: center;
}
.cookie-btn-accept:hover {
    background: var(--primary-hover);
}
.cookie-btn-decline {
    padding: 10px 16px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.cookie-btn-decline:hover {
    background: #e2e8f0;
}

@media (max-width: 768px) {
    .site-header .header-wrap {
        padding: 10px 0;
    }
    .site-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 65%;
    }
    .site-nav::-webkit-scrollbar {
        display: none;
    }
    .cookie-consent-banner {
        left: 14px;
        right: 14px;
        bottom: 14px;
        max-width: none;
        padding: 18px;
    }
}

/* =====================================================================
   STATIC PAGE (PAGE.PHP) STYLES
   ===================================================================== */
.page-container {
    padding: 30px 0 60px;
    background: #f9fafb;
    min-height: calc(100vh - 200px);
}
.page-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: 40px 48px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.page-header-box {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f3f4f6;
}
.page-title {
    font-size: 34px;
    font-weight: 800;
    color: #111827;
    line-height: 1.3;
    margin: 0;
}
.page-excerpt {
    margin-top: 12px;
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
}
.page-featured-image {
    margin-bottom: 32px;
    text-align: center;
}
.page-featured-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}
.page-content {
    font-size: 18px;
    line-height: 1.85;
    color: #374151;
}
.page-content p {
    margin-bottom: 20px;
}
.page-content h2 {
    font-size: 24px;
    font-weight: 800;
    color: #111827;
    margin: 36px 0 16px;
}
.page-content h3 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 28px 0 14px;
}
.page-content ul, 
.page-content ol {
    margin: 0 0 20px 28px;
}
.page-content li {
    margin-bottom: 8px;
}
.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 20px auto;
    display: block;
}
.page-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 14px 20px;
    background: #f8fafc;
    margin: 24px 0;
    color: #4b5563;
    font-size: 17px;
    font-style: italic;
    border-radius: 0 6px 6px 0;
}
.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}
.page-content th, 
.page-content td {
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    text-align: left;
}
.page-content th {
    background: #f8fafc;
    font-weight: 700;
    color: #111827;
}
.page-links {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: center;
}
.page-links-title {
    font-weight: 700;
}
.page-number {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}
@media (max-width: 768px) {
    .page-card {
        padding: 24px 18px;
    }
    .page-title {
        font-size: 26px;
    }
    .page-content {
        font-size: 16.5px;
    }
}

/* =====================================================================
   GLOBAL JS LAZY LOAD STYLES (HIỆU ỨNG TẢI ẢNH MƯỢT MÀ CHỐNG LAG)
   ===================================================================== */
img.tcd-lazy {
    opacity: 0.15;
    filter: blur(6px);
    transition: opacity 0.35s ease, filter 0.35s ease;
    will-change: opacity, filter;
}

img.tcd-lazy.lazy-loaded {
    opacity: 1;
    filter: blur(0);
}

img.tcd-lazy.lazy-error {
    opacity: 0.8;
    filter: none;
    cursor: pointer;
}


