@import "variables.scss";

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html,
body {
  font-family: $font-family-sans-serif;
  font-size: $font-size-base;
  line-height: $line-height-base;
  -webkit-font-smoothing: antialiased;
}

body {
  width: 375px !important;
  height: 600px !important;
  overflow: hidden;
  color: $text-color;
  background-color: $background-color;

  @include themify($themes) {
    color: themed("textColor");
    background-color: themed("backgroundColor");
  }

  &.body-sm {
    width: 375px !important;
    height: 500px !important;
  }

  &.body-xs {
    width: 375px !important;
    height: 300px !important;
  }

  &.body-full {
    width: 100% !important;
    height: 100% !important;
  }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: $font-family-sans-serif;
  font-size: $font-size-base;
  font-weight: normal;
}

p {
  margin-bottom: 10px;
}

ul,
ol {
  margin-bottom: 10px;
}

img {
  border: none;
}

a {
  text-decoration: none;

  @include themify($themes) {
    color: themed("primaryColor");
  }

  &:hover,
  &:focus {
    @include themify($themes) {
      color: darken(themed("primaryColor"), 6%);
    }
  }
}

input,
select,
textarea {
  @include themify($themes) {
    color: themed("textColor");
    background-color: themed("inputBackgroundColor");
  }
}

input,
select,
textarea,
button {
  font-size: $font-size-base;
  font-family: $font-family-sans-serif;
}

input[type*="date"] {
  @include themify($themes) {
    color-scheme: themed("dateInputColorScheme");
  }
}

::-webkit-calendar-picker-indicator {
  @include themify($themes) {
    filter: themed("webkitCalendarPickerFilter");
  }
}

::-webkit-calendar-picker-indicator:hover {
  @include themify($themes) {
    filter: themed("webkitCalendarPickerHoverFilter");
  }
  cursor: pointer;
}

select {
  width: 100%;
  padding: 0.35rem;
}

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

app-root > div {
  height: 100%;
}

main::-webkit-scrollbar,
cdk-virtual-scroll-viewport::-webkit-scrollbar,
.vault-select::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

main::-webkit-scrollbar-track,
.vault-select::-webkit-scrollbar-track {
  background-color: transparent;
}

cdk-virtual-scroll-viewport::-webkit-scrollbar-track {
  @include themify($themes) {
    background-color: themed("backgroundColor");
  }
}

main::-webkit-scrollbar-thumb,
cdk-virtual-scroll-viewport::-webkit-scrollbar-thumb,
.vault-select::-webkit-scrollbar-thumb {
  border-radius: 10px;
  margin-right: 1px;

  @include themify($themes) {
    background-color: themed("scrollbarColor");
  }

  &:hover {
    @include themify($themes) {
      background-color: themed("scrollbarHoverColor");
    }
  }
}

header {
  min-height: 44px;
  max-height: 44px;
  display: flex;
  border-bottom: 1px solid #000000;

  @include themify($themes) {
    color: themed("headerColor");
    background-color: themed("headerBackgroundColor");
    border-bottom-color: themed("headerBorderColor");
  }

  .left,
  .right {
    flex: 1;
    display: flex;
    min-width: -webkit-min-content; /* Workaround to Chrome bug */
    .header-icon {
      margin-right: 5px;
    }
  }

  .right {
    justify-content: flex-end;
    align-items: center;
    app-avatar {
      max-height: 30px;
      margin-right: 5px;
    }
  }

  .center {
    display: flex;
    align-items: center;
    text-align: center;
    min-width: 0;
  }

  .login-center {
    margin: auto;
  }

  app-pop-out > button,
  div > button,
  div > a {
    border: none;
    padding: 0 10px;
    text-decoration: none;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    height: 100%;
    white-space: pre;

    @include themify($themes) {
      color: themed("headerColor");
      background-color: themed("headerBackgroundColor");
    }

    &:hover,
    &:focus {
      @include themify($themes) {
        background-color: themed("headerBackgroundHoverColor");
        color: themed("headerColor");
      }
    }

    &[disabled] {
      opacity: 0.65;
      cursor: default !important;
      background-color: inherit !important;
    }

    i + span {
      margin-left: 5px;
    }
  }

  app-pop-out {
    display: flex;
    padding-right: 0.5em;
  }

  .title {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .search {
    padding: 7px 10px;
    width: 100%;
    text-align: left;
    position: relative;
    display: flex;

    .bwi {
      position: absolute;
      top: 15px;
      left: 20px;

      @include themify($themes) {
        color: themed("headerInputPlaceholderColor");
      }
    }

    input {
      width: 100%;
      margin: 0;
      border: none;
      padding: 5px 10px 5px 30px;
      border-radius: $border-radius;

      @include themify($themes) {
        background-color: themed("headerInputBackgroundColor");
        color: themed("headerInputColor");
      }

      &::selection {
        @include themify($themes) {
          // explicitly set text selection to invert foreground/background
          background-color: themed("headerInputColor");
          color: themed("headerInputBackgroundColor");
        }
      }

      &:focus {
        border-radius: $border-radius;
        outline: none;

        @include themify($themes) {
          background-color: themed("headerInputBackgroundFocusColor");
        }
      }

      &::-webkit-input-placeholder {
        @include themify($themes) {
          color: themed("headerInputPlaceholderColor");
        }
      }
      /** make the cancel button visible in both dark/light themes **/
      &[type="search"]::-webkit-search-cancel-button {
        -webkit-appearance: none;
        appearance: none;
        height: 15px;
        width: 15px;
        background-repeat: no-repeat;
        mask-image: url("../images/close-button-white.svg");
        -webkit-mask-image: url("../images/close-button-white.svg");
        @include themify($themes) {
          background-color: themed("headerInputColor");
        }
      }
    }
  }

  .left + .search,
  .left + .sr-only + .search {
    padding-left: 0;

    .bwi {
      left: 10px;
    }
  }

  .search + .right {
    margin-left: -10px;
  }
}

.no-bg {
  background-color: transparent;
}

.no-pad {
  padding: 0 !important;
}

.content {
  padding: 15px 5px;
}

.tabs {
  width: 100%;
  height: 55px;
  border-top: 1px solid #000000;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;

  @include themify($themes) {
    background-color: themed("tabBackgroundColor");
    border-top-color: themed("borderColor");
  }

  ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;

    li {
      flex: 1;
      display: inline-block;
      padding: 0;
      margin: 0;

      a,
      button {
        text-align: center;
        display: block;
        padding: 7px 0;
        text-decoration: none;
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;

        @include themify($themes) {
          color: themed("mutedColor");
        }

        &:hover,
        &:focus {
          @include themify($themes) {
            background-color: themed("tabBackgroundHoverColor");
          }
        }

        i {
          display: block;
          margin-bottom: 2px;
          text-align: center;
        }
      }

      &.active {
        a,
        button {
          @include themify($themes) {
            color: themed("primaryColor");
          }
        }
      }
    }
  }
}

