@use '@/styles/variables' as *;
@use '@/styles/mixins' as *;

.header {
  @include flex-between;
  height: $header-height;
  padding: 0 $page-padding;
  background-color: $card-background;
  border-bottom: 1px solid $border-color;

  &__left {
    @include flex-column;
    gap: $spacing-xs;
  }

  &__breadcrumb {
    @include flex-start;
    font-size: $font-size-sm;
  }

  &__breadcrumbItem {
    @include flex-start;
    gap: $spacing-sm;
  }

  &__breadcrumbLink {
    color: $text-secondary;
    @include transition-fast;

    &:hover {
      color: $primary-color;
    }
  }

  &__breadcrumbCurrent {
    color: $text-primary;
  }

  &__breadcrumbSeparator {
    color: $text-disabled;
  }

  &__title {
    font-size: $font-size-lg;
    font-weight: $font-weight-semibold;
    color: $text-primary;
    margin: 0;
  }

  &__right {
    @include flex-start;
    gap: $spacing-lg;
  }

  &__actions {
    @include flex-start;
    gap: $spacing-sm;
  }

  &__iconButton {
    @include flex-center;
    width: 40px;
    height: 40px;
    border-radius: $border-radius-base;
    color: $text-secondary;
    @include transition-fast;

    &:hover {
      background-color: $background-color;
      color: $text-primary;
    }

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

  &__user {
    position: relative;
    @include flex-start;
    gap: $spacing-sm;
    padding: $spacing-sm $spacing-md;
    border-radius: $border-radius-base;
    cursor: pointer;
    @include transition-fast;

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

      .header__dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
      }
    }
  }

  &__userInfo {
    @include flex-column;
    gap: 2px;
  }

  &__userName {
    font-size: $font-size-sm;
    font-weight: $font-weight-medium;
    color: $text-primary;
  }

  &__userRole {
    font-size: $font-size-xs;
    color: $text-secondary;
  }

  &__dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    margin-top: $spacing-xs;
    padding: $spacing-sm;
    background-color: $card-background;
    border: 1px solid $border-color;
    border-radius: $border-radius-base;
    box-shadow: $shadow-lg;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    @include transition-fast;
    z-index: $z-index-dropdown;
  }

  &__dropdownItem {
    @include flex-start;
    gap: $spacing-sm;
    width: 100%;
    padding: $spacing-sm $spacing-md;
    border-radius: $border-radius-sm;
    font-size: $font-size-sm;
    color: $text-primary;
    @include transition-fast;

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

    &--danger {
      color: $error-color;

      &:hover {
        background-color: rgba($error-color, 0.05);
      }
    }

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

  &__dropdownDivider {
    margin: $spacing-sm 0;
    border-top: 1px solid $border-color;
  }
}
