/**
 * Nextcloud - passman
 *
 * @copyright Copyright (c) 2016, Sander Brand (brantje@gmail.com)
 * @copyright Copyright (c) 2016, Marcos Zuriaga Miguel (wolfi@wolfi.es)
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

//override nc style to fix wrong offset
#content {
  padding-top: 47px !important; // 45px but +2 because of borders
  height: 100%;
  width: 100%;
}

//fix for different heights of passwordicon
.icon-image{
  width: 16px;
}

//fix for ui-element behind Background
.angularjs-datetime-picker{
  z-index: 1000;
}

.link{
  color:var(--color-primary);
}


//this fixes the scrollbars, because passman-contols are shown above the sidebar.
#app-sidebar{
  height: auto;
  .sidebar{
    display: inline-block;
    .sidebar-icon {
      margin-right: 15px;
      .icon-image{
        width: 44px;
      }
      i {
        width: 44px;
      }
    }
    .sidebar-label{
      float:right;
      line-height: 44px;
    }
  }
}

.vaultlist_sidebar_hidden{
  width: 100vw !important;
  margin-left: 0px !important;
}
#app-content {

  margin-left: 300px;

  @media only screen and (max-width: 769px) {
    width: 100vw;
  }
  @media only screen and (min-width: 770px) {
    width: calc(100vw - 300px);
  }

  overflow-x: hidden;

  //width: 100%;
  #app-content-wrapper {
    min-height: 95%;
    display:flex;
    //hack for missing separatorbar when app-sidebar is opened
    height: calc(100vh - 49px);

    #passman-controls {
      text-align: center;
      &.sidebar-shown {
        //padding-right: 27% !important;
        .title {
          @media screen and (max-width: 765px) {
            display: none;
          }
          @media screen and (min-width: 769px) and (max-width: 1120px) {
            display: none;
          }
        }
      }
      border-bottom: 1px solid #c9c9c9;

    }

    .title {
      text-align: center;
      display: inline-block;
      font-weight: bold;
      margin-top: 10px;
      @media screen and (max-width: 575px) {
        display: none;
      }
      @media screen and (min-width: 769px) and (max-width: 820px) {
        display: none;
      }
    }
    .breadcrumb {
      float: left;
    }
    .actions.creatable {
      float: left;
      overflow: hidden;
      .bubble {
        position: relative;
        width: 185px;
        @include border-radius(5px);
        box-shadow: 0 1px 10px rgba(50, 50, 50, .7);
        ul {
          li {
            padding-left: 10px;
          }
          .menuitem {
            font-size: 12px;
            display: inline;
          }
        }
      }
      .bubble:after {
        right: inherit;
        left: 10px;
        top: -19px;
      }
    }

    .viewModes {
      float: right;
      margin-right: 5px;
      margin-top: 3px;
      .view-mode:first-child {
        @include border-left-radius(5px);
        border: 1px solid rgba(240, 240, 240, .9);
      }
      .view-mode:last-child {
        @include border-right-radius(5px);
        border: 1px solid rgba(240, 240, 240, .9);
      }
      .view-mode {
        display: inline-block;
        padding: 7px;
        background-color: rgba(240, 240, 240, .9);
      }
      .view-mode.active {
        display: inline-block;
        padding: 7px;
        background-color: rgba(226, 226, 226, 0.9);
      }
      .view-mode {
        cursor: pointer;
        display: inline-block;
        padding: 7px;
      }
    }

    .searchboxContainer {
      /*display: inline-block;*/
      visibility: hidden;
      display: none;
      margin-right: 14px;
      float: right;
      .searchbox {
        display: inline-block;
      }
      .searchclear {
        color: #ccc;
        cursor: pointer;
        font-size: 18px;
        height: 14px;
        margin: auto;
        position: absolute !important;
        right: 10px;
        top: 12px;
        z-index: 99999999;
      }
      .searchOptions {
        position: relative;
        bottom: 5px;
        background: #fff;
        border: 1px solid #ddd;
        padding: 5px;
        width: calc(100% - 3px);
        box-shadow: 3px 3px 5px #888888;
        @include border-bottom-radius(3px);
      }
    }

    .credential-table {
      width: 100%;
      tr:hover {
        background-color: darken(#fff, 4%);
      }
      tr {
        &.selected {
          background-color: #f8f8f8;
        }
        td {
          cursor: pointer;
          padding: 5px;
          border-bottom: 1px solid #eeeeee;
          .icon {
            font-size: 19px;
            float: left;
            margin-right: 5px;
            margin-left: 3px;
          }

          .icon-more {
            display: inline-block;
            float: right;
            margin-left: 5px;
            margin-top: 1px;
            opacity: 0.4;
            height: 20px;
            width: 32px;
            cursor: pointer;
          }
          .icon-more:hover {
            opacity: 1;
          }
          .popovermenu {
            margin-top: 25px;
            height: 100px;
            width: 100px;
            right: -2px !important;
            box-shadow: 0 1px 10px rgba(50, 50, 50, .7);
            ul {
              display: block;
              width: 100px;
              height: 75px;
              li {
                padding: 0px;
              }
              .menuitem {
                font-size: 12px;
                display: inline;
              }
            }
            .action {
              padding: 10px;
              margin: -10px;
            }
          }
        }
      }
    }

    .tags {
      float: right;
      .tag {
        background-color: rgba(240, 240, 240, .9);
        padding: 4px;
        font-size: 12px;
        margin-right: 3px;
        @include border-radius(5px);
      }
      .tag:last-child {
        margin-right: 8px;
      }
    }

    .grid-view {
      width: 100%;
      height: 100%;
      //margin-top: 44px;
      display: flex;
      flex-wrap: wrap;
      .credential {
        display: flex;
        width: 100%;
        border: 2px solid rgba(240, 240, 240, .9);
        margin: 25px;
        @include border-radius(10px);
        .credential_content {
          display: flex;
          padding: 2px;
          flex-direction: column;
          width: 100%;
          cursor: pointer;
          font-size: 1.75em;
          //text-align: center;
          .label {
            padding-top: 0.5em;
            //padding-left: 1em;
            padding-right: 1em;
            line-height: 1.3em;
            word-wrap: break-word;
            float: right;
          }
          .icon{
          }
          .tags {
            margin: 0 0 auto;
            text-align: right;
            //margin-bottom: 0.5em;
            .tag {
              color: #000 !important;
              margin-top: 5px;
              display: inline-block;
              left:0;
            }
          }
        }
      }
      @media all and (min-width: 40em) {
        .credential {
          width: 40%;
        }
      }
      @media all and (min-width: 58em) {
        .credential {
          width: 26%;
        }
      }
      @media all and (min-width: 78em) {
        .credential {
          width: 20%;
        }
      }

    }

    .edit_credential {
      padding-top: 10px;
      label {
        display: block;
      }
      input[type="text"], input[type="password"] {
        width: 100%;
      }
      .tags {
        float: left;
        .tag {
          background-color: rgba(240, 240, 240, .9);
          padding: 4px;
          font-size: 11px;
        }
      }
      tags-input {
        .tags {
          width: 100%;
          .input {
          }
        }
      }
      .credential_textarea {
        width: 100%;
        height: 100px;
      }
      .password_settings {
        label {
          overflow: hidden;
          input[type="checkbox"] {
            width: auto !important;
            float: left;
          }
          .label {
            &.sm {
              font-size: 12px;
            }
            float: left;
          }
        }
        .password-settings-padding-left-fix{
          padding-left: 0 !important;
        }
      }
      .field-value {
        .valueInput {
          padding-right: 0;
          input {
            @include border-right-radius(0);
          }
          .pw-gen .generate_pw .cell:last-child {
            @include border-right-radius(0);
          }
        }
        .selectType {
          padding-left: 0;
          margin-left: 0px;
          select {
            @include border-left-radius(0);
          }
        }
      }
      .custom_fields, .files {
        margin-top: 10px;
        table {
          width: 100%;
          thead {
            th.dragger {
              width: 3%;
            }
            th {
              color: #fff;
            }
            th.field_actions {
              width: 15%;
            }
          }
          tr:hover {
            background-color: transparent;
          }
          tr {
            td.dragger {
              width: 3%;
              text-align: center;
              cursor: move;
              cursor: -webkit-grab;
              cursor: -moz-grab;
              cursor: grab;
            }
            td.field_actions {
              font-size: 13px;
              width: 15%;
              i {
                cursor: pointer;
              }
            }
            td, th {
              width: 20%;
              padding: 5px;
              .editable-has-buttons.editable-input {
                width: 55%;
              }
            }
            td {
              height: 50px;
              vertical-align: middle;
            }
          }
        }
      }
      .file_tab {

      }
      .otpText {
        padding-right: 10px;
      }

      .import-selection{
        select{
          margin-left: 15px;
        }
      }

    }

    .main_list{
      flex:1;
      float:left;
      height:auto;
      overflow:auto;
      width:100%;
      .share{
        overflow:hidden;
      }
      .nopasswords{
        margin-right: auto;
        margin-left: auto;
        margin-top: 10%;
        text-align: center;
      }
      .belowList{
        margin-right: auto;
        margin-left: auto;
        margin-top: 1%;
        text-align: center;
      }
    }

    .app_sidebar {
      float:right;
      h2 {
        margin-bottom: 10px;
        font-weight: 400;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 90%;
      }
      .close.icon-close {
        position: absolute;
        top: 10px;
        right: 10px;
        cursor: pointer;
      }
      padding: 10px;
      &.item_selected {
        height: 25%;
        display: inline-block;
      }
      overflow-y: auto;

      .credential-data {
        .row {
          margin-bottom: 11px;
        }
        .tags {
          margin-top: 15px;
          margin-bottom: 15px;
          float: none;
          .tag {
            background-color: rgba(240, 240, 240, .9);
            padding: 4px;
            margin-right: 3px;
          }
        }
      }
    }
  }
}

