/* 缩进代码块复制功能样式 */

/* 缩进代码块包装器 */
.indent-code-wrapper {
  position: relative;
  margin: 16px 0px;
  border-radius: 12px !important;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  overflow: hidden;
  padding: 0;
  background: var(--hl-code-bg, #f8f9fa) !important;
  color: var(--hl-code-fg, #24292e);
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--anzhiyu-card-border, #e1e8ed) !important;
}

/* 缩进代码块中的pre元素样式 */
.indent-code-wrapper pre {
  font-size: var(--code-font-size, 14px) !important;
  margin: 0 !important;
  padding: 16px 20px !important;
  border: none !important;
  border-radius: inherit !important;
  line-height: 1.5 !important;
  background: var(--hl-code-bg, #f8f9fa) !important;
  font-family: var(
    --code-font-family,
    'Consolas, "Fira Code", "Fira Mono", Menlo, "DejaVu Sans Mono", monospace, 宋体'
  ) !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

/* 缩进代码块中的code元素样式 */
.indent-code-wrapper pre code {
  background: none !important;
  background-color: transparent !important;
  padding: 0 !important;
  font-size: var(--code-font-size, 14px) !important;
  line-height: 1.5 !important;
  text-indent: 0 !important;
  margin-left: 0 !important;
  transform: none !important;
  box-shadow: none !important;
  border: none !important;
  font-family: inherit !important;
}

/* 强制移除所有可能影响代码块背景的内联样式 */
.indent-code-wrapper [style],
.indent-code-wrapper * [style] {
  background-color: transparent !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

/* 确保代码块内所有元素都使用透明背景 */
.indent-code-wrapper pre *,
.indent-code-wrapper code *,
.indent-code-wrapper .code * {
  background-color: transparent !important;
  background: transparent !important;
  background-image: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
}

/* 移除所有可能产生背景的样式 */
.indent-code-wrapper [style*="background"] {
  background: transparent !important;
  background-color: transparent !important;
}

/* 强制移除所有代码元素的内联背景样式 */
.indent-code-wrapper pre code *,
.indent-code-wrapper .code pre *,
.indent-code-wrapper .code * {
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  border: none !important;
  text-shadow: none !important;
}

/* 复制按钮样式 - 适中版 */
.indent-copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(
    135deg,
    rgba(248, 249, 250, 0.9),
    rgba(241, 243, 245, 0.9)
  );
  border: 1px solid rgba(206, 212, 218, 0.8);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95);
  z-index: 10;
}

.indent-code-wrapper:hover .indent-copy-button {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.indent-copy-button:hover {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: scale(1.05);
}

.indent-copy-button:active {
  transform: scale(0.98);
}

/* 复制按钮状态样式 - 改进版 */
.indent-copy-button.success {
  background: linear-gradient(
    135deg,
    rgba(52, 199, 89, 0.15),
    rgba(34, 197, 94, 0.15)
  );
  border-color: rgba(34, 197, 94, 0.4);
  animation: successPulse 0.6s ease-out;
}

.indent-copy-button.success i {
  color: #16a34a;
  animation: checkmarkAnimation 0.6s ease-out;
}

/* 确保成功状态时hover不覆盖样式 */
.indent-copy-button.success:hover {
  background: linear-gradient(
    135deg,
    rgba(52, 199, 89, 0.15),
    rgba(34, 197, 94, 0.15)
  );
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.indent-copy-button.success:hover i {
  color: #16a34a;
}

/* 复制按钮图标 */
.indent-copy-button i {
  font-size: 12px;
  color: #6b7280;
  transition: all 0.3s ease;
}

.indent-copy-button:hover i {
  color: #49b1f5;
}

/* 动画效果 */
@keyframes successPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(52, 199, 89, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
  }
}

@keyframes checkmarkAnimation {
  0% {
    transform: scale(0.8) rotate(0deg);
  }
  50% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}