//////////////////////////////////////////////////////////////////////////////////////////
//   _  _ ____ _  _ ___  ____                                                           //
//   |_/  |__| |\ | |  \ |  |    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 *;

.button {
  @include normal-button;

  display: inline-flex;
  align-items: center;

  font-size: inherit;
  white-space: nowrap;
  line-height: 1.3rem;

  .text {
    text-overflow: ellipsis;
    overflow: hidden;
    min-width: 0;
  }

  &:active {
    transform: translateY(1px);
  }

  &.grouped:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  &.grouped:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .indicator {
    width: 8px;
    height: 8px;
    background-color: $key-dark;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    right: 4px;
  }

  .badge {
    font-size: 0.75em;
    background-color: $key-dark;
    color: $text-always-light;
    border-radius: 4px;
    padding: 2px 8px;
    transform: translateX(8px);
  }
}

.left {
  justify-content: flex-start;
}

.right {
  justify-content: flex-end;
}

.center {
  justify-content: center;
}

.invisible {
  @include invisible-button;
}

.tool {
  @include tool-button;
}

.primary {
  @include primary-button;
}

.pill {
  border-radius: 50px;
}

.small {
  padding: 7px;
  font-size: 0.8em;
  gap: 4px;

  &.grouped {
    padding: 7px;

    &.flat:last-child,
    &.pill:last-child {
      padding-right: 9px;
    }
    &.flat:first-child,
    &.pill:first-child {
      padding-left: 9px;
    }
  }
}

.medium {
  padding: 8px;
  font-size: 1em;
  gap: 6px;

  &.grouped {
    padding: 8px;

    &.flat:last-child,
    &.pill:last-child {
      padding-right: 15px;
    }
    &.flat:first-child,
    &.pill:first-child {
      padding-left: 15px;
    }
  }
}

.large {
  padding: 13px;
  font-size: 1.2em;
  gap: 8px;

  &.grouped {
    padding: 11px;

    &.flat:last-child,
    &.pill:last-child {
      padding-right: 17px;
    }
    &.flat:last-child,
    &.pill:first-child {
      padding-left: 17px;
    }
  }
}

.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.block {
  width: 100%;
}

.grow {
  flex-grow: 1;
}
