@import "variables.scss";
@import "mixins.scss";
@import "animations.scss";

* {
  @include css-prefix(user-select, none);
  @include css-prefix(touch-callout, none);
}

:root {
  @media (orientation: portrait) and (min-width: 321px) {
    font-size: 16px;
  }
  @media (orientation: portrait) and (min-width: 411px) {
    font-size: 18px;
  }
  @media (orientation: portrait) and (min-width: 480px) {
    font-size: 20px;
  }
  @media (orientation: portrait) and (min-width: 600px) {
    font-size: 22px;
  }
  @media (orientation: portrait) and (min-width: 760px) {
    font-size: 26px;
  }
  @media (orientation: portrait) and (min-width: 800px) {
    font-size: 30px;
  }
  @media (orientation: portrait) and (min-width: 900px) {
    font-size: 32px;
  }

  @media (orientation: landscape) and (min-width: 720px) and (min-height: 361px) {
    font-size: 16px;
  }
  @media (orientation: landscape) and (min-width: 813px) {
    font-size: 18px;
  }
  @media (orientation: landscape) and (min-width: 900px) {
    font-size: 20px;
  }
  @media (orientation: landscape) and (min-width: 960px) {
    font-size: 22px;
  }
  @media (orientation: landscape) and (min-width: 980px) {
    font-size: 24px;
  }
  @media (orientation: landscape) and (min-width: 1200px) {
    font-size: 28px;
  }
  @media (orientation: landscape) and (min-width: 1280px) {
    font-size: 32px;
  }
}

html,
body {
  height: 100%;
  overflow: auto;
}

body {
  background: transparent;
  overflow: auto;

  a {
    &:focus,
    &:hover {
      color: $colour-text1;
      border-bottom-color: $colour-text1;
    }
  }

  h2 {
    font-size: 1.6em;
    line-height: 1em;
  }

  button.btn {
    &.btn-default:not([disabled]) {
      &:hover,
      &:focus {
        background-color: rgba($colour-text1, 0.3);
        color: $colour-text1;
        border-color: $colour-text1;
        text-decoration: none;
      }
    }

    &.btn-icon {
      &:hover,
      &:focus {
        i {
          opacity: 0.4;
        }
      }
    }
  }

  input,
  textarea {
    @include css-prefix(user-select, text);
    @include css-prefix(touch-callout, default);
  }

  textarea.form-control {
    padding: 0.5rem 1rem;
  }

  .alert {
    position: absolute;
    z-index: 200;
  }

  .checkbox {
    width: 3rem;
    height: 1.5rem;

    input[type="checkbox"]:checked + label {
      left: 1.65rem;
    }

    label {
      width: 1.2rem;
      height: 1.2rem;
    }
  }

  .container {
    height: 100vh;
  }

  .form-group {
    &.btn-icon-container {
      .btn-icon {
        &:focus,
        &:hover {
          background-color: #7db2be;
          border: none;
        }
      }
    }
  }

  .header-panel {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;

    button {
      font-size: 1.5em;
      line-height: 0.9em;
    }
  }

  .lookahead-container .lookahead:after {
    position: absolute;
    margin-left: 0.25em;
    @include icon("\f0d0");
  }

  .view {
    .view-content {
      height: 100%;

      &.ng-enter {
        z-index: 10 !important;
      }

      &.ng-leave {
        z-index: 20;
      }
    }
  }

  .well {
    a {
      &:focus,
      &:hover {
        color: $colour-text2;
        border-bottom-color: $colour-text2;
      }
    }

    button.btn.btn-default {
      font-size: 1rem;

      &:not([disabled]) {
        &:hover,
        &:focus {
          background-color: transparent;
          color: $colour-text2;
          border-color: $colour-text2;
          text-decoration: none;
        }
      }
    }
  }
}

