/**
 * Wallex Copy Box Widget Styles
 * Follows Wallex Token Style design system.
 * @since 2.6.1
 */

.wallex-copy-box {
  width: 100%;
  box-sizing: border-box;
}

.wallex-copy-box__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacingM, 16px);
  direction: ltr;
  box-sizing: border-box;
  background-color: var(--color-bg-3, #F5F6F7);
  border: 1px solid var(--color-stroke-2, rgba(0, 0, 0, 0.05));
  border-radius: 9999px;
  padding: 8px 12px;
  width: 100%;
  max-width: 640px;
  margin: 0;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

:root[theme-mode="dark"] .wallex-copy-box__inner {
  background-color: var(--color-bg-3, #1D2430);
  border-color: var(--color-stroke-2, rgba(255, 255, 255, 0.05));
}

.wallex-copy-box--btn-left .wallex-copy-box__button {
  order: 1;
}

.wallex-copy-box--btn-left .wallex-copy-box__text {
  order: 2;
}

.wallex-copy-box--btn-right .wallex-copy-box__button {
  order: 2;
}

.wallex-copy-box--btn-right .wallex-copy-box__text {
  order: 1;
}

.wallex-copy-box__text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: var(--body-large-size, 16px);
  line-height: var(--body-large-line-height, 28px);
  font-weight: 500;
  color: var(--color-text-1, #252525);
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}

:root[theme-mode="dark"] .wallex-copy-box__text {
  color: var(--color-text-1, #F7F7F7);
}

.wallex-copy-box__text[dir="ltr"] {
  text-align: left;
}

.wallex-copy-box__text[dir="rtl"] {
  text-align: right;
}

.wallex-copy-box__button {
  flex: 0 0 auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  outline: none;
  padding: 6px;
  margin: 0;
  cursor: pointer;
  color: var(--color-text-2, rgba(0, 0, 0, 0.6));
  border-radius: var(--cornerRadiusM, 8px);
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

:root[theme-mode="dark"] .wallex-copy-box__button {
  color: var(--color-text-2, rgba(255, 255, 255, 0.6));
}

.wallex-copy-box__button:hover {
  color: var(--color-primaryBrandText, #007AFF);
  background-color: var(--color-negativeGlassBg-2, rgba(0, 0, 0, 0.05));
}

:root[theme-mode="dark"] .wallex-copy-box__button:hover {
  color: var(--color-primaryBrandText, #3395FF);
  background-color: var(--color-negativeGlassBg-2, rgba(255, 255, 255, 0.1));
}

.wallex-copy-box__button:active {
  transform: scale(0.92);
}

.wallex-copy-box__button.is-copied {
  color: var(--color-approveText, #039874);
}

:root[theme-mode="dark"] .wallex-copy-box__button.is-copied {
  color: var(--color-approveText, #00B88A);
}

.wallex-copy-box__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.wallex-copy-box__icon-wrap svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.wallex-copy-box__icon-copy {
  display: block;
}

.wallex-copy-box__icon-check {
  display: none !important;
}

.wallex-copy-box__button.is-copied .wallex-copy-box__icon-copy {
  display: none !important;
}

.wallex-copy-box__button.is-copied .wallex-copy-box__icon-check {
  display: block !important;
  animation: wallex-copy-pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes wallex-copy-pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.wallex-copy-box__tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background-color: var(--color-text-1, #252525);
  color: var(--color-onNegativeText, #FFFFFF);
  font-size: var(--caption-size, 12px);
  line-height: 1.4;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--cornerRadiusS, 4px);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

:root[theme-mode="dark"] .wallex-copy-box__tooltip {
  background-color: var(--color-bg-4, #2E3A4D);
  color: var(--color-text-1, #F7F7F7);
}

.wallex-copy-box__button.is-copied .wallex-copy-box__tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}