@use '../../partials/flex';
@use '../../partials/text';
@use '../../partials/dir';

.context-menu {
  background-color: var(--bg-surface);
  box-shadow: var(--bs-popup);
  border-radius: var(--bo-radius);
  overflow: hidden;

  &:focus {
    outline: none;
  }
  & .tippy-content > div > .scrollbar {
    max-height: 90vh;
  }
}

.context-menu__click-wrapper {
  display: inline-flex;

  &:focus {
    outline: none;
  }
}

.context-menu__header {
  height: 34px;
  padding: 0 var(--sp-normal);
  margin-bottom: var(--sp-ultra-tight);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--bg-surface-border);

  .text {
    @extend .cp-txt__ellipsis;
    color: var(--tc-surface-low);
  }

  &:not(:first-child) {
    margin-top: var(--sp-extra-tight);
    border-top: 1px solid var(--bg-surface-border);
  }
}

.context-menu__item {
  display: flex;
  button[class^="btn"] {
    @extend .cp-fx__item-one;
    justify-content: flex-start;
    border-radius: 0;
    box-shadow: none;
    white-space: nowrap;
    padding: var(--sp-extra-tight) var(--sp-normal);

    & > .ic-raw {
      @include dir.side(margin, 0, var(--sp-tight));
    }

    // if item doesn't have icon
    .text:first-child {
      @include dir.side(
        margin,
        calc(var(--ic-small) + var(--sp-tight)),
        0
      );
    }
  }
  .btn-surface:focus {
    background-color: var(--bg-surface-hover);
  }
  .btn-positive:focus {
    background-color: var(--bg-positive-hover);
  }
  .btn-caution:focus {
    background-color: var(--bg-caution-hover);
  }
  .btn-danger:focus {
    background-color: var(--bg-danger-hover);
  }
}