/* Webfont stuff. */

.mdi::before { font-family: MaterialDesignIcons; }
.mdi.alert::before { content:"\F0026" }
.mdi.chevron-right::before { content:"\F0142" }
.mdi.crosshairs-gps::before { content:"\F01A4" }
.mdi.debug-step-over::before { content:"\F01B7" }
.mdi.link-variant::before { content:"\F0339" }
.mdi.cog::before { content:"\F0493" }
.mdi.table-column-plus-after::before { content:"\F04EC" }
.mdi.table-column-remove::before { content:"\F04EE" }
.mdi.format-horizontal-align-left::before { content:"\F061F" }
.mdi.format-horizontal-align-right::before { content:"\F0620" }
.mdi.help-circle-outline::before { content:"\F0625" }
.mdi.arrow-expand-vertical::before { content:"\F084F" }

/* Keep consistent with source-viewer.css */
html {
  --shell-bg-color: white;
  --shell-fg-color: black;
  --focus-color-light: rgb(235,250,235);
  --focus-color: rgb(199,246,199);
  --focus-color-dark: rgb(153,200,153);
  background-color: bisque;
  color: black;
  height: 100%;
}
html.dragging * {
  cursor: inherit;
}

:root {
  --sans-serif-fonts: 'Open Sans', sans-serif;
  --monospace-fonts: Inconsolata, monospace;
  --default-fonts: var(--sans-serif-fonts);
}

body.app {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--default-fonts);
  font-size: 14px;
}

html > body.app {
  overflow: hidden;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1000;
}

#toolbar {
  background: black;
  color: white;
  display: flex;
  align-items: baseline;
  padding: 1em;
}
#toolbar > *:not(:first-child):not(.empty) {
  margin-left: 1em;
}

#title {
  max-width: 30%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  unicode-bidi: isolate;

}
#title.empty {
  width: 0;
}
#title > a {
  color: white;
  font-size: 18px;
}

/* Search box */

#search {
  flex: 1;
  position: relative;
}
#searchInput {
  box-sizing: border-box;
  width: 100%;
}
#searchDropdown {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 50;
  background: white;
  color: black;
  overflow: hidden;
}
#searchDropdown:empty {
  visibility: hidden;
  height: 0;
}

#searchDropdown > * {
  position: relative;
  border: 0;
  padding: 0 10px;
  background: none;
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  /* Reset properties that button sets */
  font-family: var(--default-fonts);
  font-size: 14px;
  text-shadow: initial;
  text-align: initial;
}
#searchDropdown > button > * {
  /* Pass all pointer events through to the button */
  pointer-events: none;
}
#searchDropdown > :hover, #searchDropdown:not(:hover) > .defaultHighlight {
  background: rgb(200,200,200);
}
#searchDropdown.more::after {
  display: block;
  font-size: 30px;
  text-align: center;
  font-weight: bold;
  content: "\B7\B7\B7";
}

.searchboxResultCell {
  margin-inline-start: 10px;
  height: 70px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.previewCell {
  width: 140px;
  height: 70px;
  outline: 1px solid black;
  overflow: hidden;
  position: relative;
}

.previewCell > .view {
  position: absolute;
  left: 0;
  top: 0;
  width: 400px;
  height: 140px;
  transform-origin: 0 0;
  transform: scale(0.5);
  margin: 0;
  border: none;
  padding: 0;
  float: none;
}

.previewCell > .view > .contents {
  overflow: hidden;
}

.previewCell > .view > .viewTitle {
  display: none;
}

/* Right toolbar */

#mainContainer {
  display: flex;
  flex-direction: row;
  height: 100%;
  flex: 1;
  min-height: 0;
}

#rightToolbar {
  display: flex;
  flex-direction: column;
  flex: 0;
  padding: 2px;
  color: white;
}
#rightToolbar > button {
  appearance: none;
  padding: 2px 4px;
  margin: 1px 0;
  font-size: 25px;
  background: black;
  color: white;
}
#rightToolbar > button:hover {
  background: white;
  color: black;
}

/* Main part of the window */

#main {
  position: relative;
  flex: 1;
  margin: 3px;
}

/* Toolbox */

#toolbox {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  max-height: 100%;
  max-width: 100%;
  writing-mode: vertical-lr;
  overflow-x: auto;
  background: black;
  opacity: 0.8;
}
#toolbox.hidden {
  height: 0;
}

