/**
 * 二维码下载组件样式
 * 卡片结构复用父主题 .sc-download（c-downbtn），此处只补充按钮与弹窗样式
 * 颜色全部使用主题 CSS 变量，自动适配深色模式
 */

.qr-download {
  position: relative;
}

/* 按钮元素抹平浏览器默认样式，保持与父主题 a.sc-download__btn 一致 */
.qr-download .sc-download__btn {
  font-family: inherit;
  line-height: 1.5;
  border: none;
  cursor: pointer;
}

.qr-download__card {
  cursor: pointer;
}

.qr-download__card:focus-visible {
  outline: 2px solid var(--theme-color, #3b82f6);
  outline-offset: 2px;
}

.qr-download__card .sc-download__title {
  color: var(--text-primary, #1e293b);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 弹窗 ---------- */
.qr-download__mask {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  box-sizing: border-box;
}

.qr-download__mask[hidden] {
  display: none;
}

.qr-download__modal {
  position: relative;
  width: 100%;
  max-width: 360px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 24px 22px;
  text-align: center;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-primary, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

.qr-download__close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary, #64748b);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.qr-download__close:hover {
  background: var(--bg-hover, #f1f5f9);
}

.qr-download__title {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 600;
  color: var(--caption-color, #1e293b);
}

/* 二维码必须保持白底，否则部分扫码工具识别困难 */
.qr-download__frame {
  display: inline-block;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border-primary, #e5e7eb);
  border-radius: 8px;
  max-width: 100%;
  box-sizing: border-box;
}

.qr-download__canvas {
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-download__canvas canvas,
.qr-download__canvas img {
  max-width: 100%;
  height: auto !important;
  display: block;
}

.qr-download__error {
  display: inline-block;
  max-width: 200px;
  font-size: 13px;
  color: var(--color-danger, #d9534f);
}

.qr-download__tip {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-secondary, #475569);
}

/* ---------- 复制提示 ---------- */
.qr-download__toast {
  position: absolute;
  left: 50%;
  bottom: -34px;
  transform: translateX(-50%) translateY(6px);
  padding: 5px 12px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}

.qr-download__toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
  .qr-download__modal {
    padding: 24px 16px 18px;
  }
}
