/*
 * Copyright 2022 Haulmont.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

.jmix-list-menu {
  color: var(--lumo-secondary-text-color);
  margin: 0;
  overflow: auto;
  padding: 0 var(--lumo-space-s);
}

.jmix-list-menu .jmix-menubar-item .menubar-list {
  margin-inline-start: var(--lumo-space-l);
}

.jmix-list-menu .jmix-menubar-item {
  padding: var(--lumo-space-s) 0;
  margin: 0;
}

.jmix-list-menu .jmix-menubar-item vaadin-details-summary {
  padding: var(--lumo-space-s);
}

.jmix-list-menu .jmix-menubar-item .jmix-menubar-summary-icon-container {
  display: flex;
  gap: var(--lumo-space-s);
  align-items: center;
}

.jmix-list-menu .jmix-menu-item-link .link-icon,
.jmix-list-menu .jmix-menubar-item .jmix-menubar-summary-icon-container .menubar-icon {
  width: var(--lumo-icon-size-s);
  height: var(--lumo-icon-size-s);
  flex-shrink: 0;
}

.jmix-list-menu .jmix-menu-item-link .prefix-component,
.jmix-list-menu .jmix-menubar-item .jmix-menubar-summary-icon-container .prefix-component {
  flex-shrink: 0;
}

.jmix-list-menu .jmix-menu-item-link vaadin-icon.prefix-component,
.jmix-list-menu .jmix-menubar-item .jmix-menubar-summary-icon-container vaadin-icon.prefix-component {
  width: var(--lumo-icon-size-s);
  height: var(--lumo-icon-size-s);
}

.jmix-list-menu .jmix-menu-item-link vaadin-icon.prefix-component[icon^='vaadin:'],
.jmix-list-menu .jmix-menubar-item .jmix-menubar-summary-icon-container vaadin-icon.prefix-component[icon^='vaadin:'] {
  padding: 0.125em;
  box-sizing: border-box;
}

.jmix-list-menu .jmix-menubar-item .menubar-summary {
  white-space: nowrap;
  font-weight: bold;
  text-overflow: ellipsis;
  overflow: hidden;
}

.jmix-list-menu .jmix-menu-item-link .suffix-component,
.jmix-list-menu .jmix-menubar-item .jmix-menubar-summary-icon-container .suffix-component {
  margin-inline-start: auto;
  flex-shrink: 0;
}

.jmix-list-menu .jmix-menu-item-link {
  gap: var(--lumo-space-s);
  padding: var(--lumo-space-s);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  align-items: center;
}

.jmix-list-menu .jmix-menu-item-link .link-text {
  line-height: var(--lumo-line-height-s);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jmix-list-menu a[highlight][class*='jmix-menu-item-link'] {
  color: var(--lumo-primary-text-color);
}

.jmix-list-menu a[highlight][class*='jmix-menu-item-link'] {
  background-color: var(--lumo-primary-color-10pct);
  border-radius: var(--lumo-border-radius-m);
}

.jmix-list-menu .jmix-menubar-item vaadin-details-summary::part(content) {
  display: flex;
  overflow: hidden;
  width: 100%;
  align-items: center;
}

.jmix-list-menu[theme~='toggle-reverse'] vaadin-details-summary {
  justify-content: space-between;
}

.jmix-list-menu[theme~='toggle-reverse'] vaadin-details-summary::part(toggle) {
  order: 1;
  margin-inline-end: 0;
}

@supports selector(:focus-visible) {
  .jmix-list-menu .jmix-menu-item-link:focus-visible {
    border-radius: var(--lumo-border-radius-m);
    box-shadow: 0 0 0 var(--vaadin-focus-ring-width, 2px) var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
    outline: 0;
  }
}