@use 'mixins/mixins' as *;
@use 'mixins/var' as *;
@use 'common/var' as *;

@include b(navbar-group) {
  position: relative;

  &::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translate(-50%);
    bottom: -3px;
    max-width: 18px;
    margin: auto;
    width: 0;
    transition: width 0.3s ease;
    height: 3px;
    border-radius: 12px;
    background-color: black;
  }

  &:hover {
    .#{$namespace}-navbar-group__text {
      opacity: 1;
    }
    .#{$namespace}-navbar-group__items {
      opacity: 1;
      visibility: visible;
      transform: translate(0, 100%);
    }
  }

  @include when(active) {
    .#{$namespace}-navbar-group__text {
      opacity: 1;
    }

    &::after {
      width: 100%;
    }
  }

  @include e(text) {
    padding: 10px 15px;
    font-size: 0.85rem;
    background: transparent;
    color: inherit;
    font-weight: bold;
    transition: getCssVar(transition-ease), color 0s;
    opacity: 0.7;
    border: 0px;
    cursor: pointer;
  }

  @include e(items) {
    @include flex(center, center);
    position: absolute;
    bottom: 0px;
    left: 0px;
    flex-direction: column;
    margin-bottom: -12px;
    transform: translate(0, 90%);
    background: getColor('color');
    border-radius: 5px 18px 18px 18px;
    padding: 10px;
    min-width: 160px;
    opacity: 0;
    box-shadow: 0px 5px 20px 0px rgba(0, 0, 0, getCssVar('shadow-opacity'));
    transition: getCssVar(transition-ease);
    color: inherit;
    visibility: hidden;

    &:after {
      content: '';
      left: 0px;
      top: -13px;
      background: transparent;
      width: 100%;
      height: 14px;
      position: absolute;
      z-index: -1;
    }

    .#{$namespace}-navbar-item {
      text-align: left;
      width: 100%;
      position: relative;
      padding: 5px 10px;

      &:before {
        content: '';
        left: 0px;
        top: 0px;
        width: 4px;
        height: 4px;
        background: getColor('text');
        position: absolute;
        border-radius: 50%;
        top: calc(50% - 2px);
        opacity: 0;
        transform: translate(-10px);
        transition: getCssVar(transition-ease);
      }
      @include when(active) {
        &:before {
          opacity: 1;
          transform: translate(0px);
        }
      }

      &::after {
        width: 0;
        height: 0;
      }
    }
  }
}