#toolbox > button {
  writing-mode: horizontal-tb;
  position: relative;
  border: 0;
  padding: 0 10px;
  background: none;
  color: white;
  width: 400px;
  height: 80px;
  display: inline-flex;
  align-items: center;
  /* Reset properties that button sets */
  font-family: var(--default-fonts);
  font-size: 14px;
  text-shadow: initial;
  text-align: initial;
}
#toolbox > button > * {
  /* Pass all pointer events through to the button */
  pointer-events: none;
}
#toolbox > button:hover {
  background: rgb(50,50,50);
}

.toolboxNameCell {
  width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-inline-start: 10px;
}

.toolboxNameCell::first-letter {
  text-transform: capitalize;
}

/* Reconnection notification */

.reconnect {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
  text-align: center;
}
.reconnect > span {
  background: lightyellow;
  border: 2px solid black;
  padding: 4px;
  pointer-events: auto;
}
body.reconnecting #reconnect, body.noReconnect #noReconnect {
  display: block;
}
.reconnect > span > button {
  font-weight: bold;
  text-decoration: underline;
  border: none;
  background: none;
}

.reconnect > span, #searchDropdown, #contextMenu, #contextMenu .subMenuContent {
  border: 1px solid black;
  box-shadow: 4px 4px 3px rgba(0, 0, 0, 0.25);
}

/* Starting notifications */

#starting {
  display: none;
  position: fixed;
  left: 40%;
  width: 20%;
  top: 40%;
  background: white;
  border: 2px solid black;
  padding: 1em;
  text-align: center;
}
#startingProgress {
  display: block;
  margin: 1em auto;
  max-width: 100%;
}

/* Dialog boxes */
.dialog {
  display: flex;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
}
.dialog:not(.open) {
  display: none;
}
.dialog > div {
  background: white;
  border: 2px solid black;
  padding: 2em;
}
#shareLinkDialog > div > a {
  display: block;
  margin: 2em;
}

/* Views */

.view {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid black;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition-property: left, top, width, height;
  transition-duration: 0.05s;
}
.dragging:root .view {
  transition-property: none;
}
.view.dragging {
  opacity: 0.7;
  z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
  .view {
    transition: none;
  }
}
.view:focus-within, .view[fakeFocusWithin] {
  outline: 2px solid black;
}

.viewResizer {
  position: absolute;
}
.viewResizer.horizontal {
  cursor: ew-resize;
}
.viewResizer.vertical {
  cursor: ns-resize;
}

.viewTitle {
  /* Not sure why this is needed since its initial value is 'auto',
     but Chrome 68 seems to need it :-( */
  flex-basis: auto;
  background: lightgray;
  font-style: italic;
  display: flex;
  justify-content: space-between;
  cursor: move;
}
.viewTitle > *:first-child {
  text-overflow: ellipsis;
  flex: 1;
  overflow: hidden;
  padding: 1px;
}
.viewTitle > *:first-child::first-letter {
  text-transform: capitalize;
}
.view.source > .viewTitle > *:first-child::first-letter { text-transform: none }

.viewTitleButton {
  /* Reset properties that button sets */
  font-family: var(--default-fonts);
  font-size: 14px;
  text-shadow: initial;
  text-align: initial;
  border: none;
  padding: 0 2px;
  margin: 0;
  color: black;
  background: none;
}
.viewTitleButton:hover {
  background: rgb(97, 120, 219);
}
.viewCloseButton::before {
  content: "✕";
}
.unjoinButton::before {
  content: "⧉";
}

.showInvalidConditions {
  margin: 0 1em;
}
.showInvalidConditions::before {
  content: "Show invalid conditions";
}

