/* ==========================================================================
   Site chrome — sticky header, popovers, mobile drawer, mobile tab bar.
   Markup: includes/layout/header.php   Behaviour: assets/js/header.js
   ========================================================================== */

/* ── Header bar ─────────────────────────────────────────────────────────── */
.pb-header {
  position: sticky; top: 0; z-index: var(--pb-z-header);
  height: var(--pb-header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px 0 8px;
  background: var(--pb-surface);
  border-bottom: 1px solid var(--pb-border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .03);
}
.pb-header__menu {
  flex: none; width: 44px; height: 44px; border: 0; background: none; border-radius: 50%;
  color: var(--pb-text); font-size: 22px;
}
.pb-header__brand { position: relative; display: flex; align-items: center; min-width: 0; flex: none; }
.pb-header__logo { display: block; height: 46px; width: auto; flex: none; }
.pb-header__paw {
  display: none; position: absolute; left: 400px; top: 50%; margin-top: -15px;
  color: #f7e3b8; font-size: 30px; transform: rotate(-20deg); pointer-events: none;
}
.pb-header__tabs { display: none; }
.pb-header__actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-left: auto; min-width: 0; }

/* Search: pill on wide screens, round icon button on narrower ones */
.pb-search { display: none; }
.pb-search-btn {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--pb-surface-2); color: var(--pb-text); font-size: 17px;
}

/* Round icon buttons (bell etc.) */
.pb-icon-btn {
  position: relative; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pb-surface-2); color: var(--pb-text); font-size: 19px;
  transition: background .15s;
}
.pb-icon-btn:hover { background: #ebebee; color: var(--pb-text); }
.pb-icon-btn__dot {
  position: absolute; top: 8px; right: 9px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--pb-red); border: 2px solid var(--pb-surface-2);
}

