/*
 * V01-NAT-UI-13-02-02-R3-FIX1
 * Viewport Containment Repair
 *
 * Goal:
 * - Keep primary bottom navigation in the viewport in all states.
 * - Preserve warning / mode banners in normal document flow.
 * - Shrink only the map region as banners consume vertical space.
 * - Preserve bottom-sheet bottom:76px relationship.
 * - No Common Alert Engine or Training Hub semantics are changed.
 */

html,
body {
  height: 100%;
}

/*
 * The app itself is a viewport-contained vertical layout.
 * min-height alone previously allowed warning/mode surfaces to
 * expand the shell beyond the viewport.
 */
.app-shell {
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;

  display: flex;
  flex-direction: column;
}

/*
 * Header and alert/mode presentation consume only their real
 * height and must never force the primary nav off-screen.
 */
.app-shell > .topbar,
.app-shell > header.topbar,
.app-shell > #ui06ModeBanner,
.app-shell > #warningBanner {
  flex: 0 0 auto;
}

/*
 * MAP FIRST:
 * map receives all remaining viewport height.
 *
 * This intentionally overrides the historical fixed
 * calc(100dvh - ...) map height and the UI06 42vh minimum.
 */
.app-shell > .map-stage {
  flex: 1 1 auto;
  height: auto !important;
  min-height: 0 !important;
  overflow: hidden;
}

/*
 * Primary navigation remains the final viewport row.
 * It stays in document/flex flow so no overlay is introduced.
 */
.app-shell > .bottom-nav {
  flex: 0 0 76px;
  height: 76px;
  min-height: 76px;

  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
}

/*
 * Desktop shell already has 20px body padding in the inherited
 * design. Keep the app inside that usable viewport.
 */
@media (min-width: 761px) {
  .app-shell {
    height: calc(100dvh - 40px);
    min-height: 0;
    max-height: calc(100dvh - 40px);
  }
}