@import '../../../styles/common.scss';

.container {
  all: unset; // remove all button styles

  @include boxSizing;

  height: $page-header-height;
  width: 120px;

  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;

  color: var(--page-header-action-color, $page-header-action-color);
  background-color: var(
    --page-header-action-background-color,
    $page-header-action-background-color
  );
  cursor: pointer;
  user-select: none;

  .label,
  .icon {
    display: grid;
    grid-template: 1fr / 1fr;
    place-items: center;
  }

  .label {
    place-items: end;
    justify-items: center;
    padding-bottom: 10px;

    font-size: 14px;
    line-height: 1.1;
    text-align: center;
  }

  .icon {
    justify-items: center;
    padding-top: 10px;
  }

  .icon > * {
    height: 40px;
  }

  &:hover {
    background-color: var(
      --page-header-action-hover-background-color,
      $page-header-action-hover-background-color
    );

    cursor: pointer;
  }

  .pageHeaderActionsIcons {
    polygon,
    polyline,
    path,
    circle {
      stroke: var(
        --page-header-action-icon-color,
        $page-header-action-icon-color
      );
    }
  }

  &.context {
    background-color: var(
      --page-header-action-context-background-color,
      $page-header-action-context-background-color
    );

    &:hover {
      background-color: var(
        --page-header-action-context-hover-background-color,
        $page-header-action-context-hover-background-color
      );

      &.hasConfirm {
        background-color: var(
          --page-header-action-confirmation-background-color,
          $page-header-action-confirmation-background-color
        );
      }
    }
  }

  &.highlight {
    background-color: var(
      --page-header-action-context-hover-background-color,
      $page-header-action-context-hover-background-color
    );
  }

  &.active {
    color: var(
      --page-header-action-context-background-color,
      $page-header-action-context-background-color
    );

    background-color: var(
      --page-header-action-active-background-color,
      $page-header-action-active-background-color
    );

    .pageHeaderActionsIcons {
      polygon,
      path,
      circle {
        stroke: var(
          --page-header-action-context-background-color,
          $page-header-action-context-background-color
        );
      }
    }

    &:hover {
      color: var(--page-header-action-color, $page-header-action-color);

      background-color: var(
        --page-header-action-context-hover-background-color,
        $page-header-action-context-hover-background-color
      );

      .pageHeaderActionsIcons {
        polygon,
        path,
        circle {
          stroke: var(
            --page-header-action-icon-color,
            $page-header-action-icon-color
          );
        }
      }
    }
  }

  &.hasConfirm {
    background-color: var(
      --page-header-action-confirmation-background-color,
      $page-header-action-confirmation-background-color
    );
  }

  &:disabled,
  &:disabled.context,
  &:disabled.active {
    background-color: var(
      --actions-disabled-bg-color,
      $actions-disabled-bg-color
    );

    .pageHeaderActionsIcons {
      polygon,
      path,
      circle {
        stroke: var(--actions-disabled-fg-color, $actions-disabled-fg-color);
      }
    }

    color: var(--actions-disabled-fg-color, $actions-disabled-fg-color);
  }

  .tag {
    position: absolute;
    transform: rotate(45deg) translateX(53px) translateY(-40px);
    transform-origin: center;
    top: 0;
    left: 0;
    display: grid;
    background-color: var(
      --page-header-action-tag-background-color,
      $page-header-action-tag-background-color
    );
    font-size: var(
      --page-header-action-tag-font-size,
      $page-header-action-tag-font-size
    );
    font-weight: bold;
    width: 75px;
    height: 14px;
    align-items: center;
    text-align: center;
    z-index: 0;
  }

  &:has(.tag) {
    position: relative;
    overflow: hidden;
  }
}
