@import "../../scss/mnd-bootstrap/variables/variables";

$font-source-sans-pro: $font-family-sans-serif;

.mnd-ui-c-form-file-upload {
  margin: 0 0 0.5rem;
  width: 100%;

  &__button-block-wrapper {
    height: 11rem;
    position: relative;
    margin: 0 1.5rem 1.5rem 0;
    display: block;
    background-color: $color-white;

    &--with-content {
      display: none;
    }
  }

  &__button-block {
    border: 1px dashed $color-gray-4000;
    color: $color-gray-2000;
    cursor: pointer;
    height: 100%;
    width: 11rem;
    min-width: 11rem;
    font-family: $font-source-sans-pro;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25rem;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.2s;

    &-inner {
      display: flex;
      flex-direction: column;
      align-items: center;
      opacity: 1;
      width: auto;
      transition: opacity 0.15s;
      transition-delay: 0.15s;
    }

    &-inner--error {
      position: absolute;
      display: flex;
      flex-direction: column;
      align-items: center;
      opacity: 0;
      transition: opacity 0.15s;
    }

    &-icon,
    &-icon--error {
      color: $color-feel-good-blue;
      font-size: 2.25rem;
      margin-bottom: 0.5rem;
    }

    &-icon--error {
      color: $color-copenhagen-red;
      background: $color-white;
      border: 1px solid $color-white;
      border-radius: 50%;
    }
  }

  &__button-block--hover,
  &__button-block:hover {
    background-color: $color-feel-good-blue;
    color: $color-white;

    .mnd-ui-c-form-file-upload__button-block-icon {
      color: $color-white;
    }
  }

  &__button-block--error,
  &__button-block--error:hover {
    background-color: $color-copenhagen-red;
    color: $color-white;

    .mnd-ui-c-form-file-upload__button-block-inner {
      opacity: 0;
      transition-delay: 0s;
    }

    .mnd-ui-c-form-file-upload__button-block-inner--error {
      opacity: 1;
      transition-delay: 0.15s;
    }
  }

  &__container {
    display: flex;
    flex-flow: row wrap;
  }

  &__preview-wrapper {
    border: 1px solid $color-gray-4000;
    height: 11rem;
    width: 11rem;
    margin: 0 1.5rem 1.5rem 0;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    position: relative;
    overflow: hidden;
  }

  &__preview-img {
    background-color: $color-gray-5000;
    background-position: center center;
    background-size: cover;
    width: 100%;
    flex: 1;
    flex-direction: column;
    align-items: center;
    display: flex;
    justify-content: center;
  }

  &__preview-description {
    height: 3rem;
    background: $color-white;
    width: 100%;
    border-top: 1px solid $color-gray-4000;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    p {
      margin: 0.25rem 1rem;
      font-size: 0.85rem;
      word-wrap: break-word;
      overflow: hidden;
    }
  }

  &__preview-icon {
    font-size: 4.25rem;
    color: $color-gray-2000;
  }

  &__delete-icon-wrapper {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 4;
    border-radius: 50%;
    background: $color-white;
    height: 0.8rem;
    width: 0.8rem;
  }

  &__delete-icon {
    color: $color-mynewsdesk-red;
    position: absolute;
    top: -0.15rem;
    left: -0.15rem;
    height: 1.1rem;
    width: 1.1rem;
    cursor: pointer;
  }

  input[type = "file"] {
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 1;
    cursor: pointer;
  }
}
