/**
 * app-layout.css — унифицированная структура приложения
 * app-shell: header | main_content (скролл) | nav-footer.
 * Сетка: header в потоке сверху, main под ним, footer внизу.
 * Когда header получает .fixed (position: fixed при скролле), резервируем место через padding-top у main.
 */

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  overflow: hidden;
}

html.auth-gate,
html.auth-gate body {
  background: #ffffff;
}

html.auth-gate .app-shell {
  visibility: hidden;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.app-shell > header {
  flex: 0 0 auto;
  min-height: var(--LUVIO-header-height, 64px);
}

.app-shell .main_content {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Когда header фиксирован при скролле — резервируем место, чтобы контент не уходил под header */
.app-shell.header-is-fixed .main_content {
  padding-top: var(--LUVIO-header-height, 64px);
}

/* footer внутри shell — в потоке (переопределяем position:fixed из style.css) */
.app-shell > .footer-nav {
  flex: 0 0 auto;
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  max-width: 100%;
}

/* landing: без header и footer, main на весь экран */
.app-shell:not(:has(header)) .main_content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* auth / onboarding-intro: header и nav в DOM, скрыты */
.app-shell--auth > header,
.app-shell--auth > .footer-nav,
.app-shell--onboarding-intro > header,
.app-shell--onboarding-intro > .footer-nav {
  display: none;
}

/* auth: на мобильных показываем header (логотип) */
@media (max-width: 991px) {
  .app-shell--auth > header {
    display: flex;
  }
}

/* auth/otp: main_content — flex, скролл только внутри .site_content.auth-page */
.app-shell--auth .main_content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 0;
  overflow: hidden;
}

/* site_content.auth-page: всё ограничено внутри этого блока, скролл только здесь */
.app-shell--auth .main_content .site_content.auth-page {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* site_content: по высоте по максимуму, overflow → скролл в main */
.app-shell .main_content .site_content {
  min-height: 100%;
  box-sizing: border-box;
}

/* Спец. страницы: без скролла, контент на всю высоту (home-simple, chat) */
.app-shell:has(.site_content.home-simple) .main_content,
.app-shell:has(.site_content.chat-screen) .main_content {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-shell:has(.site_content.home-simple) .site_content.home-simple,
.app-shell:has(.site_content.chat-screen) .site_content.chat-screen {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
