// these styles are only used by angular components/pages
// once angular is disabled, this file can be deleted

@use 'sass:map';
@use 'sass:color';
@use 'sass:list';
@use 'sass:math';

// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.
// Makes the @content apply to the given breakpoint and wider.
@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
  $min: if(map.get($breakpoints, $name) != 0, map.get($breakpoints, $name), null);
  @if $min {
    @media (min-width: $min) {
      @content;
    }
  } @else {
    @content;
  }
}

// Gradients
@mixin gradient-vertical($startColor: #555, $endColor: #333) {
  background-color: color.mix($startColor, $endColor, 60%);
  background-image: linear-gradient(to bottom, $startColor, $endColor); // Standard, IE10
  background-repeat: repeat-x;
}

@mixin font-family-monospace() {
  font-family: $font-family-monospace;
}

@mixin make-col($size, $columns: $grid-columns) {
  position: relative;
  min-height: 1px;
  padding-right: calc($grid-gutter-width / 2);
  padding-left: calc($grid-gutter-width / 2);

  @if $enable-flex {
    flex: 0 0 math.percentage(calc($size / $columns));
    // Add a `max-width` to ensure content within each column does not blow out
    // the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
    // do not appear to require this.
    max-width: math.percentage(calc($size / $columns));
  } @else {
    float: left;
    width: math.percentage(calc($size / $columns));
  }
}

.edit-tab-content {
  flex-grow: 1;
  min-width: 0;
}

.view-mode--inactive {
  .react-resizable-handle,
  .add-row-panel-hint,
  .dash-row-menu-container,
  .panel-info-corner--info,
  .panel-info-corner--links {
    display: none;
  }
}

.login-form {
  margin-bottom: $space-md;
  width: 100%;
}

[ng\:cloak],
[ng-cloak],
.ng-cloak {
  display: none !important;
}

// <3: https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7
@keyframes onAutoFillStart {
  from {
    /**/
  }
  to {
    /**/
  }
}
@keyframes onAutoFillCancel {
  from {
    /**/
  }
  to {
    /**/
  }
}
input:-webkit-autofill {
  animation-name: onAutoFillStart;
  transition: transform 1ms;
}
input:not(:-webkit-autofill) {
  animation-name: onAutoFillCancel;
}

input.validation-error,
input.ng-dirty.ng-invalid {
  box-shadow: inset 0 0px 5px $red;
}

input.invalid {
  box-shadow: inset 0 0px 5px $red;
}

.gf-code-editor {
  min-height: 36px;
  min-width: 280px;
  flex-grow: 1;
  margin-right: $space-xs;

  &.ace_editor {
    @include font-family-monospace();
    font-size: $font-size-md;
    min-height: 50px; // Include space for horizontal scrollbar

    border-radius: $input-border-radius;
    border: $border-width solid $input-border-color;
  }

  .ace_content {
    z-index: 0;
  }
}

.ace_editor.ace_autocomplete {
  @include font-family-monospace();
  font-size: $font-size-md;

  // Ace editor adds <style> tag at the end of <head>, after grafana.css, so !important
  // is used for overriding styles with the same CSS specificity.
  background-color: $dropdownBackground !important;
  color: $dropdownLinkColor !important;
  border: 1px solid $dropdownBorder !important;
  width: 550px !important;

  .ace_scroller {
    .ace_selected,
    .ace_active-line,
    .ace_line-hover {
      color: $dropdownLinkColorHover;
      background-color: $dropdownLinkBackgroundHover !important;
    }

    .ace_line-hover {
      border-color: transparent;
    }

    .ace_completion-highlight {
      color: $yellow;
    }

    .ace_rightAlignedText {
      color: $text-muted;
      z-index: 0;
    }
  }
}

$doc-font-size: $font-size-sm;

.ace_tooltip.ace_doc-tooltip {
  @include font-family-monospace();
  font-size: $doc-font-size;

  background-color: $popover-help-bg;
  color: $popover-help-color;
  background-image: none;
  border: 1px solid $dropdownBorder;
  padding: $space-sm $space-md;

  hr {
    background-color: $popover-help-color;
    margin: $space-sm 0;
  }

  code {
    padding: 0px 1px;
    margin: 0px;
  }
}

.ace_tooltip {
  border-radius: 3px;
}

.ace_hidden-cursors .ace_cursor {
  opacity: 0 !important;
}

.graph-panel {
  display: flex;
  flex-direction: column;
  height: 100%;

  &--legend-right {
    @include media-breakpoint-up(sm) {
      flex-direction: row;

      .graph-legend {
        flex: 0 1 10px;
        max-height: 100%;
        overflow-y: initial;
      }

      .graph-legend-series {
        display: block;
        padding-left: 4px;
      }

      .graph-legend-table .graph-legend-series {
        display: table-row;
      }
    }
  }
}

.graph-panel__chart {
  position: relative;
  cursor: crosshair;
  flex-grow: 1;
  min-height: 65%;
}

.datapoints-warning {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  margin-top: -50px;
  margin-left: -100px;
  width: 200px;
  text-align: center;
  cursor: auto;
  padding: 10px;
}

.graph-legend {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  max-height: 35%;
  margin: 0;
  text-align: center;
  overflow-y: auto;
  padding-top: 6px;
  position: relative;

  .popover-content {
    padding: 0;
  }
}

.graph-legend-alias {
  background: transparent;
  border: none;
}

.graph-legend-content {
  position: relative;
}

.graph-legend-icon {
  position: relative;
  padding-right: 4px;
  top: 1px;
}

.graph-legend-icon,
.graph-legend-alias,
.graph-legend-value {
  display: inline;
  white-space: nowrap;
  font-size: 12px;
  text-align: left;
  &.current::before {
    content: 'Current: ';
  }
  &.max::before {
    content: 'Max: ';
  }
  &.min::before {
    content: 'Min: ';
  }
  &.total::before {
    content: 'Total: ';
  }
  &.avg::before {
    content: 'Avg: ';
  }
}

.graph-legend-icon .fa {
  font-size: 135%;
  position: relative;
  top: 1px;
}

.graph-legend-series {
  float: left;
  white-space: nowrap;
  padding-left: 10px;
  display: flex;
  align-items: center;

  &--right-y {
    float: right;
  }
}

// Don't move series to the right if legend is on the right as well
.graph-panel--legend-right .graph-legend-series--right-y {
  float: left;
}

.graph-legend-value {
  padding-left: 6px;
}