/* Avatar button */
.pb-avatar-btn {
  flex: none; width: 44px; height: 44px; min-width: 44px; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pb-text); color: #fff;
  font-family: var(--pb-font-head); font-weight: 800; font-size: 15px; letter-spacing: .02em;
}
.pb-login-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 20px; border-radius: 22px;
  background: var(--pb-primary); color: #fff;
  font-family: var(--pb-font-head); font-weight: 800; font-size: 15px;
}
.pb-login-btn:hover { background: var(--pb-primary-hover); color: #fff; }
.pb-login-btn--icon { display: inline-flex; }
.pb-login-btn--text { display: none; }

@media (min-width: 900px) {
  .pb-header {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 16px; padding: 0 30px 0 28px;
  }
  .pb-header__menu { display: none; }
  .pb-header__logo { height: 50px; }

  .pb-header__tabs { display: flex; align-items: stretch; gap: 2px; height: var(--pb-header-h); }
  .pb-tab {
    position: relative; width: 96px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    font-family: var(--pb-font-body); font-size: 14.5px; font-weight: 500; color: var(--pb-text-2);
  }
  .pb-tab i { font-size: 20px; }
  .pb-tab:hover { color: var(--pb-link); }
  .pb-tab::after {
    content: ''; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px;
    border-radius: 3px 3px 0 0; background: transparent;
  }
  .pb-tab.is-active { color: var(--pb-link); font-weight: 700; }
  .pb-tab.is-active::after { background: var(--pb-link); }

  .pb-header__actions { gap: 16px; }
  .pb-icon-btn { background: none; }
  .pb-icon-btn:hover { background: var(--pb-surface-2); }
  .pb-icon-btn__dot { right: 9px; border-color: #fff; }
  .pb-avatar-btn { width: 46px; height: 46px; min-width: 46px; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #ececec; }
  .pb-login-btn--icon { display: none; }
  .pb-login-btn--text { display: inline-flex; }
}
@media (min-width: 1200px) {
  .pb-search {
    display: flex; align-items: center; gap: 14px; flex: 0 1 344px; min-width: 160px; height: 48px;
    padding: 0 20px; margin-right: 8px; background: var(--pb-surface-2); border-radius: 24px;
  }
  .pb-search i { color: var(--pb-text-3); font-size: 17px; }
  .pb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--pb-text); }
  .pb-search:focus-within { box-shadow: 0 0 0 2px rgba(144, 109, 2, .35); }
  .pb-search-btn { display: none; }
}
@media (min-width: 1500px) {
  .pb-tab { width: 112px; }
  .pb-header__paw { display: block; }
}
@media (max-width: 399px) {
  .pb-header__logo { height: 38px; }
  .pb-icon-btn, .pb-search-btn, .pb-avatar-btn { width: 42px; height: 42px; min-width: 42px; }
}

/* ── Popovers (notifications, profile) ─────────────────────────────────── */
.pb-backdrop {
  position: fixed; inset: 0; z-index: calc(var(--pb-z-popover) - 5);
  background: transparent; display: none;
}
.pb-backdrop.is-open { display: block; }

.pb-popover {
  position: fixed; z-index: var(--pb-z-popover);
  top: 80px; right: 12px; width: min(310px, calc(100vw - 64px));
  max-height: calc(100vh - 180px);
  display: none; flex-direction: column;
  background: var(--pb-surface); border: 1px solid #efece4; border-radius: 20px;
  box-shadow: var(--pb-shadow-pop); overflow: hidden;
}
.pb-popover.is-open { display: flex; }
.pb-popover--profile { width: min(250px, calc(100vw - 64px)); overflow-y: auto; padding: 8px; }
@media (min-width: 900px) {
  .pb-popover { top: 76px; right: 84px; width: 392px; max-height: calc(100vh - 100px); }
  .pb-popover--profile { right: 24px; width: 300px; }
}

.pb-pop-hd { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.pb-pop-hd h3 { font-size: 19px; }
.pb-pop-hd button { border: 0; background: none; font-family: var(--pb-font-head); font-weight: 800; font-size: 14px; color: var(--pb-link); }
.pb-pop-empty { padding: 34px 24px 38px; text-align: center; color: var(--pb-text-muted); font-size: 15px; }
.pb-pop-empty i { display: block; margin-bottom: 12px; font-size: 30px; color: var(--pb-amber); }
.pb-notif-list { overflow-y: auto; padding-bottom: 6px; }
.pb-notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; color: var(--pb-text); }
a.pb-notif:hover { background: var(--pb-surface-2); color: var(--pb-text); }
.pb-notif.is-unread { background: #fff8e6; }
.pb-notif__ico { flex: none; overflow: hidden; width: 36px; height: 36px; border-radius: 50%; background: var(--pb-surface-warm, #fff3d9); color: var(--pb-orange-2, #e08a00); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.pb-notif__txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pb-notif__txt strong { font-family: var(--pb-font-head); font-weight: 800; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.pb-notif__body { font-size: 13.5px; line-height: 1.4; color: var(--pb-text-muted); overflow-wrap: anywhere; }
.pb-notif__time { font-size: 12px; color: var(--pb-text-faint); }
.pb-notif.is-unread .pb-notif__time::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--pb-red, #e5484d); }
.pb-pop-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px;
  border-top: 1px solid #f1eee7; font-family: var(--pb-font-head); font-weight: 800; font-size: 15px; color: var(--pb-link);
}

.pb-menu-user { padding: 14px 14px 12px; }
.pb-menu-user strong { display: block; font-family: var(--pb-font-head); font-weight: 800; font-size: 16px; }
.pb-menu-user span { display: block; margin-top: 1px; font-size: 13px; color: var(--pb-text-muted); }
.pb-menu-link {
  display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 12px; border-radius: 12px;
  font-size: 15px; font-weight: 600; color: var(--pb-text);
}
.pb-menu-link i { width: 20px; text-align: center; color: var(--pb-text-3); font-size: 15px; }
.pb-menu-link:hover { background: #f7f5f0; color: var(--pb-text); }
.pb-menu-link--danger, .pb-menu-link--danger i { color: #d92d33; }
.pb-menu-sep { height: 1px; margin: 6px 8px; background: #f1eee7; }

/* ── Mobile drawer ──────────────────────────────────────────────────────── */
.pb-scrim {
  position: fixed; inset: 0; z-index: calc(var(--pb-z-drawer) - 5);
  background: rgba(20, 16, 8, .38); display: none;
}
.pb-scrim.is-open { display: block; }

.pb-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: var(--pb-z-drawer);
  width: min(340px, 88vw); display: flex; flex-direction: column;
  background: var(--pb-bg); transform: translateX(-105%); transition: transform .28s ease;
  box-shadow: none;
}
.pb-drawer.is-open { transform: none; box-shadow: 8px 0 40px rgba(0, 0, 0, .22); }
.pb-drawer__hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; }
.pb-drawer__hd img { height: 42px; width: auto; display: block; }
.pb-drawer__close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--pb-surface-2); font-size: 18px; }
.pb-drawer__body { flex: 1; overflow-y: auto; padding: 4px 14px 16px; overscroll-behavior: contain; }
.pb-drawer__ft { padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid #f1eee7; }

.pb-drawer-user {
  position: relative; overflow: hidden; padding: 18px 16px; border-radius: 20px; color: #fff;
  background: linear-gradient(160deg, #2e2c27, #1d1d1f);
}
.pb-drawer-user__row { display: flex; align-items: center; gap: 14px; }
.pb-drawer-user__av {
  flex: none; width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #906d02; font-family: var(--pb-font-head); font-weight: 900; font-size: 17px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .12);
}
.pb-drawer-user__name { font-family: var(--pb-font-head); font-weight: 800; font-size: 17px; }
.pb-drawer-user__mail { font-size: 13px; color: #c9c6be; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-drawer-user__cta {
  margin-top: 14px; height: 40px; border-radius: 20px; background: var(--pb-amber); color: var(--pb-text);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--pb-font-head); font-weight: 800; font-size: 14.5px;
}
.pb-drawer-user__cta:hover { color: var(--pb-text); filter: brightness(1.05); }

.pb-drawer-join { padding: 18px 16px; border-radius: 20px; background: linear-gradient(160deg, #fff3d9, #fde3a2); }
.pb-drawer-join h3 { font-size: 18px; }
.pb-drawer-join p { margin-top: 4px; font-size: 14px; color: #4a4a50; }
.pb-drawer-join__btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.pb-drawer-join__btns a {
  height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center;
  font-family: var(--pb-font-head); font-weight: 800; font-size: 15px; background: #fff; color: var(--pb-text);
}
.pb-drawer-join__btns a:first-child { background: var(--pb-text); color: #fff; }

.pb-drawer-label {
  padding: 20px 8px 8px; font-family: var(--pb-font-head); font-weight: 800; font-size: 12.5px;
  letter-spacing: .08em; color: var(--pb-text-faint); text-transform: uppercase;
}
.pb-drawer-list { display: flex; flex-direction: column; gap: 2px; }
.pb-drawer-link {
  display: flex; align-items: center; gap: 16px; height: 50px; padding: 0 12px; border-radius: 14px;
  font-family: var(--pb-font-head); font-weight: 700; font-size: 16.5px; color: var(--pb-text);
}
.pb-drawer-link__ico { width: 36px; height: 36px; border-radius: 11px; background: #fff6e0; display: flex; align-items: center; justify-content: center; }
.pb-drawer-link__ico i { font-size: 17px; color: var(--pb-orange-2); }
.pb-drawer-link__chev { margin-left: auto; font-size: 12px; color: #b5b2aa; }
.pb-drawer-link.is-active { background: var(--pb-amber-soft); color: #6d5000; }
.pb-drawer-link:hover { background: #f7f5f0; color: var(--pb-text); }
.pb-drawer-link--plain { height: 48px; font-family: var(--pb-font-body); font-size: 15.5px; font-weight: 600; }
.pb-drawer-link--plain .pb-drawer-link__ico { background: var(--pb-surface-2); }
.pb-drawer-link--plain .pb-drawer-link__ico i { font-size: 15px; color: var(--pb-text-2); }
.pb-drawer-logout {
  width: 100%; height: 50px; border: 1px solid #f6d4d5; border-radius: 25px; background: #fff6f6; color: #d92d33;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--pb-font-head); font-weight: 800; font-size: 15.5px;
}
.pb-drawer-logout:hover { color: #d92d33; background: #ffeded; }

@media (min-width: 900px) { .pb-drawer, .pb-scrim { display: none !important; } }

/* ── Mobile tab bar ─────────────────────────────────────────────────────── */
.pb-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--pb-surface); border-top: 1px solid var(--pb-border);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .04); padding-bottom: env(safe-area-inset-bottom);
}
.pb-tabbar a {
  position: relative; height: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 13.5px; font-weight: 500; color: var(--pb-text-2); white-space: nowrap;
}
.pb-tabbar a i { font-size: 23px; }
.pb-tabbar a.is-active { color: var(--pb-link); font-weight: 700; }
.pb-tabbar a.is-active i { color: var(--pb-orange-2); }
.pb-tabbar a.is-active::after {
  content: ''; position: absolute; bottom: 4px; left: 18%; right: 18%; height: 3px; border-radius: 3px; background: var(--pb-link);
}
.pb-tabbar__fab {
  width: 58px; height: 58px; margin-top: -34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pb-primary); border: 4px solid #fff; box-shadow: 0 8px 18px rgba(144, 109, 2, .35);
}
.pb-tabbar__fab i { font-size: 22px; color: #fff; }
@media (min-width: 900px) { .pb-tabbar { display: none; } }
@media (max-width: 399px) { .pb-tabbar a { font-size: 12px; } }

/* ── Admin promo banner + compact search popover ───────────────────────── */
.pb-header-banner { display: none; align-items: center; flex: none; }
.pb-header-banner img { display: block; height: 36px; max-width: 260px; width: auto; object-fit: contain; border-radius: var(--pb-r-sm); }
@media (min-width: 1360px) { .pb-header-banner { display: flex; } }

.pb-popover--search { top: 80px; left: 12px; right: 12px; width: auto; padding: 12px; }
.pb-popsearch { display: flex; align-items: center; gap: 10px; }
.pb-popsearch i { color: var(--pb-text-3); }
.pb-popsearch input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border: 0; border-radius: 22px; background: var(--pb-surface-2); outline: 0; font-size: 16px; }
@media (min-width: 900px) { .pb-popover--search { left: auto; right: 84px; width: 392px; top: 76px; } }
@media (min-width: 1200px) { .pb-popover--search { display: none !important; } }
