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

.devices-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background-color: $color-surface;
    border-radius: 100px;
    padding: 4px;
    box-shadow: $shadow-toolbar;
}

.devices-search {
    width: 250px;
    height: calc(100% - 20px);
    padding: 10px 12px;
    border-radius: 24px;
    background: $color-bg;
    display: flex;
    align-items: center;
    gap: 8px;
    color: $gray50;

    transition: .2s ease;

    svg {
        height: 16px;
        width: auto;
    }

    input {
        width: 100%;
        border: none;
        outline: none;
        background: $transparent;
        color: $color-text-strong;
        font-size: $font-size-16;

        &::placeholder {
            color: $gray50;
        }
    }
    
        &:focus-within{
          box-shadow: inset 0 0 0 1.5px rgba($color-primary-rgb, .15);
        }
}

.devices-toolbar__right {
    display: flex;
    align-items: center;
    gap: 6px;

    button {
        padding: 12px 20px;
        font-size: $font-size-16;
        font-weight: 500;
        background-color: $color-bg;
        border-radius: 20px;
        border: none;
    }

    .add-device {
        background-color: $blue;
        color: $color-text-inverse;
        cursor: pointer;
        transition: .2s ease;
        &:hover{
            box-shadow: 0 4px 20px -6px rgba(var(--color-primary-rgb), 0.8);
        }
    }
}


.devices-sort {
  //height: 32px;
  padding: 11px 14px 11px 20px !important;

  border: none;
  border-radius: 20px;
  background: $color-surface;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  color: $gray50;
  font-size: $font-size-14;
  font-weight: 500;

  cursor: pointer;
  transition: 0.2s ease;

  &:hover{
    background-color: $gray20;
  }

  &[data-state='open'] {
    color: $blue;
    background-color: $blue20;
  }
  svg{
    height: 22px;
    width: auto;
  }
}

.devices-sort-menu {
  z-index: 100;

  min-width: 230px;
  padding: 6px;

  border-radius: 16px;
  background: $color-surface;

  box-shadow: $shadow-popover;

  animation: devicesSortMenuShow 0.16s ease;
}

.devices-sort-menu__item {
  min-height: 38px;
  padding: 0 10px;
  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  color: $color-text-heading;
  font-size: $font-size-14;
  font-weight: 500;

  outline: none;
  cursor: pointer;

  &[data-highlighted] {
    background: $color-surface-subtle;
    color: $blue;
  }
}

.devices-sort-menu__check {
  width: 7px;
  height: 7px;

  border-radius: 50%;
  background: $blue;
  flex: 0 0 7px;
}

@keyframes devicesSortMenuShow {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.devices-filter {
    position: relative;
    border: none;
    border-radius: 20px;
    color: $gray50;
    padding: 12px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: .2s ease;

    cursor: pointer;

    &:hover{
      background-color: $gray20;
    }

    &--active{
        color: $blue;
        background-color: $blue20 !important;
    }

    svg {
        height: 19px;
        width: auto;
    }
}

.devices-filter__alert {
    position: absolute;
    top: -2px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: $blue;
}

@include desktop-down{
    .devices-toolbar {
        gap: 10px;
    }

    .devices-search {
        width: 180px !important;
        input{
            font-size: var(--font-size-14) !important;
        }
    }

    .devices-toolbar__right {
        button {
            padding: 10px 14px !important;
            font-size: var(--font-size-14) !important;
            height: 38px !important;
        }
    }

    .devices-sort {
        padding: 10px 12px 10px 14px !important;
    }
}

@include laptop-down {
    .devices-toolbar {
        gap: 10px;
    }

    .devices-search {
        width: 220px;
    }

    .devices-toolbar__right {
        button {
            padding: 10px 14px;
        }
    }

    .devices-sort {
        padding: 10px 12px 10px 14px !important;
    }
}

@include tablet-down {
    .devices-toolbar {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 6px;
        border-radius: 24px;
        padding: 6px;
    }

    .devices-search {
        order: 1;
        width: 100%;
        height: 42px;
        min-height: 42px;
        box-sizing: border-box;
    }

    .devices-toolbar__right {
        order: 2;
        width: 100%;
        justify-content: flex-end;

        .add-device {
            flex: 1 1 auto;
        }
    }
}