.graph-legend-table {
  padding-right: 5px;
  padding-left: 5px;

  .graph-legend-series {
    display: table-row;
    float: none;
    padding-left: 0;
    &--right-y {
      float: none;

      .graph-legend-alias::after {
        content: '(right-y)';
        padding: 0 5px;
        color: $text-color-weak;
      }
    }
  }

  td,
  .graph-legend-alias,
  .graph-legend-icon,
  .graph-legend-value {
    float: none;
    display: table-cell;
    white-space: nowrap;
    padding: 2px;
    text-align: right;
  }

  .graph-legend-icon {
    cursor: pointer;
  }

  .graph-legend-value {
    padding-left: 15px;
  }

  .graph-legend-alias {
    text-align: left;
    max-width: 650px;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .graph-legend-series:nth-child(even) {
    background: $table-bg-accent;
  }

  .graph-legend-value {
    &.current,
    &.max,
    &.min,
    &.total,
    &.avg {
      &::before {
        content: '';
      }
    }
  }

  th {
    text-align: right;
    padding: 0px 10px 1px 0;
    font-weight: bold;
    color: $blue;
    font-size: 85%;
    white-space: nowrap;
  }
}

.graph-legend-series__table-name {
  display: flex;
  align-items: center;
}

.graph-legend-series-hidden {
  .graph-legend-value,
  .graph-legend-alias {
    color: $link-color-disabled;
  }
}

.graph-legend-popover {
  width: 210px;
  label {
    display: inline-block;
  }
  .btn {
    padding: 1px 3px;
    margin-right: 0px;
    line-height: initial;
  }
}

.annotation-tags {
  color: $purple;
}

.graph-series-override__properties {
  margin-left: $space-md;
}

.graph-tooltip {
  white-space: nowrap;
  font-size: $font-size-sm;
  background-color: $graph-tooltip-bg;
  color: $text-color;

  .graph-tooltip-time {
    text-align: center;
    position: relative;
    top: -3px;
    padding: $space-xxs;
    font-weight: $font-weight-semi-bold;
    color: $text-color;
  }

  .graph-tooltip-list-item {
    display: table-row;

    &--highlight {
      color: $text-color-emphasis;
      font-weight: $font-weight-semi-bold;
    }
  }

  .graph-tooltip-series-name {
    display: table-cell;
    padding: $space-xxs;
    max-width: 650px;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .graph-tooltip-value {
    display: table-cell;
    font-weight: $font-weight-semi-bold;
    padding-left: 15px;
    text-align: right;
  }
}

.graph-annotation {
  .label-tag {
    margin-right: 4px;
    margin-top: 8px;
  }

  .graph-annotation__header {
    background: $popover-header-bg;
    padding: 4px 8px;
    display: flex;
    flex-wrap: nowrap;
  }

  .graph-annotation__title {
    font-weight: $font-weight-semi-bold;
    padding-right: $spacer;
    overflow: hidden;
    display: inline-block;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex-grow: 1;
  }

  .graph-annotation__edit-icon {
    padding-left: $spacer;
  }

  .graph-annotation__time {
    color: $text-muted;
    font-style: italic;
    font-weight: normal;
    display: inline-block;
    position: relative;
    top: 1px;
  }

  .graph-annotation__body {
    padding: $space-sm;
  }

  .graph-annotation__user {
    img {
      border-radius: 50%;
      width: 16px;
      height: 16px;
    }
  }

  a[href] {
    color: $blue;
    text-decoration: underline;
  }
}

.left-yaxis-label {
  top: 50%;
  left: 8px;
  transform: translateX(-50%) translateY(-50%) rotate(-90deg);
}

.right-yaxis-label {
  top: 50%;
  right: 8px;
  transform: translateX(50%) translateY(-50%) rotate(90deg);
}

.axisLabel {
  display: inline-block;
  color: $text-color;
  font-size: $font-size-sm;
  position: absolute;
  text-align: center;
}

.alert-handle-wrapper {
  position: absolute;
  user-select: none;

  .alert-handle {
    z-index: 10;
    position: relative;
    float: right;
    box-shadow: $card-shadow;
    background: $card-background;
    cursor: move;
    width: 100px;
    font-size: $font-size-sm;
    border-radius: 4px;
    text-align: left;
    color: $text-muted;

    &:hover {
      background-color: $btn-inverse-bg-hl;
    }

    .icon-gf {
      font-size: 14px;
      position: relative;
      top: 0px;
      float: left;
      border-right: 1px solid $btn-divider-left;
      padding: 6px 4px 4px 6px;
    }
  }

  .alert-handle-value {
    border-left: 1px solid $btn-divider-right;
    padding: $space-xs $space-sm;
    padding: 7px;
    line-height: 24px;
    height: 24px;

    .alert-handle-grip {
      background: url($btn-drag-image) no-repeat 50% 50%;
      background-size: 8px;
      float: right;
      width: 16px;
      height: 24px;
      margin-right: 2px;
    }
  }

  &--T1 {
    right: -222px;
    width: 245px;

    .alert-handle-line {
      width: 145px;
    }
  }

  &--T0 {
    right: -104px;
    width: 129px;

    .alert-handle-line {
      width: 28px;
    }
  }

  &--no-value {
    .alert-handle-line {
      display: none;
    }
  }

  .alert-handle-line {
    float: left;
    height: 2px;
    margin-top: 13px;
    z-index: 0;
    position: relative;

    &--critical {
      background-color: rgba(237, 46, 24, 0.6);
    }
    &--warning {
      background-color: rgba(247, 149, 32, 0.6);
    }
  }
}

.thresholds-form-disabled {
  filter: blur(3px);
}

.piechart-panel {
  position: relative;
  display: table;
  width: 100%;
  height: 100%;

  .piechart-container {
    top: 10px;
    margin: auto;

    svg {
      width: 100%;
      height: 100%;
    }
  }

  .piechart-tooltip {
    white-space: nowrap;
    font-size: 12px;
    background-color: #141414;
    color: #d8d9da;
    opacity: 0;
    position: absolute;

    .piechart-tooltip-time {
      text-align: center;
      position: relative;
      padding: $space-xxs;
      font-weight: bold;
      color: #d8d9da;

      .piechart-tooltip-value {
        display: table-cell;
        font-weight: bold;
        padding: 15px;
        text-align: right;
      }
    }
  }
}

// Baron styles
.baron {
  // display: inline-block; // this brakes phantomjs rendering (width becomes 0)
  overflow: hidden;
}

// Fix for side menu on mobile devices
.main-view.baron {
  width: unset;
}

.baron__clipper {
  position: relative;
  overflow: hidden;
}

.baron__scroller {
  overflow-y: scroll;
  -ms-overflow-style: none;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  /* remove line to customize scrollbar in iOs */
}

.baron__scroller::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.baron__track {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
}

.baron._scrollbar .baron__track {
  display: block;
}

.baron__free {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
}

.baron__bar {
  display: none;
  position: absolute;
  right: 0;
  z-index: 1;
  // width: 10px;
  background: #999;

  // height: 15px;
  width: 15px;
  transition:
    background-color 0.2s linear,
    opacity 0.2s linear;
  opacity: 0;
}

.baron._scrollbar .baron__bar {
  display: block;

  @include gradient-vertical($scrollbarBackground, $scrollbarBackground2);
  border-radius: 6px;
  width: 6px;
  /* there must be 'right' for ps__thumb-y */
  right: 0px;
  /* please don't change 'position' */
  position: absolute;

  // background-color: transparent;
  // opacity: 0.6;

  &:hover,
  &:focus {
    // background-color: transparent;
    opacity: 0.9;
  }
}

.panel-hover-highlight .baron__track .baron__bar {
  opacity: 0.6;
}

.baron._scrolling > .baron__track .baron__bar {
  opacity: 0.9;
}

.baron__control {
  display: none;
}

.baron.panel-content--scrollable {
  // Width needs to be set to prevent content width issues
  // Set to less than 100% for fixing Firefox issue (white stripe on the right of scrollbar)
  width: calc(100% - 2px);

  .baron__scroller {
    padding-top: 1px;
  }
}

// temp hack
.modal-body {
  .nav-tabs {
    border-bottom: none;
  }

  .nav-tabs > li > a {
    border: none;
    border-radius: 0;
    &:hover,
    &:focus {
      border-bottom: 1px solid $blue;
    }
  }

  .nav-tabs > .active > a,
  .nav-tabs > .active > a:hover,
  .nav-tabs > .active > a:focus {
    border: none;
    border-bottom: 1px solid $blue;
    color: $link-color;
  }
}

.grafana-tooltip {
  position: absolute;
  top: -1000;
  left: 0;
  color: $tooltipColor;
  padding: 10px;
  font-size: 11pt;
  font-weight: 200;
  background-color: $tooltipBackground;
  border-radius: 5px;
  z-index: 9999;
  max-width: 800px;
  max-height: 600px;
  overflow: hidden;
  line-height: 14px;

  a {
    color: $tooltipLinkColor;
  }

  a.external-link {
    color: $tooltipExternalLinkColor;
  }
}

.grafana-tip {
  padding-left: 5px;
}

.table-panel-content {
  padding: 0;

  .panel-title-container {
    padding-bottom: 4px;
  }
}

.table-panel-scroll {
  overflow: auto;
}

.table-panel-container {
  padding-top: 2.2em;
  position: relative;
}

.table-panel-footer {
  text-align: center;
  font-size: 90%;
  line-height: 2px;

  ul {
    position: relative;
    display: inline-block;
    margin-left: 0;
    margin-bottom: 0;
  }

  ul > li {
    display: inline; // Remove list-style and block-level defaults
  }

  ul > li > a {
    float: left; // Collapse white-space
    padding: 4px 12px;
    text-decoration: none;
    border-left-width: 0;

    &:hover {
      background-color: $tight-form-func-bg;
    }

    &.active {
      font-weight: bold;
      color: $blue;
    }
  }
}

.table-panel-table {
  width: 100%;
  border-collapse: collapse;

  th {
    padding: 0;

    &:first-child {
      .table-panel-table-header-inner {
        padding-left: 15px;
      }
    }
  }

  td {
    padding: 0.45em 1.1em;
    border-bottom: 2px solid $body-bg;
    border-right: 2px solid $body-bg;

    &:first-child {
      padding-left: 15px;
    }
    &:last-child {
      border-right: none;
    }

    &.table-panel-cell-pre {
      white-space: pre;
    }

    &.table-panel-cell-link {
      // Expand internal div to cell size (make all cell clickable)
      padding: 0;

      a {
        padding: 0.45em 0 0.45em 1.1em;
        height: 100%;
        display: inline-block;
        text-decoration: underline;
        text-underline-position: under;
      }
    }

    &.cell-highlighted:hover {
      background-color: $tight-form-func-bg;
    }

    &:hover {
      .table-panel-filter-link {
        visibility: visible;
      }
    }
  }
}

.table-panel-filter-link {
  visibility: hidden;
  color: $text-color-weak;
  float: right;
  display: block;
  padding: 0 5px;
}

.table-panel-header-bg {
  background: $list-item-bg;
  border-top: 2px solid $body-bg;
  border-bottom: 2px solid $body-bg;
  height: 2em;
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
}

.table-panel-table-header-inner {
  padding: 0.3em 0 0.45em 1.1em;
  text-align: left;
  color: $blue;
  position: absolute;
  top: 0;
}

.table-panel-width-hack {
  visibility: hidden;
  height: 0px;
  line-height: 0px;
}

.table-panel-color-cell {
  color: white;
  a {
    color: white;
  }
}

.table-panel-color-row {
  color: white;
  a {
    color: white;
  }
}

.editor-row {
  vertical-align: top;
}

.section {
  margin-right: 42px;
  vertical-align: top;
  display: inline-block;
}

div.editor-option {
  vertical-align: top;
  display: inline-block;
  margin-right: 10px;
}

div.editor-option label {
  display: block;
}

@font-face {
  font-family: 'grafana-icons';
  src: url('../fonts/grafana-icons.eot?okx5td');
  src:
    url('../fonts/grafana-icons.eot?okx5td#iefix') format('embedded-opentype'),
    url('../fonts/grafana-icons.ttf?okx5td') format('truetype'),
    url('../fonts/grafana-icons.woff?okx5td') format('woff'),
    url('../fonts/grafana-icons.svg?okx5td#grafana-icons') format('svg');
  font-weight: normal;
  font-style: normal;
}

.icon-gf {
  /* use !important to prevent issues with browser extensions that change fonts */
  font-family: 'grafana-icons' !important;
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;

  /* Better Font Rendering =========== */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-gf-fw {
  width: 1.2857142857em;
  text-align: center;
}
.inline-icon-gf {
  vertical-align: middle;
}
.icon-gf-raintank_wordmark:before {
  content: '\e600';
}
.micon-gf-raintank_icn:before {
  content: '\e601';
}
.icon-gf-raintank_r-icn:before {
  content: '\e905';
}
.icon-gf-check-alt:before {
  content: '\e603';
}
.icon-gf-check:before {
  content: '\e604';
}
.icon-gf-collector:before {
  content: '\e605';
}
.icon-gf-dashboard:before {
  content: '\e606';
}
.icon-gf-panel:before {
  content: '\e904';
}
.icon-gf-endpoint-tiny:before {
  content: '\e608';
}
.icon-gf-critical:before {
  content: '\e610';
}
.icon-gf-online:before {
  content: '\e611';
}
.icon-gf-event-error:before {
  content: '\e623';
}
.icon-gf-event:before {
  content: '\e624';
}
.icon-gf-sadface:before {
  content: '\e907';
}
.icon-gf-private-collector:before {
  content: '\e612';
}
.icon-gf-alert:before {
  content: '\e61f';
}
.icon-gf-alert-disabled:before {
  content: '\e621';
}
.icon-gf-refresh:before {
  content: '\e613';
}
.icon-gf-save:before {
  content: '\e614';
}
.icon-gf-share:before {
  content: '\e616';
}
.icon-gf-star:before {
  content: '\e617';
}
.icon-gf-search:before {
  content: '\e618';
}
.icon-gf-settings:before {
  content: '\e615';
}
.icon-gf-add:before {
  content: '\e619';
}
.icon-gf-remove:before {
  content: '\e61a';
}
.icon-gf-video:before {
  content: '\e61b';
}
.icon-gf-bulk_action:before {
  content: '\e61c';
}
.icon-gf-grabber:before {
  content: '\e90b';
}
.icon-gf-users:before {
  content: '\e622';
}
.icon-gf-globe:before {
  content: '\e61d';
}
.icon-gf-snapshot:before {
  content: '\e61e';
}
.icon-gf-play-grafana-icon:before {
  content: '\e629';
}
.icon-gf-grafana-icon:before {
  content: '\e625';
}
.icon-gf-email:before {
  content: '\e628';
}
.icon-gf-stopwatch:before {
  content: '\e626';
}
.icon-gf-skull:before {
  content: '\e900';
}
.icon-gf-probe:before {
  content: '\e901';
}
.icon-gf-apps:before {
  content: '\e902';
}

.page-header {
  margin-top: $space-md;

  .btn {
    float: right;
    margin-left: $space-md;

    // better align icons
    .fa {
      position: relative;
      top: 1px;
    }
  }

  @include media-breakpoint-up(md) {
    margin-top: 0;
  }
}

.page-header__inner {
  flex-grow: 1;
  display: flex;
  padding: $space-lg 0;
}

.page-header__title {
  font-size: $font-size-h2;
  margin-bottom: 1px;
  padding-top: $spacer;
}

.page-header__img {
  position: relative;
  top: 10px;
  height: 50px;
}

.page-header__icon {
  font-size: 50px;
  width: 50px;
  height: 50px;
  position: relative;
  color: $text-color-weak;

  &.fa {
    top: 10px;
  }

  &.gicon {
    top: 10px;
  }

  &.icon-gf {
    top: 3px;
  }
}

.page-header__logo {
  margin: -1px $spacer -1px 0;
  color: $text-color-weak;
}

.page-header__sub-title {
  color: $text-muted;
}

.page-header-stamps-type {
  color: $link-color-disabled;
  text-transform: uppercase;
}

.page-header__select-nav {
  margin-bottom: 10px;
  max-width: 100%;

  @include media-breakpoint-up(lg) {
    display: none;
  }
}

.page-header__link {
  color: $text-color;
  text-decoration: underline;
}

.page-header__tabs {
  display: none;
  @include media-breakpoint-up(lg) {
    display: block;
  }
}

.page-breadcrumbs {
  display: flex;
  padding: 10px 0;
  line-height: 0.5;
}

.breadcrumb {
  display: inline-block;
  box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border-radius: 5px;
  counter-reset: flag;
}

gf-form-switch[disabled] {
  .gf-form-switch,
  .gf-form-switch-container {
    cursor: default;
    pointer-events: none !important;
    .gf-form-label {
      color: $text-color-weak;
    }
  }
}

.gf-form-switch-container {
  display: flex;
  cursor: pointer;
  margin-right: $space-xs;
}

.gf-form-switch {
  display: flex;
  position: relative;
  width: 56px;
  height: $input-height;
  background: $switch-bg;
  border: 1px solid $input-border-color;
  border-radius: $input-border-radius;
  align-items: center;
  justify-content: center;
  input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  &--transparent {
    background: transparent;
    border: 0;
    width: 40px;
  }
}

.gf-form-switch__slider {
  background: $switch-slider-off-bg;
  border-radius: 8px;
  height: 16px;
  width: 32px;
  display: block;
  position: relative;

  &::before {
    position: absolute;
    content: '';
    height: 12px;
    width: 12px;
    left: 2px;
    top: 2px;
    background: $switch-slider-color;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: $switch-slider-shadow;
  }
}

input:checked + .gf-form-switch__slider {
  background: $switch-slider-on-bg;
}

input:checked + .gf-form-switch__slider::before {
  transform: translateX(16px);
}

.gf-form-checkbox {
  position: relative;
  display: flex;
  width: 50px;
  height: $input-height;
  background: $switch-bg;
  border: 1px solid $input-border-color;
  border-left: none;
  border-radius: $input-border-radius;
  align-items: center;
  justify-content: center;

  input {
    opacity: 0;
    width: 0;
    height: 0;
    appearance: none;
  }

  &--transparent {
    background: transparent;
    border: none;
    width: 23px;
    height: auto;
    position: relative;
    padding-left: 8px;
  }

  &--table-cell {
    width: 20px;
    background: transparent;
    height: auto;
    border: none;
    position: relative;
    top: -5px;
  }
}

.gf-form-switch__checkbox {
  height: 16px;
  width: 16px;
  border-radius: 3px;
  border: $checkbox-border;
  background: $checkbox-bg;
  display: flex;
  align-items: center;
  justify-content: center;
}

input:checked + .gf-form-switch__checkbox::before {
  font-family: 'FontAwesome';
  content: '\f00c';
  color: $checkbox-color;
}

input:checked + .gf-form-switch__checkbox {
  background: $checkbox-checked-bg;
  border: none;
}

@keyframes spin-clockwise {
  0% {
    transform: rotate(0deg) scaleX(-1); // scaleX flips the `sync` icon so arrows point the correct way
  }
  100% {
    transform: rotate(359deg) scaleX(-1);
  }
}

.spin-clockwise {
  animation: spin-clockwise 3s infinite linear;
}

@mixin drop-theme($themeName, $theme-bg, $theme-color, $border-color: $theme-bg) {
  .drop-element.drop-#{$themeName} {
    max-width: 100%;
    max-height: 100%;

    .drop-content {
      border-radius: $border-radius-lg;
      position: relative;
      font-weight: $font-weight-semi-bold;
      background: $theme-bg;
      color: $theme-color;
      padding: $space-sm;
      word-wrap: break-word;
      max-width: 280px;
      border: 1px solid $border-color;

      &:before {
        content: '';
        display: block;
        position: absolute;
        width: 0;
        height: 0;
        border-color: transparent;
        border-width: $popover-arrow-size;
        border-style: solid;
        pointer-events: null;
      }
    }

    &.drop-wide {
      .drop-content {
        max-width: 560px;
      }
    }

    // Centers and middles

    &.drop-element-attached-bottom.drop-element-attached-center .drop-content {
      margin-bottom: $popover-arrow-size;

      &:before {
        top: 100%;
        left: 50%;
        margin-left: -$popover-arrow-size;
        border-top-color: $border-color;
      }
    }

    &.drop-element-attached-top.drop-element-attached-center .drop-content {
      margin-top: $popover-arrow-size;

      &:before {
        bottom: 100%;
        left: 50%;
        margin-left: -$popover-arrow-size;
        border-bottom-color: $border-color;
      }
    }

    &.drop-element-attached-right.drop-element-attached-middle .drop-content {
      margin-right: $popover-arrow-size;

      &:before {
        left: 100%;
        top: 50%;
        margin-top: -$popover-arrow-size;
        border-left-color: $border-color;
      }
    }

    &.drop-element-attached-left.drop-element-attached-middle .drop-content {
      margin-left: $popover-arrow-size;

      &:before {
        right: 100%;
        top: 50%;
        margin-top: -$popover-arrow-size;
        border-right-color: $border-color;
      }
    }

    // Target middle/center, element corner
    &.drop-element-attached-left.drop-target-attached-center .drop-content {
      left: -$popover-arrow-size * 2;
    }

    &.drop-element-attached-right.drop-target-attached-center .drop-content {
      left: $popover-arrow-size * 2;
    }

    &.drop-element-attached-top.drop-element-attached-left.drop-target-attached-middle .drop-content {
      margin-top: $popover-arrow-size;

      &:before {
        bottom: 100%;
        left: $popover-arrow-size;
        border-bottom-color: $border-color;
      }
    }

    &.drop-element-attached-top.drop-element-attached-right.drop-target-attached-middle .drop-content {
      margin-top: $popover-arrow-size;

      &:before {
        bottom: 100%;
        right: $popover-arrow-size;
        border-bottom-color: $border-color;
      }
    }

    &.drop-element-attached-bottom.drop-element-attached-left.drop-target-attached-middle .drop-content {
      margin-bottom: $popover-arrow-size;

      &:before {
        top: 100%;
        left: $popover-arrow-size;
        border-top-color: $border-color;
      }
    }

    &.drop-element-attached-bottom.drop-element-attached-right.drop-target-attached-middle .drop-content {
      margin-bottom: $popover-arrow-size;

      &:before {
        top: 100%;
        right: $popover-arrow-size;
        border-top-color: $border-color;
      }
    }

    // Top and bottom corners
    &.drop-element-attached-top.drop-element-attached-left.drop-target-attached-bottom .drop-content {
      margin-top: $popover-arrow-size;

      &:before {
        bottom: 100%;
        left: $popover-arrow-size;
        border-bottom-color: $border-color;
      }
    }

    &.drop-element-attached-top.drop-element-attached-right.drop-target-attached-bottom .drop-content {
      margin-top: $popover-arrow-size;

      &:before {
        bottom: 100%;
        right: $popover-arrow-size;
        border-bottom-color: $border-color;
      }
    }

    &.drop-element-attached-bottom.drop-element-attached-left.drop-target-attached-top .drop-content {
      margin-bottom: $popover-arrow-size;

      &:before {
        top: 100%;
        left: $popover-arrow-size;
        border-top-color: $border-color;
      }
    }

    &.drop-element-attached-bottom.drop-element-attached-right.drop-target-attached-top .drop-content {
      margin-bottom: $popover-arrow-size;

      &:before {
        top: 100%;
        right: $popover-arrow-size;
        border-top-color: $border-color;
      }
    }

    // Side corners
    &.drop-element-attached-top.drop-element-attached-right.drop-target-attached-left .drop-content {
      margin-right: $popover-arrow-size;

      &:before {
        top: $popover-arrow-size;
        left: 100%;
        border-left-color: $border-color;
      }
    }

    &.drop-element-attached-top.drop-element-attached-left.drop-target-attached-right .drop-content {
      margin-left: $popover-arrow-size;

      &:before {
        top: $popover-arrow-size;
        right: 100%;
        border-right-color: $border-color;
      }
    }

    &.drop-element-attached-bottom.drop-element-attached-right.drop-target-attached-left .drop-content {
      margin-right: $popover-arrow-size;

      &:before {
        bottom: $popover-arrow-size;
        left: 100%;
        border-left-color: $border-color;
      }
    }

    &.drop-element-attached-bottom.drop-element-attached-left.drop-target-attached-right .drop-content {
      margin-left: $popover-arrow-size;

      &:before {
        bottom: $popover-arrow-size;
        right: 100%;
        border-right-color: $border-color;
      }
    }
  }
}

@mixin drop-animation-scale($themePrefix: 'drop', $themeName: 'default', $attachmentOffset: 0, $easing: 'linear') {
  .#{$themePrefix}-element.#{$themePrefix}-#{$themeName} {
    transform: translateZ(0);
    transition: opacity 100ms;
    opacity: 0;
    .#{$themePrefix}-content {
      transition: transform 0.2s $easing;
      transform: scale(0.8) translateZ(0);
    }
    &.#{$themePrefix}-open {
      display: none;
    }
    &.#{$themePrefix}-open-transitionend {
      display: block;
    }
    &.#{$themePrefix}-after-open {
      transition: none;
      opacity: 1;
      .#{$themePrefix}-content {
        transform: scale(1) translateZ(0);
      }
    }
    // Centers and middles
    &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-center .#{$themePrefix}-content {
      transform-origin: 50% calc(100% + #{$attachmentOffset});
    }
    &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-center .#{$themePrefix}-content {
      transform-origin: 50% (-$attachmentOffset);
    }
    &.#{$themePrefix}-element-attached-right.#{$themePrefix}-element-attached-middle .#{$themePrefix}-content {
      transform-origin: calc(100% + #{$attachmentOffset}) 50%;
    }
    &.#{$themePrefix}-element-attached-left.#{$themePrefix}-element-attached-middle .#{$themePrefix}-content {
      transform-origin: -($attachmentOffset 50%);
    }
    // Top and bottom corners
    &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-left.#{$themePrefix}-target-attached-bottom
      /* stylelint-disable-line */ .#{$themePrefix}-content {
      transform-origin: 0 (-$attachmentOffset);
    }
    &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-right.#{$themePrefix}-target-attached-bottom
      /* stylelint-disable-line */ .#{$themePrefix}-content {
      transform-origin: 100% (-$attachmentOffset);
    }
    &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-left.#{$themePrefix}-target-attached-top
      /* stylelint-disable-line */ .#{$themePrefix}-content {
      transform-origin: 0 calc(100% + #{$attachmentOffset});
    }
    &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-right.#{$themePrefix}-target-attached-top
      /* stylelint-disable-line */ .#{$themePrefix}-content {
      transform-origin: 100% calc(100% + #{$attachmentOffset});
    }
    // Side corners
    &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-right.#{$themePrefix}-target-attached-left
      /* stylelint-disable-line */ .#{$themePrefix}-content {
      transform-origin: calc(100% + #{$attachmentOffset}) 0;
    }
    &.#{$themePrefix}-element-attached-top.#{$themePrefix}-element-attached-left.#{$themePrefix}-target-attached-right
      /* stylelint-disable-line */ .#{$themePrefix}-content {
      transform-origin: (-$attachmentOffset) 0;
    }
    &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-right.#{$themePrefix}-target-attached-left
      /* stylelint-disable-line */ .#{$themePrefix}-content {
      transform-origin: calc(100% + #{$attachmentOffset}) 100%;
    }
    &.#{$themePrefix}-element-attached-bottom.#{$themePrefix}-element-attached-left.#{$themePrefix}-target-attached-right
      /* stylelint-disable-line */ .#{$themePrefix}-content {
      transform-origin: (-$attachmentOffset) 100%;
    }
  }
}

