/* Customize spacings of page scaffold. */

html,
body {
  height: 100%;
}

body {
  overflow-y: scroll;
  overflow-x: hidden;
  padding-right: calc(100vw - 100%);
  margin-right: calc(-1 * (100vw - 100%));
}

#root-container {
  min-width: 567px;
}

#error {
  display: none;
  margin-top: 15px;
}

#form-box {
  padding-top: 13px;
}

#panel {
  padding-bottom: 15px;
}

@media (min-width: 1200px) {
  #panel {
    padding-left: 0px;
    padding-top: 15px;
  }
}

#toolbar {
  position: sticky;
  top: 0;
  z-index: 1000;
}

#toolbar,
#status .card-body,
#mqtt .card-body,
#help .card-body {
  margin-bottom: 15px;
}

#toolbar .card-body {
  padding-top: 10px;
  padding-bottom: 10px;
}

#toolbar .btn-toolbar>.btn-group,
#toolbar .btn-toolbar>button {
  margin-right: 10px;
}

#toolbar .btn-toolbar>:last-child {
  margin-right: 0px;
}

/* Adjust toolbar buttons based on screen width. */

@media (max-width: 820px),
(min-width: 1200px) and (max-width: 1599px) {
  .long-button-label {
    display: none;
  }

  #button-status,
  #button-help,
  #button-mqtt {
    width: auto;
  }

  #button-apply {
    width: 70px;
  }

  #button-deploy {
    width: 92px;
  }
}

@media (min-width: 821px) and (max-width: 1199px),
(min-width: 1599px) {
  .long-button-label {
    display: inline;
  }

  #button-status,
  #button-help,
  #button-mqtt {
    width: 72px;
  }

  #button-apply,
  #button-deploy {
    width: 172px;
  }
}

/* Tweak dropdown menu of toolbar buttons. */

#deploy-menu {
  min-width: 172px;
}

#schema-menu {
  min-width: 102px;
}

#deploy-menu button,
#schema-menu button {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Customize validation messages and error paths. */

#status p:last-of-type {
  margin-bottom: 0px;
}

#status p span {
  font-family: monospace;
}

/* Customize and align MQTT configuration form. */

#mqtt fieldset {
  margin-bottom: 8px;
}

#mqtt legend {
  font-size: 16px;
  font-weight: 600;
}

#mqtt small.form-text {
  color: var(--gray);
  font-size: 11px;
}

#mqtt .input-group-text code {
  margin-top: 2px;
}

#mqtt .form-check-inline {
  vertical-align: middle;
}

#mqtt .form-check-inline>input {
  margin-top: -1px;
}

/* Customize margin of last element in help tab. */

#help .tab-pane>:last-child {
  margin-bottom: 0rem;
}

/* Customize dynamic scroll-to-top button. */

#scroll-to-top {
  display: none;
  position: fixed;
  bottom: 15px;
  right: 15px;
}

/* Common adjustments of code and form editor. */

h6 {
  font-weight: bold;
  margin-bottom: 1rem;
}

.card-body {
  padding: 10px;
}

/* Align form editor and code editor scaffold. */

#form-editor h3.card-title.level-1>label {
  font-weight: bold;
}

#form-editor > div > p {
  margin-bottom: 12px;
}

#form-editor h3.card-title {
  margin-bottom: .2rem;
}

#config>div.card-body {
  margin-bottom: 2px;
}

#config h3.card-title {
  margin-top: 4px;
  margin-bottom: 3px;
}

#code-box,
#code-editor {
  border-radius: .25rem;
}

#code-box {
  border: 1px solid #ced4da;
  clear: both;
  margin-bottom: 12px;
}

#code-editor.ace-tm .ace_gutter {
  background: rgba(0, 0, 0, .03);
}

#code-editor.ace-tm .ace_marker-layer .ace_bracket {
  margin: 0px;
}

/* Position examples button top right of code editor. */

#config .card-body>p {
  display: inline-flex;
}

#config #button-restore,
#config #button-clear,
#config #button-examples {
  float: right;
  margin-top: -7px;
  margin-right: 2px;
}

#config #examples-menu {
  top: 7px !important;
  left: 2px !important;
}

@media (min-width: 1200px) {
  #config #examples-menu {
    left: 1px !important;
  }
}

/* Beautify and align labels, buttons and tabs. */

#form-editor label,
#form-editor button span,
#form-editor ul.nav-tabs a span {
  text-transform: capitalize;
}

#form-editor label {
  margin-right: 10px;
}

#form-editor h3 label {
  margin-bottom: 0px;
  vertical-align: middle;
}

#form-editor select.je-switcher {
  font-size: 11px;
  font-style: normal;
  margin-left: 0px;
  padding: 0px 0px 0px 0px;
  transform: translateY(-2px);
}

#form-editor .json-editor-btntype-editjson {
  border-bottom-left-radius: 0.2rem;
  border-top-left-radius: 0.2rem;
}

#form-editor .json-editor-btntype-editjson span,
#form-editor .json-editor-btntype-properties span,
#form-editor .json-editor-btntype-add span,
#form-editor .json-editor-btntype-deletelast span,
#form-editor .json-editor-btntype-deleteall span {
  display: none;
}

