/*! _buttons.scss | Friendkit | © Css Ninja. 2020-2021 */

/* ==========================================================================
Friendkit button styles
========================================================================== */

/*
    1. Main Class
    2. Like button
    3. Circle button
    4. Load more button
    5. Spinner button
*/

/* ==========================================================================
1. Main Class
========================================================================== */

button.button {
  line-height: 0;
}

.button {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 18px 22px;
  border-radius: 0.65rem;
  transition: all 0.3s;

  &.is-rounded {
    padding-left: 1.5em;
    padding-right: 1.5em;
  }

  &.icon-button {
    width: 32px;
    height: 32px;
    padding: 0;

    svg {
      height: 16px !important;
      width: 16px !important;
      stroke: $sidebar;
    }

    &.is-solid {
      svg {
        stroke: $white !important;
      }
    }
  }

  &.has-icon {
    svg {
      height: 16px;
      width: 16px;
      min-height: 16px;
      min-width: 16px;
      margin-right: 4px;
    }
  }

  &.default-raised:hover {
    box-shadow:
      0 14px 26px -12px rgba(0, 0, 0, 0.42),
      0 4px 23px 0px rgba(0, 0, 0, 0.12),
      0 8px 10px -5px rgba(0, 0, 0, 0.2);
    opacity: 0.8;
  }

  &.is-phantom {
    background: transparent;
    border: 2px solid transparent;

    &.primary-button {
      color: $primary;

      &:hover {
        border-color: $primary;
      }
    }

    &.accent-button {
      color: $accent;

      &:hover {
        border-color: $accent;
      }
    }
  }

  &.is-reversed-phantom {
    background: transparent;
    border: 1px solid transparent;

    &.primary-button {
      color: $primary;

      &:hover {
        border-color: transparent !important;
        background: $primary;
        color: $white-light;
      }
    }

    &.accent-button {
      color: $accent;

      &:hover {
        border-color: transparent !important;
        background: $accent;
        color: $white-light;
      }
    }
  }

  &.is-solid {
    &.primary-button {
      background: $primary;
      border-color: $primary;
      color: $white;

      &.raised:hover {
        box-shadow: $primary-box-shadow;
        opacity: 0.8;
      }
    }

    &.secondary-button {
      background: $secondary;
      border-color: $secondary;
      color: $white;

      &.raised:hover {
        box-shadow: $secondary-box-shadow;
        opacity: 0.8;
      }
    }

    &.accent-button {
      background: $accent;
      border-color: $accent;
      color: $white;

      &.raised:hover {
        box-shadow: $accent-box-shadow;
        opacity: 0.8;
      }
    }

    &.red-button {
      background: $red;
      border-color: $red;
      color: $white;

      &.raised:hover {
        box-shadow: $red-box-shadow;
        opacity: 0.8;
      }
    }

    &.green-button {
      background: $green;
      border-color: $green;
      color: $white;

      &.raised:hover {
        box-shadow: $green-box-shadow;
        opacity: 0.8;
      }
    }

    &.blue-button {
      background: $blue;
      border-color: $blue;
      color: $white;

      &.raised:hover {
        box-shadow: $blue-box-shadow;
        opacity: 0.8;
      }
    }

    &.grey-button {
      background: lighten($fade-grey, 6%);
      border-color: lighten($fade-grey, 6%);

      svg {
        stroke: $sidebar !important;
      }

      &:hover {
        background: lighten($fade-grey, 4%);
        border-color: lighten($fade-grey, 4%);
      }
    }

    &.dark-grey-button {
      background: lighten($fade-grey, 2%);
      border-color: lighten($fade-grey, 2%);

      svg {
        stroke: $sidebar !important;
      }

      &:hover {
        background: darken($fade-grey, 4%);
        border-color: darken($fade-grey, 4%);
      }
    }
  }

  &.light-button {
    background: transparent;
    border-color: $white;
    color: $white;
    font-weight: 500;

    &:hover {
      background: $white;
      color: $dark-text;
    }

    &.raised:hover {
      box-shadow: $primary-box-shadow !important;
      opacity: 0.8;
    }
  }
}