#bookmark-panel {
  .mobile-landscape {
    min-height: 2.3rem;

    @media (orientation: landscape) {
      flex: 1 0;
      display: flex;
      flex-direction: row;
      overflow: auto;
    }
  }

  .tags-container {
    .badge {
      font-size: 1rem;
      line-height: 1.3rem;

      &:focus,
      &:hover {
        i {
          color: $colour-link;
        }
      }
    }

    .label {
      padding: 0.6rem 1rem;
      border-radius: $border-radius-input;
      margin: 0 0.5rem 0.6rem 0;
    }

    @media (orientation: landscape) {
      flex: auto;
      height: 100%;
      max-height: none;
      margin-top: 0;
      margin-bottom: 0;
    }
  }

  .tags-input-container {
    @media (orientation: landscape) {
      height: 2.3rem;
      width: 40%;
      margin-right: 1rem;

      input {
        line-height: 2rem;
      }
    }
  }

  .textarea-container {
    max-height: 15rem;

    @media (orientation: landscape) {
      flex: 1 0 4rem;
    }
  }
}

#login-panel {
  .form-group {
    input {
      font-size: 0.92em;
    }
  }

  .login-form-existing,
  .login-form-new,
  .update-service-panel {
    height: auto;
  }

  .login-form-new {
    .toggle-form {
      display: block;
    }
  }

  .logo {
    background-size: 11rem;
  }

  .well {
    margin-bottom: 0;
  }

  @media (orientation: landscape) {
    form {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      flex-grow: 1;

      .form-content {
        display: flex;
        justify-content: center;
        height: auto;

        & > div {
          position: initial;
        }
      }
    }

    .header-panel {
      position: absolute;
      top: 0.75rem;
      width: calc(100% - 1.5rem);
    }

    .logo {
      height: 17rem;
      flex: 1 12rem;
      background-size: 13rem;
      background-position: 90% 50%;
    }

    .view-content {
      flex-direction: row;
      align-items: center;
    }
  }
}

#qr-panel {
  #qr {
    @media (orientation: landscape) {
      height: 7rem;
      width: 7rem;
    }
  }
}

#search-panel {
  &.search-bar-bottom {
    .view-content {
      flex-direction: column-reverse;

      .bookmark-tree-panel,
      .search-results-panel {
        padding-top: 0.75rem;
      }

      .btn-fab.fixed {
        bottom: 5rem;
      }
    }
  }

  .view-content {
    padding-left: 0;

    .bookmark-list .bookmark {
      &:not(.folder) {
        &:focus,
        &:hover {
          & > .bookmark-content {
            background-color: $colour-text1;
          }
        }

        & > .bookmark-content > .bookmark-heading {
          margin-right: 0;
          transition: none;
        }
      }

      &.folder {
        &.open > .bookmark-content > .bookmark-heading:after {
          @include icon("\f106");
        }

        & > .bookmark-content > .bookmark-heading:not(.opening):after {
          opacity: 0.6;
        }
      }
    }

    .header-panel,
    .search-results-panel {
      padding-left: 0.75rem;
      padding-right: 0.75rem;
    }

    .header-panel {
      display: flex;
      flex-direction: row-reverse;

      .search-form {
        .btn-clear {
          font-size: 0.7em;
        }

        .lookahead-container .lookahead:after {
          font-size: 0.7em;
        }
      }
    }

    .search-results-panel {
      & > h4 {
        margin: 1rem;
      }
    }

    @media all and (orientation: portrait) {
      .bookmark-tree-panel .description {
        @include text-overflow-ellipsis;
      }
    }
  }
}

#settings-panel {
  .form-group {
    a {
      &:focus,
      &:hover {
        color: $colour-text2;
        border-bottom-color: $colour-text2;
      }
    }
  }

  .sync-panel {
    .id-url,
    .service-url {
      @media (orientation: landscape) {
        position: absolute;
        width: auto;
      }
    }
  }
}

#scan-panel {
  @media (orientation: landscape) {
    h3 {
      margin: 0;
    }

    .buttons {
      flex: 0 5rem;
    }

    .target {
      width: 10rem;
      height: 10rem;
    }
  }
}
