@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;
    z-index: @discoverWrapperDepth;
  }

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

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

    .series > rect {
      fill-opacity: 0.5;
      stroke-width: 1;
    }

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

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

      .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: 14px; /* 1 */
      height: 14px;
    }

    .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 {
  padding: 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 {
    background-color: darken(@globalColorLightGray, 5%);
    margin-bottom: 0px;
    border-radius: 0px;

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

      span {
        background-color: rgba(0,0,0,.8);
        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: @discover-field-details-bg;
    color: @globalColorBlack;
    font-weight: bold;
  }
  .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;
    }
  }

.discover-skip-button {
  position: absolute;
  left: -10000px;
  top: 4px;
  width: 1px;
  height: 1px;
  overflow: hidden;

  &:focus {
    left: initial;
    right: 15px;
    width: auto;
    height: auto;
  }
}