/* ==========================================================================
2. Like button
========================================================================== */

.like-wrapper {
  .like-button {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: $white;
    box-shadow: 0px 5px 43px rgba(0, 0, 0, 0.18);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    text-decoration: none;
    opacity: 1 !important;
    overflow: hidden;

    .like-overlay {
      display: block;
      position: absolute;
      top: 0;
      left: 0;
      width: 54px;
      height: 54px;
      border-radius: 50%;
      background: darken($red, 10%);
      transform: scale(0);
      transition: all 0.4s;
      z-index: 0;
    }

    i {
      &.not-liked {
        display: block;
        color: darken($red, 10%);
        position: relative;
        z-index: 1;
      }

      &.is-liked {
        display: none;
        color: $white;
        position: relative;
        z-index: 1;
      }
    }

    &.is-active {
      box-shadow: 0px 5px 43px rgba($red, 0.18);

      .like-overlay {
        transform: scale(1);
      }

      i {
        &.not-liked {
          display: none;
        }

        &.is-liked {
          display: block;
        }
      }
    }
  }
}

/* ==========================================================================
3. Circle button
========================================================================== */

.fab-wrapper {
  &.is-share {
    a {
      background: lighten($accent, 5%);
      box-shadow: $accent-box-shadow;

      &:hover {
        background: lighten($accent, 12%);

        svg {
          stroke: $white;
        }
      }
    }
  }

  &.is-comment {
    a {
      background: lighten($accent, 5%);
      box-shadow: $accent-box-shadow;

      &:hover {
        background: lighten($accent, 12%);

        svg {
          stroke: $white;
        }
      }
    }
  }

  .small-fab {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 43px;
    height: 43px;
    border-radius: 50%;
    color: $white-smoke;
    opacity: 1;
    transition: all 0.3s;

    svg {
      width: 18px;
      height: 18px;
      transition: all 0.3s;
    }

    &.is-active {
      background: $accent;
    }
  }
}

/* ==========================================================================
4. Load more button
========================================================================== */

.load-more-wrap {
  padding: 40px 0;

  &.narrow-top {
    padding-top: 20px 0;
  }
}

.load-more-button {
  box-sizing: border-box;
  display: inline-block;
  width: 9em;
  height: 2.75em;
  padding: 0.5em 1em;
  background-color: $white;
  border: 1px solid $accent-grey;
  border-radius: 4px;
  text-align: center;
  color: $medium-text !important;
  white-space: nowrap;
  line-height: 1.5;
  font-size: 1em;
  text-decoration: none;
  transition:
    width 0.1s ease,
    height 0.4s ease,
    border-width 0.4s ease,
    border-radius 0.4s ease,
    border-color 0.4s ease,
    padding 0.4s ease;

  &:focus {
    outline: none;
    border-color: $medium-grey;
  }

  &:hover {
    background: $white-light;
  }

  &.loading {
    height: 24px;
    width: 24px;
    padding: 0;
    border-width: 2px;
    border-radius: 17px;
    border-color: $cream-grey $cream-grey $cream-grey $muted-grey;
    background: $white;
    font-size: 0;
    color: transparent;
    pointer-events: none;
    animation: spin 1.2s infinite linear;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
5. Spinner button
========================================================================== */

.spinner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  min-width: 110px;
  border: 1px solid $fade-grey;
  border-radius: 100px;
  box-shadow: $light-box-shadow;
  padding: 0 4px;

  .add,
  .remove {
    height: 38px;
    width: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    background: none;
    cursor: pointer;
    outline: none !important;

    &:hover {
      svg {
        stroke: $dark-text;
      }
    }

    svg {
      height: 14px;
      width: 14px;
      stroke: $med-grey;
      transition: stroke 0.3s;
    }
  }

  .value {
    font-size: 0.9rem;
    font-weight: 500;
    color: $dark-text;
    user-select: none;
  }
}
