:root {
  --sc-copy-active-bg: var(--sc-gray-800);
}

.sc-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  display: block;
  justify-content: center;
  align-items: center;
  border-radius: var(--sc-rounded);
  width: 40px;
  height: 40px;
  border: none;
  background-color: transparent;
  opacity: 0;
  cursor: pointer;
  background-position: 50%;
  background-size: 20px;
  background-repeat: no-repeat;
  transition: opacity 0.4s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2'/%3E%3C/svg%3E");

  &:hover {
    background-color: var(--sc-copy-active-bg);
  }

  .sc-code-wrapper:hover & {
    opacity: 1;
  }
}

.sc-copied {
  border-radius: 0 var(--sc-rounded) var(--sc-rounded) 0;
  background-color: var(--sc-copy-active-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-6 9 2 2 4-4'/%3E%3C/svg%3E");
  opacity: 1;

  &::before {
    position: absolute;
    top: 0;
    right: calc(100% + 1px);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--sc-rounded) 0 0 var(--sc-rounded);
    width: 64px;
    height: 40px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--sc-gray-500);
    background-color: var(--sc-copy-active-bg);
    white-space: nowrap;
    content: 'Copied';
  }
}
