.btn, .btn-icon {
  background: none;
	outline: none;
  border: none;
  cursor: pointer;

  body.animation-level-0 & {
    transition: none;
  }

  @include btn-hoverable();
}

.btn-icon {
  text-align: center;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50% !important;
  color: var(--secondary-text-color);
  background-color: transparent;
  border: none;
  padding: .5rem;
  position: relative;
  overflow: hidden;
  transition: color .15s ease-in-out, opacity .15s ease-in-out, background-color .15s ease-in-out;
  
  /* kostil */
  display: flex;
  align-items: center;
  justify-content: center;

  &.active {
    color: var(--primary-color);
  }

  &:disabled {
    pointer-events: none !important;
    opacity: var(--disabled-opacity);
  }
}

.btn-corner {
  --offset: 1.25rem;
  --translateY: calc(54px + var(--offset));
  position: absolute !important;
  bottom: var(--offset);
  right: var(--offset);
  //transition: .2s ease;
  transition: transform var(--btn-corner-transition) !important;
  transform: translate3d(0, var(--translateY), 0);
  z-index: 3;
  user-select: none;
  background-color: var(--primary-color);
  text-align: center;
  font-size: 1.5rem;
  color: #fff;
  border: none;
  outline: none;
  cursor: pointer;
  
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  
  &.is-visible {
    --translateY: 0;
  }

  body.animation-level-0 & {
		transition: none !important;
  }
  
  &:disabled {
    opacity: 1 !important;
    pointer-events: all !important;
  }

  .preloader-circular {
    width: 2.5rem;
    height: 2.5rem;
  }
}

.btn-menu {
  visibility: hidden;
  position: absolute;
  background-color: var(--surface-color);
  box-shadow: 0px 2px 8px 1px rgba(0, 0, 0, .24);
  z-index: 3;
  top: 100%;
  padding: .5rem 0;
  border-radius: $border-radius-medium;
  opacity: 0;
  transform: scale(.8);
  transition-property: opacity, transform, visibility;
  transition-duration: .2s;
  transition-timing-function: cubic-bezier(.4, 0, .2, 1);
  font-size: 16px;

  body.animation-level-0 & {
    transition: none;
  }

  -webkit-user-select: none; /* disable selection/Copy of UIWebView */
  -webkit-touch-callout: none; /* disable the IOS popup when long-press on a link */

  &.active {
    visibility: visible;
    opacity: 1;
    transform: scale(1);
  }

  &:not(.active) {
    &, .btn-menu-item {
      pointer-events: none !important;
    }
  }

  &.bottom-left {
    right: 0;
    top: 100%;
    transform-origin: top right;
  }

  &.bottom-right {
    left: 0;
    top: 100%;
    transform-origin: top left;
  }

  &.bottom-center {
    transform-origin: top center;
  }

  &.top-left {
    top: initial;
    right: 0;
    bottom: 100%;
    transform-origin: bottom right;
  }

  &.top-right {
    top: initial;
    left: 0;
    bottom: 100%;
    transform-origin: bottom left;
  }

  &.center-left {
    transform-origin: center right;
  }

  &.center-right {
    transform-origin: center left;
  }

  &-item {
    display: flex;
    position: relative;
    padding: 0 40px 0 1rem;
    height: 56px;
    cursor: pointer !important;
    pointer-events: all !important;
    color: var(--primary-text-color);
    text-transform: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    align-items: center;
    text-align: left;
    line-height: var(--line-height);

    @include hover-background-effect();

    &.danger {
      @include hover-background-effect(red);
    }

    &:before {
      color: var(--secondary-text-color);
      font-size: 1.5rem;
      margin-right: 2rem;
    }

    @include respond-to(handhelds) {
      padding: 0 30px 0 16px;
      height: 50px;
    }

    &-text {
      flex: 1 1 auto;
    }

    .checkbox-field {
      --size: 20px;
      margin: 0 .3125rem;
      padding: 0;
      display: flex;
      align-items: center;
      pointer-events: none;

      .checkbox-toggle {
        --toggle-width: 1.9375rem;
        width: var(--toggle-width);
        height: .875rem;
        background-color: var(--secondary-color);
        border-radius: $border-radius-big;
        position: relative;
        display: flex;
        align-items: center;
        transition: background-color .2s;

        &:before {
          --offset: 3px;
          width: 1.25rem;
          height: 1.25rem;
          border: 2px solid var(--secondary-color);
          transition: border-color .2s, transform .2s;
          background-color: var(--surface-color);
          content: " ";
          transform: translateX(calc(var(--offset) * -1));
          border-radius: 50%;
          position: absolute;
        }
      }

      [type="checkbox"]:checked + .checkbox-toggle {
        background-color: var(--primary-color);
        
        &:before {
          border-color: var(--primary-color);
          transform: translateX(calc(var(--toggle-width) - 1.25rem + var(--offset)));
        }
      }
    }
  }

  /* &-overlay {
    position: fixed !important;
    left: -100vw;
    right: -100vw;
    top: -100vh;
    bottom: -100vh;
    z-index: 1;
    background-color: rgba(0, 0, 0, .2);
  } */
  &-overlay {
    position: fixed !important;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1;
    cursor: default;
    user-select: none;
    //background-color: rgba(0, 0, 0, .2);
  }

  /* &-toggle  */&-overlay {
    left: -100vw;
    right: -100vw;
    top: -100vh;
    bottom: -100vh;

    width: auto !important;
    max-width: none !important;
  }
}