$popover-arrow-size: 10px;
$color: inherit;
$color: $text-color;
$useDropShadow: false;
$attachmentOffset: 0%;
$easing: cubic-bezier(0, 0, 0.265, 1);

@include drop-theme('error', $popover-error-bg, $white);
@include drop-theme('popover', $popover-bg, $popover-color, $popover-border-color);
@include drop-theme('help', $popover-help-bg, $popover-help-color);

@include drop-animation-scale('drop', 'help', $attachmentOffset: $attachmentOffset, $easing: $easing);
@include drop-animation-scale('drop', 'error', $attachmentOffset: $attachmentOffset, $easing: $easing);
@include drop-animation-scale('drop', 'popover', $attachmentOffset: $attachmentOffset, $easing: $easing);

.drop-element {
  z-index: 10000;
  position: absolute;
  display: none;
  opacity: 0;

  &.drop-open {
    display: block;
  }
}

.drop-element,
.drop-element * {
  box-sizing: border-box;
}

.drop-popover-close {
  position: absolute;
  top: -5px;
  right: 0;
  font-size: $font-size-lg;
}

.drop-help {
  a {
    color: $gray-6;

    &:hover {
      color: $white;
    }
  }
}

.drop-hide-out-of-bounds {
  &.drop-open.drop-help.drop-out-of-bounds,
  &.drop-open-transitionend.drop-help.drop-out-of-bounds {
    display: none;
  }
}

