/*
SPDX-FileCopyrightText: German Aerospace Center (DLR) <cosmoscout@dlr.de>
SPDX-License-Identifier: MIT
*/

/* Layout */

:root {
  --statusbar-size: 30px;
  --console-width: 30vw;
  --console-height: 300px;
}

#statusbar {
  grid-area: statusbar;
  display: flex;
  z-index: 2;
  width: 100%;
  height: var(--statusbar-size);
  line-height: var(--statusbar-size);
}

#statusbar i {
  line-height: var(--statusbar-size);
  font-size: calc(var(--statusbar-size) * 0.6);
}

#statusbar .button {
  text-align: center;
}

#statusbar>div {
  white-space: nowrap;
}

#statusbar>div:first-of-type,
#statusbar>div:last-of-type {
  margin-right: auto;
}

#statusbar>div>div {
  display: inline-block;
  vertical-align: top;
}

#console-output-wrapper {
  position: absolute;
  bottom: 0;
  z-index: 0;
  height: var(--console-height);
  width: var(--console-width);
}

#console-output-area {
  padding-bottom: var(--statusbar-size);
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column-reverse;
  overflow-y: auto;
  overflow-x: hidden;
}

#console-output-wrapper::after {
  content: '';
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  z-index: -1;
}

#console-output-area .message {
  flex-shrink: 0;
  white-space: pre-wrap;
}

#console-suggestion-area {
  position: absolute;
  bottom: var(--statusbar-size);
  width: var(--console-width);
  max-height: var(--console-height);
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  z-index: 100;
}

#console-suggestion-area .suggestion {
  padding: 3px 6px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 200px;
}

#console-input-area {
  height: var(--statusbar-size);
  flex-basis: initial !important;
}

#console-input-area input {
  transition: width 0.3s ease;
  width: 120px;
}

#console-input-area input:focus {
  width: calc(var(--console-width) - 2*var(--statusbar-size));
}

#console-toggle-button {
  display: inline-block;
}


/* Transitioning */

#console-output-wrapper::after {
  transition: opacity 1s linear;
  opacity: 0;
}

#console-output-wrapper:hover::after,
#console-output-wrapper.console-has-input-focus::after {
  opacity: 1;
}

#console-output-area .message {
  opacity: 1;
  transition: opacity 1s linear, max-height 1s linear;
  transition-delay: 3s, 0s;
  max-height: 0;
  overflow-y: hidden;
}

#console-output-area .message.initial-transition {
  opacity: 0;
  max-height: 500px;
}

#console-output-wrapper:hover .message,
#console-output-wrapper.console-has-input-focus .message {
  opacity: 1;
  transition-delay: 0s, 0s;
}

#console-suggestion-area {
  transition: opacity 0.1s linear;
  opacity: 0;
  pointer-events: none;
}

#console-suggestion-area.show {
  opacity: 1;
  pointer-events: initial;
}



/* Styling */
#statusbar,
#console-output-area,
#console-suggestion-area,
#console-input-area input {
  text-shadow: 1px 1px 1px #000, 0px 0px 1px #000, 1px 1px 5px rgba(0, 0, 0, 0.75);
  color: #ddf;
  font-size: 11pt;
}

#console-output-area,
#console-suggestion-area,
#console-input-area input {
  font-family: 'Ubuntu Mono', Courier, monospace;
}

#console-output-area {
  font-size: 10pt;
}

#console-suggestion-area::-webkit-scrollbar,
#console-output-area::-webkit-scrollbar {
  display: none;
}

#console-output-wrapper {
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0) 0px, rgba(0, 0, 0, 1) 50px),
    linear-gradient(180deg, rgba(0, 0, 0, 0) calc(100% - var(--statusbar-size)), rgba(0, 0, 0, 1) 100%, rgba(0, 0, 0, 1) 100%);
  -webkit-mask-composite: xor;
}

#console-output-wrapper::after {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
}

#console-output-area .message {
  text-indent: -24px;
  padding-left: 24px;
  line-height: 14px;
  word-wrap: break-word;
}

#console-output-area .message.level-T {
  color: rgb(174, 128, 197);
}

#console-output-area .message.level-D {
  color: rgb(148, 196, 255);
}

#console-output-area .message.level-I {
  color: #ddf;
}

#console-output-area .message.level-W {
  color: rgb(255, 200, 100);
}

#console-output-area .message.level-E {
  color: rgb(255, 126, 126);
}

#console-output-area .message.level-C {
  color: rgb(255, 40, 40);
}

#console-suggestion-area {
  background: rgba(0, 0, 0, 1);
  box-shadow: black 0 0 30px;
  font-size: 9pt;
}

#console-suggestion-area .suggestion {
  color: rgb(255, 255, 255);
  opacity: 0.8;
}

#console-suggestion-area .suggestion.private {
  opacity: 0.5;
}

#console-suggestion-area .suggestion::before {
  font-family: 'Material Icons';
  vertical-align: middle;
  margin-right: -5px;
}

#console-suggestion-area .suggestion.type-string::before {
  content: "format_size";
}

#console-suggestion-area .suggestion.type-string {
  color: rgb(214, 194, 168);
}

#console-suggestion-area .suggestion.type-function::before {
  content: "code";
}

#console-suggestion-area .suggestion.type-function {
  color: rgb(175, 196, 216);
}

#console-suggestion-area .suggestion.type-object::before {
  content: "extension";
}

#console-suggestion-area .suggestion.type-object {
  color: rgb(216, 177, 216);
}

#console-suggestion-area .suggestion.type-boolean::before {
  content: "done";
}

#console-suggestion-area .suggestion.type-boolean {
  color: rgb(214, 172, 172);
}

#console-suggestion-area .suggestion.type-number::before {
  content: "filter_1";
}

#console-suggestion-area .suggestion.type-number {
  color: rgb(170, 218, 174);
}

#console-suggestion-area .suggestion:hover {
  opacity: 1;
  cursor: pointer;
}

#console-suggestion-area .suggestion:active {
  position: relative;
  top: 1px;
}

#console-input-area input {
  height: 22px;
  padding: 0 0 0 3px;
  border: none;
  background: none;
  outline: none;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

#console-input-area input::placeholder {
  opacity: 0.5;
  color: #ddf;
}