/**
 * TechHub Header & Mega Menu Stylesheet
 * 
 * Quản lý Navigation Bar, Dropdown đa cột (Mega Menu),
 * Mobile Off-canvas Drawer và Search Shortcut trigger.
 */

/* Header Container */
.th-site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--wp--preset--color--border-light);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.th-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--wp--style--global--wide-size, 1360px);
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    gap: 1.5rem;
}

/* Brand & Logo */
.th-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
}

.th-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.th-brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--wp--preset--color--navy-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.th-brand-name span {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Desktop Navigation Wrapper */
.th-nav-desktop-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Nút Khám Phá Chuyên Mục (Mega Menu Button) */
.th-mega-menu-wrap {
    position: relative;
}

.th-mega-toggle-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--wp--preset--color--text-main);
    background: var(--wp--preset--color--background-alt);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.th-mega-toggle-link:hover,
.th-mega-menu-wrap:hover .th-mega-toggle-link,
.th-mega-menu-wrap.is-open .th-mega-toggle-link {
    color: var(--wp--preset--color--blue-electric);
    border-color: var(--wp--preset--color--blue-electric);
    background: var(--wp--preset--color--surface-white);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.th-mega-menu-wrap:hover .th-chevron-icon,
.th-mega-menu-wrap.is-open .th-chevron-icon {
    transform: rotate(180deg);
}

/* Menu Động WordPress (Do Appearance -> Menus Sinh Ra) */
.th-nav-desktop-dynamic {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.th-nav-desktop-dynamic > .menu-item {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
}

.th-nav-desktop-dynamic > .menu-item > a {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.85rem;
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--wp--preset--color--text-main);
    text-decoration: none;
    border-radius: 8px;
    transition: color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.th-nav-desktop-dynamic > .menu-item > a:hover {
    color: var(--wp--preset--color--blue-electric);
    background-color: var(--wp--preset--color--background-alt);
}

/* Mục Menu Đang Được Chọn (Active State) */
.th-nav-desktop-dynamic > .current-menu-item > a,
.th-nav-desktop-dynamic > .current_page_item > a,
.th-nav-desktop-dynamic > .current-menu-ancestor > a {
    color: var(--wp--preset--color--blue-electric) !important;
    background-color: rgba(37, 99, 235, 0.08);
    font-weight: 700;
}

/* Mũi Tên Chỉ Dẫn Cho Mục Có Menu Con (Dropdown Indicator) */
.th-nav-desktop-dynamic .menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 0.35rem;
    margin-top: -3px;
    transition: transform 0.2s ease;
}

.th-nav-desktop-dynamic .menu-item-has-children:hover > a::after {
    transform: rotate(-135deg);
    margin-top: 2px;
}

/* Dropdown Con (.sub-menu) */
.th-nav-desktop-dynamic .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--wp--preset--color--surface-white, #ffffff);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 12px;
    padding: 0.5rem;
    margin: 0.35rem 0 0 0;
    list-style: none;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
}

/* Vùng đệm chống hụt chuột khi hover */
.th-nav-desktop-dynamic .sub-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

.th-nav-desktop-dynamic .menu-item-has-children:hover > .sub-menu,
.th-nav-desktop-dynamic .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.th-nav-desktop-dynamic .sub-menu .menu-item {
    display: block;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
}

.th-nav-desktop-dynamic .sub-menu .menu-item a {
    display: block;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wp--preset--color--text-main);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.th-nav-desktop-dynamic .sub-menu .menu-item a:hover {
    background-color: var(--wp--preset--color--background-alt);
    color: var(--wp--preset--color--blue-electric);
    transform: translateX(3px);
}

.th-nav-desktop-dynamic .sub-menu .current-menu-item > a {
    color: var(--wp--preset--color--blue-electric) !important;
    font-weight: 700;
    background-color: rgba(37, 99, 235, 0.06);
}

/* Menu Con Cấp 2 (Nested Sub-menu) */
.th-nav-desktop-dynamic .sub-menu .menu-item-has-children > .sub-menu {
    top: 0;
    left: 100%;
    margin-left: 0.25rem;
    margin-top: -0.5rem;
}

.th-chevron-icon {
    transition: transform 0.2s ease;
}

/* ==========================================================================
   Mega Menu: Bài Viết Mới (Chuẩn Danh Mục Tinh Gọn)
   ========================================================================== */