.drop-element.drop-popover {
  .drop-content {
    box-shadow: $popover-shadow;
  }
}

.drop-element.drop-popover--form {
  .drop-content {
    max-width: none;
    padding: 0;
  }
}

.drop-element.drop-popover--annotation {
  .drop-content {
    padding: 0;
  }
}

.drop-popover.gf-color-picker {
  .drop-content {
    width: 210px;
  }
}

// TODO: Remove. This is a temporary solution until color picker popovers are used
// with Drop.js.
.drop-popover.drop-popover--transparent {
  .drop-content {
    border: none;
    background: none;
    padding: 0;
    max-width: none;

    &:before {
      display: none;
    }
  }
}

.section-heading {
  font-size: $font-size-md;
  margin-bottom: $space-sm;
}

@each $prop, $abbrev in (margin: m, padding: p) {
  @each $size, $lengths in $spacers {
    $length-x: map.get($lengths, x);
    $length-y: map.get($lengths, y);

    .#{$abbrev}-a-#{$size} {
      #{$prop}: $length-y $length-x !important;
    } // a = All sides
    .#{$abbrev}-t-#{$size} {
      #{$prop}-top: $length-y !important;
    }
    .#{$abbrev}-r-#{$size} {
      #{$prop}-right: $length-x !important;
    }
    .#{$abbrev}-b-#{$size} {
      #{$prop}-bottom: $length-y !important;
    }
    .#{$abbrev}-l-#{$size} {
      #{$prop}-left: $length-x !important;
    }

    // Axes
    .#{$abbrev}-x-#{$size} {
      #{$prop}-right: $length-x !important;
      #{$prop}-left: $length-x !important;
    }
    .#{$abbrev}-y-#{$size} {
      #{$prop}-top: $length-y !important;
      #{$prop}-bottom: $length-y !important;
    }
  }
}

