/**
 * Wpfd
 *
 * We developed this code with our hearts and passion.
 * We hope you found it useful, easy to understand and to customize.
 * Otherwise, please feel free to contact us at contact@joomunited.com *
 * @package WP File Download
 * @copyright Copyright (C) 2013 JoomUnited (http://www.joomunited.com). All rights reserved.
 * @copyright Copyright (C) 2013 Damien Barrère (http://www.crac-design.com). All rights reserved.
 * @license GNU General Public License version 2 or later; http://www.gnu.org/licenses/gpl-2.0.html
 */

$image-theme-path: '../../../assets/images/theme' !default;

#et-boc .wpfd-content-tree, .wpfd-content-tree {
  &.wpfd-content {
    overflow: unset;
  }
  ul li.directory + .ext {
      margin-top: 5px !important;
  }
  a {
    text-decoration: none !important;
    border-bottom: 0;
    box-shadow: none;
    &:not(.tree-download-category):not(.tree-download-selected):hover, &:focus, &:active {
      color: #3d3d3d !important;
      box-shadow: none;
      outline: none;
    }
  }
  .active > a {
    &:first-of-type {
      color: #3d3d3d;
      font-weight: bold;
      span {
        color: #3d3d3d !important;
        font-weight: bold !important;
      }
    }
    > {
      i.zmdi-folder, div.icon-open-close, div.icon-open-close:before {
        color: #3d3d3d !important;
        font-weight: bold !important;
      }
    }
  }
  h2 {
    background: #fff;
    padding: 10px 15px;
    margin: 0 0 10px 0;
    word-wrap: break-word;
    font-size: 20px;
  }
  .head-category-tree {
    &:before {
      content: '>>';
      font-size: 16px;
      display: inline-block;
      text-align: left;
      text-transform: none;
      vertical-align: middle;
      margin: 0 3px 0 0;
    }
  }
  ul {
    list-style: none !important;
    .wpfd-file.ext, li.directory {
      //background: top left transparent no-repeat;
      color: #fff;
      padding: 0;
      line-height: 28px !important;
      margin-left: 0 !important;
    }
    .wpfd-file.ext a.wpfd-file-link,
    li.directory a.catlink {
      font-size: 1em;
      line-height: 28px;
      height: 28px;
      display: block;
      color: #666666;
    }
    li.directory a.catlink span {
      margin: 0 0 0 15px;
      position: relative;
      text-transform: none;
      font-size: 15px;
      font-weight: normal;
      font-stretch: normal;
      font-style: normal;
      letter-spacing: normal;
      text-align: left;
      vertical-align: baseline;
      display: block;
      line-height: 26px;
      height: 26px;
      float: left;
      max-width: 90%;
      overflow: hidden;
      text-overflow: ellipsis;
      @media screen and(max-width: 768px) {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
      }
      @media screen and(max-width: 420px) {
        max-width: 150px;
      }
      &:hover {
        font-weight: bold;
        color: #323232;
        box-shadow: none;
      }
    }
  }
  > ul:not(.breadcrumbs) {
    margin: 20px 0;
    padding: 0 !important;
  }

  .icon-open-close {
    width: 9px;
    height: 28px;
    float: left;
    margin: 0;
    position: relative;
    box-sizing: border-box;
    text-align: left;
  }
  .zmdi-folder, .zmdi-folder-open {
    font-size: 20px;
    margin-top: 0;
    margin-left: 5px;
    color: #808080;
    font-weight: bold;
    vertical-align: baseline;
    line-height: 28px;
    float: left;
  }
  li.directory {
    .icon-open-close:before {
      position: relative;
      top: 0;
      display: inline-block;
      font-family: Material-Design-Iconic-Font;
      font-size: 18px;
    }
    &.expanded .icon-open-close:before {
      content: '\f2f2';
      font-size: 22px;
      color: #888888;
      transform: translateY(-50%);
      top: 50%;

    }
    &.collapsed .icon-open-close:before {
      content: '\f2f6';
      color: #888888;
      font-size: 22px;
      transform: translateY(-50%);
      top: 50%;
    }
  }
  ul {
    li {
      &.directory {
        width: auto;
        list-style: inherit;
        position: relative;
        > ul {
          margin: 0;
          padding: 2px 0 0 20px !important;
        }
        &.expanded {
          > .catlink {
            > .zmdi-folder:before {
              content: '';
              display: block;
              width: 24px;
              height: 24px;
              background: url('#{$image-theme-path}/folder_open.svg') left center no-repeat;
              margin-left: -2px;
            }
          }
          &.active {
            > .catlink {
              > .zmdi-folder:before {
                content: '';
                display: block;
                width: 24px;
                height: 24px;
                background: url('#{$image-theme-path}/folder_open_selected.svg') left center no-repeat;
              }
            }
          }
        }
        &.open {}
        &.wpfd-loading-tree {
          background: none;
        }
      }
      &.directory.expanded {
        .icon-open-close {
          padding: 1px 0;
        }
      }
      &.ext {
        position: relative;
        padding-left: 34px;
        line-height: 32px;
        margin: 0;
        list-style: inherit;
        a {
          margin-left: 7px;
          text-transform: none;
          font-size: 15px;
          font-weight: normal;
          font-stretch: normal;
          font-style: normal;
          line-height: 1.2;
          letter-spacing: normal;
          text-align: left;
          color: #999999;
          vertical-align: baseline;
          display: inline-block;
          min-height: 19px;
        }


        .wpfd_checkbox {
          display: inline-block;
          vertical-align: middle;
          margin: 0 3px 0 -19px;
          width: 16px;
          height: 16px;
          background-color: transparent;
          .cbox_file_download[type="checkbox"] {
            display:none;
            -webkit-appearance: checkbox;
            box-sizing: border-box;
          }
          span {
            width: 16px;
            height: 16px;
            line-height: 13px;
            vertical-align: top;
            margin: 0;
            box-sizing: border-box;
            display: inline-block;
            font-size: 13px;
            &:before {
              content: '';
              display: inline-block;
              width: 16px;
              height: 16px;
              margin: 0;
              vertical-align: middle;
              transition: .6s;
              text-align: center;
              background: #fff;
              border: 1px solid #ccc;
              color: #808080;
              padding: 1px;
              font-size: 13px;
              box-sizing: border-box;
            }
            &:hover,
            &:focus {
              cursor: pointer;
            }
            &:hover {
              &:before {
                background-color: #efefef;
              }
            }
          }
          .cbox_file_download:checked {
            + span:before {
              content: '\2714';
            }
          }
        }

      }
    }
    .wpfd-file {
      &.ext {
        width: 16px;
        height: 26px;
        display: inline-block;
        vertical-align: middle;
      }
      img {
        width: 16px;
        display: inline-block;
        vertical-align: middle;
      }
      &.ext[class*='wpfd-icon-set-'] {
        width: 26px;
        height: 26px;
        background-size: 100%;
      }
      &.ext[class*='wpfd-icon-set-png'] {
        background-size: 100% !important;
      }
      &.ext[class*='wpfd-icon-set-svg'] {
        background-size: 100% !important;
      }
      &.ext:not([class*='wpfd-icon-set-']) {
        background-image: url(#{$image-theme-path}/small/neutral.png);
        background-size: 16px 23px;
        background-repeat: no-repeat;
        color: transparent;
        vertical-align: middle;
        $defaultExtensions: (7z,ace,bz2,dmg,gz,rar,tgz,zip,csv,doc,docx,html,key,keynote,odp,ods,odt,pages,pdf,pps,ppt,pptx,rtf,tex,txt,xls,xlsx,xml,bmp,exif,gif,ico,jpeg,jpg,png,psd,tif,tiff,aac,aif,aiff,alac,amr,au,cdda,flac,m3u,m4a,m4p,mid,mp3,mp4,mpa,ogg,pac,ra,wav,wma,3gp,asf,avi,flv,m4v,mkv,mov,mpeg,mpg,rm,swf,vob,wmv,css,img);
        @each $extension in $defaultExtensions {
          &.ext-#{$extension} {
            background-image: url('#{$image-theme-path}/small/#{$extension}.png');
          }
        }
      }
    }
  }
}

