@import '../../../theme/mixins';

.Post {
  padding: 0;
  margin-bottom: var(--spacing-xxl);
  margin-left: -1px;
  margin-right: -1px;
  @include whiteBox();

  @media (max-width: 735px) {
    margin-bottom: 15px;
  }

  @media (max-width: 450px) {
    margin-bottom: 0;
  }
}

.Header {
  flex-direction: row;
  align-items: center;
  height: var(--headerHeight);
  padding: var(--spacing-m);
  border-bottom: 1px solid var(--color-border-02);
  background-color: var(--color-light);
}

.Avatar {
  display: block;
  align-self: center;
  flex: none;
}

.LinkToUser {
  width: 100%;
  height: 100%;
}

.AvatarImg {
  width: 32px;
  height: 32px;
  border-radius: 50%;

  &:after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border: 1px solid rgba(0,0,0,.0975);
    border-radius: 50%;
    pointer-events: none;
  }
}

.UserInfo {
  margin-left: var(--spacing-m);
  align-items: flex-start;
  flex-grow: 1;
  flex-shrink: 1;
  overflow: hidden;
}

.Username {
  max-width: 220px;

  &Wrap {
    flex-direction: row;
    align-items: center;
    flex-grow: 1;
    flex-shrink: 1;
    max-width: 100%;
    overflow: hidden;
  }

  .UsernameLink {
    color: var(--color-main);
    display: inline;
    padding: 0;
    position: relative;
    background-color: transparent;
    font-weight: 600;
    text-align: center;
    text-transform: inherit;
    text-overflow: ellipsis;
    width: auto;
  }
}

.Location {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  .LocationLink {
    color: var(--color-main);
    max-width: 100%;
    line-height: 15px;
    font-size: var(--small-font);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.Content {
  display: block;
  width: 100%;
}

.ImageBlock {
  display: block;
  overflow: hidden;
  padding-bottom: 100%;
}

.Image {
  object-fit: cover;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  width: 100%;
}

.LikeShow {
  position: absolute;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
  pointer-events: none;
}

.LikeIcon {
  background-repeat: no-repeat;
  background-size: 411px 396px;
  background-position: 0 -100px;
  width: 90px;
  height: 80px;
  animation-duration: 1s;
  animation-timing-function: ease-in-out;
  opacity: 0;
  transform: scale(0);

  &AnimationLike {
    animation-name: like-heart-animation;
  }
}

.Additional {
  padding: 0;
  background-color: var(--color-light);
}

.Actions {
  flex-direction: row;
  padding-left: var(--spacing-m);
  padding-right: var(--spacing-m);
  margin-top: var(--spacing-xxs);
}

.ButtonIcon {
  padding: var(--spacing-xs);
  cursor: pointer;
  justify-content: center;
  align-items: center;
  border: 0;
  background: 0 0;
}

.LikeButton {
  display: inline-block;
  margin-left: -8px;
  transform: scale(1);
  animation-duration: .45s;
  animation-timing-function: ease-in-out;

  &AnimationLike {
    animation-name: like-button-animation;
  }

  &AnimationUnLike {
    animation-name: unlike-button-animation;
  }
}

.CommentButton {
  display: inline-block;
}

.FavoriteButton {
  margin-left: auto;
  margin-right: -10px;
  display: inline-block;
}

.Tools {
  position: absolute;
  justify-content: center;
  height: var(--headerHeight);
  padding: var(--spacing-xs);
  top: 0;
  bottom: 0;
  right: 4px;
  cursor: pointer;

  @media (max-width: 830px) {
    display: none;
  }
}

.Likes {
  padding-left: var(--spacing-m);
  padding-right: var(--spacing-m);
  margin-bottom: var(--spacing-xs);
  flex-direction: row;
  justify-content: flex-end;
  height: max-content;

  &Row {
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    justify-content: flex-start;
    align-items: stretch;

    button {
      display: inline;
      position: relative;
      color: var(--color-main);
      border: 0;
      padding: 0;
      background-color: transparent;
      font-weight: 600;
      text-overflow: ellipsis;
      user-select: none;
      width: auto;
      cursor: pointer;
    }
  }
}

.Caption {
  flex-direction: row;
  margin-bottom: var(--spacing-xxs);
  padding-left: var(--spacing-m);
  padding-right: var(--spacing-m);
  flex: 0 0 auto;
  justify-content: flex-start;
}

.Editable {
  outline: 0;
  padding-right: var(--spacing-xs);
  border: 2px solid var(--color-accent);
  line-height: 25px;
}

.Comments {
  padding-left: var(--spacing-m);
  padding-right: var(--spacing-m);
  flex: 0 0 auto;

  &More {
    margin-bottom: var(--spacing-xxs);

    a {
      color: var(--color-neutral-02) !important;
    }
  }
}

.Comment {
  margin-bottom: var(--spacing-xxs);
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;

  &Text {
    display: block;
    flex: auto;
    min-height: 0;
    min-width: 0;

    a {
      color: var(--color-main)!important;
      font-weight: 600;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding-left: 5px;
      margin-left: -5px;
    }
  }
}

.TimeAgo {
  padding-left: var(--spacing-m);
  margin-bottom: var(--spacing-xxs);

  time {
    color: var(--color-neutral-02);
    margin-bottom: 5px;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .2px;
  }
}

.AddComment {
  padding-left: var(--spacing-m);
  padding-right: var(--spacing-m);
  margin-top: var(--spacing-xxs);
  color: var(--color-neutral-02);
  flex-shrink: 0;
  min-height: 56px;
  justify-content: center;
  border-top: 1px solid var(--color-border-02);
}

.CommentForm {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
  flex-shrink: 1;
  align-items: center;
  position: relative;
}

.Textarea {
  display: flex;
  color: var(--color-main);
  background: transparent;
  flex-grow: 1;
  max-height: 80px;
  height: 18px;
  border: 0;
  outline: 0;
  padding: 0;
  resize: none;
}

.SubmitComment {
  display: inline;
  color: var(--color-accent);
  background: transparent;
  padding: 0;
  border: 0;
  position: relative;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  overflow: hidden;
  user-select: none;
  cursor: pointer;

  &:disabled {
    opacity: .3;
    pointer-events: none;
  }
}

.CommentLoading {
  position: absolute;
  width: 100%;
  height: 56px;
  background-color: var(--color-light);
  opacity: .3;
  align-items: center;
  justify-content: center;
}

.PostAddComment {
  @media (max-width: 735px) {
    display: none;
  }
}

@keyframes like-button-animation {
  0%,to {
    -webkit-transform: scale(1);
    transform: scale(1)
  }

  25% {
    -webkit-transform: scale(1.2);
    transform: scale(1.2)
  }

  50% {
    -webkit-transform: scale(.95);
    transform: scale(.95)
  }
}

@keyframes unlike-button-animation {
  0%,to {
    -webkit-transform: scale(1);
    transform: scale(1)
  }

  25% {
    -webkit-transform: scale(1.2);
    transform: scale(1.2)
  }

  50% {
    -webkit-transform: scale(.95);
    transform: scale(.95)
  }
}


@keyframes like-heart-animation {
  0%,to {
    opacity: 0;
    -webkit-transform: scale(0);
    transform: scale(0)
  }

  15% {
    opacity: .9;
    -webkit-transform: scale(1.2);
    transform: scale(1.2)
  }

  30% {
    -webkit-transform: scale(.95);
    transform: scale(.95)
  }

  45%,80% {
    opacity: .9;
    -webkit-transform: scale(1);
    transform: scale(1)
  }
}
