//////////////////////////////////////////////////////////////////////////////////////////
//   _  _ ____ _  _ ___  ____                                                           //
//   |_/  |__| |\ | |  \ |  |    This file belongs to Kando, the cross-platform         //
//   | \_ |  | | \| |__/ |__|    pie menu. Read more on github.com/kando-menu/kando     //
//                                                                                      //
//////////////////////////////////////////////////////////////////////////////////////////

// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de>
// SPDX-License-Identifier: MIT

@use '../../variables.scss' as *;
@use '../../mixins.scss' as *;

.menuList {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.menuListContent {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0px; // This is important to make the scrollboxes work.
  background-color: $window-background;
  border-top-left-radius: 12px;
  flex-grow: 1;
  border-top: $area-border;
  border-left: $area-border;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.075);

  > :first-child {
    flex-grow: 1;
  }
}

.menu {
  @include raised-button;

  position: relative;
  display: block;
  line-height: normal;
  padding: 10px;
  margin-bottom: 8px;
  text-align: left;
  width: 100%;
  overflow: hidden;

  * {
    pointer-events: none;
  }

  &.selected {
    padding-right: 100px;
  }

  // A low opacity seems to be required. Setting it to zero hides also the dragged copy
  // at the pointer.
  &.dragging {
    opacity: 0.001;
  }

  &.dropping {
    box-shadow: $drop-highlight;
  }

  .toolButtonContainer {
    position: absolute;
    right: 5px;
    opacity: 0;
    transform: translateX(20px);
    transition:
      transform 0.2s,
      opacity 0.2s;
  }

  .toolButton {
    display: inline-block;
    border-radius: 50%;
    height: 22px;
    width: 22px;
    padding: 6px;
    color: $text-link;
  }

  &.selected .toolButtonContainer {
    transform: none;
    opacity: 1;

    > * {
      pointer-events: all;
    }
  }
}

.menuTitle,
.menuSubtitle {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.menuTitle {
  font-size: 1rem;
}

.menuSubtitle {
  color: $text-muted;
  font-size: 0.8rem;
}

.addMenuButtonContainer {
  display: flex;
  gap: 2px;
  padding: 20px;
}

.message {
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
  margin-top: 30vh;

  > * {
    width: min(250px, 80%);
  }
}
