// core
.p-fieldset-legend > a,
.p-fieldset-legend > span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.p-fieldset-toggleable .p-fieldset-legend a {
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  position: relative;
  text-decoration: none;
}

.p-fieldset-legend-text {
  line-height: 1;
}

// theme
.p-fieldset {
  border: $panelContentBorder;
  background: $panelContentBg;
  color: $panelContentTextColor;
  border-radius: $borderRadius;

  .p-fieldset-legend {
    padding: $panelHeaderPadding;
    border: $panelHeaderBorder;
    color: $panelHeaderTextColor;
    background: $panelHeaderBg;
    font-weight: $panelHeaderFontWeight;
    border-radius: $borderRadius;
  }

  &.p-fieldset-toggleable {
    .p-fieldset-legend {
      padding: 0;
      transition: $actionIconTransition;

      a {
        padding: $panelHeaderPadding;
        color: $panelHeaderTextColor;
        border-radius: $borderRadius;
        transition: $listItemTransition;
        outline-color: transparent;

        .p-fieldset-toggler {
          margin-right: $inlineSpacing;
        }

        &:focus-visible {
          @include focused();
        }

        &:hover {
          color: $panelHeaderTextHoverColor;
        }
      }

      &:hover {
        background: $panelHeaderHoverBg;
        border-color: $panelHeaderHoverBorderColor;
        color: $panelHeaderTextHoverColor;
      }
    }
  }

  .p-fieldset-content {
    padding: $panelContentPadding;
  }
}
