@import 'src/assets/styles/responsive-base.scss';

:host {
  flex: 1 1 auto;
  display: flex;
  position: relative;

  #drop-area {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.5);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-size: 2.5em;
    line-height: 2.5em;
    box-sizing: border-box;
    display: none;
    z-index: 11; // sticky drive header is 10
  }
  #drop-zone {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 12;
  }

  .mdi-icon {
    font-size: 18px;
    height: 18px;
    width: 18px;
    margin-right: 16px;
  }
}

.show-drop-area {
  display: flex !important;
}

#drive-cont {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: hidden;
}

#path-root {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
}

#path-root-cont {
  font-size: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-left: 6px;
  padding: 8px;
}

#full-path {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  @include screen('phone') {
    display: none;
  }
}

.no-shrink {
  flex-shrink: 0;
}

#drive-path {
  min-height: 50px;
}

#drive-path ul {
  margin: 0;
  padding: 8px 0;
  list-style-type: none;
  display: inline-flex;
  align-items: center;
  position: absolute;
  left: 0;
  height: 100%;
  box-sizing: border-box;

  overflow-x: hidden;
  justify-content: flex-end;

  right: 0;
  padding-right: 30px;

  li:last-of-type {
    margin-right: auto;
  }
}

#drive-path #path-list-container {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  padding-right: 8px;
  width: fit-content;
  max-width: 100%;
  height: 100%;
}

#drive-path ul li {
  display: flex;
  align-items: center;
  cursor: pointer;
}

#drive-path ul li span {
  margin-right: 4px;

  white-space: nowrap;
}

#drive-path ul li mat-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
}

#drive-path {
  border-top-width: 1px;
  border-top-style: solid;
  display: flex;
  justify-content: space-between;
  @include screen('phone') {
    flex-direction: column;
    box-shadow: 0 0px 4px rgba(0, 0, 0, 0.3);
  }
}

#menu-space {
  flex: 1 1 auto;
}

#drive-menu {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-right: 8px;
  flex-basis: 175px;

  .menu-divider {
    margin: 4px;
  }

  .mdi {
    font-size: 24px;
  }

  mat-icon {
    margin: 0;
  }

  @include screen('phone') {
    display: none;
  }

  button {
    width: auto;
    height: auto;
    padding: 6px;
  }
}

#drive-menu-mobile {
  display: none;
  justify-content: flex-end;
  align-items: center;
  padding: 0 5px;
  @include screen('phone') {
    display: flex;
  }

  #actions-button {
    flex-shrink: 0;
    min-width: unset;

    .actions-button-container {
      display: flex;
      justify-content: center;
    }

    #actions-label {
      width: 0;
      overflow: hidden;
      transition: width ease-in 0.25s;
    }

    &.active {
      min-width: unset;
      width: auto;

      #actions-label {
        width: unset;
        width: 50px;
      }
    }
  }

  #refresh-button {
    flex-grow: 0;
  }

  #current-folder {
    position: relative;
    flex: 1 1 0;
    height: 100%;

    > span {
      cursor: pointer;
      position: absolute;
      left: 0;
      top: 0;
      display: flex;
      width: 100%;
      align-items: center;
      bottom: 0;

      > span {
        white-space: nowrap;
        overflow-x: hidden;
        text-overflow: ellipsis;
        padding: 0 8px;
      }
    }
  }

  #selected-files-container {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: space-between;

    #selected-files-info {
      display: flex;
      align-items: center;

      button {
        justify-content: center;
        display: flex;
        align-items: center;
      }
    }
  }
}

#drive-menu span,
#drive-menu-mobile > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  margin-right: 8px;
}

#drive-menu mat-icon,
#drive-menu-mobile mat-icon {
  display: flex;
  cursor: pointer;
}

.opaque {
  opacity: 0.5;
}

.drive-loading-spinner {
  margin: 4px 12px 4px 4px;
}

#file-browser-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  position: relative;
}

#all-files {
  margin: 0;
  flex: 1 1 auto;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  overflow-y: scroll;
}

#all-files > div {
  position: absolute;
  width: 100%;
}

#file-tile-table {
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  grid-row-gap: 10px;
  @include screen('phone') {
    display: grid;
    grid-template-columns: repeat(auto-fill, 100px);
    justify-content: space-evenly;
    padding-bottom: 50px;
  }
}