.th-mega-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.th-mega-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 760px;
    max-width: 90vw;
    background: var(--wp--preset--color--surface-white, #ffffff);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
    z-index: 1050;
    display: block !important;
}

/* Vùng đệm chống hụt chuột khi rê từ nút sang menu */
.th-mega-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

/* Hiển thị Mega Menu khi hover hoặc click toggle */
.th-mega-menu-wrap:hover .th-mega-menu,
.th-mega-menu-wrap.is-open .th-mega-menu {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

.th-mega-menu-wrap:hover .th-chevron-icon,
.th-mega-menu-wrap.is-open .th-chevron-icon {
    transform: rotate(180deg);
}

.th-mega-menu-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-bottom: 0.75rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--wp--preset--color--border-light);
}

.th-mega-title {
    font-size: 0.825rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wp--preset--color--blue-electric);
}

.th-mega-subtitle {
    font-size: 0.775rem;
    color: var(--wp--preset--color--text-muted);
}

/* Lưới hiển thị bài viết rút gọn (2 cột song song chuẩn responsive) */
.th-mega-grid-posts {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.75rem 1rem !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.th-mega-grid-item {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.th-mega-post-card {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.6rem 0.85rem !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    border: 1px solid var(--wp--preset--color--border-light) !important;
    background: var(--wp--preset--color--surface-light, #f8fafc) !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.th-mega-post-card:hover {
    background: var(--wp--preset--color--blue-light, #eff6ff) !important;
    border-color: rgba(37, 99, 235, 0.3) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08) !important;
}

.th-mega-post-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    background: rgba(37, 99, 235, 0.08) !important;
    font-size: 1rem !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

.th-mega-post-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.2rem !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

.th-mega-post-cat {
    color: var(--wp--preset--color--purple-ai, #7c3aed) !important;
    font-weight: 600 !important;
    background: rgba(124, 58, 237, 0.08) !important;
    padding: 0.1rem 0.4rem !important;
    border-radius: 4px !important;
    text-transform: uppercase !important;
    font-size: 0.65rem !important;
    letter-spacing: 0.02em !important;
    display: inline-block !important;
}

.th-mega-post-title {
    display: block !important;
    font-size: 0.835rem !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    color: var(--wp--preset--color--navy-primary, #0b132b) !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.th-mega-post-card:hover .th-mega-post-title {
    color: var(--wp--preset--color--blue-electric, #2563eb) !important;
}

.th-mega-post-meta {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    font-size: 0.7rem !important;
    color: var(--wp--preset--color--text-muted, #64748b) !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.th-mega-post-date {
    color: var(--wp--preset--color--text-muted, #64748b) !important;
}

.th-mega-footer {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--wp--preset--color--border-light);
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 0.775rem;
}

/* Responsive cho Mega Menu 2 cột */
@media (max-width: 820px) {
    .th-mega-menu {
        width: min(720px, calc(100vw - 2rem)) !important;
    }
}

@media (max-width: 640px) {
    .th-mega-menu {
        position: fixed !important;
        top: 65px !important;
        left: 1rem !important;
        right: 1rem !important;
        width: auto !important;
        max-width: none !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
    }

    .th-mega-grid-posts {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    .th-mega-menu-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.4rem !important;
    }
}

.th-mega-footer-hint {
    color: var(--wp--preset--color--text-muted);
}

.th-mega-footer-link {
    font-weight: 700;
    color: var(--wp--preset--color--blue-electric);
    text-decoration: none;
    transition: transform 0.15s ease;
}

.th-mega-footer-link:hover {
    transform: translateX(3px);
}

/* Dark Mode Overrides cho Mega Menu */
html.dark-mode .th-mega-menu {
    background: #0f172a !important;
    border-color: #1e293b !important;
    box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.6) !important;
}

html.dark-mode .th-mega-menu-header {
    border-bottom-color: #1e293b !important;
}

html.dark-mode .th-mega-post-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

html.dark-mode .th-mega-post-card:hover {
    background: #283548 !important;
    border-color: #3b82f6 !important;
}

html.dark-mode .th-mega-post-title {
    color: #f8fafc !important;
}

html.dark-mode .th-mega-footer {
    border-top-color: #1e293b !important;
}

.th-mega-col-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wp--preset--color--text-muted);
    margin: 0 0 0.85rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--wp--preset--color--border-light);
}

.th-mega-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.th-mega-link-item a {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--wp--preset--color--navy-primary);
    transition: background-color 0.15s ease;
}

.th-mega-link-item a:hover {
    background-color: var(--wp--preset--color--blue-light);
}

.th-mega-link-item a:hover .th-mega-item-title {
    color: var(--wp--preset--color--blue-electric);
}

.th-mega-item-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}

.th-mega-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wp--preset--color--navy-primary);
    margin: 0;
    transition: color 0.15s ease;
}