#tree-wpfd-box {
  .dropblock {
    min-width: 400px;
    min-height: 150px;
    display: inline-block;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -150px;
    margin-top: -100px;
    background: #FFF;
    color: #8d8d8d;
    padding: 15px 10px;
    @media screen and(max-width: 420px) {
      left: 0 !important;
      top: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      margin: 0 !important;
      .extra-downloadlink {
        margin-top: 10px !important;
        width: 100% !important;
        text-align: center !important;
        a {
          float: unset !important;
          display: inline-block !important;
          margin: 0 5px !important;
        }
      }
    }
    .filecontent {
      float: left;
      min-width: 350px;
    }
    .icon-custom {
      display: block;
      float: left;
      max-width: 70px;
      max-height: 70px;
      margin-right: 5px;
    }
    div.ext[class*='wpfd-icon-set-'] {
      width: 70px;
      height: 70px;
      float: left;
      position: relative;
      margin-top: 0;
      text-indent: -9999999px;
    }
    div.ext[class*='wpfd-icon-set-png'] {
      background-size: 100% !important;
    }
    div.ext[class*='wpfd-icon-set-svg'] {
      background-size: 100% !important;
    }
    div.ext:not([class*='wpfd-icon-set-']) {
      background: top left transparent no-repeat;
      color: #fff;
      float: left;
      width: 60px;
      height: 80px;
      position: relative;
      margin-top: 0;
      background-image: url(../../../assets/images/theme/neutral.png);
      text-shadow: 1px 1px 1px #666;
      background-size: contain;

      $defaultExtensions: (7z,ace,bz2,dmg,gz,rar,tgz,zip,csv,doc,docx,html,key,keynote,odp,ods,odt,pages,pdf,pps,ppt,pptx,rtf,tex,txt,xls,xlsx,xml,bmp,exif,gif,ico,jpeg,jpg,png,psd,tif,tiff,aac,aif,aiff,alac,amr,au,cdda,flac,m3u,m4a,m4p,mid,mp3,mp4,mpa,ogg,pac,ra,wav,wma,3gp,asf,avi,flv,m4v,mkv,mov,mpeg,mpg,rm,swf,vob,wmv,css,img);
      @each $extension in $defaultExtensions {
        &.ext-#{$extension} {
          background-image: url('../../../assets/images/theme/#{$extension}.png');
          text-shadow: unset;
        }
      }
    }
    .wpfd-extra {
      padding-left: 85px;
      line-height: 1.3em;
      font-size: 1em;
      > div {
        margin: 3px 0;
        text-transform: none;
        font-size: 1em;
        font-weight: normal;
        font-stretch: normal;
        font-style: normal;
        letter-spacing: normal;
        color: #999999;
        > span, > p {
          min-width: 75px;
          display: inline-block;
          text-transform: none;
          font-size: 1em;
          font-weight: normal;
          font-stretch: normal;
          font-style: normal;
          letter-spacing: normal;
          text-align: left;
          color: #999999;
        }
      }
      .file_desc {
        margin-bottom: 15px !important;
      }
    }
    div.ext .txt {
      position: absolute;
      top: 52px;
      left: 7px;
      display: block;
      width: auto;
      font-size: 12px;
      line-height: 16px;
      text-align: center;
      letter-spacing: -1px;
      text-transform: uppercase;
      font-family: arial, helvetica, sans-serif;
      font-weight: bold;
      text-indent: -9999px;
    }
  }
  a {
    text-decoration: none;
    &.wpfd_previewlink {
      color: #5C5C5C;
    }
  }
}

