@use "../../../styles/int.scss";
@use "sass:math";

$button-size: int.$spacing-8;
$border-color: var(--ShareTools-border, #{int.$gray-20});
$border-color-hover: var(--ShareTools-border-hover, #{int.$gray-40});

.shareRow {
  position: relative;
  display: grid;
  width: max-content;
  grid-auto-columns: $button-size;
  grid-auto-flow: column;
  gap: int.$spacing-2;
  color: var(--ShareTools-iconfg, #{int.$gray-90});
}

.button {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px;
  position: relative;
  background: none;
  border-width: 1px;
  border-style: solid;
  border-color: $border-color;
  border-radius: 50%;
  cursor: pointer;
  width: $button-size;
  height: $button-size;
  color: inherit;

  &:hover {
    border-color: $border-color-hover;
  }
}

.more,
.copied {
  position: absolute;
  border-width: 1px;
  border-style: solid;
  border-color: $border-color;
  padding: int.$spacing-3;
  background-color: var(--ShareTools-morebg, white);
  z-index: 10;

  &::before {
    content: "";
    position: absolute;
    border-style: solid;
    top: 0;
    margin-top: -11px;
  }

  &::after {
    content: "";
    position: absolute;
    border-style: solid;
    top: 0;
    margin-top: -8.7px;
  }
}

.more {
  top: 100%;
  right: 0;
  transform: translate(
    -#{math.div($button-size, 2)},
    #{math.div($button-size, 2)}
  );
  display: grid;
  grid-template-columns: repeat(2, $button-size);
  gap: int.$spacing-2;

  &::before {
    right: 0;
    border-color: transparent transparent #{$border-color};
    border-width: 0 0 10px 10px;
    margin-right: -1px;
  }

  &::after {
    right: 0;
    border-color: transparent transparent var(--ShareTools-morebg, white);
    border-width: 0 0 9px 9px;
  }
}

.copied {
  top: 100%;
  left: 0;
  transform: translate(
    #{math.div($button-size, 2)},
    #{math.div($button-size, 2)}
  );

  @include int.overline();

  &::before {
    left: 0;
    border-color: transparent transparent #{$border-color};
    border-width: 0 10px 10px 0;
    margin-left: -1px;
  }

  &::after {
    left: 0;
    border-color: transparent transparent var(--ShareTools-morebg, white);
    border-width: 0 9px 9px 0;
  }
}
