/*
 * Copyright (C) 2017-2019 Dremio Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@import "~#oss/uiTheme/less/mixins.less";

.search-field {
  input {
    &:hover {
      border-color: var(--border--hover);
    }

    &:focus {
      border-color: var(--border--focused);
      background-color: white;
    }
  }
}

.search-field-divider {
  height: 32px;
  width: 257px !important; // accounts for 240px input width, 16px padding, 1px border
  margin-right: 8px !important;
  padding-right: 16px;
  border-right: 1px solid var(--border--neutral);
}

.active-wiki-button {
  display: flex;
  justify-content: flex-end;
}

.panel-icon {
  color: var(--icon--primary) !important;

  &:hover {
    color: var(--icon--hover) !important;
  }
}

.slider {
  position: absolute;
  top: 0;
  //use right, as on resize I am going to replace right property with distance from cursor position to right edge of sidebar
  right: 100%;
  bottom: 0;
  width: 11px;
  transform: translateX(50%);
  background: var(--color--neutral--75);
  cursor: col-resize;
  opacity: 0;
  z-index: 100;

  &:hover {
    opacity: 1;
  }
}

:global {
  // DX-11429 TODO reafactor component to use css modules instead fo global classes
  .list-content__title-wrap {
    display: flex;
    align-items: center;
    overflow: hidden;
  }

  .browse-table__titleExtra {
    margin-left: 8px;
  }

  //Job table relies on the below CSS also since it's a global style
  .ReactVirtualized__Table {
    border-collapse: collapse;
    * :not(.dremio-icon-button) {
      outline: 0;
    }
    .ReactVirtualized__Table__headerRow {
      height: 40px !important;
      text-transform: initial;
      line-height: 20px;
      vertical-align: bottom;
      border-bottom: 1px solid var(--border--neutral);
      font-size: 12px;
      font-weight: 500;
    }
    &--noZebraStripesRows {
      cursor: pointer !important;
      border-bottom: 1px solid var(--border--neutral) !important;
      background: var(--fill--primary) !important;
    }
    .ReactVirtualized__Table__row {
      .fontBody();
      height: 30px;
      .pin {
        opacity: 0;
      }
      .active {
        opacity: 1;
      }
      .action-wrap .main-settings-btn {
        opacity: 0;
        text-decoration: none;
      }
      &.odd {
        background-color: var(--fill--secondary);
      }
      .copy-button {
        opacity: 0;
      }
      &:hover {
        .action-wrap .main-settings-btn {
          opacity: 1;
        }
        background: var(--fill--secondary);
        .copy-button {
          opacity: 1;
        }
      }
      .hovered {
        background: var(--fill--secondary);
        .copy-button {
          opacity: 1;
        }
      }
      .action-wrap .main-settings-btn.active {
        opacity: 1;
      }
      .ReactVirtualized__Table__rowColumn {
        &:last-child {
          text-align: left;
        }
      }
    }
    .action-wrap {
      justify-content: center;
      color: var(--icon--primary);

      // Customizes <SettingsBtn> with same style as <IconButton>
      span.main-settings-btn.min-btn.catalog-btn .settings-button {
        height: 32px;
        width: 32px;
        align-items: center;
        justify-content: center;
        user-select: none;
        color: inherit;
        padding: var(--dremio--spacing--05);
        transition: color 125ms ease-in-out;
        background-color: transparent;

        dremio-icon {
          height: 24px;
          width: 24px;
        }

        &:hover {
          color: var(--icon--hover);
        }
      }
    }
    td {
      border: 0;
      padding: 0;
      vertical-align: middle;
    }
  }

  .list-content {
    min-width: 500px;
    min-height: ~"calc(100vh - 65px)";
    display: flex;
    flex-grow: 0;
    flex-shrink: 0;
    justify-content: center;
    width: 100%;

    .ReactVirtualized__Table {
      &--noZebraStripesRows {
        cursor: unset !important;
      }
    }
  }

  .last-File {
    cursor: pointer;
    &:hover {
      text-decoration: underline;
    }
  }

  .--dead-link {
    cursor: default;
    &:hover {
      text-decoration: none !important;
    }
  }

  .row {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  .sharing-row {
    color: var(--color--brand--300);
  }

  .browse-table-viewer-header {
    overflow: hidden;
    height: 48px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border--neutral);
    .copy-button {
      display: none;
    }
    &:hover {
      .copy-button {
        display: block;
      }
    }
    .btn {
      .fa {
        font-size: 15px;
      }
    }
    .left-border {
      position: relative;
      margin-left: 10px !important;
      &::before {
        content: "";
        position: absolute;
        left: -10px;
        top: 0;
        bottom: 0;
        width: 1px;
        background: var(--color--neutral--150);
      }
    }

    .browse-table__externalLink {
      margin-right: 8px;
    }
  }
  .folder-path {
    cursor: pointer;
    color: var(--text--faded);
    .last-folder {
      color: var(--color--brand--300);
    }
  }
  .database-path {
    cursor: pointer;
    .last-folder {
      color: var(--color--brand--300);
    }
  }
  .table-path {
    cursor: pointer;
  }
  .help-btn {
    background: white;
    border: 1px solid darken(white, 15%);
    border-radius: 4px;
    padding: 1px 5px 2px 5px;
    cursor: pointer;
    .fa {
      font-size: 7px;
      line-height: 7px;
      color: #909090;
      margin: 0 2px;
      vertical-align: middle;
    }
    &:hover {
      background: darken(white, 5%);
    }
  }
  .queries-row {
    color: var(--color--brand--300);
    cursor: pointer;
  }

  .request-access-holder {
    background: var(--color--indigo--300);
    padding: 10px;
    button {
      width: auto;
      padding: 5px 20px;
    }
    .fa {
      font-size: 25px;
    }
    .request-access-inner {
      font-size: 12px;
      display: inline-block;
      overflow: hidden;
      vertical-align: top;
      margin: 0 10px;
      .title {
        font-size: 13px;
        font-weight: 500;
        margin: 0 0 7px;
      }
    }
  }
  .empty-table {
    .empty-message {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      position: absolute;
      height: 100%;
      width: 100%;
      text-align: center;
      font-size: 32px;
      color: #cbcbcb;
      background-color: var(--fill--secondary);
    }
    .table {
      margin-bottom: 0;
    }
  }

  // avoiding extra right margin on DS list page in Action column
  .main-info
    .ReactVirtualized__Table__row
    .ReactVirtualized__Table__rowColumn.row-buttons,
  .ReactVirtualized__Table__headerColumn.row-buttons {
    margin-right: 5px;
  }

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

    &:hover,
    &:focus-visible {
      .headerCell__sorting-icon {
        display: inline-flex;
        opacity: 50%;
      }
    }
  }

  .table-wrap .table-wrap__empty dremio-icon {
    width: 40vh;
    height: 40vh;

    & + span {
      font-weight: bold;
      font-size: 16px;
    }
  }
}