.pull-right {
  float: right;
}
.pull-left {
  float: left;
}

/* makes the font 33% larger relative to the icon container */
.fa-lg {
  font-size: calc(4em / 3);
  line-height: calc(3em / 4);
  vertical-align: -15%;
}

.cheat-sheet-item {
  margin: $space-lg 0;
}

.cheat-sheet-item__title {
  font-size: $font-size-h3;
}

.cheat-sheet-item__example {
  margin: $space-xs 0;
  // element is interactive, clear button styles
  text-align: left;
  border: none;
  background: transparent;
  display: block;
}

.add-data-source-item {
  padding: $space-md;
  display: flex;
  align-items: center;
  cursor: pointer;
  background: $card-background;
  border-radius: 3px;
  margin-bottom: $space-xxs;

  &:hover {
    background: $card-background-hover;

    .add-data-source-item-actions {
      opacity: 1;
      transition: 0.15s opacity ease-in-out;
    }
  }
}

.add-data-source-item-text-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.add-data-source-item-logo {
  margin-right: $space-lg;
  margin-left: $space-sm;
  width: 55px;
  max-height: 55px;
}

.add-data-source-item-desc {
  font-size: $font-size-sm;
  color: $text-color-weak;
}

.add-data-source-item-actions {
  opacity: 0;
  padding-left: $space-md;
  display: flex;
  align-items: center;

  > button {
    margin-left: $space-md;
    cursor: pointer;
  }
}