.wpfd-tree-box-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  background: rgba(0, 0, 0, .8) url(../../../assets/images/theme/loadingfile.svg) center center no-repeat;
}

#tree-wpfd-box-overlay {
  z-index: 9999;
  height: 100%;
  width: 100%;
  position: absolute;
  background: #000000;
  opacity: 0.5;
  filter: alpha(opacity = 5);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#80000000, endColorstr=#80000000);
}

#tree-wpfd-box {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  background-color: rgba(0, 0, 0, .8);
  color: #FFF;
  font-size: 13px;
  .dropblock {
    color: #999999;
    @media screen and(min-width: 768px) {
      border-radius: 4px;
    }
    h3 {
      padding: 0 15px 0 85px;
      margin: 0 0 10px;
      word-wrap: break-word;
      clear: none;
      color: inherit;
      font-size: 1.3em;
      .wpfd_checkbox {
        display: none;
        margin: 0;
        position: absolute;
        left: 70px;
        width: 16px;
        height: 16px;
        background-color: transparent;
        .cbox_file_download[type="checkbox"] {
          display:none;
          -webkit-appearance: checkbox;
          box-sizing: border-box;
        }
        span {
          width: 16px;
          height: 16px;
          line-height: 13px;
          vertical-align: top;
          margin: 0;
          box-sizing: border-box;
          display: inline-block;
          font-size: 13px;
          &:before {
            content: '';
            display: inline-block;
            width: 16px;
            height: 16px;
            margin: 0;
            vertical-align: middle;
            transition: .6s;
            text-align: center;
            background: #fff;
            border: 1px solid #808080;
            color: #808080;
            padding: 1px;
            font-size: 13px;
            box-sizing: border-box;
          }
          &:hover,
          &:focus {
            cursor: pointer;
          }
          &:hover {
            &:before {
              background-color: #efefef;
            }
          }
        }
        .cbox_file_download:checked {
          + span:before {
            content: '\2714';
          }
        }
      }
      a {
        font-weight: bold;
        font-stretch: normal;
        font-style: normal;
        letter-spacing: normal;
        text-align: left;
        color: #808080;
        text-transform: none;
        vertical-align: text-top;
        font-size: 16px;
        line-height: 13px;
      }
    }
    .wpfd-close {
      position: absolute;
      top: 3px;
      right: 3px;
      height: 20px;
      width: 20px;
      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAQAAAC0NkA6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfjCwsJES8LDFBaAAAA90lEQVRYw+3WTQqDMBCG4Zcm5AJCeyqvo+RAekMV3KSLorXiz6SOUkq+dcKTMWYYSElJSYEHOU682pFzjyUyahpKrGi1paShIouroiYQ6ESMpaQjEKhiqslpCELmTQQacjniJhu3GTtbKb/Fhc1WsKoQ3mAUc5jYZ1SIbUaNWGdUiSXGYLSJOdPi8bTaxJzp6c8gBmY4/1CTMgFg8GMNgR6PkW69aZ/lxz/XBRd/wS88f90GQ3Hmey/GtqLIrPcoNWa7Daow+532MCNr5ocYJ27mn0zUIDEdifbON2WiRqI7VcQn+HK4g4zq7DH1Vc3pA3dKSso/5gmAWxwDE0VxTgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOS0xMS0xMVQwOToxNzoyNCswMDowMF30EfwAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTktMTEtMTFUMDk6MTc6MjQrMDA6MDAsqalAAAAAAElFTkSuQmCC) center center no-repeat transparent;
      background-size: cover;
      z-index: 9999;
    }
    .extra-downloadlink {
      background: none;
      padding: 0;
      margin: 5px 0 0 0;
      height: 30px;
      text-align: right;
      display: inline-block;
      float: left;
      width: 130px;
    }
    a.downloadlink {
      text-decoration: none;
      font-size: 16px;
      text-transform: none;
      margin-left: 10px;
      background-color: #75be5f;
      border-color: #75be5f;
      color: #fff;
      @media screen and(min-width: 768px) {
        margin: 23px 0 5px 0;
      }
    }
    a.openlink {
      background-color: #fafafa;
      border-color: #dadada;
      color: #8f8f8f;
    }
    .extra-downloadlink a {
      border-radius: 8px;
      font-size: 13px;
      padding: 5px 15px;
      margin-bottom: 5px;
      line-height: 22px;
      text-align: center;
      text-decoration: none;
      box-sizing: border-box;
      display: block;
      width: 130px;
      height: 32px;
      float: right;
    }
    .wpfd-download {
      font-size: 16px;
      vertical-align: middle;
      text-align: right;
      margin-left: 10px;
      margin-bottom: 2px;
    }
    .extra-downloadlink a:hover {
      box-shadow: 1px 1px 12px #ccc;
    }
    .viewerlink {
      .openlink {
        &:hover {
          box-shadow: 1px 1px 12px #ccc;
        }
        font-size: 13px;
        margin-top: 10px;
        padding: 5px 15px;
        text-align: center;
        text-decoration: none;
        box-sizing: border-box;
        display: block;
        width: 120px;
        height: 32px;
      }
      text-align: right;
      display: inline-block;
      height: 30px;
      padding: 0;
      margin: 10px 0 0 10px;
    }
    .wpfd-preview {
      font-size: 16px;
      vertical-align: middle;
      text-align: right;
      margin-left: 10px;
    }
  }
}