#form-editor .btn-group {
  display: inline-block;
  margin: 0px 0px 0px 0px;
  vertical-align: top;
}

#form-editor .btn-group.je-object__controls {
  display: inline-flex;
  margin: 5px 0px 0px 0px;
}

#form-editor .btn-group:empty {
  display: none;
}

#form-editor .btn-group .btn {
  flex-grow: 0;
}

#form-editor .btn-group button.btn-secondary {
  background-color: #ffffff;
  border-color: #ced4da;
  color: #212529;
}

#form-editor .btn-group .je-modal button.btn-secondary {
  border-color: transparent;
}

#form-editor button.btn-secondary i {
  min-height: 14px;
  min-width: 14px;
}

#form-editor .card-header-tabs a {
  color: var(--secondary)
}

/* Customize description, links, validation and tooltip. */

#form-editor small.form-text {
  color: var(--gray);
  font-size: 11px;
}

#form-editor div>a {
  color: var(--gray);
  font-size: 11px;
  margin-bottom: 0px !important;
  margin-right: 4px !important;
}

#form-editor .invalid-feedback {
  font-size: 11px;
  font-weight: bold;
  margin-top: 0px;
}

#form-editor .alert {
  display: none;
}

#form-editor button[data-toggle="tooltip"] {
  margin-left: 5px !important;
}

#form-editor .tooltip-inner {
  font-size: 11px;
  max-width: 400px;
  text-align: left;
}

/* Ensure space below cards for dynamic properties. */

#form-editor .card {
  margin-bottom: 1rem;
}

/* Unhide header label for polymorphic type selections. */

#form-editor h3.je-object__title>label {
  display: inline-block !important;
}

/* Add space between object containers inside an array. */

#form-editor div[data-schematype="array"] div.card>div>div[data-schemapath] {
  margin-bottom: 1rem;
}

/* Ensure type switcher is shown behind label not in separate row. */

#form-editor div:has(>select.je-switcher) {
  display: block;
}

/* Simplify header of card position and size. */

#form-editor div[data-schemapath$=".position"]>h3.je-object__title,
#form-editor div[data-schemapath$=".size"]>h3.je-object__title {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: .5rem;
}

#form-editor div[data-schemapath$=".position"]>h3.je-object__title button,
#form-editor div[data-schemapath$=".size"]>h3.je-object__title button,
#form-editor div[data-schemapath$=".position"]>span.je-object__controls,
#form-editor div[data-schemapath$=".size"]>span.je-object__controls,
#form-editor div[data-schemapath$=".position"]>p:first-of-type,
#form-editor div[data-schemapath$=".size"]>p:first-of-type {
  display: none;
}

/* Special customization of the header for the widget section. */

#form-editor div[data-schemapath$=".widget"]>select.je-switcher {
  background-color: var(--white);
  font-size: initial;
  font-style: normal;
  padding: 0px 0px 0px 3px;
  text-transform: capitalize;
  transform: translateY(0px);
}

#form-editor div[data-schemapath$=".widget"]>span.btn-group {
  margin: 3px 0px 0px 0px;
}

/* Make headers below style (incl.) etc. and widget (excl.) level less prominent. */

#form-editor div[data-schemapath$=".figma"]:not([data-schemapath="root.figma"]) h3,
#form-editor div[data-schemapath$=".fontMappings"] h3,
#form-editor div[data-schemapath$=".intents"] h3,
#form-editor div[data-schemapath$=".style"] h3,
#form-editor div[data-schemapath*=".widget."] h3 {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: .5rem;
}

#form-editor div[data-schemapath$=".figma"]:not([data-schemapath="root.figma"]) h3 button.json-editor-btn-collapse,
#form-editor div[data-schemapath$=".fontMappings"] h3 button.json-editor-btn-collapse,
#form-editor div[data-schemapath$=".intents"] h3 button.json-editor-btn-collapse,
#form-editor div[data-schemapath$=".style"] h3 button.json-editor-btn-collapse,
#form-editor div[data-schemapath*=".widget."] h3 button.json-editor-btn-collapse {
  height: 16px;
  line-height: 1;
  padding: 0px;
  width: 16px;
}

#form-editor div[data-schemapath$=".figma"]:not([data-schemapath="root.figma"]) span.btn-group,
#form-editor div[data-schemapath$=".fontMappings"] span.btn-group,
#form-editor div[data-schemapath$=".intents"] span.btn-group,
#form-editor div[data-schemapath$=".style"] span.btn-group,
#form-editor div[data-schemapath*=".widget."] span.btn-group {
  margin: -4px 0px 0px 0px;
}

#form-editor div[data-schemapath$=".figma"]:not([data-schemapath="root.figma"]) h3~p,
#form-editor div[data-schemapath$=".fontMappings"] h3~p,
#form-editor div[data-schemapath$=".intents"] h3~p,
#form-editor div[data-schemapath$=".style"] h3~p,
#form-editor div[data-schemapath*=".widget."] h3~p {
  font-size: 13px;
  margin-bottom: .5rem;
}