@import (reference) "~ui/styles/variables";

.tab-discover {
  overflow-x: hidden;
}

.discover {

  &-wrapper {
    padding-right: 0px !important;
  }

  &-content {
    padding-right: @padding-base-horizontal;
    clear: both;
  }

  &-timechart {
    display: block;
    position: relative;

    header {
      min-height: @input-height-base + 8px;
      padding: 4px 0;
    }

    visualize {
      height: 200px;
      max-height: 600px;

      &.only-spy {
        height: auto;

        .visualize-table {
          height: auto;
        }
      }
    }

    .chartwrapper {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }

    .vis-overlay {
      display: flex;
      align-items: center;
    }
  }

  &-overlay {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 20;

    opacity: 0.75;
    text-align: center;
    background-color: #ffffff;

    // spinner and prorgess counter
    > div {
      text-align: center;
    }
  }

  &-info {
    background-color: @well-bg;
    float: right;
    padding: 5px 10px;
    border-bottom-left-radius: @border-radius-base;

    text-align: right;

    &-title {
      font-weight: bold;
      margin-right: 10px;
    }
  }

  &-table {
    overflow-y: auto;
    overflow-x: auto;
    padding-left: 0px !important;
    padding-right: 0px !important;

    tbody {
      font-family: "Lucida Console", Monaco, monospace;
    }

    &-footer {
      background-color: @well-bg;
      padding: 5px 10px;
    }

    &-details-toggle {
      margin-bottom: 3px;
    }

    &-timefield {
      white-space: nowrap;
    }

    &-open-icon {
      // when switching between open and closed, the toggle changes size
      // slightly which is a problem because it forces the entire table to
      // re-render which is SLOW
      width: 7px;
    }
  }

  &-field {
    &-filter {
      background-color: @well-bg;
      margin-right: 10px;

      .form-group {
        margin-bottom: 0px;
      }

    }

    &-toggle {
      color: @btn-success-color;
      font-size: 9px;
    }
  }
}

.shard-failures {
  color: @brand-danger;
  background-color: lighten(@brand-danger, 40%) !important;
  border: 1px solid @brand-danger;
  border-radius: @border-radius-base;
  padding: 0 20px 20px;
  li {
    padding-bottom: 5px;
  }
}

.sidebar-item button.discover-field-toggle {
  display: none;
  font-size: 9px;
  position: absolute;
  right: 0;
  top: 0;
  margin: 5px 10px;
}

.sidebar-item:hover:hover button.discover-field-toggle {
  display: block;
}

.discover-field-details {
  border-top: 1px solid @well-border;
  padding: 5px 10px;
  background-color: @body-bg;
  color: @text-color;

  &-close {
    text-align: center;
    border-top: 1px solid @well-border;
    background-color: @well-bg;

    &:hover {
      background-color: @sidebar-hover-bg;
      color: @sidebar-hover-color;
    }
  }

  &-count {
    white-space: nowrap;
  }

  &-error {
    margin-top: 5px;
  }

  &-item {
    margin-top: 5px;
  }

  &-filter {
    cursor: pointer;
  }

  a {
    color: @link-color !important;
  }

  a.btn {
    color: @text-color !important;
  }

  .progress {
    margin-bottom: 0px;

    .progress-bar {
      padding-left: 10px;
      text-align: right;
      line-height: 18px;
      max-width: 100%;
      border-radius: 4px;

      span {
        background-color: @gray;
        padding: 3px;
        border-radius: 4px;
        margin-left: 3px;
        margin-right: 3px;
      }
    }
  }
}

field-name,
[field-name] {
  > i {
    margin-right: 5px;
    text-align: center;
    display: inline-block;
    width: 12px;
    color: @text-muted;
  }

  &.no-results {
    color: @text-muted;
  }
}

disc-field-chooser {
  ul.discover-selected-fields {
    /* If only _source is presend in the selected fields list, hide its toggle button */
    li:first-child:nth-last-child(1)[field=_source] button.discover-field-toggle {
      display: none;
    }
  }

  .sidebar-item-title {
    position: relative;
  }
}

.results {
  h3 {
    margin: -20px 0 10px 0;
    text-align: center;
  }

  &-interval {
    a {
      text-decoration: underline;
    }

    select {
      display: inline-block;
      width: auto;
    }
  }
}