.credential_field {
  overflow: hidden;
  .cell, .value {
    float: left;
  }
  .value {
    &.ellipsis {

    }
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .tools {
    margin-left: 10px;
    margin-top: 8px;
    overflow: hidden;
    float: left;
    .cell {
      cursor: pointer;
      margin-right: 4px;
    }
  }
}

.progress {
  margin-top: 10px;
  height: 20px;
  .progress-bar {
    position: relative;
    height: 20px;
    background-image: none;
    background-color: #0082c9;
    .progress-label {
      position: absolute;
      top: 0;
      z-index: 2;
      text-align: center;
      width: 100%;
    }
  }
}

.loaderContainer {
  height: 140px;
  width: 120px;
  margin-top: 30px;
  margin-left: -60px;
  top: 30%;
  left: 50%;
  position: absolute;
}

.loaderContainer .text {
  width: 120px;
  text-align: center;
}

.loader {
  border-bottom: 10px solid #1d2d44;
  border-left: 10px solid #c9c9c9;
  border-right: 10px solid #c9c9c9;
  border-top: 10px solid #c9c9c9;
  height: 120px;
  width: 120px;
  border-radius: 120px;
  animation: 1.1s linear 0s normal none infinite running load8;
}

@keyframes load8 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.inputfile {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

.inputfile + label {
  font-size: 1.25em;
  background-color: rgba(240, 240, 240, .9);
  margin-top: 4px;
  padding: 5px;
  margin-right: 4px;
  border-right: 1px solid #c9c9c9;
}

.inputfile:focus + label,
.inputfile + label:hover {
  background-color: #c9c9c9;
}

.inputfile + label {
  cursor: pointer; /* "hand" cursor */
}

.btn-danger {
  color: #000000;
  background-color: #ff0000;
}

.icon-label {
  overflow: hidden;
  input {
    width: calc(100% - 28px) !important;
    float: left;
    background: #fff;
    color: #555;
    cursor: text;
    font-family: inherit;
    border: 1px solid #ddd;
    outline: none;
    border-radius: 3px;
    margin: 3px 0 3px 0;
    padding: 7px 6px 5px;
    font-size: 13px;
    @include border-left-radius(0)
  }
  .icon-picker {
    float: left;
    margin-top: 3px;
    .cell {
      height: 32px;
      padding: 7px 12px 2px 12px;
      font-size: 14px;
      border: 1px solid #ddd;
      background-color: lighten(#ddd, 5%);
      cursor: pointer;
      @include border-left-radius(6px);
    }
    .cell:hover {
      color: rgb(0, 102, 255);
    }
  }
}

#iconPicker {
  .iconList {
    float: left;
    width: 60%;
    max-height: 310px;
    overflow: auto;
    .icon{
      img{
        cursor: pointer;
      }
      padding: 10px;
      cursor: pointer;
      float: left;
    }
  }
  .iconModifier {
    margin-left: 10px;
    float: right;
    width: calc(40% - 10px);
  }
  .iconSearch {
    width: 100%;
  }
}
