/* Shared site header — loaded by all public page entry points. */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: background 0.3s;
}
[data-theme="dark"] .site-header { background: var(--bg); }

.header-main { padding: 12px 0; border-bottom: 1px solid var(--line); }
/* Header dàn RỘNG HẾT MÀN HÌNH trên MỌI trang (logo/nav sát trái, tài khoản
   sát phải) — không bó vào 1200px.
   Selector cố ý viết .site-header .container.header-inner để thắng .container
   { max-width:1200px } của homepage.min.css / site-shell.css bất kể file nào
   nạp sau. Trước đây chỉ ghi .header-inner nên trang chủ bị homepage.min.css
   đè lại thành 1200px -> header trang chủ chụm giữa, các trang khác dàn 2 bên. */
.header-inner,
.site-header .container.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 100%; width: 100%; padding: 0 20px; }
.header-left { display: flex; align-items: center; gap: 4px; }
.header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex-shrink: 0; margin-right: 8px; }
.header-logo { width: 36px; height: 36px; border-radius: 8px; }
.header-brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 16px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.brand-tagline { font-size: 10px; color: var(--muted); font-weight: 500; white-space: nowrap; }

/* Navigation */
.header-nav { display: flex; align-items: center; gap: 0; }
.nav-link { display: flex; align-items: center; gap: 5px; padding: 8px 10px; font-size: 13px; font-weight: 600; color: var(--ink); border-radius: 8px; transition: all 0.2s ease; white-space: nowrap; }
.nav-link:hover { background: var(--light); color: var(--primary); }
.nav-link.active { color: var(--primary); background: #eff6ff; }
.nav-icon-box { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: #f3f4f6; border-radius: 6px; color: #6b7280; transition: all 0.2s ease; }
.nav-link:hover .nav-icon-box { background: #dbeafe; color: var(--primary); }
.nav-icon-box.icon-orange { background: #fff3e0 !important; color: #f97316 !important; }
.nav-icon-box.icon-hot { background: #fee2e2 !important; color: #ef4444 !important; position: relative; }
.nav-icon-box.icon-hot::after { content: 'HOT'; position: absolute; top: -6px; right: -10px; background: #ef4444; color: #fff; font-size: 7px; font-weight: 800; padding: 1px 4px; border-radius: 4px; border: 1px solid #fff; line-height: 1; letter-spacing: 0.5px; box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2); }
.nav-link-hot { color: #ef4444 !important; font-weight: 700 !important; }
.nav-link-hot:hover { background: #fee2e2 !important; }
.mobile-menu-link.highlight-red, .mobile-menu-link.highlight-red svg { color: #ef4444 !important; }
.dropdown-divider { border-top: 1px solid var(--line); margin: 8px 0; }
.nav-arrow-icon { margin-left: 2px; opacity: 0.5; }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-menu { position: absolute; top: 100%; left: 0; min-width: 200px; background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12); padding: 8px; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.2s ease; z-index: 100; display: flex; flex-direction: column; gap: 2px; }
.nav-dropdown:hover .nav-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dropdown-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #374151; font-size: 14px; font-weight: 500; border-radius: 6px; transition: all 0.15s ease; }
.nav-dropdown-menu a:hover { background: #f0f7ff; color: #2563eb; }
.nav-dropdown-menu a svg { width: 16px; height: 16px; color: #9ca3af; }
.nav-dropdown-menu a:hover svg { color: #2563eb; }
.nav-dropdown-menu .dropdown-cta { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); color: #fff !important; font-weight: 600; border-radius: 8px; margin-top: 4px; padding: 10px 14px; justify-content: center; box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25); transition: all 0.2s ease; white-space: nowrap; }
.nav-dropdown-menu .dropdown-cta:hover { background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35); }
.nav-dropdown-menu .dropdown-cta svg { color: #fff !important; }

/* Header history dropdown */
.header-history-dropdown { position: relative; display: flex; align-items: center; flex-shrink: 0; margin-right: 12px; }
.header-history-dropdown .nav-dropdown { position: relative; }
.header-history-dropdown .nav-link { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; font-size: 13px; font-weight: 600; color: var(--ink); transition: all 0.2s; }
.header-history-dropdown .nav-link:hover { background: #f9fafb; border-color: var(--primary); color: var(--primary); }
.header-history-dropdown .nav-icon-box { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: #f3f4f6; border-radius: 6px; color: #6b7280; transition: all 0.2s; }
.header-history-dropdown .nav-link:hover .nav-icon-box { background: #dbeafe; color: var(--primary); }
.header-history-dropdown .nav-arrow-icon { margin-left: 2px; opacity: 0.5; }
.header-history-dropdown .nav-dropdown-menu { right: 0; left: auto; min-width: 260px; }
.header-history-dropdown .history-menu { padding: 0; }
.history-search-in-dropdown { padding: 12px; border-top: 1px solid #f1f5f9; }
.history-search-form-dropdown { display: flex; align-items: center; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.history-search-form-dropdown:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1); }
.history-search-input-dropdown { flex: 1; padding: 10px 12px; border: none; background: transparent; font-size: 13px; outline: none; color: var(--ink); }
.history-search-input-dropdown::placeholder { color: #9ca3af; }
.history-search-btn-dropdown { padding: 10px 12px; background: var(--primary); border: none; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.history-search-btn-dropdown:hover { background: var(--primary-dark); }
[data-theme="dark"] .header-history-dropdown .nav-link { background: var(--bg-card); border-color: #334155; }
[data-theme="dark"] .header-history-dropdown .nav-link:hover { border-color: #60a5fa; }
[data-theme="dark"] .header-history-dropdown .nav-icon-box { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .history-search-in-dropdown { border-color: #334155; }
[data-theme="dark"] .history-search-form-dropdown { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .history-search-input-dropdown { color: #f1f5f9; }

/* Header controls */
.theme-toggle {
    width: 40px; height: 40px;
    border-radius: 10px; border: 2px solid var(--line);
    background: var(--light); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--primary); transform: scale(1.05); }
.theme-toggle-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: #f1f5f9; border: none; border-radius: 10px; cursor: pointer; transition: all 0.2s; }
.theme-toggle-btn:hover { background: #e2e8f0; }
.theme-toggle-btn svg { color: #64748b; }
[data-theme="dark"] .theme-toggle-btn { background: #334155; }
[data-theme="dark"] .theme-toggle-btn:hover { background: #475569; }
[data-theme="dark"] .theme-toggle-btn svg { color: #fbbf24; }
.header-auth { display: flex; align-items: center; gap: 12px; }
.auth-login-btn, .auth-register-btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; font-size: 13px; font-weight: 600; border-radius: 8px; transition: all 0.2s ease; }
.auth-login-btn { color: #fff; background: var(--primary); border: 2px solid var(--primary); }
.auth-login-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.auth-register-btn { color: var(--ink); background: transparent; border: 2px solid #e5e7eb; }
.auth-register-btn:hover { border-color: var(--primary); color: var(--primary); }

/* User account dropdown */
.user-balance {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; font-size: 13px; font-weight: 600;
    background: #ecfdf5; color: #059669; border-radius: 8px;
}
.user-balance svg { color: #10b981; }
[data-theme="dark"] .user-balance { background: #064e3b; color: #a7f3d0; }
.user-dropdown { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink); border-radius: 10px; cursor: pointer; border: 1px solid #e5e7eb; transition: all 0.2s; }
.user-btn:hover { border-color: var(--primary); color: var(--primary); }
.user-avatar { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%); color: #fff; border-radius: 8px; font-size: 13px; font-weight: 700; }
.user-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown-balance { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; }
.udb-label { font-size: 12px; font-weight: 500; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
.udb-amount { font-size: 15px; font-weight: 700; color: #059669; }
.logout-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; background: none; border: none; cursor: pointer; color: #dc2626; font-size: 14px; font-weight: 500; border-radius: 6px; transition: all 0.15s; }
.logout-btn:hover { background: #fef2f2; }
.logout-btn svg { color: #dc2626; }
[data-theme="dark"] .udb-label { color: #94a3b8; }
[data-theme="dark"] .udb-amount { color: #34d399; }
[data-theme="dark"] .user-btn { border-color: #475569; }
[data-theme="dark"] .user-btn:hover { border-color: #60a5fa; }
.user-dropdown .nav-dropdown-menu { right: 0; left: auto; min-width: 220px; }

/* Collapsible submenu */
.nav-submenu-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; background: transparent; border: none; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink, #1f2937); border-radius: 8px; transition: background .2s; font-family: inherit; }
.nav-submenu-toggle:hover { background: var(--light, #f8fafc); }
.submenu-count { font-size: 11px; font-weight: 700; background: var(--primary, #1e40af); color: #fff; padding: 1px 6px; border-radius: 10px; line-height: 1.4; }
.nav-submenu-toggle .submenu-arrow { margin-left: auto; transition: transform .3s; opacity: .4; }
.nav-submenu-group.open .nav-submenu-toggle { background: var(--light, #f8fafc); }
.nav-submenu-group.open .submenu-arrow { transform: rotate(180deg); opacity: .7; }
.nav-submenu-items { max-height: 0; overflow: hidden; transition: max-height .3s ease; margin-left: 14px; border-left: 2px solid transparent; }
.nav-submenu-group.open .nav-submenu-items { max-height: 350px; border-left-color: var(--primary, #1e40af); margin-top: 4px; }
.nav-submenu-items a { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.submenu-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted, #9ca3af); flex-shrink: 0; opacity: .5; transition: all .15s; }
.nav-submenu-items a:hover .submenu-dot { background: var(--primary, #1e40af); opacity: 1; transform: scale(1.4); }

.btn-mobile-menu { display: none; flex-direction: column; gap: 4px; padding: 12px; background: none; border: none; cursor: pointer; position: relative; z-index: 100; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; -webkit-tap-highlight-color: rgba(0,0,0,0.1); touch-action: manipulation; }
.btn-mobile-menu span { display: block; width: 20px; height: 2px; background: var(--ink); transition: all 0.2s; pointer-events: none; }
@media (max-width: 1100px) { .header-nav { display: none !important; } .btn-mobile-menu { display: flex !important; } }
@media (max-width: 900px) { .brand-tagline { display: none !important; } }
@media (max-width: 768px) { .header-right { display: none !important; } .btn-mobile-menu { margin-left: auto; } }
