:root {
  --selection-color: var(--color-text-light);
  --filter-color: var(--color-accent7);
}

#react_qb_viz {
  flex-grow: 1;
}

/* @layout */
.QueryBuilder {
  transition: margin-right 0.35s;
}

.QueryBuilder--showSideDrawer {
  margin-right: 300px;
}

.QueryHeader-details {
  display: flex;
  align-items: center;
}

.QueryHeader-section {
  padding-right: 1em;
  margin-right: 1em;
  border-right: 1px solid color(var(--filter-color) alpha(-80%));
}

.QueryHeader-section:last-child {
  border-right: none;
}

/*
.Icon-download,
.Icon-addToDash {
    fill: var(--color-text-medium);
    transition: fill .3s linear;
}

.Icon-download:hover,
.Icon-addToDash:hover {
    fill: var(--color-brand);
    transition: fill .3s linear;
}
*/

/* a section of the graphical query itself */
.Query-section {
  display: flex;
  align-items: center;
}

.Query-section.Query-section--right {
  justify-content: flex-end;
}

.QueryName {
  font-weight: 200;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 1.2rem;
}

.Query-label {
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-medium);
}

.Query-filters {
  max-width: 400px;
}

.Query-filterList {
  display: flex;
  overflow-y: hidden;
  white-space: nowrap;
  min-height: 55px;
}

.Query-filter {
  display: flex;
  flex-shrink: 0;
  font-size: 0.75em;
  border: 2px solid transparent;
  border-radius: var(--default-border-radius);
}

.Query-filter.selected {
  border-color: var(--filter-color);
}

