// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC Sucursal en España SL

@use "refactor/common-refactor.scss" as deprecated;

.copy-button {
  @include deprecated.button-style;

  width: 100%;
  height: deprecated.$s-32;
  border: deprecated.$s-1 solid transparent;
  border-radius: deprecated.$br-8;
  background-color: transparent;
  box-sizing: border-box;

  .icon-btn {
    @include deprecated.flex-center;

    height: deprecated.$s-32;
    min-width: deprecated.$s-28;
    width: deprecated.$s-28;

    svg {
      @extend %button-icon-small;

      stroke: var(--icon-foreground);
    }
  }

  &:hover {
    background-color: var(--color-background-tertiary);
    color: var(--color-foreground-primary);
    border: deprecated.$s-1 solid var(--color-background-tertiary);

    .icon-btn {
      svg {
        stroke: var(--button-tertiary-foreground-color-active);
      }
    }
  }

  &:focus,
  &:focus-visible {
    outline: none;
    border: deprecated.$s-1 solid var(--button-tertiary-border-color-focus);
    background-color: transparent;
    color: var(--button-tertiary-foreground-color-focus);

    .icon-btn svg {
      stroke: var(--button-tertiary-foreground-color-active);
    }
  }
}

.copy-wrapper {
  @include deprecated.button-style;
  @include deprecated.copy-wrapper-base;

  width: 100%;
  height: fit-content;
  text-align: left;
  border: deprecated.$s-1 solid transparent;

  .icon-btn {
    @include deprecated.flex-center;

    position: absolute;
    top: 0;
    right: 0;
    height: deprecated.$s-32;
    width: deprecated.$s-28;

    svg {
      @extend %button-icon-small;

      stroke: var(--button-tertiary-foreground-color-focus);
      display: none;
    }
  }

  &:hover {
    background-color: var(--button-tertiary-background-color-focus);
    color: var(--button-tertiary-foreground-color-focus);
    border: deprecated.$s-1 solid var(--button-tertiary-background-color-focus);

    .icon-btn svg {
      display: flex;
    }
  }

  &:focus,
  &:focus-visible {
    outline: none;
    border: deprecated.$s-1 solid var(--button-tertiary-border-color-focus);
    background-color: transparent;
    color: var(--button-tertiary-foreground-color-focus);
  }
}