.btn-primary {
  border-radius: $border-radius-medium;
  width: 100%;
  text-align: center;
  height: 54px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  padding: 0; // new
  transition: .2s opacity;
 
  @include hover() {
    transition: .2s background-color, .2s opacity;
    background: var(--dark-primary-color);
  }

  &-transparent {
    color: var(--primary-color);
    background-color: transparent;

    @include hover() {
      background: var(--light-primary-color);
    }

    &.danger {
      @include hover-background-effect(red, false);
    }

    .preloader-circular .preloader-path {
      stroke: var(--primary-color);
    }
  }

  body.animation-level-0 & {
    transition: none;
  }
  
  > svg, use {
    height: calc(100% - 20px);
    right: 15px;
    left: auto;
  }

  &:disabled {
    pointer-events: none !important;
    opacity: var(--disabled-opacity);
  }
}

// ! example: multiselect input, button in pinned messages chat, settings, chat background tab
.btn-transparent {
  color: var(--primary-text-color);
  background-color: transparent;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  height: 3.5rem;
  //width: auto;
  //text-transform: capitalize;
  font-weight: normal;
  line-height: 1.3125; // * it centers the text

  @include respond-to(handhelds) {
    height: 3rem;
  }

  @include hover-background-effect();

  &.danger {
    @include hover-background-effect(red);
  }

  // * tgico
  &:before {
    color: var(--secondary-text-color);
    font-size: 1.5rem;
    margin-right: 2rem;
  }

  &.btn-short:before {
    margin-right: 1rem;
  }
}

.btn-primary.btn-circle {
  .preloader-circular {
    height: calc(100% - 20px);
    right: auto;
    left: auto;
    margin: 0;
    top: 10px;
    
    .preloader-path {
      stroke: #fff;
    }
  }
}

.btn-menu-toggle {
  position: relative;
  overflow: visible !important;
  font-weight: normal !important;
  cursor: pointer !important;
  pointer-events: all !important;

  &:not(.btn-primary):not(.btn-corner).menu-open {
    background-color: var(--light-secondary-text-color);
  }

  .btn-menu {
    margin-top: .5rem;
  }
}

.btn-circle {
  border-radius: 50%;
  height: 54px;
  width: 54px;
  line-height: 54px;
  
  @include respond-to(handhelds) {
    height: 46px;
    width: 46px;
  }
  
  path {
    fill: white;
  }
}

.btn-disabled {
  pointer-events: none !important;
  cursor: default !important;
  color: var(--secondary-text-color) !important;

  &:before {
    color: inherit !important;
  }
}

.btn-secondary:not(:first-child) {
  margin-top: .5rem !important;
}

.btn-color-primary {
  background: var(--primary-color);
  color: #fff;

  /* .c-ripple__circle {
    background-color: var(--light-primary-color);
  } */
}
