/* Vỏ trang: header (desktop thanh ngang sticky / mobile drawer), footer nhiều cột, nút Zalo nổi.
   Nạp CUỐI CÙNG trong index.html để thắng các file css khác khi cùng độ ưu tiên. */

/* ---------- Header ---------- */
.top { height: auto; }
.bar { height: var(--header-h); }
.menu-btn { display: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; align-items: center; justify-content: center; padding: 0; }
.menu-btn:hover { background: var(--bg); }
.logo-ico { flex: none; display: block; }
.logo-name { font-family: var(--font); font-weight: 800; letter-spacing: -.01em; }
.nav { position: static; }
.nav-head, .nav-extra { display: none; }
.nav-link { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 999px; font: inherit; font-weight: 500; font-size: 14.5px; color: var(--text); background: none; border: 0; cursor: pointer; white-space: nowrap; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--accent-ink); font-weight: 600; }
.nav-dd { position: relative; }
.nav-dd-menu { display: none; position: absolute; left: 0; top: calc(100% + 8px); min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 1100; }
.nav-dd-menu.open { display: block; }
.nav-dd-menu a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); font-weight: 500; }
.nav-dd-menu a:hover { background: var(--bg); color: var(--text); }
.caret { font-size: 11px; }
.only-auth { display: none; }
body.logged-in .only-auth { display: inline-flex; }
.drawer-bg { display: none; }

