@use 'sass:math';

/* stylelint-disable max-nesting-depth */

.context-menu {
  background: var(--newtab-background-color-secondary);
  border-radius: var(--border-radius-small);
  box-shadow: $context-menu-shadow;
  display: block;
  font-size: $context-menu-font-size;
  margin-inline-start: var(--space-xsmall);
  inset-inline-start: 100%;
  position: absolute;
  inset-block-start: var(--space-small);
  z-index: 2;

  > ul {
    list-style: none;
    margin: 0;
    padding: var(--space-xsmall) 0;

    > li {
      margin: 0;
      width: 100%;

      &.separator {
        border-bottom: $border-secondary;
        margin: var(--space-xsmall) 0;
      }

      > a,
      > button {
        align-items: center;
        color: inherit;
        cursor: pointer;
        display: flex;
        width: 100%;
        outline: none;
        border: 0;
        padding: var(--space-xsmall) var(--space-medium);
        white-space: nowrap;

        &:is(:focus, :hover) {
          background: var(--newtab-element-secondary-hover-color);
        }

        &:active {
          background: var(--newtab-element-secondary-active-color);
        }

        &.disabled {
          opacity: 0.4;
          pointer-events: none;
        }
      }
    }
  }
}