.Filter-section {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.Query-filter .input {
  border-radius: 0;
  border: none;
  font-size: inherit;
  background-color: transparent;
  width: 150px;
  padding: 0;
}

.TooltipFilterList .Query-filter {
  padding-left: 0 !important;
  padding-bottom: 0 !important;
}

.TooltipFilterList .Query-filterList {
  flex-direction: column;
}

.TooltipFilterList .Query-section {
  margin-left: -0.5rem;
}

/*
    @selectionmodule
*/
.SelectionModule {
  color: var(--color-brand);
}

.SelectionList {
  padding-top: 5px;
  overflow-y: auto;
  max-height: 340px;
}

.SelectionItems {
  max-width: 320px;
}

.SelectionItems.SelectionItems--open {
  opacity: 1;
  transition: opacity 0.3s linear;
  pointer-events: all;
}

.SelectionItems.SelectionItems--expanded {
  max-height: inherit;
}

.SelectionItem {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.75rem 1.5rem 0.75rem 0.75rem;
  background-color: var(--color-bg-white);
}

.SelectionItem:hover {
  background-color: currentColor;
}

.SelectionItem .Icon {
  margin-left: 0.5rem;
  margin-right: 0.75rem;
  color: currentcolor;
}

.SelectionItem .Icon-check {
  opacity: 0;
}

.SelectionItem .Icon-chevrondown {
  opacity: 1;
}

.SelectionItem:hover .Icon {
  color: var(--color-text-white) !important;
}

.SelectionItem:hover .SelectionModule-display {
  color: var(--color-text-white);
}

.SelectionItem:hover .SelectionModule-description {
  color: var(--color-text-white);
}

.SelectionItem.SelectionItem--selected .Icon-check {
  opacity: 1;
}

.SelectionModule-display {
  color: currentColor;
  margin-bottom: 0.25em;
}

.SelectionModule-description {
  color: var(--color-text-medium);
  font-size: 0.8rem;
}

.Visualization {
  transition: background 0.3s linear;
}

.Visualization.Visualization--loading {
  transition: background 0.3s linear;
}

.Visualization.Visualization--error {
  justify-content: center;
}

.Visualization--scalar {
  justify-content: center;
  font-size: 8rem;
  font-weight: 200;
}

.Loading {
  background-color: color(var(--color-bg-white) alpha(-28%));
  transition: opacity 0.5s;
}
.Loading.Loading--hidden {
  background-color: transparent;
}
.Dirty {
  background-color: color(var(--color-bg-white) alpha(-28%));
  transition: opacity 0.5s;
}
.Dirty.Loading--hidden {
  background-color: transparent;
}

/* query errors */
.QueryError {
  flex-direction: column;
  justify-content: center;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.QueryError-iconWrapper {
  padding: 2em;
  margin-bottom: 2em;
  border: 4px solid var(--color-accent3);
  border-radius: 99px;
}

.QueryError-image {
  background-repeat: no-repeat;
  margin-bottom: 1rem;
}

.QueryError-image--noRows {
  width: 120px;
  height: 120px;
  background-image: url("~assets/img/no_results.svg");
}

.QueryError-image--queryError {
  width: 120px;
  height: 120px;
  background-image: url("~assets/img/no_understand.svg");
}

.QueryError-image--serverError {
  width: 120px;
  height: 148px;
  background-image: url("~assets/img/blown_up.svg");
}

.QueryError-image--timeout {
  width: 120px;
  height: 120px;
  background-image: url("~assets/img/stopwatch.svg");
}

.QueryError-message {
  /* IE flexbox align-items:center bug workaround */
  /* https://github.com/philipwalton/flexbugs#2-column-flex-items-set-to-align-itemscenter-overflow-their-container */
  max-width: 100%;
}

.QueryError-messageText {
  line-height: 1.4;
}

.QueryError-adminEmail {
  position: relative;
  display: inline-block;
  border-radius: var(--default-border-radius);
  border: 1px solid var(--color-border);
  margin-top: var(--margin-2);
  padding: var(--padding-1) var(--padding-4) var(--padding-1) var(--padding-4);
}

.QueryError-adminEmail:before {
  content: "Admin Email";
  font-size: 10px;
  text-align: center;
  text-transform: uppercase;
  background-color: white;
  padding-left: var(--padding-1);
  padding-right: var(--padding-1);

  position: absolute;
  top: -0.75em;
  left: 50%;
  margin-left: -41px; /* ugh */
}

.QueryError2 {
  padding-top: 4rem;
  margin-left: auto;
  margin-right: auto;
}

.QueryError2-details {
  max-width: 500px;
}

.QueryError2-detailBody {
  background-color: var(--color-bg-light);
  max-height: 15rem;
  overflow: auto;
}

/* GUI BUILDER */

.GuiBuilder {
  position: relative;
  display: flex;
  flex-direction: column;
  font-size: 0.9em;
  z-index: 2;
  background-color: var(--color-bg-white);

  border: 1px solid var(--color-border);
}

/* for medium breakpoint only expand if data reference is not shown */
@media screen and (--breakpoint-min-md) {
  .GuiBuilder {
    font-size: 1em;
  }
}

/* un-expanded (default) */
.GuiBuilder-row {
  border-bottom: 1px solid var(--color-border);
}
.GuiBuilder-row:last-child {
  border-bottom-color: transparent;
}
.GuiBuilder-data {
  border-right: 1px solid var(--color-border);
}
.GuiBuilder-filtered-by {
  border-right: 1px solid transparent;
}
.GuiBuilder-view {
  border-right: 1px solid var(--color-border);
}
.GuiBuilder-sort-limit {
  border-left: 1px solid var(--color-border);
}

/* expanded */
.GuiBuilder.GuiBuilder--expand {
  flex-direction: row;
}
.GuiBuilder.GuiBuilder--expand .GuiBuilder-row:last-child {
  border-right-color: transparent;
  border-bottom-color: var(--color-border);
}
.GuiBuilder.GuiBuilder--expand .GuiBuilder-filtered-by {
  border-right-color: var(--color-border);
}

.GuiBuilder-section {
  position: relative;
  min-height: 55px;
  min-width: 100px;
}

.GuiBuilder-section-label {
  background-color: white;
  position: absolute;
  top: -7px;
  left: 10px;
  padding-left: 10px;
  padding-right: 10px;
}

.QueryOption {
  font-weight: 700;
}

.QueryOption:hover {
  cursor: pointer;
}

/* @transitions */

.AddToDashSuccess {
  max-width: 260px;
  text-align: center;
}

/* DATA SECTION */

.GuiBuilder-data {
  z-index: 1; /* moved the arrow thingy above the filter outline */
}

/* FILTER BY SECTION */

.Filter-section-field,
.Filter-section-operator {
  color: var(--filter-color);
}

.Filter-section-field .QueryOption {
  color: var(--filter-color);
}
.Filter-section-operator .QueryOption {
  color: var(--filter-color);
}
.Filter-section-value .QueryOption {
  color: white;
  background-color: var(--filter-color);
  border: 1px solid var(--filter-color);
  border-radius: 6px;
  padding: 0.5em;
  padding-top: 0.3em;
  padding-bottom: 0.3em;
  margin-bottom: 0.2em;
}

.Filter-section-value {
  padding-right: 0.5em;
  padding-bottom: 0.25em;
}

.Filter-section-sort-field.selected .QueryOption,
.Filter-section-sort-direction.selected .QueryOption {
  color: inherit;
}

.FilterPopover .ColumnarSelector-row--selected,
.FilterPopover .PopoverHeader-item.selected {
  color: var(--filter-color) !important;
}
.FilterPopover .ColumnarSelector-row:hover {
  background-color: var(--filter-color) !important;
}

/* VIEW SECTION */

.View-section-aggregation,
.View-section-aggregation-target,
.View-section-breakout {
  color: var(--color-accent1);
}

.View-section-aggregation.selected .QueryOption,
.View-section-aggregation-target.selected .QueryOption,
.View-section-breakout.selected .QueryOption {
  color: var(--color-accent1);
}

/* SORT/LIMIT SECTION */

.GuiBuilder-sort-limit {
  min-width: 0px;
}

.EllipsisButton {
  font-size: 3em;
  position: relative;
  top: -0.8rem;
}

/* NATIVE */

.NativeQueryEditor .GuiBuilder-data {
  border-right: none;
}

.NativeQueryEditorDragHandleWrapper {
  position: absolute;
  height: 8px;
  width: 100%;
  bottom: -4px;
  cursor: row-resize;
  display: flex;
  justify-content: center;
  align-items: center;
}

.NativeQueryEditorDragHandle {
  background: color(var(--color-border) blackness(+ 3%));
  width: 100px;
  height: 5px;
  border-radius: 4px;
}

/* VISUALIZATION SETTINGS */

.VisualizationSettings .GuiBuilder-section {
  border-right: none !important;
}

.ChartType-button {
  width: 38px;
  height: 38px;
  border-radius: 38px;
  background-color: white;
  border: 1px solid var(--color-border);
}

.ChartType-popover {
  min-width: 15em !important;
}

.ChartType--selected {
  color: white;
  background-color: var(--color-brand);
}

.ChartType--notSensible {
  opacity: 0.5;
}

.ColorWell {
  width: 18px;
  height: 18px;
  margin: 3px;
  margin-right: 0.3rem;
}

.RunButton {
  opacity: 1;
  transition: transform 0.25s, opacity 0.25s;
}

.RunButton.RunButton--hidden {
  transform: translateY(-20px);
  opacity: 0;
}

/* DATA REFERENCE */

.SideDrawer {
  z-index: -1;
  position: absolute;
  top: 0;
  right: -300;
  width: 300px;
  height: 100%;
  background-color: var(--color-bg-light);
  border-left: 1px solid var(--color-border);
  overflow: hidden;
  opacity: 0;
}

.SideDrawer--show {
  z-index: 0;
  right: 0;
  opacity: 1;
  transition: all 0.5s;
}

.DataReference h1 {
  font-size: 20pt;
}

.DataReference-paneCount {
  padding-right: 0.6em;
}

.ObjectJSON {
  max-height: 200px;
  overflow: scroll;
  padding: 1em;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 2px;
  white-space: pre-wrap;
}

.PopoverBody.AddToDashboard {
  min-width: 25em;
}

.List-item--segment .Icon,
.List-item--segment .List-item-title {
  color: var(--filter-color);
}

.List-item--customfield .Icon,
.List-item--customfield .List-item-title {
  color: var(--color-brand);
}

.FieldList-grouping-trigger {
  display: flex;
  visibility: hidden;
  border-left: 2px solid color(var(--filter-color) alpha(-90%));
  color: color(var(--color-text-white) alpha(-50%));
}

.List-item:not(.List-item--disabled):hover .FieldList-grouping-trigger,
.List-item--selected .FieldList-grouping-trigger {
  visibility: visible;
}

.QuestionTooltipTarget {
  color: var(--color-text-light);
  display: inline-block;
  border: 2px solid currentColor;
  border-radius: 99px;
  width: 20px;
  height: 20px;
  display: flex;

  align-items: center;
  justify-content: center;
  opacity: 0.7;

  cursor: pointer;
}

.QuestionTooltipTarget:after {
  content: "?";
  font-size: 13px;
  font-weight: bold;
}

.FilterRemove-field {
  border-radius: 99px;
  opacity: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--filter-color);
  border: 1px solid var(--filter-color);
  transition: opacity 0.3s ease-out;
}

.FilterInput:hover .FilterRemove-field {
  opacity: 1;
}

/* need to do this ugliness to override the locally scoped font size from Scalar.css */
.QueryBuilder .ScalarValue {
  font-size: 5em;
}

.sql-code {
  font-size: 90%;
  line-height: 1.2em;
  font-family: "Courier 10 Pitch", Courier, monospace;
  white-space: pre;
  white-space: pre-wrap;
  white-space: -moz-pre-wrap;
  white-space: -o-pre-wrap;
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.ParameterValuePickerNoPopover input {
  font-size: 16px;
  color: var(--color-text-dark);
  border: none;
}

.ParameterValuePickerNoPopover--selected input {
  font-weight: bold;
  color: var(--color-brand);
}

.ParameterValuePickerNoPopover input:focus {
  outline: none;
  color: var(--color-text-dark);
}

.ParameterValuePickerNoPopover input::-webkit-input-placeholder {
  color: var(--color-text-medium);
}
