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

.add-employee-modal__overlay {
  position: fixed;
  inset: 0;
  z-index: 110;

  background: $color-backdrop;
  backdrop-filter: blur(2px);

}

.add-employee-modal {
  position: fixed;
  z-index: 120;
  top: 50%;
  left: 50%;

  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;

  transform: translate(-50%, -50%);

  border-radius: 26px;
  background: $color-surface;
  padding: 24px;

  box-shadow: $shadow-modal;

}

.add-employee-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;

  margin-bottom: 22px;
}

.add-employee-modal__title {
  margin: 0;

  color: $color-text-strong;
  font-size: $font-size-24;
  font-weight: 650;
}

.add-employee-modal__description {
  margin: 6px 0 0;

  color: $gray50;
  font-size: $font-size-15;
  font-weight: 400;
}

.add-employee-modal__close {
  width: 40px;
  height: 40px;

  border: none;
  border-radius: 12px;
  background: $color-bg;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: $gray50;
  cursor: pointer;

  transition: 0.2s ease;

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

  &:disabled {
    opacity: 0.6;
    cursor: default;
  }
}

.add-employee-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.add-employee-layout {
  //display: grid;
  //grid-template-columns: 260px minmax(0, 1fr);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: start;
}

.add-employee-fields__section {
  border: 1px solid $color-border-accent;
  border-radius: 22px;
  background: $color-surface-muted;
  flex: 1;
}
.avatar-fio-container{
  display: flex;
  flex: 1;
  gap: 20px;
}

.add-employee-fields__title {
  span {
    color: $color-text-strong;
    font-size: $font-size-16;
    font-weight: 650;
  }

  p {
    margin: 5px 0 0;
    color: $gray50;
    font-size: $font-size-13;
    font-weight: 500;
    line-height: 1.35;
  }
}

.add-employee-fields {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
}

.add-employee-fields__section {
  padding: 16px;

  display: flex;
  flex-direction: column;
  gap: 12px;
}

.add-employee-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.add-employee-form__grid--credentials {
  align-items: end;
}

.add-employee-field__spacer {
  visibility: hidden;
}