.add-data-source-item-badge {
  margin-top: 6px;
}

.add-data-source-item-text {
  font-size: $font-size-h5;
}

.panel-empty {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;

  p {
    text-align: center;
    color: $text-muted;
    font-size: $font-size-lg;
    width: 100%;
  }
}

// Base classes
.label,
.badge {
  display: inline-block;
  padding: 2px 4px;
  font-size: $font-size-base * 0.846;
  font-weight: $font-weight-semi-bold;
  line-height: 14px; // ensure proper line-height if floated
  color: $white;
  vertical-align: baseline;
  white-space: nowrap;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
  background-color: $gray-1;
}

// Labels & Badges
.label-tag {
  background-color: $purple;
  color: color.adjust($white, $lightness: -5%);
  white-space: nowrap;
  border-radius: 3px;
  text-shadow: none;
  font-size: 12px;
  padding: 0px 6px;
  line-height: 20px;
  height: 20px;

  svg {
    margin-bottom: 0;
  }

  &:hover {
    opacity: 0.85;
    background-color: color.adjust($purple, $lightness: -10%);
  }
}

.query-part__link {
  cursor: pointer;

  &--no-value {
    color: $text-muted;
  }
}

.grafana-info-box {
  position: relative;
  padding: $space-lg;
  background-color: $empty-list-cta-bg;
  border-left: 3px solid $info-box-border-color;
  margin-bottom: $space-md;
  margin-right: $space-xs;
  box-shadow: $card-shadow;
  flex-grow: 1;

  h5 {
    margin-bottom: $spacer;
  }
  ul {
    padding-left: $spacer * 1.5;
  }

  code {
    @include font-family-monospace();
    font-size: $font-size-base - 2;
    background-color: $code-tag-bg;
    color: $text-color;
    border: 1px solid $code-tag-border;
    border-radius: 4px;
  }

  p:last-child {
    margin-bottom: 0;
  }

  a {
    @extend .external-link;
  }

  &--max-lg {
    max-width: map.get($grid-breakpoints, 'lg');
  }
}

