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

.tab-dashboard {
  background-color: @dashboard-bg;
}

.dashboardCloneModal {
  width: 450px;
}

dashboard-grid {
  display: block;
  margin: 0;
  padding: 5px;
  z-index: @dashboardGridDepth;
}

.start-screen {
  margin: 20px;
  background-color: @dashboard-bg;
  padding: 20px;
}

.gridster {
  list-style-type: none;
  display: block;
  background-color: @dashboard-bg;
  margin: 0;
  padding: 0;

  .gs-resize-handle {
    background-position: 50% 50% !important;
    bottom: 0 !important;
    right: 0 !important;
    padding: 4px;
    height: 25px;
    width: 25px;
  }

  .gs-w {

    &:hover {

      dashboard-panel {
        .visualize-show-spy {
          visibility: visible;
        }
      }

    }
    .panel--edit-mode {
      border-color: @kibanaGray4;
      .visualize-show-spy {
        visibility: visible;
      }
    }
  }

  i.remove {
    cursor: pointer;
  }
}

.panel {
  border: 2px dashed transparent;
}

.panel--edit-mode {
  border-color: @kibanaGray4;
  .visualize-show-spy {
    visibility: visible;
  }
}

.dashboard-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/**
 * 1. Fix Firefox bug where a value of overflow: hidden will prevent scrolling in a panel where the spy panel does
 * not have enough room.
 */
dashboard-panel {
  flex: 1;
  display: flex;
  flex-direction: column;

  height: 100%;
  background: @dashboard-panel-bg;
  color: @dashboard-panel-color;
  padding: 0;
  overflow: auto; /* 1 */
  position: relative;

  .panel {
    margin: 0;
    // maintain the 100% height of the panel
    height: 100%;
    flex: 1;

    // flex layout allows us to define the visualize element as "fill available space"
    display: flex;
    flex-direction: column;
    justify-content: flex-start;

    .panel-heading {
      padding: 0px 0px 0px 5px;
      flex: 0 0 auto;
      white-space: nowrap;
      display: flex;
      border-top-right-radius: 0;
      border-top-left-radius: 0;
      background-color: @white;
      border: none;

      .panel-title {
        font-size: inherit;

        // flexbox fix for IE10
        // http://stackoverflow.com/questions/22008135/internet-explorer-10-does-not-apply-flexbox-on-inline-elements
        display: inline-block;

        .ellipsis();
        flex: 1 1 auto;

        i {
          opacity: 0.3;
          font-size: 1.2em;
          margin-right: 4px;
        }
      }

      .panel-move:hover {
        cursor: move;
      }
    }

    .visualize-show-spy {
      visibility: hidden;
    }

    .load-error {
      text-align: center;
      font-size: 1em;
      display: flex;
      flex: 1 0 auto;
      justify-content: center;
      flex-direction: column;

      .fa-exclamation-triangle {
        font-size: 2em;
        color: @dashboard-panel-load-error-color;
      }
    }

    .panel-content {
      display: flex;
      flex: 1 1 100%;
      height: auto;
    }
  }

  /**
   * 1. We want the doc-table-container to scroll only when embedded in a dashboard panel
   */
  .doc-table-container {
    flex: 1 1 0; /* 1 */
    overflow: auto; /* 1 */
  }
}
