@use '../../../../shared/styles/variables' as *;


.device-actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100% - 40px);

  h3 {
    line-height: 1;
    margin: 0 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid $color-border;
    text-align: left;
    color: $color-text-heading;
    font-size: $font-size-18;
    font-weight: 600;
  }

  .actions-button-container {
    display: flex;
    flex-direction: column;
  }

  button {
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: $color-bg;

    display: flex;
    align-items: center;

    color: $gray50;
    font-size: $font-size-18;
    font-weight: 550;
    cursor: pointer;
    transition: .2s ease;
    small{
        font-weight: 500;
        opacity: .8;
    }
    .actions-button-text{
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    svg {
      height: 32px;
      width: 32px;
    }

    &:not(:disabled):hover {
      background-color: rgba($gray20-rgb, .9);
      //color: $blue;
      box-shadow: inset 0 0 0 1.5px rgba($gray50-rgb, .1);
    }

    &:disabled {
      opacity: .74;
      cursor: not-allowed;

      &:hover {
        background: $color-bg;
        color: $gray50;
      }
    }

    &+button {
      margin-top: 8px;
    }
  }

  .device-actions__lock-button {
    overflow: hidden;

    .device-actions__lock-content {
      position: relative;
      display: grid;
      width: 100%;
      min-height: 40px;
      min-width: 0;
      overflow: hidden;
    }

    .device-actions__lock-state {
      grid-area: 1 / 1;
      display: flex;
      align-items: center;
      gap: 14px;
      width: 100%;
      min-height: 40px;
      min-width: 0;
    }

    .device-actions__lock-icon {
      flex: 0 0 32px;
      transition:
        color 0.2s ease,
        transform 0.24s cubic-bezier(0.34, 1.42, 0.64, 1);
    }

    &.is-loading {
      opacity: 1;
      cursor: wait;

      .device-actions__loading-icon {
        color: $blue;
        transform: none;
        transform-box: fill-box;
        transform-origin: center;
        backface-visibility: hidden;
        transition: color 0.2s ease;
        will-change: transform;
        animation: device-actions-loading-spin 0.85s linear infinite;
      }

      &:disabled:hover {
        background: $color-bg;
        color: $gray50;
      }
    }

    &.is-lock:not(.is-loading) {
      &:not(:disabled):hover {
        .device-actions__lock-icon {
          color: $red;
          transform: translateY(-1px) scale(1.06);
        }
      }
    }

    &.is-unlock:not(.is-loading) {
      &:not(:disabled):hover {
        .device-actions__lock-icon {
          color: $blue;
          transform: rotate(-8deg) translateY(-1px) scale(1.06);
        }
      }
    }
  }

  .device-actions__error {
    margin-top: 10px;
    padding: 7px 10px;
    border-radius: 10px;
    background: $color-danger-tint;

    color: $red;
    font-size: $font-size-13;
    font-weight: 600;
    line-height: 1.25;
  }

  .future-label{
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: $font-size-14;
    font-weight: 550;
    padding: 10px 14px;
    margin-top: 20px;
    gap: 14px;
    color: $blue;
    background-color: $blue20;
    border-radius: 14px;
    svg{
        height: 20px;
        width: auto;
    }
  }
}

.device-actions__apps-icon {
  transition: color 0.2s ease;

  rect {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.22s ease;
  }
}

.device-actions__apps-button:not(:disabled):hover {
  .device-actions__apps-icon {
    color: $blue;

    rect:nth-child(2) {
      --tile-pop-x: 1.7px;
      --tile-pop-y: -1.7px;
      --tile-rest-x: 0.8px;
      --tile-rest-y: -0.8px;
      animation: device-actions-app-tile 0.48s cubic-bezier(0.34, 1.42, 0.64, 1);
      transform: translate(var(--tile-rest-x), var(--tile-rest-y)) scale(1);
    }
  }
}

@keyframes device-actions-app-tile {
  0% {
    transform: translate(0, 0) scale(1);
  }

  45% {
    transform: translate(var(--tile-pop-x), var(--tile-pop-y)) scale(0.86);
  }

  100% {
    transform: translate(var(--tile-rest-x, 0), var(--tile-rest-y, 0)) scale(1);
  }
}

@keyframes device-actions-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .device-actions {
    .device-actions__lock-button.is-loading {
      .device-actions__loading-icon {
        animation: none;
      }
    }
  }
}
