@import '@opensumi/ide-components/lib/style/mixins.less';
@import './variable.less';

.overrideMenu(@n, @i: 1) when (@i =< @n) {
  @clsx: extract(@menuClx, @i);

  .kt-menu {
    &.@{clsx},
    .@{clsx} {
      padding: 2px 0px !important;
      color: var(--menu-foreground) !important;
      background-color: var(--menu-background) !important;
      border: none !important;
      .overlay-shadow(var(--kt-menu-shadow)) !important;
      border-radius: 2px !important;
      min-width: 200px;

      .@{clsx}-item,
      .@{clsx}-submenu-title {
        margin: 0 !important;
        padding: 3px 4px !important;
        height: 26px !important;
        display: flex !important;
        align-items: center !important;
        color: inherit !important;
        transition: none !important;
      }

      .@{clsx}-submenu-title:hover {
        color: inherit !important;
      }

      .@{clsx}-item:is(.@{clsx}-item-disabled) {
        cursor: default !important;
      }

      .@{clsx}-item-disabled {
        color: var(--kt-menu-disableForeground) !important;
      }

      .@{clsx}-item-divider {
        margin: 3px 0 !important;
        pointer-events: none !important;
        background-color: var(--menu-separatorBackground) !important;
        opacity: 0.3;
      }

      .@{clsx}-item-active,
      .@{clsx}-item-open,
      .@{clsx}-item-selected,
      .@{clsx}-submenu-active,
      .@{clsx}-submenu-open,
      .@{clsx}-submenu-selected {
        background: var(--menu-selectionBackground) !important;
        color: var(--menu-selectionForeground) !important;
      }

      .@{clsx}-submenu-arrow {
        display: none;
      }
    }

    // 解决 antd 弹出元素防穿透的背景色
    &.@{clsx}-submenu {
      .overlay-shadow(var(--kt-menu-shadow)) !important;
      border-radius: 0 !important;
      min-width: 120px;
      background-color: var(--menu-background) !important;
    }
  }

  .overrideMenu(@n, (@i + 1));
}

@menuClx: kt-inner-menu, kt-dropdown-menu;

.overrideMenu(length(@menuClx));

.monaco-editor {
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p {
    color: var(--foreground);
  }

  .monaco-icon-label::before {
    box-sizing: content-box;
  }

  .codicon-keyboard-tab {
    color: var(--vscode-icon-foreground);
  }
}