.th-mega-item-desc {
    font-size: 0.75rem;
    color: var(--wp--preset--color--text-muted);
    margin: 0.15rem 0 0 0;
    line-height: 1.35;
}

/* Mega Feature Card */
.th-mega-featured-card {
    background: linear-gradient(145deg, var(--wp--preset--color--surface-light), var(--wp--preset--color--surface-muted));
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.th-mega-card-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--wp--preset--color--purple-ai);
    background: var(--wp--preset--color--purple-light);
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    margin-bottom: 0.5rem;
    width: fit-content;
}

.th-mega-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--wp--preset--color--navy-primary);
    margin: 0 0 0.35rem 0;
    line-height: 1.35;
}

.th-mega-card-desc {
    font-size: 0.75rem;
    color: var(--wp--preset--color--text-muted);
    margin: 0 0 0.85rem 0;
}

.th-mega-card-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--wp--preset--color--blue-electric);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Header Action Controls */
.th-header-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.th-search-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--wp--preset--color--surface-light);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    color: var(--wp--preset--color--text-muted);
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.th-search-trigger-btn:hover {
    border-color: var(--wp--preset--color--blue-electric);
    color: var(--wp--preset--color--navy-primary);
    background: #ffffff;
}

.th-kbd-shortcut {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    background: #ffffff;
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: var(--wp--preset--font-family--mono);
    color: var(--wp--preset--color--text-muted);
}

/* Mobile Toggle Hamburger */
.th-hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--wp--preset--color--surface-light);
    border: 1px solid var(--wp--preset--color--border-light);
    border-radius: 8px;
    color: var(--wp--preset--color--navy-primary);
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.th-hamburger-btn svg {
    pointer-events: none;
}

/* Mobile Drawer (Off-Canvas) */
.th-mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    box-shadow: -10px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    transform: translateX(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
    box-sizing: border-box;
}

.th-mobile-drawer.is-open {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.th-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 19, 43, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s;
}

.th-drawer-backdrop.is-open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.th-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--wp--preset--color--border-light);
}

.th-drawer-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--wp--preset--color--navy-primary);
    cursor: pointer;
    padding: 0.25rem;
}

.th-mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.th-mobile-nav-list .menu-item a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wp--preset--color--text-main);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.15s, color 0.15s;
}

.th-mobile-nav-list .menu-item a:hover {
    background-color: var(--wp--preset--color--background-alt);
    color: var(--wp--preset--color--blue-electric);
}

.th-mobile-nav-list .current-menu-item > a {
    color: var(--wp--preset--color--blue-electric);
    background-color: rgba(37, 99, 235, 0.08);
    font-weight: 700;
}

/* Menu con trên mobile (Hierarchical Sub-menu) */
.th-mobile-nav-list .sub-menu {
    list-style: none;
    margin: 0.25rem 0 0.5rem 1rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--wp--preset--color--border-light);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.th-mobile-nav-list .sub-menu .menu-item a {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wp--preset--color--text-muted);
}

.th-mobile-nav-list .sub-menu .menu-item a:hover {
    color: var(--wp--preset--color--blue-electric);
}

