.eacf7-uploader {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  user-select: none;

  * {
    box-sizing: border-box;
  }

  .hidden {
    display: none !important;
  }

  &.drag-active {
    border-color: var(--color-primary);
    border-width: 2px;
    background-color: #BFDBFE;
    box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;

    * {
      pointer-events: none;
    }
  }

  &-body {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc !important;
    border-radius: 7px !important;
    background-color: #fcfcfc !important;
    width: 100% !important;
    padding: 2rem 1rem !important;

    .uploader-text {
      margin: 0;
      color: #555;
      text-align: center;
      font-size: .9rem;
    }

    .uploader-buttons {
      button {
        margin: 0 5px;
        border-radius: 5px;
        padding: 5px 10px;
        border: 1px solid #ccc;
        background-color: #fff;
        color: #333;
        cursor: pointer;
        transition: all 0.2s ease-in-out;
        font-size: .875rem !important;

        &:hover {
          background-color: #f7f7f7;
        }
      }
    }

    &.hidden {
      display: none !important;
    }
  }

  .eacf7-uploader-label {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem !important;
  }

  .uploader-hint {
    font-size: .8rem !important;
    margin-top: 1rem !important;
    color: #999;

    span {
      margin-right: 3px;

      &:last-child {
        margin-right: 0;
      }
    }
  }

  p {
    font-size: .875rem !important;
    font-weight: 400;
    margin: 5px 0 !important;
    color: #555;
    line-height: 1;
  }

  .dashicons-cloud-upload {
    font-size: 50px !important;
    height: auto;
    width: auto;
    margin-bottom: 10px !important;
    line-height: 1;
    color: #b1b1b1;
  }

  .eacf7-uploader-buttons {
    display: flex;
    margin-top: 10px;

    button {
      display: flex;
      align-items: center;
      white-space: nowrap;
      cursor: pointer;
      border-radius: .25rem;
      border: none;
      padding: .375rem .5rem;
      margin: .5rem;
      box-shadow: rgba(149, 157, 165, 0.2) 0 8px 24px;
      transition: all .2s ease-in-out;
      font-size: .8rem;
      font-weight: 400;

      span {
        margin-left: 5px;
      }

      &:hover {
        background-color: var(--color-primary-light-alt);
      }

    }
  }

  &.error {
    border-color: #F00;
  }

  .file-list-wrapper {
    display: flex;
    flex-direction: column;
    z-index: 50;
    margin-top: 15px !important;
    width: 100% !important;
    max-height: 400px;
    max-width: 100%;
    overflow: hidden !important;
    background-color: #fff !important;
    border-radius: .25rem !important;
    box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px !important;
    bottom: 1rem;
    right: 1rem;

    &.fixed {
      position: fixed;
    }

    @media (max-width: 991px) {
      max-width: 300px;
      max-height: 300px;
      right: 0;
    }
  }

  .file-list {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap !important;
    overflow-y: auto !important;
    width: 100%;

    &-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 15px !important;
      background-color: var(--color-primary) !important;
      color: #fff;
      line-height: 1;

      span {
        font-size: 1rem;
      }

      i {
        cursor: pointer;
        height: 26px !important;
        width: 26px !important;
        border: 1px solid !important;
        border-radius: 50% !important;
        font-size: 22px !important;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

    &-item {
      display: flex;
      align-items: center;
      padding: 8px 12px !important;
      border-bottom: 1px solid #eaeaea !important;
      width: 100% !important;
      opacity: .5;

      .file-icon {
        width: 25px !important;
        height: 25px !important;
        margin-right: 10px !important;
      }

      .file-info {
        display: flex;
        flex-wrap: wrap;
        overflow: hidden;
        width: 100%;
        line-height: 1;

        .upload-item {
          display: flex;
          flex-direction: column;
          text-overflow: ellipsis;
          white-space: nowrap;
          overflow: hidden;
          flex: 1;

          &-name {
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
            font-size: .875rem;
            margin-right: 10px;
          }

          &-size {
            margin-top: 5px;
            font-size: .75rem;
            color: #999;
          }
        }

        &-percentage {
          margin-left: auto;
          text-align: right;
          font-size: .875rem;
          display: flex;
          align-items: center;
          width: max-content;

          .components-spinner {
            margin-top: 0;
            margin-right: 5px;
            border-radius: 50%;
          }


        }

        &-progress {
          width: 100%;
          height: 8px;
          background-color: #ddd;
          border-radius: .25rem;
          margin-top: 7px;
          overflow: hidden;
          position: relative;
          align-items: center;
          justify-content: space-between;
          display: none;

          &-bar {
            width: 0;
            height: 100%;
            background-color: #28a745;
            border-radius: .25rem;
            position: absolute;
            left: 0;
            top: 0;
            transition: width .5s ease-in-out;
          }
        }

        &-error {
          color: #F00;
          width: 100%;
          font-size: .75rem;
          margin-top: 3px;
        }

        .spinner-icon {
          width: 20px;
          display: none;
        }

        .percentage {
          margin: 0 7px;
          display: none;
        }

        i {
          margin-left: 15px;
          height: 22px !important;
          width: 22px !important;
          font-size: 16px;
          border-radius: 50%;
          display: flex;
          align-items: center;
          justify-content: center;
          cursor: pointer;

          &:not(.dashicons-saved, .dashicons-no-alt) {
            border: 1px solid #ddd;
          }
        }

        .dashicons-saved {
          background: #28a745;
          color: #fff;
          display: none;
          margin-right: 10px;
        }

        .dashicons-controls-play {
          padding-left: 3px;
          display: none;
        }

        .dashicons-controls-pause {
          padding-left: 1px;
          display: none;
        }

        .remove-file {
          background: #FF9F10;
          color: #FFF;
          margin-left: 15px;
        }

      }

      &:hover {
        background-color: #E0F2FE;
      }

      &.uploaded {
        opacity: 1;

        .file-info {
          .dashicons-saved {
            display: flex;
          }

          .spinner-icon {
            display: none !important;
          }

          .percentage {
            color: #28a745;
            display: block;
          }

          &-progress {
            display: flex;

            &-bar {
              width: 100%;
            }
          }

        }
      }

      &.active {
        opacity: .8;

        .file-info {

          .spinner-icon {
            display: block;
          }

          .percentage {
            display: block;
          }

          &-progress {
            display: flex;
          }
        }
      }

      &.error {
        opacity: 1;

        .file-info {
          .dashicons-no-alt {
            display: flex;
          }

          .spinner-icon {
            display: none !important;
          }

          .percentage {
            display: none;
          }

          &-progress {
            display: none;
          }

          &-error {
            display: block;
          }
        }
      }

    }

    //customize scrollbar
    &::-webkit-scrollbar {
      width: 5px;
    }

    &::-webkit-scrollbar-track {
      background: #f1f1f1;
    }

    &::-webkit-scrollbar-thumb {
      background: #ccc;

      &:hover {
        background: #bbb;
      }
    }
  }

  &.image-upload {
    .file-list {
      flex-direction: row;
      flex-wrap: wrap !important;
      margin-top: 15px;

      &-item {
        width: 150px !important;
        height: 150px !important;
        margin: 7px !important;
        border: 1px solid #ddd !important;
        border-radius: 5px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        position: relative;
        overflow: hidden;
        padding: 0 !important;

        .file-icon {
          width: 100% !important;
          height: 100% !important;
          margin: 0 !important;
          position: absolute;
          object-fit: cover;
          top: 0;
          left: 0;
        }

        .file-info {
          margin-top: auto;
          z-index: 1;
          background: #fff;
          flex-direction: column-reverse;

          .upload-item {
            overflow: inherit;
            width: 100% !important;
            flex: auto;
            flex-direction: row;
            align-items: center;
            padding: 7px;
            justify-content: space-between;

            &-size {
              margin-top: 0;
            }
          }

          &-percentage {
            & > *:not(.remove-file) {
              display: none;
            }
          }

          &-progress {
            margin-top: 0;
            border-radius: 0;
            height: 6px;
            display: flex !important;

            &-bar {
              border-radius: 0;
            }
          }

        }

        .dashicons-saved {
          position: absolute;
          top: 5px;
          right: -5px;
        }

        .remove-file {
          position: absolute;
          top: 5px;
          right: 5px;
          background: #FF9F10;
          color: #FFF;
        }

        &.error {
          border-color: #F00 !important;

          .file-info {

            &-error {
              padding: 5px 5px 0 5px;
            }

            &-progress {
              display: none !important;
            }
          }
        }

        &.uploaded {
          border-color: rgba(#28a745, .3) !important;

          .file-info {
            &-percentage {
              .dashicons-saved {
                display: flex;
              }

              .remove-file {
                display: none;
              }
            }
          }

          &:hover {
            .file-info {
              &-percentage {
                .dashicons-saved {
                  display: none;
                }

                .remove-file {
                  display: flex;
                }
              }
            }
          }

        }

      }

    }
  }

}