/* TODO: Selectors starting with shiny-cnc-* actually hardcode the default
 * shinyCNC module prefix, which the user can override, thus bypassing the CSS
 * rules. Either move these into R code (as style attributes), or disallow the
 * override -- nobody needs it anyway, and keeping the CSS rules here would be
 * cleaner.
 */

/* The default positioning of the toolbar is absolute for some reason, perhaps
 * a good one, who knows. Accordingly, the least intrusive way of preventing
 * overlap between the toolbar and the app itself is by applying a margin to the
 * body, since the height of the toolbar is known.
 */
body {
  margin-top: 40px !important;
}

/* The toolbar output container has some generic Shiny classes, which make it
 * vulnerable to CSS rules meant to affect all Shiny outputs, which various
 * additional packages can bring to the table. E.g. the shinybusy spinner sets
 * position: relative, which screws up the toolbar's placement. This is the
 * place to unset all this nonsense, if necessary.
 */
#shiny-cnc-toolbar {
  position: unset;
}

/* From experience, some Shiny themes set box-sizing to border-box, which then
 * screws up the layout of the toolbar logo. So let's override that for good
 * measure.
 */
#cnc-toolbar-logo {
  box-sizing: content-box;
}

/* An overlay in addition to the default one provided by Shiny to improve UX
 * when the app disconnects.
 */
#shiny-cnc-disconnected-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  padding: 0 10rem;
  cursor: not-allowed;

  /* Horizontally and vertically center content. */
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

#shiny-cnc-disconnected-overlay span {
  padding: 2rem 4rem;
  border: .2rem solid rgba(0, 0, 0, 0);
  border-radius: 2rem;
  transition: border .5s;
  cursor: pointer;
  font-size: 10rem;
  color: #fff;
  animation: glow 1s ease-in-out infinite alternate;
}

#shiny-cnc-disconnected-overlay span:hover {
  border: .2rem solid #fff;
  transition: border .5s;
}

@keyframes glow {
  from {
    text-shadow: 0 0 1rem #fff, 0 0 2rem #333;
  }
  to {
    text-shadow: 0 0 2rem #fff, 0 0 3rem #e2007a;
  }
}
