/* ============================================================
   Exchange Block Plugin
   ============================================================ */

.exchange-block {
  margin: 1rem 0;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s;
  position: relative;
}

.exchange-block:focus-within {
  border-color: var(--color-green-light);
}

.exchange-block-num {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 10px;
  font-size: 0.72em;
  line-height: 1;
  color: currentColor;
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
}

.exchange-block.is-unlocked {
  border: none;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  margin: 1rem 0;
}

.exchange-block.is-unlocked .exchange-block-num {
  display: none;
}

.exchange-block-lock {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(160deg, #f8f9fa 0%, #f8f9fa 100%);
  cursor: default;
}

.exchange-block-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a5a10;
  flex-shrink: 0;
  transition: background 0.2s;
}

.exchange-block-icon svg {
  width: 18px;
  height: 18px;
}

.exchange-block-hint {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 300;
  color: #7ba60a;
  user-select: none;
  letter-spacing: -0.01em;
  transition: color 0.18s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 33px;
}

.exchange-block-error {
  flex: 1;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 300;
  color: #7ba60a;
  letter-spacing: -0.01em;
  line-height: 33px;
}

.exchange-unlock-btn {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: #7ba60a;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  transition:
    color 0.18s,
    transform 0.1s;
}

.exchange-unlock-btn:hover {
  color: var(--color-accent-hover);
}

.exchange-unlock-btn:active {
  transform: scale(0.9);
}

/* ── 解锁后内容区域 ── */
.exchange-block-content {
  display: none;
}

.exchange-block-content.is-revealed {
  display: block;
  animation: exchange-reveal 0.28s ease;
}

@keyframes exchange-reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.exchange-block-content > :first-child,
.exchange-block-content > pre:first-child,
.exchange-block-content > .itxgo-code-block:first-child {
  margin-top: 0;
}

.exchange-block-content > :last-child,
.exchange-block-content > pre:last-child,
.exchange-block-content > .itxgo-code-block:last-child {
  margin-bottom: 0;
}

/* ── 确认弹窗里的"确定"按钮（复用全站 .modal-actions 结构） ── */
.modal-btn-confirm-exchange {
  background: var(--color-green-light);
  color: #3a4508;
}

.modal-btn-confirm-exchange:hover {
  background: #cfe36a;
}

/* ── 深色模式 ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .exchange-block {
    border-color: var(--color-border);
    background: var(--color-bg-card);
  }

  :root:not([data-theme="light"]) .exchange-block-lock {
    background: linear-gradient(
      160deg,
      var(--color-bg-light) 0%,
      var(--color-bg-light) 100%
    );
  }
}

[data-theme="dark"] .exchange-block,
.dark-mode .exchange-block {
  border-color: var(--color-border);
  background: var(--color-bg-card);
}

[data-theme="dark"] .exchange-block-lock,
.dark-mode .exchange-block-lock {
  background: linear-gradient(
    160deg,
    var(--color-bg-light) 0%,
    var(--color-bg-light) 100%
  );
}

/* ── 移动端适配 ── */
@media (max-width: 480px) {
  .exchange-block-lock {
    padding: 0.75rem 1rem;
  }

  .exchange-block-hint,
  .exchange-block-error {
    font-size: 1.1rem;
    line-height: 33px;
  }
}
