@import "./siteDetails.less";

#appContainer > div {
  height: auto;
}

.siteDetailsPage {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;

  &.bookmarksManager {
    position: fixed;
    width: 100%;
  }

  .siteDetailsPageContent {
    display: flex;
    flex-wrap: wrap;
    height: 100%;
    flex: 1;

    .folderView {
      /* TODO: once refactoring to Aphrodite, make
      it more flexible with relative units */
      max-width: 410px;
      min-width: 220px;
      flex-grow: 1;

      .columnHeader {
        background: linear-gradient(to bottom, @lightGray, @veryLightGray);
        border-top: 1px solid @gray;
        text-align: left;
        font-weight: 300;
        padding: 8px;
        box-sizing: border-box;
        padding-left: 10px;
        user-select: none;
        cursor: default;
      }

      > .bookmarkFolderList {
        display: block;
        overflow-x: auto;
        overflow-y: auto;
        max-width: 410px;
        // viewport - header size - header size
        max-height: calc(~"100vh - 84px - 35px");

        .listItem >* {
          color: @buttonColor;
        }
      }

      .bookmarkFolderList {
        .listItem {
          height: 1rem;
          &.selected >*,
          &.isDragOver >* {
            font-weight: 600;
          }
          &.isDragOver {
            background-color: lighten(@braveOrange, 20%);
          }
        }
        .bookmarkFolderIcon {
          margin-right: 5px;
        }
      }
    }
    .organizeView {
      flex-grow: 5;
      border-left: 1px solid @braveOrange;
      overflow: auto;
      // viewport - header size
      // TODO: once table header is fixed,
      // add table header (35px) size
      max-height: calc(~"100vh - 84px");

      .sortableTable {
        user-select: none;
        // Custom title column (has add bookmark icon)
        th:first-of-type > div { display: block; }
        // Bookmark last visited column
        th:nth-of-type(2), td.date { width: 250px; }
        td {
          font-size: 11pt;
          padding-left: 10px;
          white-space: nowrap;
          max-width: 0;
          .bookmarkFavicon {
            display: inline-block;
            margin-right: 5px;
          }
          .bookmarkLocation {
            color: @gray;
            margin-left: 12px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: none;
          }
        }
        .title {
          div {
            overflow: hidden;
            text-overflow: ellipsis;
          }
          span {
            vertical-align: middle;
          }

          .bookmarkFavicon {
            width: 16px;
          }

        }
        tr:hover {
          .bookmarkLocation {
            display: inline;
            overflow: hidden;
            text-overflow: ellipsis;
          }
        }
        tr.selected:hover {
          .bookmarkLocation {
            color: #fff;
          }
        }
      }
    }
  }

  @media (min-width: @breakpointNarrowViewport) {
    .folderView {
      max-width: 50%;
    }
  }
}

.bookmarkFolderList list >* {
  padding-left: 12px;
}

.addBookmarkFolder,
.addBookmark {
  background-color: @buttonColor;
  -webkit-mask-repeat: no-repeat;
  width: 24px;
  height: 26px;
  float: right;
  margin-right: 7px;
}

.addBookmarkFolder {
  -webkit-mask-image: url('../../img/toolbar/add_BM_folder_btn.svg');
}

.addBookmark {
  -webkit-mask-image: url('../../img/toolbar/add_bookmark_btn.svg');
  width: 20px;
  height: 20px;
}

.addBookmark,
.addBookmarkFolder,
.importBrowserData,
.exportBookmarks {
  &:hover {
    background-color: #000;
  }
}

.exportBookmarks,
.importBrowserData {
  background-color: @buttonColor;
  -webkit-mask-repeat: no-repeat;
  width: 43px;
  height: 22px;
  display: inline-block;
  vertical-align: top;
  margin: 7px 0 5px 10px;
}


.importBrowserData {
  -webkit-mask-image: url('../../img/toolbar/bookmarks_import.svg');
}

.exportBookmarks {
  -webkit-mask-image: url('../../img/toolbar/bookmarks_export.svg');
}

// Reset styles for small breakpoints
@media (max-width: @breakpointForBookmarksPage) {
  .siteDetailsPage.bookmarksManager {
    position: static;
  }

  .siteDetailsPage {
    .siteDetailsPageContent {
      .organizeView {
        overflow: visible;
        max-height: inherit;
      }
      .folderView {
        max-width: 100%;
        > .bookmarkFolderList {
          overflow-x: visible;
          overflow-y: visible;
          max-width: inherit;
          max-height: inherit;
        }
      }
    }
  }
}
