/**
 * WP File Download
 *
 * 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-table, .wpfd-content-table {
  ul.jaofiletree {
    li.selected {
      > a {
        color: #3d3d3d;
        font-weight: bold;
      }
      > .zmdi-folder {
        color: #3d3d3d;
        font-weight: bold;
        &:before {
          color: #3d3d3d;
          font-weight: bold;
        }
      }
      > .icon-open-close {
        color: #3d3d3d;
        font-weight: bold;
        &:before {
          color: #3d3d3d;
          font-weight: bold;
        }
      }
    }
  }
  tr, td, thead, tbody, th {
    border: none;
  }
  a {
    text-decoration: none !important;
    border-bottom: 0;
    box-shadow: none;
    &.wpfd_downloadlink {
      color: #999999;
      text-transform: none;
    }
    &:focus {
      outline: none;
    }
    .zmdi {
      font-size: 16px;
      vertical-align: middle;
    }
  }
  tr, td, thead, tbody, th {
    font-size: 13px;
  }
  td {
    &.file_size, &.file_hits {
      white-space: nowrap;
    }
  }
  h2 {
    padding: 10px 0 0 0;
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #b3b3b3;
    text-transform: uppercase;
    font-weight: normal;
    @media only screen and (max-width: 720px) {
      margin: 0 0 7px 0;
      padding-top: 7px;
    }
  }
  .file {
    .wpfd_checkbox {
        vertical-align: middle;
        margin-right: 3px;
      width: 16px;
      height: 16px;
      background-color: transparent;
      display: inline;
      .cbox_file_download[type="checkbox"] {
        display:none;
        -webkit-appearance: checkbox;
        box-sizing: border-box;
      }
      > span {
        width: 16px;
        height: 16px;
        line-height: 13px;
        vertical-align: middle;
        margin: 0;
        box-sizing: border-box;
        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';
        }
      }
    }
  }

  table {
    max-width: 100%;
    background-color: transparent;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: auto;
  }
  .wpfd-table {
    width: 100%;
    display: table;
    table-layout: auto;
    box-sizing: content-box;
    background-color: #fff;
    color: #999999;
    border: none;
    padding: 0 10px;
    margin: 0 !important;
    td {
      padding: 15px 0 15px 10px;
      line-height: 20px;
      text-align: left;
      vertical-align: middle;
    }
    thead th {
      line-height: 30px;
      font-weight: normal;
      white-space: nowrap;
      padding: 15px 0 15px 10px !important;
      text-align: left;
      vertical-align: middle;
      background-color: #fff;
      color: #666666;
      border: none !important;
    }
    caption + thead tr:first-child {
      th, td {
        border-top: 0;
      }
    }
    colgroup + thead tr:first-child {
      th, td {
        border-top: 0;
      }
    }
    thead:first-child tr:first-child {
      th, td {
        border-top: 0;
      }
    }
    tbody + tbody {
      border-top: 2px solid #dddddd;
    }
  }
  .table-condensed {
    th, td {
      padding: 4px 5px;
    }
  }
  .wpfd-table-bordered {
    border-collapse: separate;
    *border-collapse: collapse;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;

    tr {
      border: none;
    }

    tr .file_desc,
    tr .file_version {
      @media screen and(max-width: 1024px) {
        display: none;
      }
    }

    tr .file_hits {
      @media screen and(max-width: 950px) {
        display: none;
      }
    }

    tr .file_created {
      @media screen and(max-width: 900px) {
        display: none;
      }
    }

    tr .file_size {
      @media screen and(max-width: 850px) {
        display: none;
      }
    }

    th {
      line-height: 30px;
    }
    th:first-child {
      border-top-left-radius: 4px;
    }
    th:last-child {
      border-top-right-radius: 4px;
    }
    td {
      background-color: #fff;
      line-height: 32px;
      border-top: 1px solid #cccccc;
      border-left: 0;
      border-right: 0;
      border-bottom: 0;
    }
    tr:last-child {
      td:first-child {
        border-bottom-left-radius: 4px;
      }
      td:last-child {
        border-bottom-right-radius: 4px;
      }
    }
    th.file_title,
    td.file_title {
      @media screen and(min-width: 1024px) {
        min-width: 132px;
      }
      > a.wpfd_downloadlink {
        vertical-align: middle;
      }
    }
    th.file_desc,
    td.file_desc {
      p {
        margin: 0;
        padding: 0;
      }
    }
    caption + {
      thead tr:first-child th {
        border-top: 0;
      }
      tbody tr:first-child {
        th, td {
          border-top: 0;
        }
      }
    }
    colgroup + {
      thead tr:first-child th {
        border-top: 0;
      }
      tbody tr:first-child {
        th, td {
          border-top: 0;
        }
      }
    }
    thead:first-child tr:first-child th {
      border-top: 0;
    }
    tbody:first-child tr:first-child {
      th, td {
        border-top: 0;
      }
    }
  }
  .wpfd-table-striped tbody > tr:nth-child(odd) > {
    td, th {
      background-color: #ffffff;
    }
  }
  .table-hover tbody tr:hover > {
    td, th {
      background-color: #f5f5f5;
    }
  }
  .extcol {
    text-align: center;
  }
  .icon-custom {
    img {
      width: 35px;
      display: inline-block;
      padding-left: 8px;
    }
    .icon-custom-title {
      margin-left: 3px;
      vertical-align: top;
    }
  }
  span.ext[class*='wpfd-icon-set-'] {
    width: 40px;
    height: 40px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
  }
  span.ext[class*='wpfd-icon-set-png'] {
    background-size: 100% !important;
  }
  span.ext[class*='wpfd-icon-set-svg'] {
    background-size: 100% !important;
  }
  span.ext:not([class*='wpfd-icon-set-']) {
    width: 40px;
    height: 40px;
    display: inline-block;
    vertical-align: middle;
    background: url(#{$image-theme-path}/neutral.png) no-repeat center center;
    background-size: 70% 100%;
    &[class*='ext-'] {
      color: transparent;
    }
    $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}/#{$extension}.png');
      }
    }
    .txt {
      position: absolute;
      top: 48px;
      left: 7px;
      display: block;
      width: 35px;
      font-size: 12px;
      line-height: 16px;
      text-align: center;
      letter-spacing: -1px;
      text-transform: uppercase;
      font-family: arial, helvetica, sans-serif;
    }
  }
  &.wpfd-content {
    .head-category-table {
      &:before {
        content: '>>';
        font-size: 16px;
        display: inline-block;
        text-align: left;
        text-transform: none;
        vertical-align: middle;
        margin: 0 3px 0 0;
      }
    }
    .downloadlink {
      display: inline-block;
      transition: all 0.2s ease;
      i.wpfd-download {
        margin-bottom: 3px;
      }
      &:hover {
        box-shadow: 1px 1px 12px #ccc;
      }
    }
    .openlink {
      &:hover {
        box-shadow: 1px 1px 12px #ccc;
      }
      display: inline-block;
      transition: all 0.2s ease;
      i.wpfd-preview {
        margin-bottom: 3px;
      }
    }
  }
  .wpfd-container-table {
    box-sizing: border-box;
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    &.with_foldertree {
      width: 70%;
      padding: 0 5px 0 10px;
      margin: 0;
      overflow-y: auto;
      flex: 1;
      .wpfd-categories {
        .backcategory {
          margin: 10px 5px 5px 5px;
        }
      }
    }
    .wpfd-categories {
      padding: 0;
      > h2 {
        padding: 0;
        margin: 0 0 0 10px;
      }
      .backcategory {
        margin: 5px;
      }
    }
  }
  .mediaTableWrapperWithMenu {
    padding-top: 1em;
  }
  .mediaTableMenu {
    display: none;
  }
  &.colstyle .mediaTableMenu {
    display: block;
    margin-top: 28px;
    right: 10px;
    box-shadow: none !important;
    z-index: 9;
    min-width: 32px;
    min-height: 26px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    a {
      padding: 0 10px;
      border-radius: 5px;
      color: darkgrey;
      vertical-align: middle;
      box-shadow: unset;
      margin: 2px 0;
      > .zmdi-settings {
        box-sizing: content-box;
        vertical-align: baseline;
      }
    }
    &.mediaTableMenuClosed {
      display: block;
      margin-top: 30px;
      right: 10px;
      box-shadow: none !important;
      z-index: 9;
      width: 32px;
      height: 24px;
      background-color: #fff;
      border: 1px solid #ccc;
      border-radius: 4px;
      text-align: center;
      box-sizing: unset;
      a {
        display: block;
        vertical-align: middle;
        padding: 0;
        background-color: transparent;
        text-align: center;
        width: 18px;
        height: 100%;
        box-sizing: unset;
        margin: auto;
        line-height: 22px;
        .zmdi-settings {
          text-align: center;
          width: 100%;
          display: inline-block;
          box-sizing: unset;
          vertical-align: middle;
        }
      }
    }
    ul {
      padding: 0 10px 5px 10px !important;
      color: #666666;
      li {
        line-height: 18px;
      }
      input {
        display: inline-block;
        vertical-align: middle;
        margin-left: 0;
        -webkit-appearance: checkbox;
        width: 16px;
        height: 16px;
        background: #fff;
        border-radius: 0;
        box-shadow: none;
        font-size: 13px;
        line-height: 1em;
        &:before {
          content: '';
          display: inline-block;
          width: 16px;
          height: 16px;
          margin-right: .5em;
          vertical-align: middle;
          font-size: 1em;
          transition: .6s;
          text-align: center;
          background: #fff;
          border: 1px solid #808080;
          color: #808080;
          padding: 1px;
          box-sizing: border-box;
        }
        &:hover,
        &:focus {
          cursor: pointer;
        }
        &:hover {
          &:before {
            background: #efefef;
          }
        }
      }
      input:checked {
        &:before {
          content: '\2714';
        }
      }
      label {
        color: inherit;
        display: inline-block;
        vertical-align: middle;
        margin: 3px 3px 3px 5px;
      }
    }
  }
  .table-download-category:hover,
  .table-download-selected:hover {
    cursor: pointer;
    box-shadow: 1px 1px 0.6666666667em #ccc;
  }
  .table-download-category, .table-download-selected {
    cursor: pointer;
    margin: 8px 5px 8px 8px;
  }
  .table-download-category.display-download-category {
    display: none;
  }
  .wpfd-foldertree-table {
    padding: 0;
    margin: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mediaTableWrapper .mediaTable .col-download {
    text-align: left;
    max-width: 155px !important;
    width: 155px !important;
    min-width: 150px;
    padding: 5px 10px 5px 5px;
  }
}

/* Reponsive */
@media (max-width: 720px) {
  #et-boc .wpfd-content-table, .wpfd-content-table {
    ul.jaofiletree li {
      padding-left: 10px;
    }
    .wpfd-container-table {
      width: 100%;
      &.with_foldertree {
        width: auto;
      }
    }
  }
}

/* Right to left */
.rtl {
  #et-boc .wpfd-content, .wpfd-content {
    &.wpfd-content-table {
      direction: rtl;
      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;
      }
      .wpfdcategory > span {
        padding-right: 5px;
      }
      .backcategory {
        left: 10px;
        right: unset !important;
      }
      table {
        direction: rtl;
        &.wpfd-table {
          thead th {
            padding-right: 5px;
          }
          td, thead th {
            text-align: right;
          }
        }
      }
      .mediaTableMenu {
        left: 10px;
        right: unset !important;
      }
      .wpfd-foldertree ul.jaofiletree:first-child {
        margin-right: -10px !important;
        margin-left: unset !important;
      }
      ul.jaofiletree li {
        padding-right: 10px !important;
        padding-left: unset !important;
      }
    }
  }
}
