/* ============================================================
   CUSTOM HEADER
============================================================ */

/* Reset #header container to be transparent */
#header,
#header .header-wrapper {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    height: auto !important;
}

/* ── Main header wrap ── */
.tm-hdr {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,.06);
    transition: box-shadow .3s ease;
    overflow: visible;
}
.tm-hdr.is-scrolled {
    box-shadow: 0 2px 20px rgba(0,0,0,.10);
}

/* ── Header bar ── */
.tm-hdr__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: visible;
}
/* Nav: absolute center — always exactly at 50% regardless of logo/actions width */
.tm-hdr__nav {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 50;
}
.tm-hdr__logo   { flex-shrink: 0; position: relative; z-index: 2; align-self: center; }
.tm-hdr__actions { flex-shrink: 0; display: flex; align-items: center; align-self: center; gap: 10px; position: relative; z-index: 2; }

/* ── Logo ── */
.tm-hdr__logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}
.tm-hdr__logo-img {
    height: 38px;
    width: auto;
    display: block;
}
.tm-hdr__logo-text {
    font-size: 20px;
    font-weight: 900;
    color: #1e3a4a;
    letter-spacing: -0.04em;
}

/* ── Desktop nav ── */
.tm-hdr__nav {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: visible;
}
.tm-hdr__menu {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    padding-top: 12px !important;
}
.tm-hdr-item {
    position: relative;
    list-style: none;
}
.tm-hdr-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 13px;
    font-size: 14px;
    font-weight: 600;
    color: #1e3a4a;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s, color .18s;
    line-height: 1.4;
}
.tm-hdr-link:hover {
    background: #eff6ff;
    color: #2563eb;
    text-decoration: none;
}
.tm-hdr-item.is-active > .tm-hdr-link {
    background: #eff6ff;
    color: #2563eb;
    text-decoration: none;
}
.tm-hdr-item.is-active > .tm-hdr-link .tm-hdr-arrow,
.tm-hdr-item:hover > .tm-hdr-link .tm-hdr-arrow {
    color: #2563eb;
}
.tm-hdr-arrow {
    font-size: 12px;
    color: #94a3b8;
    line-height: 0;
    display: block;
    transition: transform .25s ease;
}
.tm-hdr-item.has-dropdown:hover .tm-hdr-arrow {
    transform: rotate(-180deg);
}

/* ── Dropdown ── */
.tm-hdr-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    min-width: 210px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,.07);
    box-shadow: 0 8px 36px rgba(0,0,0,.13);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 200;
}
.tm-hdr-item.has-dropdown:hover .tm-hdr-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.tm-hdr-dropdown__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tm-hdr-dropdown__item { list-style: none; }
.tm-hdr-dropdown__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.tm-hdr-dropdown__link:hover,
.tm-hdr-dropdown__item.is-active .tm-hdr-dropdown__link {
    background: #eff6ff;
    color: #2563eb;
    text-decoration: none;
}

/* ── Right actions ── */
.tm-hdr__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Search button */
.tm-hdr__search-btn {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center;
    border: none !important;
    background: #f1f5f9;
    border-radius: 10px;
    cursor: pointer;
    color: #475569;
    transition: background .18s, color .18s;
    flex-shrink: 0;
    box-sizing: border-box !important;
    vertical-align: middle;
}
.tm-hdr__search-btn:hover {
    background: #eff6ff;
    color: #2563eb;
}
.tm-hdr__search-btn[aria-expanded="true"] {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
}

/* CTA button */
.tm-hdr__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 22px;
    height: 42px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
    color: #fff !important;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-decoration: none !important;
    border: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
    white-space: nowrap;
}
.tm-hdr__cta span { position: relative; z-index: 2; color: #fff; }
.tm-hdr__cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 80%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.45), transparent);
    transition: all 0.55s ease;
}
.tm-hdr__cta:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 55%, #1e40af 100%);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 16px 30px rgba(37,99,235,.38),
                inset 0 1.5px rgba(255,255,255,.4),
                inset 0 -2.5px rgba(30,64,175,.5);
    text-decoration: none !important;
}
.tm-hdr__cta:hover::before { left: 130%; }
.tm-hdr__cta:active { transform: translateY(0) scale(.98); }

/* Hamburger */
.tm-hdr__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    align-self: center;
    vertical-align: middle;
    gap: 5px;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    border: none;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}
.tm-hdr__ham-line {
    display: block;
    width: 22px;
    height: 2px;
    background: #1e3a4a;
    border-radius: 2px;
    transition: transform .28s ease, opacity .2s ease;
}
.tm-hdr__hamburger.is-open .tm-hdr__ham-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.tm-hdr__hamburger.is-open .tm-hdr__ham-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.tm-hdr__hamburger.is-open .tm-hdr__ham-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Search dialog ── */
.tm-search-dlg {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 2px solid #eff6ff;
    box-shadow: 0 12px 40px rgba(0,0,0,.10);
    border-radius: 0 0 16px 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 150;
}
.tm-search-dlg.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.tm-search-dlg__inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 24px 24px;
}