.view.loading::before {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  height: 50px;
  width: 50px;
  font-size: 10px;
  left: calc(50% - 25px);
  top: calc(50% - 25px);
  border-radius: 50%;
  border-top: 1em solid rgba(64,64,64,0.2);
  border-right: 1em solid rgba(64,64,64,0.2);
  border-bottom: 1em solid rgba(64,64,64,0.2);
  border-left: 1em solid rgba(255,255,255,0.6);
  animation: contents-loading 1s infinite linear, contents-loading-opacity 0.1s 0.5s forwards linear;
  opacity: 0;
  content: "";
  pointer-events: none;
}
/* Shows the loading spinner after 0.5s */
@keyframes contents-loading-opacity {
  100% {
    opacity: 1;
  }
}
@keyframes contents-loading {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.queryParam {
  margin: 0 5px;
  padding: 2px;
}
.queryParam > [contenteditable="true"] {
  background: white;
  cursor: text;
  padding: 0 4px;
}
.queryParam > [contenteditable="true"]:not(:empty) {
  font-style: normal;
}
.queryParam > [contenteditable="true"]:empty::after {
  content: attr(placeholderText);
}

[contenteditable="true"].single-line {
    white-space: nowrap;
    overflow: hidden;
}
[contenteditable="true"].single-line br {
    display: none;
}
[contenteditable="true"].single-line * {
    display: inline;
    white-space: nowrap;
}

.contents {
  flex-basis: 0;
  flex-grow: 1;
  position: relative;
  z-index: 0;
  overflow: auto;
  background: white;
  color: black;
}
.list.view > .contents {
  /* Make room to display the whole caret at the start of a line */
  padding-left: 3px;
}

.listView-item + .listView-item > .hideIfNotFirstItem {
  display: none;
}

.listView-item:not(:hover) > .hideInvalidConditions {
  display: none;
}
.hideInvalidConditions {
  margin: -1em 1em;
}
.hideInvalidConditions::before {
  content: "Hide invalid conditions";
}

.contents iframe {
  display: block;
  border: none;
  position: relative;
  width: 100%;
  height: 100%;
}

.dragging:root iframe {
  pointer-events: none;
}

.unloaded {
  background: #eeeeee;
}

.unloadedHidden {
  display: none;
}

.moreAtStart, .moreAtEnd {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.noResults {
  display: block;
  font-style: italic;
  color: red;
}

.userHighlight {
  /* important so it overrides alternative background colors in list views
     (but before .focus so it wins if both are present) */
  background: var(--user-highlight-color) ! important;
}
.focus {
  /* important so it overrides alternative background colors in list views */
  background: var(--focus-color) ! important;
}

.focusCaret:not(.inline)::before, .focusCaret.inline {
  animation: 1s blink;
  animation-iteration-count: infinite;
  animation-timing-function: steps(1,end);
  animation-direction: alternate;
}
.userHighlightCaret:not(.inline)::before, .userHighlightCaret.inline {
  outline-color: var(--user-highlight-color);
}
.focusCaret:not(.inline), .userHighlightCaret:not(.inline) {
  height: 0;
}
.focusCaret:not(.inline) + .userHighlightCaret:not(.inline), .userHighlightCaret:not(.inline) + .focusCaret:not(.inline) {
  min-height: 2px;
  padding-top: 2px;
}
.focusCaret:not(.inline)::before, .userHighlightCaret:not(.inline)::before {
  content: '';
  display: block;
  outline-style: solid;
  outline-width: 2px;
}
.focusCaret:not(.inline):first-child::before, .userHighlightCaret:not(.inline):first-child::before {
  margin-top: 3px;
}
.focusCaret:not(.inline):last-child::after, .userHighlightCaret:not(.inline):last-child::after {
  /* Create some scrollable space below a horizontal bottom caret so it's more visible */
  content: '';
  display: block;
  height: 5px;
}
.focusCaret.inline, .userHighlightCaret.inline {
  display: inline-block;
  outline-style: solid;
  outline-width: 3px;
}
.focusCaret.inline::after, .userHighlightCaret.inline::after {
  /* Totally empty spans don't lay out well */
  content: "\200B";
}
.focusCaret.demo:not(.inline), .userHighlightCaret.demo:not(.inline) {
  display: inline-block;
  width: 100px;
}


.clickHandler:hover {
  background: rgb(200,200,200);
}

@keyframes blink {
  0% {
    outline-color: var(--focus-color);
  }
  50% {
    outline-color: var(--focus-color-dark);
  }
}

body.app summary { white-space: nowrap }
body.app details > :not(summary) { margin-left: 1em; }
body.app details > :not(summary):not(details) { margin-left: 2em; }

.noscroll {
  overflow: hidden;
}

/* Per-view-type stuff */

.join > .contents > div:nth-last-of-type(2n),
.stack > .contents > .pml_block:nth-last-of-type(2n),
.locals > .contents > .pml_block:nth-last-of-type(2n),
.callees > .contents > .pml_block:nth-last-of-type(2n),
.explainer > .contents > .pml_block:nth-last-of-type(2n),
.file-search > .contents > .pml_block:nth-last-of-type(2n),
.execution > .contents > .pml_block:nth-last-of-type(2n),
.breakpoint > .contents > .pml_block:nth-last-of-type(2n) {
  background: rgb(240,240,240);
}

.stdouterr > .contents, .subquery-stdouterr {
  font-family: var(--monospace-fonts);
  /* Ensure that the focusCaret doesn't create line break opportunities */
  white-space: pre-wrap;
  word-break: break-all;
}

.stdouterr > .contents .pml_str, .subquery-stdouterr .pml_str {
  white-space: pre-wrap;
}

.stdouterr > .contents .terminalEscapeSequence {
  display: none;
}

.screenshots > .contents > * {
  vertical-align: top;
}
.screenshots > .contents > .focusCaret.inline {
  height: 150px;
}

/* gdb shell stuff */

.shell {
  background-color: var(--shell-bg-color);
  color: var(--shell-fg-color);
  font-family: var(--monospace-fonts);
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-size: 14px;
  margin: 0;
}
.shell.connecting {
  background-color: gray;
}
.shell:not(:focus):not([fakeFocus]) .input > .cursor {
  outline: 1px solid var(--shell-fg-color);
}
.shell:focus .input > .cursor, .shell[fakeFocus] .input > .cursor {
  animation: shell-blink 1s steps(1) infinite;
}
.shell .running > .prompt {
  display: none;
}
.shell .prompt {
  color: blue;
}
.shell .input {
  font-weight: bold;
}
.shell .userOutput {
  color: green;
}
.shell > *:last-child {
  margin-bottom: 1px;
}
.shell > .seek {
  text-align: center;
  font-style: italic;
  color: blue;
  font-family: sans-serif;
}
.shell > .fail {
  text-align: center;
  font-style: italic;
  color: red;
  font-family: sans-serif;
}

@keyframes shell-blink {
  from {
    color: var(--shell-bg-color);
    background-color: var(--shell-fg-color);
  }
  50% {
    background-color: var(--shell-bg-color);
     color: var(--shell-fg-color);
  }
  to {
    color: var(--shell-bg-color);
    background-color: var(--shell-fg-color);
  }
}

/* Misc UI effects */

.spinner {
  border-radius: 50%;
  border: 12px solid var(--spinner-color-light);
  border-left: 12px solid var(--spinner-color);
  animation: spinner 1.1s infinite linear;
}
@keyframes spinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.noUserSelect {
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
}

.mergable {
  position: absolute;
  top: 1em;
  left: 0;
  bottom: 0;
  right: 0;
  display: none;
}

.mergable div {
  position: absolute;
  top: 15%;
  left: 15%;
  bottom: 15%;
  right: 15%;
  background: rgba(200, 200, 200, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 150%;
  text-shadow: 0 0 4px white;
}

.activeDrag-merge :not(.dragging) > .mergable {
  display: block;
}

.subqueryJoin {
  font-style: normal;
}

/* Stuff for demos and recorded sessions */

.fakeTerminal {
  position: absolute;
  box-sizing: border-box;
  left: -10px;
  top: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  background: black;
  white-space: pre;
  font-family: var(--monospace-fonts);
  padding: 20px;
}

.fakeTerminal > .fakeTerminalCursor {
  animation: fake-terminal-blink 1s steps(1) infinite;
}
@keyframes fake-terminal-blink {
  0%, 100% {
    background: black;
  }
  50% {
    background: white;
  }
}
.fakeTerminal > .fakeTerminalCursor::before {
  content: ' ';
}
.fakeTerminalShell {
  color: gray;
}
.fakeTerminal > .fakeTerminalInput {
  color: white;
}
.fakeTerminal > .prog-output {
  color: lightgray;
}
.fakeTerminal > .rr-output {
  color: cyan;
}
.fakeTerminal > .submit-output {
  color: lightgreen;
}

.fakeNotification {
  position: absolute;
  box-sizing: border-box;
  left: -10px;
  top: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  background: white;
  font-size: 20px;
  font-family: sans-serif;
  padding: 40px;
}
.fakeNotification > div:nth-child(1) {
  font-size: 150%;
  margin-bottom: 1em;
}
.fakeNotification > div:nth-child(2) {
  font-weight: bold;
}
.fakeNotification > div:nth-child(3) {
  color: gray;
  margin-bottom: 2em;
}
.fakeNotification > div:nth-child(4) {
  margin-bottom: 1em;
}
.fakeNotification > div:nth-child(5) {
  pointer-events: none;
}
.modal {
  flex-grow: 10000;
  position: relative;
  overflow: auto;
  display: flex;
}
.modalContent {
  margin: auto;
}

#contextMenu {
  position: fixed;
  z-index: 10000;
  display: none;
  white-space: nowrap;
}

#contextMenu.visible {
  display: block;
}

#contextMenu .item, #contextMenu .subMenu {
  display: block;
  padding: 6px 8px;
}

#contextMenu .subMenu {
  position: relative;
  display: none;
}

#contextMenu.changeNumberFormat #changeNumberFormat.subMenu,
#contextMenu.changeLaneWidth #changeLaneWidth.subMenu {
  display: block;
}

#contextMenu .subMenu .subMenuContent {
  display: none;
  position: absolute;
  left: 100%;
  top: 0px;
}

#contextMenu .subMenu:hover .subMenuContent {
  display: block;
}

#contextMenu, #contextMenu .subMenuContent {
  background: white;
}
