@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;

    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;
        height: 44px;
    }

    .add-device {
        background-color: $blue;
        color: $color-text-inverse;
        cursor: pointer;
    }
}

.add-device.add-employees{
    display: flex;
    align-items: center;
    gap: 8px;
    transition: .2s ease;
    svg{
        height: 18px;
        width: auto;
    }
    &:hover{
      //box-shadow: 0 8px 20px -8px rgba(var(--color-primary-rgb), 0.8);
    }
}

.employees-report-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    color: $blue;
    cursor: pointer;
    transition: .2s ease;

    svg {
        flex: 0 0 auto;
    }

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

.employees-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: 550 !important;

  cursor: pointer;
  transition: 0.2s ease;

  &:focus-visible{
    outline: none;
  }

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

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


.employees-sort[data-state='open'] {
  color: $blue;

}

.employees-filter-button {
  max-width: 220px;
  padding: 11px 12px 11px 16px !important;
  border: none;
  border-radius: 20px;
  background: $color-surface;

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

  color: $gray50;
  font-size: $font-size-16 !important;
  font-weight: 550 !important;
  cursor: pointer;
  transition: 0.2s ease;

  > span:not(.employees-filter-button__reset) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  svg {
    flex: 0 0 auto;
    height: 17px;
    width: 17px;
  }

  &:focus-visible {
    outline: none;
  }

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

  &[data-state='open'],
  &.is-active {
    color: $blue;
    background-color: $blue20;
  }
}

.employees-filter-button--organisation {
  max-width: 260px;
}

.employees-filter-button__reset {
  width: 24px;
  height: 24px;
  margin-right: -5px;
  border-radius: 8px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;

  color: $blue;
  //background: rgba($gray30-rgb, 0.5);
  transition:
    background-color 0.18s ease,
    color 0.18s ease;

  &:hover {
    color: $red;
    background: rgba($gray30-rgb, 0.4);
  }
}

.employees-sort-menu {
  z-index: 100;
  min-width: 210px;
  padding: 6px;
  border-radius: 16px;
  background: $color-surface;
  box-shadow: $shadow-popover;
  animation: employeesSortMenuShow 0.16s ease;
}

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

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

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

  outline: none;
  cursor: pointer;


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

.employees-sort-menu__check {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: $blue;
  flex: 0 0 7px;
}

.employees-organisation-filter {
  z-index: 100;
  width: 300px;
  padding: 8px;
  border-radius: 16px;
  background: $color-surface;
  box-shadow: $shadow-popover;
  animation: employeesSortMenuShow 0.16s ease;
}

.employees-organisation-filter__search {
  height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  background: $color-bg;

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

  color: $gray50;

  input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: $transparent;

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

    &::placeholder {
      color: $gray50;
    }
  }
}

.employees-organisation-filter__list {
  max-height: 260px;
  margin-top: 8px;
  overflow: auto;

  display: flex;
  flex-direction: column;
  gap: 4px;

  scrollbar-width: thin;
  scrollbar-color: $gray50 $transparent;
}

.employees-organisation-filter__option {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: $transparent;

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

  color: $color-text;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    color 0.18s ease;

  span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: $font-size-14;
    font-weight: 550;
  }

  small {
    flex: 0 0 auto;
    color: $gray50;
    font-size: $font-size-12;
    font-weight: 500;
  }

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

  &.is-selected {
    background: $blue20;
    color: $blue;
  }
}

.employees-organisation-filter__state {
  padding: 14px 10px;
  color: $gray50;
  font-size: $font-size-14;
  font-weight: 500;
  text-align: center;

  &.is-error {
    color: $red;
  }
}

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

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

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

  .devices-search {
    width: 220px;
  }

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

  .employees-filter-button--organisation {
    max-width: 220px;
  }

  .employees-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;
    flex-wrap: wrap;

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

  .employees-filter-button {
    flex: 1 1 150px;
    max-width: none;
  }
}