#file-list-table {
  padding-bottom: 12px;
  @include screen('phone') {
    padding-bottom: 76px;
  }
}

#file-list-view-table {
  width: 100%;
  border-collapse: collapse;
}

@include screen('phone') {
  #file-list-view-header {
    display: none;
  }
}

#file-list-view-header {
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;

  .column-title {
    vertical-align: middle;
  }

  mat-icon {
    font-size: 20px;
    line-height: 20px;
    height: 20px;
    width: 20px;
    vertical-align: middle;
  }

  #file-list-view-header-ext {
    min-width: 40px;
  }
}

#file-list-view-header > th {
  padding: 4px;
}

@include screen('phone') {
  #back-in-folder {
    /* just like the file-list-view */
    user-select: none;

    td {
      padding: 6px;
      height: 48px;
      vertical-align: middle;
    }

    td:first-of-type {
      padding-left: 8px;
    }

    td:last-of-type {
      padding-right: 8px;
    }

    td:first-of-type {
      text-align: center;
    }

    .file-name {
      width: 100%;
    }

    .mdi {
      font-size: 28px;
      width: 28px;
      height: 28px;
      -webkit-user-select: none; /* Safari */
      -ms-user-select: none; /* IE 10 and IE 11 */
      user-select: none; /* Standard syntax */
      cursor: pointer;
    }
  }
}
@include screen('desktop') {
  #back-in-folder {
    /* just like the file-list-view */
    user-select: none;

    td {
      padding: 2px 4px;
    }

    td:first-of-type {
      text-align: center;
    }

    .file-name {
      width: 100%;
    }

    .mdi {
      font-size: 20px;
      width: 20px;
      height: 20px;
      -webkit-user-select: none; /* Safari */
      -ms-user-select: none; /* IE 10 and IE 11 */
      user-select: none; /* Standard syntax */
      cursor: pointer;
    }
  }
}

#file-list-view-header-name {
  width: 100%;
}

.drive-load-error {
  display: flex;
  align-items: center;
  margin: 2px 20px;

  @include screen('phone') {
    text-align: justify;
  }

  .mdi {
    font-size: 20px;
    width: 20px;
    height: 20px;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
    cursor: pointer;
  }

  .file-name {
    text-align: left;
    flex: 1 1 auto;
  }
}

.drive-load-error {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  flex-direction: column;
}

#hidden-clipboard {
  position: fixed;
  top: -100px;
  opacity: 0;
}

.hidden-input {
  display: none;
}

#context-menu {
  display: none;

  ul {
    margin: 0;
    padding: 0;
    padding: 8px 0;

    li {
      padding: 10px 8px;
      display: flex;
      flex-direction: row;
      align-items: center;
      cursor: pointer;

      mat-icon {
        font-size: 20px;
        width: 20px;
        height: 20px;
        margin-right: 8px;
      }
      // span {
      // font-size: 20px;
      // width: 20px;
      // height: 20px;
      // margin-right: 8px;
      // }
    }
  }
}

#drive-footer {
  padding: 8px;
  text-align: right;
  border-top-width: 1px;
  border-top-style: solid;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .mat-mdc-raised-button {
    line-height: 20px;
    font-size: 12px;
  }

  #drive-footer-info {
    margin-left: auto;
  }

  > div > span {
    margin: 0 8px;
  }

  @include screen('phone') {
    display: none;
  }
}

#drive-footer-mobile {
  display: none;
  position: absolute;
  width: 100%;
  // bottom: -60px;
  bottom: 0px;
  padding: 8px 0;
  justify-content: space-evenly;
  gap: 10px;
  box-shadow: 0 -2px 2px rgb(0 0 0 / 30%);

  @include screen('phone') {
    display: flex;
  }

  &.active {
    bottom: 0;
  }
}

#floating-mobile-button {
  position: absolute;
  bottom: 30px;
  right: 30px;
  display: none;
  overflow: hidden;
  transition: bottom 0.25s ease-in-out;

  &.active {
    bottom: 76px;
  }

  @include screen('phone') {
    display: block;
  }
}

.mdi-mat-menu-element {
  margin: 0 16px 0 4px;
}


// Hacky fix for an unknown layout issue with tables. See T388 for elegant fixing.
app-file-list-view{
  display: contents;

  @include screen('phone') {
    display: block;
    &.subfolder{
      display: contents;
    }
  }
}