.wpfd-content-tree {
  .tree-download-category:hover,
  .tree-download-selected:hover {
    cursor: pointer;
    box-shadow: 1px 1px 0.6666666667em #ccc;
  }
  .tree-download-category:hover, .tree-download-selected:hover {
    cursor: pointer;
  }
  .tree-download-category.display-download-category {
    display: none;
  }
  .head-category-tree .display-inline-block {
    display: inline-block;
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  #tree-wpfd-box .dropblock {
    min-height: 240px;
    min-width: unset;
  }
}


/* Right to left */
.rtl {
  .wpfd-content-tree {
    li.directory {
      position: relative;
    }
    .icon-open-close {
      float: right;
    }
    .zmdi-folder, .zmdi-folder-open {
      margin-left: 0;
      margin-right: 15px;
    }
    i.zmdi, .zmdi-folder, .zmdi-folder-open {
      -moz-transform: scaleX(-1);
      -o-transform: scaleX(-1);
      -webkit-transform: scaleX(-1);
      transform: scaleX(-1);
      padding-left: 5px;
    }
    .icon-open-close {
      -moz-transform: scaleX(-1);
      -o-transform: scaleX(-1);
      -webkit-transform: scaleX(-1);
      transform: scaleX(-1);
      float: right;
    }
    ul.jaofiletree {
      &:first-child {
        margin-right: -10px !important;
        margin-left: unset !important;
      }
      li {
        padding-right: 10px !important;
        padding-left: unset !important;
      }
    }
  }
  #tree-wpfd-box {
    .extra-downloadlink {
      i.wpfd-preview,
      i.wpfd-download {
        text-align: left;
        margin-left: unset;
        margin-right: 10px;
      }
    }
    .dropblock {
      div.ext {
        float: right;
        margin-left: 10px;
      }
      .filecontent {
        float: right;
      }
      .wpfd-extra {
        overflow: hidden;
        margin-right: 65px;
        margin-left: unset;
        span {
          float: right;
          margin-left: 2px;
        }
      }
    }
  }
}
