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

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

  .discover-wrapper {
    padding-right: 0px !important;
    padding-left: @collapser-width;
  }

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

  .discover-timechart {
    display: block;
    position: relative;

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

    /**
     * 1. Make sure chart above table is visible.
     */
    visualize {
      height: 200px; /* 1 */
      max-height: 600px;

      .loading {
        opacity: 1 !important;
      }

      &.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;
    }
  }

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

    opacity: 0.75;
    text-align: center;
    background-color: transparent;

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

  .discover-info {
    line-height: 30px;
    padding: 0px 10px;
    border-bottom-left-radius: @border-radius-base;
  }

    .discover-info-title {
      font-weight: bold;
      margin-right: 10px;
    }

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

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

    .discover-table-footer {
      background-color: @discover-table-footer-bg;
      padding: 5px 10px;
      text-align: center;
    }

    .discover-table-details-toggle {
      margin-bottom: 3px;
    }

    .discover-table-timefield {
      white-space: nowrap;
    }

    /**
     * 1. 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.
     */
    .discover-table-open-button {
      appearance: none;
      background-color: transparent;
      padding: 0;
      border: none;
      width: 7px; /* 1 */
      height: 7px;
    }

    .discover-field-filter {
      background-color: @discover-field-filter-bg;
      margin-right: 10px;

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

.shard-failures {
  color: @discover-shard-failures-color;
  background-color: @discover-shard-failures-bg !important;
  border: 1px solid;
  border-color: @discover-shard-failures-border;
  border-radius: @border-radius-base;
  padding: 0 20px 20px;
  li {
    padding-bottom: 5px;
  }
}

/**
 * 1. Override sidebar-item-title styles.
 */
.discover-sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0 !important; /* 1 */
  padding-bottom: 0 !important; /* 1 */
  height: 32px;

  &:hover,
  &:focus {
    .discover-sidebar-item-action {
      opacity: 1;
    }
  }
}

  /**
   * 1. Truncate long text so it doesn't push the actions outside of the container.
   */
  .discover-sidebar-item-label {
    overflow: hidden; /* 1 */
    text-overflow: ellipsis; /* 1 */
  }

  /**
   * 1. Only visually hide the action, so that it's still accessible to screen readers.
   * 2. When tabbed to, this element needs to be visible for keyboard accessibility.
   */
  .discover-sidebar-item-action {
    opacity: 0; /* 1 */

    &:focus {
      opacity: 1; /* 2 */
    }
  }

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

  .discover-field-details-count {
    white-space: nowrap;
  }

  .discover-field-details-error {
    margin-top: 5px;
  }

  .discover-field-details-item {
    margin-top: 5px;
  }

  .discover-field-details-filter {
    cursor: pointer;
  }

  .discover-field-details-item-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /**
   * 1. If the field name is very long, don't let it sqash the buttons.
   */
  .discover-field-details-item-buttons {
    flex: 0 0 auto; /* 1 */
  }

  .discover-field-details-item-button {
    appearance: none;
    border: none;
    padding: 0;
    background-color: transparent;
  }

/**
 * TODO: Refactor these selectors to be less specific.
 */
.discover-field-details {
  .progress {
    margin-bottom: 0px;

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

      span {
        background-color: @discover-field-details-progress-bar-bg;
        padding: 3px;
        border-radius: 4px;
        margin-left: 3px;
        margin-right: 3px;
      }
    }
  }
}

field-name,
[field-name] {
  &.no-results {
    color: @field-name-no-results-color;
  }
}

  .field-name-icon {
    margin-right: 5px;
    text-align: center;
    display: inline-block;
    width: 12px;
    color: @field-name-color;
  }

disc-field-chooser {
  .sidebar-item.active .sidebar-item-title {
    background-color: @sidebar-active-bg;
    color: @sidebar-active-color;
  }
  .sidebar-item-title {
    position: relative;
  }
}

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

  .results-interval {
    a {
      text-decoration: underline;
    }

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