@import "./../styles/index.scss";

.file-container{
  margin: 5px 15px 5px 0;
  position: relative;

  .file-content{
    align-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    display: flex;
    height: 44px;
    padding: 7px 9px;
    position: relative;
    width: 278px;
  
    &:hover{
      cursor: pointer;

      .file-button-container{
        display: flex;
      }
    }
  
    &.file-loading {
      .file-content-icon, .file-content-detail{
        opacity: 0.5;
      }

      .file-button-cancel {
        display: flex;
      }
    }

    &.file-done {
      .file-content-icon{
        div{
          display: flex;
        }
      }
    }
  
    .file-content-icon{
      align-items: center;
      border-radius: 3px;
      display: flex;
      height: 30px;
      position: relative;
      width: 30px;

      &.file-content-icon-image { 
        background-color: #99ccff; 
      }

      &.file-content-icon-pdf { 
        background-color: #ff4539; 
      }

      &.file-content-icon-zip{ 
        background-color: #ffe196; 
      }

      &.file-content-icon-audio{ 
        background-color: #f0ba02;
      }

      &.file-content-icon-video{ 
        background-color: #00a49e;
      }

      &.file-content-icon-ppt{ 
        background-color: #d64123;
      }

      &.file-content-icon-word{ 
        background-color: #2b5697;
      }

      &.file-content-icon-excel{ 
        background-color: #4d9c45;
      }

      &.file-content-icon-file-default {
        background-color: #4a90e2; 
      }

      &.file-content-icon-unsent{
        > .unsent-icon {
          width: 30px;
          height: 30px;
          background-size: cover;
        }
      }

      >i{
        color: white;
        font-size: 26px;
        margin: 0 auto;
      }

      div.file-icon-status{
        align-items: center;
        background: rgb(0, 145, 255);
        border-radius: 50%;
        bottom: -5px;
        display: none;
        height: 11px;
        position: absolute;
        right: -5px;
        width: 11px;

        i{
          color: white;
          font-size: 15px;
          left: -2px;
          line-height: 15px;
          position: relative;
          top: 0px;
        }
      }
    }

    .file-content-detail{
      display: flex;
      flex-direction: column;
      margin-left: 10px;
      width: calc(100% - 32px);
    
      .file-detail-name{
        flex-grow: 1;
        font-size: 14px;
        font-weight: 700;
        max-height: 38px;
        overflow: hidden;
        padding-right: 5px;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    
      .file-detail-size{
        color: #9b9b9b;
        flex-grow: 0;
        font-size: 11px;
        white-space: nowrap;
      }
    }

    .file-button-container{
      align-items: center;
      border-radius: 6px;
      display: none;
      height: 58px;
      justify-content: flex-end;
      position: absolute;
      right: 0;
      top: 0;
      width: 70px;

      >button{
        background: transparent;
        margin-right: 10px;

        &.file-button-cancel{
          i{
            font-weight: bold;
          }
        }

        i{
          color: #89909a;
          font-size: 25px;
        }
      }
    }
  }

  .file-bar-loading{
    background-color: #0091ff;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    bottom: 1px;
    left: 2px;
    height: 2px;
    position: absolute;
  }
}

/* THEME
   ----------------------------- */
@mixin themable($_THEME, $_BACKGROUND_FILE, $_BORDER_COLOR_FILE, $_BACKGROUND_FILE_HOVER, $_COLOR_TEXT_FILE_TITLE, $_BACKGROUND_FILE_BUTTON, $_BACKGROUND_COLOR_FILE_UNAVAILABLE){
  [data-theme^=#{$_THEME}],
  [data-theme] [data-theme^=#{$_THEME}] {
    .file-container{
      .file-content{
        background-color: $_BACKGROUND_FILE;
        border-color: $_BORDER_COLOR_FILE;

        &:hover{
          background-color: $_BACKGROUND_FILE_HOVER;
        }

        .file-content-icon {
          &.file-content-icon-unsent{
            background-color: $_BACKGROUND_COLOR_FILE_UNAVAILABLE;
            > .unsent-icon {
              background-image: url(../#{$_PATH_TO_IMAGES}/file-unavailable-#{$_THEME}.svg);
            }
          }
        }

        .file-content-detail{
          .file-detail-name{
            color: $_COLOR_TEXT_FILE_TITLE;
          }
        }

        .file-button-container{
          background-image: $_BACKGROUND_FILE_BUTTON;
        }
      }
    }
  }
}

@include themable($_THEME_LIGHT, $_BACKGROUND_FILE_LIGHT, $_BORDER_COLOR_FILE_LIGHT, $_BACKGROUND_FILE_HOVER_LIGHT, $_COLOR_TEXT_FILE_TITLE_LIGHT, $_BACKGROUND_FILE_BUTTON_LIGHT, $_BACKGROUND_COLOR_FILE_UNAVAILABLE_LIGHT);
@include themable($_THEME_DARK, $_BACKGROUND_FILE_DARK, $_BORDER_COLOR_FILE_DARK, $_BACKGROUND_FILE_HOVER_DARK, $_COLOR_TEXT_FILE_TITLE_DARK, $_BACKGROUND_FILE_BUTTON_DARK, $_BACKGROUND_COLOR_FILE_UNAVAILABLE_DARK);