/* Общая мобильная / Telegram WebApp оболочка */
:root {
  --shell-tabbar-h: 60px;
  --shell-white: #ffffff;
  --shell-border: #e8e8e8;
  --shell-muted: #525252;
  --shell-pink: #ff2d8a;
}

.header-avatar,
.shell-header-avatar {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}
.header-avatar img,
.shell-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.header-avatar[hidden],
.shell-header-avatar[hidden] { display: none !important; }

.mobile-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  height: calc(var(--shell-tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--shell-white);
  border-top: 1px solid var(--shell-border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}
.mobile-tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--shell-muted);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.mobile-tabbar__item.is-active { color: var(--shell-pink); }
.mobile-tabbar__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.mobile-tabbar__item--profile.is-logged-in .mobile-tabbar__icon--guest { display: none; }
.mobile-tabbar__avatar-wrap {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--shell-border);
}
.mobile-tabbar__avatar-wrap[hidden] { display: none !important; }
.mobile-tabbar__item--profile.is-logged-in .mobile-tabbar__avatar-wrap {
  display: block;
  border-color: var(--shell-pink);
}
.mobile-tabbar__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* WebApp: всегда нижняя панель */
body.is-tg-webapp {
  padding-bottom: calc(var(--shell-tabbar-h) + env(safe-area-inset-bottom, 0px));
}
body.is-tg-webapp .mobile-tabbar { display: flex !important; }
body.is-tg-webapp.page-landing .site-nav { display: none !important; }
body.is-tg-webapp.page-landing .site-actions .site-link { display: none !important; }
body.is-tg-webapp.page-landing .btn-rent--desktop { display: none !important; }
body.is-tg-webapp .header-avatar:not([hidden]),
body.is-tg-webapp .shell-header-avatar:not([hidden]) { display: block !important; }

body.cabinet-page--tg {
  padding-bottom: calc(var(--shell-tabbar-h) + env(safe-area-inset-bottom, 0px));
}
body.cabinet-page--tg .mobile-tabbar { display: flex !important; }
body.cabinet-page--tg .header-avatar:not([hidden]),
body.cabinet-page--tg .shell-header-avatar:not([hidden]) { display: block !important; }
body.cabinet-page--tg .cabinet-top__inner .cabinet-link { display: none; }

@media (max-width: 768px) {
  body.page-landing,
  body.cabinet-page.has-mobile-shell {
    padding-bottom: calc(var(--shell-tabbar-h) + env(safe-area-inset-bottom, 0px));
  }
  body.page-landing .mobile-tabbar,
  body.cabinet-page.has-mobile-shell .mobile-tabbar { display: flex; }
  body.page-landing .header-avatar:not([hidden]),
  body.cabinet-page.has-mobile-shell .header-avatar:not([hidden]),
  body.cabinet-page.has-mobile-shell .shell-header-avatar:not([hidden]) { display: block; }
}

@media (min-width: 769px) {
  body:not(.is-tg-webapp):not(.cabinet-page--tg) .mobile-tabbar { display: none !important; }
}