.grafana-info-box__close {
  text-align: center;
  display: block;
  color: $link-color !important;
  height: 0;
  position: relative;
  top: -9px;
}

//
// Alerts
// --------------------------------------------------

// Base styles
// -------------------------

.alert {
  padding: 15px 20px;
  margin-bottom: $space-xs;
  border-left: 3px solid $alert-error-bg;
  background: $layer2;
  position: relative;
  border-radius: $border-radius;
  display: flex;
  flex-direction: row;
  align-items: center;
}

// Alternate styles
// -------------------------

.alert-success {
  border-color: $alert-success-bg;
}

.alert-danger,
.alert-error {
  border-color: $alert-error-bg;
}

.alert-info {
  border-color: $alert-info-bg;
}

.alert-warning {
  border-color: $alert-warning-bg;
}

.alert-title {
  font-weight: $font-weight-semi-bold;
}

.alert-icon {
  padding: 0 $space-md 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;

  .fa {
    font-size: 21px;
  }
}

.alert-body {
  overflow-wrap: break-word;
  word-break: break-word;
  flex-grow: 1;
}

// Alert List
.alert-rule-item__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: center;
  overflow: hidden;
}

.alert-rule-item__header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.alert-rule-item__name {
  font-size: $font-size-base;
  margin: 0;
  font-weight: $font-weight-semi-bold;
}

.alert-rule-item__text {
  font-weight: bold;
  font-size: $font-size-sm;
  margin: 0;
}

.alert-rule-item__time {
  color: $text-color-weak;
  font-weight: normal;
  white-space: nowrap;
}

.alert-rule-item__info {
  //color: $text-color;
  font-weight: normal;
  flex-grow: 2;
  display: flex;
  align-items: flex-end;
}

.grafana-metric-options {
  margin-top: 25px;
}

.drop-element.drop-popover.drop-function-def .drop-content {
  max-width: 416px;
}

.panel-height-helper {
  display: block;
  height: 100%;
}