/* ── Search input row ── */
.tm-search-dlg__row {
    display: flex;
    align-items: center;
    background: #f8faff;
    border: 1.5px solid #dbeafe;
    border-radius: 16px;
    padding: 0 18px;
    height: 56px;
    gap: 12px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.tm-search-dlg__row:focus-within {
    background: #fff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}
.tm-search-dlg__icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: #2563eb;
}
.tm-search-dlg__icon iconify-icon { display: block; line-height: 0; }
.tm-search-dlg__input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    color: #1e293b !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    min-width: 0;
    border-radius: 0 !important;
    width: 100% !important;
}
.tm-search-dlg__input:focus { outline: none !important; box-shadow: none !important; border: none !important; }
.tm-search-dlg__input::placeholder { color: #94a3b8 !important; }
/* Ẩn native clear button của Safari/Chrome */
.tm-search-dlg__input::-webkit-search-cancel-button,
.tm-search-dlg__input::-webkit-search-decoration { display: none !important; -webkit-appearance: none !important; }

/* ── Results body ── */
.tm-search-dlg__body { margin-top: 20px; }
.tm-search-dlg__label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #2563eb;
    margin: 0 0 10px;
}
.tm-search-dlg__label::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 13px;
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    border-radius: 2px;
    flex-shrink: 0;
}
.tm-search-dlg__results {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.tm-search-result {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 9px 10px;
    border-radius: 10px;
    text-decoration: none !important;
    transition: background .15s;
    border: 1px solid transparent;
}
.tm-search-result:hover {
    background: #eff6ff;
    border-color: #dbeafe;
    text-decoration: none !important;
}
.tm-search-result__img {
    width: 56px;
    height: 44px;
    border-radius: 9px;
    overflow: hidden;
    flex-shrink: 0;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbeafe;
}
.tm-search-result__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tm-search-result__img--empty { background: #f1f5f9; border-color: #e2e8f0; }
.tm-search-result__info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tm-search-result__title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    display: block;
    transition: color .15s;
}
.tm-search-result:hover .tm-search-result__title { color: #2563eb; }
.tm-search-result__date {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── "Xem tất cả" link ── */
.tm-search-dlg__all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
    border-radius: 999px;
    text-decoration: none;
    transition: opacity .18s, transform .18s;
}
.tm-search-dlg__all:hover { opacity: .88; transform: translateY(-1px); color: #fff; text-decoration: none; }
.tm-search-empty { padding: 14px 10px; color: #94a3b8; font-size: 13px; margin: 0; text-align: center; }

/* ── Mobile nav (fullscreen) ── */
.tm-mobile-nav {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 1100;
    transform: translateY(-100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .3s ease;
    opacity: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tm-mobile-nav.is-open { transform: translateY(0); opacity: 1; }
.tm-mobile-nav__hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.tm-mobile-nav__close {
    border: none !important;
    background: #f1f5f9;
    border-radius: 50%;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    color: #64748b;
    font-size: 0 !important;
    line-height: 0 !important;
    flex-shrink: 0;
    transition: background .18s, color .18s;
    box-sizing: border-box !important;
    overflow: visible !important;
}
.tm-mobile-nav__close iconify-icon { display: block; line-height: 0; pointer-events: none; }
.tm-mobile-nav__close:hover { background: #fee2e2; color: #e11d48; }
.tm-mobile-nav__body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 24px;
    -webkit-overflow-scrolling: touch;
}
.tm-mobile-nav__foot {
    padding: 20px 24px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.tm-mob-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tm-mob-item {
    border-bottom: 1px solid #f1f5f9;
}
.tm-mob-item__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tm-mob-item__link {
    flex: 1;
    display: block;
    padding: 18px 4px;
    font-size: 17px;
    font-weight: 700;
    color: #1e3a4a;
    text-decoration: none;
    transition: color .18s;
}
.tm-mob-item__link:hover,
.tm-mob-item.is-active .tm-mob-item__link { color: #2563eb; }
.tm-mob-toggle {
    border: none;
    background: transparent;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    transition: color .18s;
    flex-shrink: 0;
    padding: 0;
}
.tm-mob-toggle:hover { color: #2563eb; }
.tm-mob-toggle[aria-expanded="true"] { color: #2563eb; }
.tm-mob-toggle[aria-expanded="true"] iconify-icon { transform: rotate(-180deg); }
.tm-mob-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}
.tm-mob-sub__list {
    list-style: none;
    margin: 0;
    padding: 0 0 8px 12px;
}
.tm-mob-sub__item { border-bottom: 1px solid #f1f5f9; }
.tm-mob-sub__link {
    display: block;
    padding: 10px 8px;
    font-size: 14px;
    color: #475569;
    text-decoration: none;
    transition: color .15s;
}
.tm-mob-sub__link:hover { color: #2563eb; }
.tm-mob-sub__item.is-active .tm-mob-sub__link { color: #2563eb; font-weight: 600; }

/* Backdrop — ẩn khi dùng fullscreen nav */
.tm-mob-backdrop { display: none !important; }

/* ── Responsive ── */
@media (min-width: 1025px) {
    .tm-hdr__hamburger { display: none !important; }
    .tm-hdr__nav { display: flex !important; }
    .tm-hdr__cta--desktop { display: inline-flex !important; }
}
@media (max-width: 1024px) {
    .tm-hdr__inner { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; gap: 12px; }
    .tm-hdr__logo  { display: flex; align-items: center; }
    .tm-hdr__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
    .tm-hdr__nav { display: none !important; }
    .tm-hdr__hamburger { display: flex !important; }
    .tm-hdr__cta--desktop { display: none !important; }
}
@media (max-width: 480px) {
    .tm-hdr__inner { padding: 0 14px; height: 60px; }
    .tm-hdr__logo-img { height: 30px; }
}


/* ============================================================
   MEGA MENU — Dịch vụ Social
============================================================ */

/* Panel container — fixed so it escapes #header overflow:hidden */
.tm-mega-panel {
    position: fixed;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e8edf3;
    box-shadow: 0 20px 60px rgba(15,23,42,.13), 0 4px 16px rgba(15,23,42,.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
    z-index: 9999;
}
.tm-mega-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Inner container */
.tm-mega-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 20px 28px 0;
}

/* 3-column grid */
.tm-mega-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-bottom: 20px;
}

/* Each column card */
.tm-mega-col {
    border-radius: 14px;
    border: 1px solid #f1f5f9;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    transition: box-shadow .2s, border-color .2s;
}
.tm-mega-col:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    border-color: #e2e8f0;
}

/* Column header */
.tm-mega-col__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 13px;
    border-bottom: 1px solid #f1f5f9;
}

/* Badge icons */
.tm-mega-col__badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tm-mega-col__badge--fb { background: #eff6ff; color: #2563eb; }
.tm-mega-col__badge--tt { background: #fff1f2; color: #e8124e; }
.tm-mega-col__badge--cr { background: #fff7ed; color: #ea580c; }

.tm-mega-col__name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2px;
    line-height: 1.25;
}
.tm-mega-col__hint {
    font-size: 11px;
    color: #94a3b8;
    margin: 0;
    font-weight: 400;
    line-height: 1.3;
}

/* Items list */
.tm-mega-col__list {
    list-style: none;
    margin: 0;
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Each item link */
.tm-mega-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    text-decoration: none !important;
    transition: background .15s;
    cursor: pointer;
}
.tm-mega-item:hover { background: #f8fafc; text-decoration: none !important; }
.tm-mega-col--fb .tm-mega-item:hover { background: #eff6ff; }
.tm-mega-col--tt .tm-mega-item:hover { background: #fff1f2; }
.tm-mega-col--cr .tm-mega-item:hover { background: #fff7ed; }

/* Arrow icon */
.tm-mega-item__arrow {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
    display: block;
    line-height: 0;
    transition: transform .15s;
}
.tm-mega-item:hover .tm-mega-item__arrow { transform: translateX(3px); }
.tm-mega-item__arrow--fb { color: #2563eb; }
.tm-mega-item__arrow--tt { color: #e8124e; }
.tm-mega-item__arrow--cr { color: #ea580c; }

.tm-mega-item__title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 3px;
    line-height: 1.3;
    display: block;
    transition: color .15s;
}
.tm-mega-col--fb .tm-mega-item:hover .tm-mega-item__title { color: #2563eb; }
.tm-mega-col--tt .tm-mega-item:hover .tm-mega-item__title { color: #e8124e; }
.tm-mega-col--cr .tm-mega-item:hover .tm-mega-item__title { color: #ea580c; }

.tm-mega-item__desc {
    font-size: 11.5px;
    color: #94a3b8;
    line-height: 1.5;
    margin: 0;
    display: block;
}

/* Column footer link */
.tm-mega-col__more {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px 12px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
    transition: opacity .15s;
}
.tm-mega-col__more:hover { opacity: .72; text-decoration: none !important; }
.tm-mega-col__more--fb { color: #2563eb; }
.tm-mega-col__more--tt { color: #e8124e; }
.tm-mega-col__more--cr { color: #ea580c; }

/* Footer bar */
.tm-mega-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px 18px;
    border-top: 1px solid #f1f5f9;
    gap: 16px;
}
.tm-mega-footer__note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #64748b;
    margin: 0;
}
.tm-mega-footer__note strong { color: #334155; font-weight: 600; }
.tm-mega-footer__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #fff !important;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .2s, transform .18s;
}
.tm-mega-footer__btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    color: #fff !important;
    text-decoration: none !important;
}
