/*
 * Copyright 2014 The Chromium Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

.soft-context-menu {
  overflow-y: auto;
  min-width: 160px !important; /* stylelint-disable-line declaration-no-important */
  /* NOTE: Keep padding in sync with padding adjustment in SoftContextMenu.ts */
  padding: var(--sys-size-5) 0;
  border: 1px solid var(--sys-color-neutral-outline);
  border-radius: var(--sys-shape-corner-small);
  background-color: var(--app-color-menu-background);
  box-shadow: var(--sys-elevation-level3);
}

:host-context(.theme-with-dark-background) .soft-context-menu {
  border: none;
}

.dockside-title {
  padding-right: var(--sys-size-14);
}

.dockside-title + devtools-toolbar {
  margin-right: -8px;
}

.soft-context-menu-item {
  display: flex;
  width: 100%;
  font-size: 12px;
  height: var(--sys-size-11);
  padding: 0 var(--sys-size-8);
  white-space: nowrap;
  align-items: center;

  &.soft-context-menu-item-mouse-over {
    background-color: var(--sys-color-state-hover-on-subtle);
  }

  & .new-badge {
    margin-left: var(--sys-size-4);
  }

  & devtools-icon {
    width: var(--sys-size-8);
    height: var(--sys-size-8);
    pointer-events: none;

    &.checkmark {
      margin-right: var(--sys-size-3);
      opacity: 0%;

      .soft-context-menu-item[checked] & {
        opacity: 100%;
      }
    }

    &[name="experiment"] {
      width: var(--sys-size-11);
      height: var(--sys-size-11);
      padding: 0 var(--sys-size-3);
    }
  }
}

.soft-context-menu-disabled {
  color: var(--sys-color-state-disabled);
  pointer-events: none;
}

.soft-context-menu-separator {
  padding: var(--sys-size-4) 0;

  & > .separator-line {
    height: var(--sys-size-1);
    border-bottom: var(--sys-size-1) solid var(--sys-color-divider);
    pointer-events: none;
  }
}

.soft-context-menu-item-submenu-arrow {
  pointer-events: none;
  text-align: right;
  align-self: center;
  margin-left: auto;

  & > devtools-icon {
    width: var(--sys-size-8);
    height: var(--sys-size-8);
    color: var(--sys-color-on-surface-subtle);
  }
}

.soft-context-menu-custom-item {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex: auto;
}

.soft-context-menu-shortcut {
  color: var(--sys-color-on-surface-subtle);
  pointer-events: none;
  flex: 1 1 auto;
  text-align: right;
  padding-left: var(--sys-size-6);

  .soft-context-menu-disabled &,
  .soft-context-menu-item-mouse-over & {
    color: inherit;
  }
}

@media (forced-colors: active) {
  .soft-context-menu-item {
    color: canvastext;
  }

  .soft-context-menu-item.soft-context-menu-item-mouse-over,
  .theme-with-dark-background .soft-context-menu-item.soft-context-menu-item-mouse-over,
  :host-context(.theme-with-dark-background) .soft-context-menu-item.soft-context-menu-item-mouse-over {
    background-color: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }

  .soft-context-menu .soft-context-menu-item devtools-icon,
  .soft-context-menu .soft-context-menu-item .soft-context-menu-shortcut {
    color: ButtonText;
  }

  .soft-context-menu .soft-context-menu-item.soft-context-menu-item-mouse-over devtools-icon,
  .soft-context-menu .soft-context-menu-item.soft-context-menu-item-mouse-over .soft-context-menu-shortcut {
    color: HighlightText;
  }

  .soft-context-menu:focus-visible {
    forced-color-adjust: none;
    background: canvas;
    border-color: Highlight;
  }

  .soft-context-menu-separator > .separator-line {
    border-bottom-color: ButtonText;
  }
}
