/* Нативные React-страницы в SPA-оболочке (без iframe) */

/* --- Settings: прокрутка правой панели --- */
body.plumnet-app-shell.page-settings .plumnet-native-shell {
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

body.plumnet-app-shell.page-settings .plumnet-native-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: none;
  padding: 16px;
  box-sizing: border-box;
}

body.plumnet-app-shell.page-settings #settings-page-root {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.plumnet-app-shell.page-settings .settings-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

body.plumnet-app-shell.page-settings .settings-menu {
  flex-shrink: 0;
  align-self: flex-start;
  background-color: var(--surface-bg, #333);
  color: var(--text-primary, #fff);
}

body.plumnet-app-shell.page-settings .plumnet-shell-main.main {
  height: calc(100vh - var(--header-height)) !important;
  max-height: calc(100vh - var(--header-height)) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.plumnet-app-shell.page-settings .native-page-frame {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.plumnet-app-shell.page-settings .native-page-frame__body,
body.plumnet-app-shell.page-settings .native-page-frame__body--visible {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.plumnet-app-shell.page-settings .settings-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background-color: var(--surface-bg, #333);
  color: var(--text-primary, #fff);
  border-color: var(--border-color, rgba(255, 255, 255, 0.08));
}

@media (max-width: 900px) {
  body.plumnet-app-shell.page-settings .settings-layout {
    position: relative;
  }

  body.plumnet-app-shell.page-settings .settings-content {
    max-height: none;
  }

  body.plumnet-app-shell.page-settings .settings-content:not(.active) {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  body.plumnet-app-shell.page-settings .sidebar,
  body.plumnet-app-shell.page-settings .sidebar.active {
    z-index: 500 !important;
  }
}

/* --- Split pages (friends / chat / news): высота внутри shell, не 100vh --- */
body.plumnet-app-shell.page-split-layout {
  display: block !important;
  height: 100% !important;
  overflow: hidden !important;
}

body.plumnet-app-shell.page-settings {
  display: block !important;
  height: 100% !important;
  overflow: hidden !important;
}

/* split-pages.css задаёт .main { height: 100vh } — в SPA это ломает оболочку */
body.plumnet-app-shell.page-split-layout .plumnet-shell-main.main {
  height: calc(100vh - var(--header-height)) !important;
  max-height: calc(100vh - var(--header-height)) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.plumnet-app-shell.page-split-layout .plumnet-native-shell {
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

body.plumnet-app-shell.page-split-layout .plumnet-native-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1150px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px;
  box-sizing: border-box;
}

body.plumnet-app-shell.page-split-layout .native-page-frame {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

body.plumnet-app-shell.page-split-layout .native-page-frame__body--visible {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
}

body.plumnet-app-shell.page-split-layout .split-page-root {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  height: 100%;
}

body.plumnet-app-shell.page-split-layout .split-page-root .split-layout {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  align-items: stretch;
  overflow: hidden;
}

body.plumnet-app-shell.page-split-layout .split-page-root .left-container {
  position: relative !important;
  margin-left: 0 !important;
  width: 350px !important;
  max-width: 350px !important;
  flex: 0 0 350px !important;
  height: 100% !important;
  box-sizing: border-box;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.plumnet-app-shell.page-split-layout .split-page-root .left-container-ol {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.plumnet-app-shell.page-split-layout .split-page-root #chatsList,
body.plumnet-app-shell.page-split-layout .split-page-root #channelsList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

body.plumnet-app-shell.page-split-layout .split-page-root .split-right,
body.plumnet-app-shell.page-split-layout .split-page-root .split-right-stack {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.plumnet-app-shell.page-split-layout .split-page-root .right-container {
  position: relative !important;
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  height: 100% !important;
  box-sizing: border-box;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.plumnet-app-shell.page-split-layout .split-page-root #chatBox,
body.plumnet-app-shell.page-split-layout .split-page-root #channelBox,
body.plumnet-app-shell.page-split-layout .split-page-root .chat-empty-state {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.plumnet-app-shell.page-split-layout .split-page-root #chatBox[style*='none'],
body.plumnet-app-shell.page-split-layout .split-page-root #channelBox[style*='none'],
body.plumnet-app-shell.page-split-layout .split-page-root #chatEmptyState[style*='none'],
body.plumnet-app-shell.page-split-layout .split-page-root .chat-empty-state[style*='none'] {
  display: none !important;
  flex: 0 0 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.plumnet-app-shell.page-split-layout .split-page-root .chat-messages {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

body.plumnet-app-shell.page-split-layout .split-page-root #channelComposer,
body.plumnet-app-shell.page-split-layout .split-page-root #chatComposer {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
}

/* --- Friends-only tweaks --- */
body.plumnet-app-shell.page-split-layout #friends-page-root .left-container {
  width: 260px !important;
  max-width: 260px !important;
  flex: 0 0 260px !important;
}

body.plumnet-app-shell.page-split-layout #friends-page-root #friendsTabs.friendsol {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

body.plumnet-app-shell.page-split-layout #friends-page-root .friends-panel-card {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.plumnet-app-shell.page-split-layout #friends-page-root .split-right {
  background: transparent !important;
  box-shadow: none !important;
}

body.plumnet-app-shell.page-split-layout #friends-page-root .friends-panel-body > .friends-panel-content {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

body.plumnet-app-shell.page-split-layout #friends-page-root #friends1 .search-box,
body.plumnet-app-shell.page-split-layout #friends-page-root #friendsSearchHint,
body.plumnet-app-shell.page-split-layout #friends-page-root #friends6 .search-box,
body.plumnet-app-shell.page-split-layout #friends-page-root .fg-topbar {
  flex-shrink: 0;
}

body.plumnet-app-shell.page-split-layout #friends-page-root .friendsol,
body.plumnet-app-shell.page-split-layout #friends-page-root .friendol {
  height: 100% !important;
  max-height: 100% !important;
}

body.plumnet-app-shell.page-split-layout #friends-page-root #friendsRecs,
body.plumnet-app-shell.page-split-layout #friends-page-root .friends-panel-content > div[id$='List'],
body.plumnet-app-shell.page-split-layout #friends-page-root #friendGroupsList,
body.plumnet-app-shell.page-split-layout #friends-page-root .friends-panel-body #friendsRecs,
body.plumnet-app-shell.page-split-layout #friends-page-root .friends-panel-body .friends-panel-content > div[id$='List'],
body.plumnet-app-shell.page-split-layout #friends-page-root .friends-panel-body #friendGroupsList {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.plumnet-app-shell.page-split-layout #friends-page-root #friendsRecs .friendsol,
body.plumnet-app-shell.page-split-layout #friends-page-root .right-container > div[id$='List'] .friendsol,
body.plumnet-app-shell.page-split-layout #friends-page-root #friendGroupsList .friendsol,
body.plumnet-app-shell.page-split-layout #friends-page-root #friendGroupsList .friend-groups-scroll {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

/* --- Profile: прокрутка длинной страницы --- */
body.plumnet-app-shell.page-profile .plumnet-native-shell {
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

body.plumnet-app-shell.page-profile .plumnet-native-view {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

body.plumnet-app-shell.page-profile .native-page-frame__body--visible {
  overflow: visible;
  height: auto;
  min-height: min-content;
}

body.plumnet-app-shell.page-profile #profile-page-root {
  width: 100%;
  max-width: 990px;
  margin: 0 auto;
  padding-bottom: 32px;
}

/* --- Mobile SPA: полноэкранный split, без отступа под rail --- */
@media (max-width: 900px) {
  body.plumnet-app-shell.page-split-layout .plumnet-shell-main.main {
    padding-top: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.plumnet-app-shell.page-split-layout .plumnet-native-view {
    padding: 10px !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  body.plumnet-app-shell.page-settings .plumnet-native-view,
  body.plumnet-app-shell.page-profile .plumnet-native-view {
    padding: 10px !important;
  }

  body.plumnet-app-shell.page-split-layout .split-page-root .split-layout {
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
  }

  body.plumnet-app-shell.page-split-layout .split-page-root .left-container,
  body.plumnet-app-shell.page-split-layout #friends-page-root .left-container {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }

  body.plumnet-app-shell.page-split-layout .split-layout:not(.show-right) .split-right,
  body.plumnet-app-shell.page-split-layout .split-layout:not(.show-right) .split-right-stack {
    display: none !important;
  }

  body.plumnet-app-shell.page-split-layout .split-layout.show-right .split-left,
  body.plumnet-app-shell.page-split-layout .split-layout.show-right .left-container {
    display: none !important;
  }

  body.plumnet-app-shell.page-split-layout .split-layout.show-right .split-right,
  body.plumnet-app-shell.page-split-layout .split-layout.show-right .split-right-stack {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
  }
}