.add-employee-field {
  display: flex;
  flex-direction: column;
  gap: 8px;

  > span {
    color: $color-text-heading;
    font-size: $font-size-14;
    font-weight: 600;
  }

  input,
  select {
    height: 44px;
    border: 1px solid $color-border-strong;
    border-radius: 14px;
    padding: 0 14px;

    background: $color-surface;
    outline: none;

    color: $color-text-strong;
    font-size: $font-size-15;
    font-weight: 400;

    transition:
      border-color 0.2s ease,
      background-color 0.2s ease,
      box-shadow 0.2s ease;

    &:focus {
      border-color: $blue;
      background: $color-surface;
      box-shadow: 0 0 0 3px rgba($color-primary-rgb, 0.12);
    }

    &:disabled {
      opacity: 0.65;
      cursor: not-allowed;
    }

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

  select {
    cursor: pointer;
  }
}

.employee-role-select {
  width: 100%;

  .organisation-select__trigger {
    border-radius: 14px;
  }
}

.employee-role-select__dropdown {
  z-index: 140;
}

.employee-role-select__list {
  margin-top: 0;
  max-height: none;
}

.employee-role-select__option {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;

  small {
    flex: 0 1 auto;
    white-space: normal;
    line-height: 1.3;
  }
}

.employee-password-picker {
  --height: 44px;
  --radius: 14px;
  --motion: 320ms cubic-bezier(0.34, 1.42, 0.64, 1);

  width: 100%;
  height: var(--height);

  display: flex;
  align-items: center;
  gap: 0;

  color: $color-text-strong;

  transition:
    gap var(--motion),
    opacity 180ms ease;
}

.employee-password-picker__button,
.employee-password-picker__status,
.employee-password-picker__input,
.employee-password-picker__action {
  height: var(--height);
  min-width: 0;
  border: 0;
  outline: 0;
  border-radius: var(--radius);
  background: $color-surface;
  color: inherit;
  font: inherit;
  height: 46px;

  transition:
    flex-basis var(--motion),
    width var(--motion),
    padding var(--motion),
    opacity 180ms ease,
    transform var(--motion),
    background-color 220ms ease,
    color 220ms ease,
    box-shadow 220ms ease;
}

.employee-password-picker__button,
.employee-password-picker__status {
  width: 100%;
  flex: 1 1 auto;
  padding: 0 14px;

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

  border: 1px solid $color-border-strong;
  cursor: pointer;

  color: $gray50;
  font-size: $font-size-15;
  font-weight: 600;
  white-space: nowrap;

  svg {
    flex: 0 0 auto;
  }
}

.employee-password-picker__button {
  border: 1px solid $color-border-strong;
  cursor: pointer;

  &:hover:not(:disabled) {
    border-color: rgba($color-primary-rgb, 0.24);
    background: $blue20;
    color: $blue;
  }

  &:disabled {
    opacity: 0.65;
    cursor: not-allowed;
  }
}

.employee-password-picker__status {
  border: 1px solid rgba($color-primary-rgb, 0.18);
  background: $blue20;
  color: $blue;
}

.employee-password-picker__input {
  width: auto !important;
  flex: 1 1 auto;
  padding: 0 14px !important;
  border: 1px solid $color-border-strong !important;

  opacity: 1;
  pointer-events: auto;
  transform: scaleX(1);

  background: $color-surface !important;
  font-size: $font-size-15 !important;
  -webkit-text-fill-color: $color-text-strong;

  &:focus {
    border-color: $blue !important;
    box-shadow: 0 0 0 3px rgba($color-primary-rgb, 0.12);
  }

  &:disabled {
    opacity: 0.65;
    pointer-events: none;
  }
}

.employee-password-picker__action {
  width: var(--height);
  flex: 0 0 var(--height);
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  opacity: 1;
  transform: scale(1) rotate(0deg);

  background: $color-surface;
  color: $gray50;
  cursor: pointer;

  &:hover:not(:disabled) {
    background: rgba($color-danger-rgb, 0.08);
    color: $red;
  }

  &:disabled {
    opacity: 0.45;
    cursor: default;
    transform: scale(0.92);
  }
}

.employee-password-picker--open {
  gap: 8px;
}

.employee-password-picker--confirmed {
  gap: 8px;
}

.employee-password-picker__action--confirm {
  background: $blue20;
  color: $blue;

  &:hover:not(:disabled) {
    background: $blue;
    color: $color-text-inverse;
    box-shadow: 0 8px 20px rgba($color-primary-rgb, 0.18);
  }
}

.employee-password-confirm {
  --height: 46px;
  --radius: 14px;

  width: 100%;
  height: var(--height);

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

.employee-password-confirm__input {
  --motion: 320ms cubic-bezier(0.34, 1.42, 0.64, 1);

  flex: 1 1 auto;
  min-width: 0;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform var(--motion);
}

.add-employee-field--password-confirm-error {
  .employee-password-confirm__input {
    border-color: rgba($color-danger-rgb, 0.62) !important;
    box-shadow: 0 0 0 3px rgba($color-danger-rgb, 0.1) !important;
  }
}

.add-employee-error {
  border-radius: 14px;
  background: $color-danger-tint;
  padding: 12px 14px;

  color: $red;
  font-size: $font-size-14;
  font-weight: 500;
}

.add-employee-modal__footer {
  padding-top: 4px;

  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.add-employee-cancel,
.add-employee-submit {
  height: 42px;
  padding: 0 18px;

  border: none;
  border-radius: 14px;

  font-size: $font-size-15;
  font-weight: 600;
  cursor: pointer;

  transition: 0.2s ease;
}

.add-employee-cancel {
  background: $color-bg;
  color: $gray50;

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

  &:disabled {
    opacity: 0.65;
    cursor: default;
  }
}

.add-employee-submit {
  background: $blue;
  color: $color-text-inverse;

  &:hover {
    box-shadow: inset 0 0 0 1px $blue, 0 8px 20px -8px rgba(var(--color-primary-rgb), 0.8);
  }

  &:disabled {
    opacity: 0.65;
    cursor: default;
  }
  &:disabled:hover {
    box-shadow: none;
  }
}

@media (max-width: 820px) {
  .add-employee-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .add-employee-modal {
    width: min(100vw - 20px, 520px);
    padding: 18px;
    border-radius: 22px;
  }

  .add-employee-form__grid {
    grid-template-columns: 1fr;
  }
}