/* Responsive Breakpoints */
@media (min-width: 1025px) {
    .th-mobile-drawer,
    .th-drawer-backdrop {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translateX(105%) !important;
    }
    .th-hamburger-btn {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .th-nav-desktop,
    .th-nav-desktop-wrapper {
        display: none !important;
    }
    .th-hamburger-btn {
        display: inline-flex !important;
    }
    .th-search-trigger-btn span {
        display: none;
    }
    .th-kbd-shortcut {
        display: none;
    }
}

/* Dark Mode Overrides */
html.dark-mode .th-site-header {
    background-color: rgba(11, 17, 32, 0.92);
    border-bottom-color: #1e293b;
}

html.dark-mode .th-mega-toggle-link {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

html.dark-mode .th-mega-toggle-link:hover {
    background: #0f172a;
    border-color: #60a5fa;
    color: #60a5fa;
}

html.dark-mode .th-nav-desktop-dynamic .sub-menu {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

html.dark-mode .th-nav-link {
    color: #cbd5e1;
}

html.dark-mode .th-nav-link:hover,
html.dark-mode .th-nav-item:hover > .th-nav-link {
    color: #60a5fa;
    background-color: #1e293b;
}

html.dark-mode .th-mega-menu {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

html.dark-mode .th-mega-col-title {
    border-bottom-color: #1e293b;
}

html.dark-mode .th-mega-link-item a:hover {
    background-color: #1e293b;
}

html.dark-mode .th-mega-featured-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-color: #334155;
}

html.dark-mode .th-recent-featured-card {
    background: #1e293b;
    border-color: #334155;
}

html.dark-mode .th-recent-compact-item:hover {
    background: #1e293b;
}

html.dark-mode .th-search-trigger-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

html.dark-mode .th-search-trigger-btn:hover {
    border-color: #3b82f6;
    color: #f8fafc;
    background: #0f172a;
}

html.dark-mode .th-kbd-shortcut {
    background: #0f172a;
    border-color: #334155;
}

html.dark-mode .th-hamburger-btn {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

html.dark-mode .th-mobile-drawer {
    background: #0f172a;
    border-left: 1px solid #1e293b;
}

html.dark-mode .th-drawer-header {
    border-bottom-color: #1e293b;
}

html.dark-mode .th-drawer-close-btn {
    color: #f8fafc;
}

html.dark-mode .th-mobile-nav-item a:hover {
    background-color: #1e293b;
}

/* ==========================================================================
   OMNISEARCH LIVE MODAL ENGINE (SPOTLIGHT POPUP)
   ========================================================================== */
.th-search-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 19, 43, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 5rem 1rem 2rem 1rem;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.th-search-modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.th-search-modal {
    width: 100%;
    max-width: 640px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--wp--preset--color--border-light, #e2e8f0);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(-20px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.th-search-modal-backdrop.is-open .th-search-modal {
    transform: translateY(0) scale(1);
}

.th-search-modal-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--wp--preset--color--border-light, #e2e8f0);
}

.th-search-modal-icon {
    color: var(--wp--preset--color--blue-electric, #2563eb);
    flex-shrink: 0;
}

.th-modal-search-input {
    flex: 1 1 auto;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 1.05rem;
    color: var(--wp--preset--color--navy-primary, #0b132b);
    font-family: inherit;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.th-modal-search-input::placeholder {
    color: #94a3b8;
}

.th-modal-esc-hint {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    font-weight: 700;
}

.th-search-modal-body {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.th-modal-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease, transform 0.15s ease;
    border: 1px solid transparent;
}

.th-modal-search-item:hover,
.th-modal-search-item.is-selected {
    background: var(--wp--preset--color--blue-light, #eff6ff);
    border-color: rgba(37, 99, 235, 0.2);
}

.th-modal-item-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.th-modal-item-title {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--wp--preset--color--navy-primary, #0b132b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.th-modal-item-meta {
    font-size: 0.75rem;
    color: #64748b;
}

.th-modal-item-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.th-search-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    background: #f8fafc;
    border-top: 1px solid var(--wp--preset--color--border-light, #e2e8f0);
    font-size: 0.75rem;
    color: #64748b;
}

.th-search-modal-footer kbd {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.7rem;
    margin: 0 0.2rem;
}

/* Dark mode cho Omnisearch Modal */
html.dark-mode .th-search-modal {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
}

html.dark-mode .th-search-modal-header {
    border-bottom-color: #1e293b;
}

html.dark-mode .th-modal-search-input {
    color: #f8fafc;
}

html.dark-mode .th-modal-search-input::placeholder {
    color: #64748b;
}

html.dark-mode .th-modal-esc-hint {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

html.dark-mode .th-modal-search-item:hover,
html.dark-mode .th-modal-search-item.is-selected {
    background: #1e293b;
    border-color: #3b82f6;
}

html.dark-mode .th-modal-item-title {
    color: #f8fafc;
}

html.dark-mode .th-search-modal-footer {
    background: #0b1120;
    border-top-color: #1e293b;
    color: #94a3b8;
}

html.dark-mode .th-search-modal-footer kbd {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