.panel-content {
  padding: $panel-padding;
  width: 100%;
  flex-grow: 1;
  contain: size layout;
  height: calc(100% - #{$panel-header-height});

  &--no-padding {
    padding: 0;
  }
}

div.flot-text {
  color: $text-color !important;
}

.modal-header {
  background: $page-header-bg;
  box-shadow: $page-header-shadow;
  border-bottom: 1px solid $page-header-border-color;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-close {
  float: right;
  padding: 9px $spacer;
}

// Body (where all modal content resides)
.modal-body {
  position: relative;
}

.modal-content {
  padding: $spacer * 2;

  &--has-scroll {
    max-height: calc(100vh - 400px);
    position: relative;
  }
}

// Footer (for actions)
.modal-footer {
  padding: 14px 15px 15px;
  border-top: 1px solid $panel-bg;
  background-color: $panel-bg;
  text-align: right; // right align buttons
  // clear it in case folks use .pull-* classes on buttons
  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

.confirm-modal {
  max-width: 500px;

  .confirm-modal-icon {
    padding-top: 41px;
    font-size: 280%;
    color: $green-base;
    padding-bottom: 20px;
  }

  .confirm-modal-text {
    font-size: $font-size-h4;
    color: $link-color;
    margin-bottom: $spacer * 2;
    padding-top: $spacer;
  }

  .confirm-modal-text2 {
    font-size: $font-size-base;
    padding-top: $spacer;
  }

  .confirm-modal-buttons {
    margin-bottom: $spacer;
    button {
      margin-right: calc($spacer/2);
    }
  }

  .modal-content-confirm-text {
    margin-bottom: $space-xl;
    span {
      text-align: center;
    }
  }
}

.gf-form-dropdown-typeahead {
  position: relative;

  &::after {
    position: absolute;
    top: 35%;
    right: $space-sm;
    background-color: transparent;
    color: $input-color;
    font: normal normal normal list.slash($font-size-sm, 1) FontAwesome;
    content: '\f0d7';
    pointer-events: none;
    font-size: 11px;
  }
}

.gf-form-help-icon {
  flex-grow: 0;
  color: $text-color-weak;

  &--bold {
    color: $text-color-emphasis;
    padding-left: 0;
  }

  &--right-absolute {
    position: absolute;
    right: $spacer;
    top: 6px;
  }

  &--right-normal {
    float: right;
  }

  &--header {
    margin-bottom: $space-xxs;
  }

  &--small-padding {
    padding-left: 4px;
  }

  &:hover {
    color: $text-color;
  }
}

.clearfix {
  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

// Close icons
// --------------------------------------------------
.close {
  opacity: 0.2;
  float: right;
  font-size: 20px;
  font-weight: bold;
  line-height: $line-height-base;
  color: $black;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 1);

  &:hover,
  &:focus {
    color: $black;
    text-decoration: none;
    cursor: pointer;
    opacity: 0.4;
  }
}

// Additional properties for button version
// iOS requires the button element instead of an anchor tag.
// If you want the anchor version, it requires `href="#"`.
button.close {
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  -webkit-appearance: none;
}

.dropup,
.dropdown {
  position: relative;
}

.dropdown-toggle:active,
.open .dropdown-toggle {
  outline: 0;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: $zindex-dropdown;
  display: none; // none by default, but block on "open" of the menu
  float: left;
  min-width: 140px;
  margin: 2px 0 0; // override default ul
  list-style: none;
  background-color: $dropdownBackground;
  border: 1px solid $dropdownBorder;
  text-align: left;

  // Aligns the dropdown menu to right
  &.pull-left {
    right: 0;
    left: auto;
  }

  .divider {
    height: 1px;
    margin: $space-sm 0; // 8px 1px
    overflow: hidden;
    background-color: $dropdownDividerTop;
    border-bottom: 1px solid $dropdownDividerBottom;
  }

  // Links within the dropdown menu
  > li {
    > a,
    > button {
      display: block;
      padding: 3px 20px 3px 15px;
      clear: both;
      font-weight: normal;
      line-height: $line-height-base;
      color: $dropdownLinkColor;
      white-space: nowrap;

      i {
        display: inline-block;
        margin-right: 10px;
        color: $link-color-disabled;
        position: relative;
        top: 3px;
      }

      .gicon {
        opacity: 0.7;
        width: 18px;
        height: 14px;
      }
    }
  }

  &--menu {
    background: $menu-dropdown-bg;
    box-shadow: $menu-dropdown-shadow;
    margin-top: 0px;

    > li > a,
    > li > button {
      display: flex;
      padding: 5px 10px;
      border-left: 2px solid transparent;

      &:hover {
        color: $link-hover-color;
        background: $menu-dropdown-hover-bg !important;
      }
    }
  }
}

.dropdown-item-text {
  flex-grow: 1;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-submenu:hover > a,
.dropdown-submenu:focus > a,
.dropdown-menu > li > button:hover,
.dropdown-menu > li > button:focus,
.dropdown-submenu:hover > button,
.dropdown-submenu:focus > button {
  text-decoration: none;
  color: $dropdownLinkColorHover;
  background-color: $dropdownLinkBackgroundHover;
}

.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus,
.dropdown-menu > .active > button,
.dropdown-menu > .active > button:hover,
.dropdown-menu > .active > button:focus {
  color: $dropdownLinkColorActive;
  text-decoration: none;
  outline: 0;
  background-color: $dropdownLinkBackgroundHover;
}

.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus,
.dropdown-menu > .disabled > button,
.dropdown-menu > .disabled > button:hover,
.dropdown-menu > .disabled > button:focus {
  color: $gray-2;
}
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus,
.dropdown-menu > .disabled > button:hover,
.dropdown-menu > .disabled > button:focus {
  text-decoration: none;
  background-color: transparent;
  background-image: none; // Remove CSS gradient
  cursor: default;
}

.open {
  > .dropdown-menu {
    display: block;
  }

  > .dropdown > .dropdown-menu {
    display: block;
  }

  &.cascade-open {
    .dropdown-menu {
      display: block;
    }
  }
}

.pull-right > .dropdown-menu {
  left: 100%;
  right: unset;
}

.dropup {
  // Reverse the caret
  .caret {
    border-top: 0;
    border-bottom: 4px solid $black;
    content: '';
  }
  // Different positioning for bottom up menu
  .dropdown-menu {
    top: auto;
    bottom: 0;
    margin-bottom: 1px;
  }
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu > .dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: 0px;
  margin-left: -1px;
}
.dropdown-submenu:hover > .dropdown-menu {
  display: block;
}

.dropup .dropdown-submenu > .dropdown-menu {
  top: auto;
  bottom: 0;
  margin-top: 0;
  margin-bottom: -2px;
}
.dropdown-submenu:hover > a::after,
.dropdown-submenu:hover > button::after {
  border-left-color: $dropdownLinkColorHover;
}

.dropdown-submenu.pull-left {
  // Undo the float
  // Yes, this is awkward since .pull-left adds a float, but it sticks to our conventions elsewhere.
  float: none !important;

  // Positioning the submenu
  > .dropdown-menu {
    left: -100%;
    width: 100%;
    margin-left: 2px;
  }
}

.dropdown-submenu.pull-right {
  float: none !important;
}

.dropdown-menu-item-shortcut {
  display: block;
  margin-left: $spacer;
  color: $text-muted;
  min-width: 47px;
}

.input-mini {
  width: 60px;
}

.input-medium {
  width: 150px;
}

input[type='checkbox'].cr1 {
  display: none;
}

.editor-option label.cr1 {
  display: inline-block;
  margin: 5px 0 1px 0;
}

label.cr1 {
  display: inline-block;
  height: 18px;
  position: relative;
  clear: none;
  text-indent: 2px;
  margin: 0 0 0px 0;
  padding: 0 0 0 20px;
  vertical-align: top;
  background: url($checkboxImageUrl) left top no-repeat;
  cursor: pointer;
}

input[type='checkbox'].cr1:checked + label {
  background: url($checkboxImageUrl) 0px -18px no-repeat;
}

.max-width {
  width: 100%;
}

@each $breakpoint in map-keys($grid-breakpoints) {
  @include media-breakpoint-up($breakpoint, $grid-breakpoints) {
    @for $i from 1 through $grid-columns {
      .col-#{$breakpoint}-#{$i} {
        @include make-col($i, $grid-columns);
      }
    }
  }
}
