@use "../../scss/globals.scss";

.sidebar {
  background-color: globals.$dark-background-color;
  color: globals.$muted-color;
  flex-direction: column;
  display: flex;
  transition: opacity ease 0.2s;
  border-right: solid 1px globals.$border-color;
  position: relative;
  overflow: hidden;
  padding-top: globals.$spacing-unit;

  &--resizing {
    opacity: globals.$active-opacity;
    pointer-events: none;
  }

  &--darwin {
    padding-top: calc(globals.$spacing-unit * 6);
  }

  &__content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: calc(globals.$spacing-unit * 2);
    gap: calc(globals.$spacing-unit * 2);
    width: 100%;
    overflow: auto;
  }

  &__handle {
    width: 5px;
    height: 100%;
    cursor: col-resize;
    position: absolute;
    right: 0;
  }

  &__menu {
    list-style: none;
    padding: 0;
    margin: 0;
    gap: calc(globals.$spacing-unit / 2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  &__menu-item {
    transition: all ease 0.1s;
    cursor: pointer;
    text-wrap: nowrap;
    display: flex;
    color: globals.$muted-color;
    border-radius: 4px;

    &:hover {
      background-color: rgba(255, 255, 255, 0.15);
    }

    &--active {
      background-color: rgba(255, 255, 255, 0.1);
    }

    &--muted {
      opacity: globals.$disabled-opacity;

      &:hover {
        opacity: 1;
      }
    }

    &--decky {
      background: linear-gradient(
        135deg,
        rgba(22, 177, 149, 0.2) 0%,
        rgba(62, 98, 192, 0.1) 100%
      );
      color: globals.$muted-color;

      &:hover {
        background: linear-gradient(
          135deg,
          rgba(22, 177, 149, 0.3) 0%,
          rgba(62, 98, 192, 0.15) 100%
        );
      }
    }
  }

  &__menu-item-button {
    color: inherit;
    display: flex;
    align-items: center;
    gap: globals.$spacing-unit;
    cursor: pointer;
    overflow: hidden;
    width: 100%;
    padding: 9px globals.$spacing-unit;
  }

  &__menu-item-button-label {
    text-overflow: ellipsis;
    overflow: hidden;
  }

  &__game-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border-radius: 4px;
    background-size: cover;
  }

  &__game-badge {
    background-color: rgba(34, 197, 94, 0.15);
    color: rgb(187, 247, 208);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 6px;
    border-radius: 6px;
    display: flex;
    margin-left: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.5);
  }

  &__collection-icon {
    min-width: 16px;
    min-height: 16px;
  }

  &__collection-count {
    margin-left: auto;
    background-color: #fff;
    color: globals.$background-color;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
  }

  &__section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  &__section-toggle {
    background: none;
    border: none;
    color: globals.$muted-color;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    cursor: pointer;
  }

  &__section-toggle-chevron {
    transition: transform 0.15s ease;
    transform: rotate(0deg);

    &--expanded {
      transform: rotate(90deg);
    }
  }

  &__section-title {
    text-transform: uppercase;
    font-weight: bold;
  }

  &__menu-empty {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    line-height: 1.4;
    padding: 9px 0;
    text-align: left;
  }

  &__container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
  }

  &__section {
    display: flex;
    flex-direction: column;
    gap: calc(globals.$spacing-unit * 2);
    padding-bottom: globals.$spacing-unit;
  }

  &__bottom-buttons {
    display: flex;
    flex-direction: column;
  }

  &__help-button {
    color: globals.$muted-color;
    padding: globals.$spacing-unit calc(globals.$spacing-unit * 2);
    gap: 9px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-top: solid 1px globals.$border-color;
    transition: background-color ease 0.1s;

    &:hover {
      background-color: rgba(255, 255, 255, 0.15);
    }
  }

  &__help-button-icon {
    background: linear-gradient(
      0deg,
      globals.$brand-teal 50%,
      globals.$brand-blue 100%
    );
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border-radius: 50%;
  }

  &__play-button {
    background: none;
    border: none;
    color: globals.$muted-color;
    cursor: pointer;
    padding: 0;

    &:active {
      color: rgba(255, 255, 255, 0.5);
    }

    &--active {
      color: globals.$brand-teal;
    }

    svg {
      display: block;
    }
  }

  &__add-button {
    background: none;
    border: none;
    color: globals.$muted-color;
    cursor: pointer;
    padding: 0;

    &:hover {
      color: rgba(255, 255, 255, 0.8);
    }

    &:active {
      color: rgba(255, 255, 255, 0.5);
    }

    svg {
      display: block;
    }
  }

  &__collection-modal {
    display: flex;
    flex-direction: column;
    gap: calc(globals.$spacing-unit * 2);
  }

  &__collection-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: calc(globals.$spacing-unit);
  }
}