app-root {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 980;
  @include themify($themes) {
    background-color: themed("backgroundColor");
  }
}

// Adds padding on each side of the content if opened in a tab
@media only screen and (min-width: 601px) {
  header,
  main {
    padding: 0 calc((100% - 500px) / 2);
  }
}

main {
  position: absolute;
  top: 44px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow-y: auto;
  overflow-x: hidden;

  @include themify($themes) {
    background-color: themed("backgroundColor");
  }

  &.no-header {
    top: 0;
  }

  &.flex {
    display: flex;
    flex-flow: column;
    height: calc(100% - 44px);

    &.tab-page {
      height: calc(100% - 99px);
    }
  }
}

.tab-page {
  main {
    bottom: 55px;
  }
}

.center-content,
.no-items,
.full-loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  flex-direction: column;
  flex-grow: 1;
}

.no-items,
.full-loading-spinner {
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  .no-items-image {
    @include themify($themes) {
      content: url("../images/search-desktop" + themed("svgSuffix"));
    }
  }

  .bwi {
    margin-bottom: 10px;

    @include themify($themes) {
      color: themed("disabledIconColor");
    }
  }
}

// cdk-virtual-scroll
.cdk-virtual-scroll-viewport {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.cdk-virtual-scroll-content-wrapper {
  width: 100%;
}

.org-filter-content {
  padding-bottom: 5px;
  padding-left: 7px;
  .org-filter {
    @include themify($themes) {
      background-color: themed("buttonBackgroundColor");
    }
    border-radius: $border-radius;
    padding: 6px 10px;
    width: auto;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .org-filter-text-container {
      // src: https://css-tricks.com/snippets/css/truncate-string-with-ellipsis/
      display: flex;
      flex: 1;
      min-width: 0;

      .org-filter-text-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
}
.vault-select {
  overflow-y: auto;
  display: flex;
  flex-direction: column;

  @include themify($themes) {
    background-color: themed("boxBackgroundColor");
  }
  margin-right: 18px;
  margin-top: 1px;
  @include themify($themes) {
    border: 1px solid themed("borderColor");
  }
  border-radius: $border-radius;
  button {
    border: none;
    background: transparent;
    width: auto;
    max-width: 100%;

    padding: 5px 10px;
    text-align: start;
    @include themify($themes) {
      color: themed("textColor");
    }

    a {
      @include themify($themes) {
        color: themed("textColor");
      }
    }

    &:hover {
      @include themify($themes) {
        background-color: themed("boxBackgroundHoverColor");
      }
    }

    i.vault-select-prefix-icon {
      margin-right: 5px;
    }
    i.vault-select-suffix-icon {
      margin-left: 5px;
    }

    .vault-select-org-text-container {
      display: flex;
      flex: 1;
      min-width: 0;
      align-items: center;
      .vault-select-org-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
  .border {
    @include themify($themes) {
      background: themed("borderColor");
    }
    left: 10px;
    width: calc(100% - 20px);
    height: 1px;
    position: relative;
  }
}

.login-with-device {
  .fingerprint-phrase-header {
    padding-top: 1rem;
    display: block;
  }

  @include themify($themes) {
    .fingerprint-text {
      color: themed("codeColor");
      font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
        monospace;
      padding: 1rem 0;
    }
  }

  .resend-notification {
    padding-bottom: 1rem;
    a {
      cursor: pointer;
    }
  }

  .footer {
    padding-top: 1rem;

    a {
      padding-top: 1rem;
      display: block;
    }
  }
}
