@mixin outside-border($width, $style, $color, $radius: 5px) {
  $border-radius: $radius + ($width * 2);

  &:before {
    border-color: $color;
    border-radius: $border-radius;
    border-style: $style;
    border-width: $width;
    content: "";
    position: absolute;
    top: -$width;
    left: -$width;
    right: -$width;
    bottom: -$width;
    z-index: -1;
  }

  &--circle {
    &:before {
      border-radius: $border-radius;
    }
  }
}

.image-drop {
  $size: 150px;
  $border-radius: $size / 2;

  height: $size;
  width: $size;
  border-radius: 5px;
  background: transparent;
  background-size: cover;
  background-repeat: no-repeat;
  position: relative;

  @include outside-border(2px, solid, transparent);

  &:not(.has-image) {
    background: $gray--light;
  }

  &.is-large {
    $size: 200px;
    height: $size;
    width: $size;

    @include media($sm-screen) {
      height: 100px;
      width: 100px;
    }
  }

  .hover {
    border-radius: 5px;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2;
  }

  .hover, .text {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px;

    p {
      &:before {
        @include sprite($camera);
        content: "";
        display: block;
        margin: 0 auto;
      }

      color: white;
      display: block;
      font-size: $body-font-size-normal;
      margin: 5px 0;
      padding: 0 10px;
      text-align: center;
      width: 100%;
    }
  }

  &:not(.image-drop--active) .text {
    align-items: center;
    display: flex;
  }

  &--circle {
    border-radius: $border-radius;

    .hover {
      border-radius: $border-radius;
    }

    input[type=file] {
      border-radius: $border-radius;
    }
  }

  &--drag {
    @include outside-border(2px, dashed, $gray--lightest);

    &.image-drop--circle {
      @include outside-border(2px, default, $gray--lightest, $border-radius);
    }

    background: transparent !important;

    p {
      display: block;
    }
  }

  &--active {
    background: $blue--background !important;

    &:before {
      border-color: $blue--dark;
    }

    p {
      color: $blue--dark;
    }
  }

  &:hover:not(.image-drop--drag) {
    @include outside-border(2px, solid, $blue--dark);

    &.image-drop--circle {
      @include outside-border(2px, solid, $blue--dark, $border-radius);
    }
  }

  &:hover:not(.image-drop--active):not(.image-drop--drag) .hover {
    align-items: center;
    display: flex;
  }
}

.image-drop p {
  color: #a9a9a9;
  display: none;
  text-align: center;
  width: 80%;
}

.image-drop input[type=file] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  filter: alpha(opacity=0);
  cursor: pointer;
  z-index: 3;
}