/* thanh phải */
#userbar > .post-btn { order: 5; padding: 9px 18px; font-size: 14px; border-radius: 999px; }
#userbar > .btn-outline { border-radius: 999px; }
#userbar > .dropdown { order: 6; }
#userbar > .btn-outline { order: 4; }
.hd-link { font-weight: 500; border-radius: var(--radius-sm); }
.hd-link:hover { background: var(--bg); color: var(--text); }
.nt-bell { width: 40px; height: 40px; justify-content: center; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); padding: 0; }
.nt-bell:hover { background: var(--bg); }
.nt-badge { background: var(--err); }
.avatar-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font: inherit; font-weight: 500; font-size: 14px; color: var(--text); }
.avatar-btn:hover { background: var(--bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex: none; }
.avatar-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Desktop */
@media (min-width: 901px) {
  .bar { gap: 12px; }
  .nav { flex: 1; margin-left: 12px; }
  #userbar { gap: 4px; }
}

/* Mobile / tablet: hàng 1 = menu tròn | logo giữa | chuông + avatar; điều hướng nằm trong drawer */
@media (max-width: 900px) {
  .bar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 0 12px; }
  .menu-btn { display: inline-flex; justify-self: start; }
  .logo { justify-self: center; font-size: 19px; }
  .bar-right { justify-self: end; gap: 6px; }
  .nav, body.is-search .nav { display: flex; flex-direction: column; align-items: stretch; gap: 2px; position: fixed; z-index: 1200; top: 0; left: 0; bottom: 0; width: min(86vw, 320px); height: 100dvh; background: var(--surface); padding: 12px 12px 24px; overflow-y: auto; transform: translateX(-102%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; box-shadow: var(--shadow-lg); margin: 0; }
  body.drawer-open .nav { transform: none; visibility: visible; transition: transform .22s ease; }
  .drawer-bg { display: block; position: fixed; inset: 0; z-index: 999; background: rgba(29,29,27,.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.drawer-open .drawer-bg { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
  .nav-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 17px; }
  .menu-close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 15px; }
  .nav-extra { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
  .nav-link { width: 100%; padding: 12px 12px; font-size: 16px; text-align: left; justify-content: flex-start; }
  .nav-dd-btn { justify-content: space-between; }
  .nav-dd-menu { display: block; position: static; box-shadow: none; border: 0; padding: 0 0 0 14px; min-width: 0; }
  .nav-dd-menu a { padding: 10px 12px; color: var(--muted); }
  .nav-dd-btn .caret { display: none; }
  .nav-post { margin-top: 12px; padding: 12px; }
  body.logged-in .only-auth { display: flex; }
  /* điều hướng đã có trong drawer: ẩn khỏi thanh phải */
  #userbar > .post-btn, #userbar > a[href="#/favorites"], #sf-btn { display: none; }
  .avatar-name { display: none; }
  .avatar-btn { padding: 3px; }
  .hd-pop { position: static; }
  .nt-panel, .sf-panel { top: calc(var(--header-h) + 4px); }
}
@media (max-width: 380px) {
  .logo-name { font-size: 17px; }
}

/* ---------- Footer ---------- */
.foot { margin-top: 48px; padding: 48px 0 0; }
.foot a { color: var(--text); }
.foot a:hover { color: var(--accent-ink); text-decoration: underline; }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.4fr 1fr 1.1fr; gap: 28px; padding-bottom: 32px; }
.foot-col h4 { margin: 0 0 12px; color: var(--text); font-size: 15px; font-weight: 700; }
.foot-col > a { display: block; padding: 4px 0; }
.foot-col p { margin: 0 0 10px; color: var(--muted); line-height: 1.6; }
.foot-two { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.foot-two a { padding: 4px 0; }
.foot-logo { display: inline-flex !important; align-items: center; gap: 8px; color: var(--text) !important; font-size: 19px; margin-bottom: 10px; text-decoration: none !important; }
.foot-tip { font-size: 13px; }
.foot-phone { color: var(--accent-ink) !important; font-weight: 700; font-size: 18px; }
.foot-contact .muted { color: var(--muted); }
.foot-logo svg rect:first-child, .logo-ico rect:first-child { fill: var(--primary); }
.foot-logo svg path, .logo-ico path { stroke: var(--primary-ink); }
.foot-logo svg rect:last-child, .logo-ico rect:last-child { fill: var(--primary-ink); }
.foot-col > a.zalo-btn, .zalo-btn { display: inline-flex; align-items: center; justify-content: center; padding: 9px 18px; border-radius: var(--radius-sm); background: #0068ff; color: #fff !important; font-weight: 700; margin: 4px 0 10px; }
.zalo-btn:hover { background: #0057d8; color: #fff !important; }
.foot-bottom { border-top: 1px solid var(--line); padding: 18px 0 24px; color: var(--muted); font-size: 13px; }
@media (max-width: 980px) { .foot-grid { grid-template-columns: 1fr 1fr 1fr; } .foot-about { grid-column: 1 / -1; } }
@media (max-width: 600px) { .foot-grid { grid-template-columns: 1fr 1fr; gap: 22px 16px; } .foot-col:nth-child(3), .foot-contact { grid-column: 1 / -1; } .foot { padding-top: 28px; } }

/* ---------- Nút Zalo nổi ---------- */
.zalo-float { position: fixed; right: 16px; bottom: 20px; z-index: 900; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border-radius: 999px; background: #0068ff; color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 6px 18px rgba(0,104,255,.38); }
.zalo-float:hover { background: #0057d8; color: #fff; }
body.is-search .zalo-float { display: none; } /* không che dock "Xem kết quả" / bản đồ ở trang tìm kiếm */
@media (max-width: 600px) { .zalo-float { width: 48px; padding: 0; justify-content: center; right: 12px; bottom: 16px; } .zalo-float span { display: none; } }

/* ---------- Thanh tab dưới (chỉ mobile, trang chủ/blog; do page-home.js chèn) ---------- */
.botnav { display: none; }
@media (max-width: 760px) {
  body.bn-on { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.bn-on .botnav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(34,34,34,.06); }
  .botnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 10px; }
  .botnav a svg { width: 22px; height: 22px; }
  .botnav a.on, .botnav a:hover { color: var(--accent-ink); }
  body.bn-on .zalo-float { bottom: 78px; }
  body.bn-on #toast { bottom: 76px; }
}

/* ---------- Nhãn trạng thái dùng chung ---------- */
.tag-new { background: var(--green-soft); color: var(--green); }
.tag-soon { background: var(--cream); color: var(--cream-ink); }
