/* ============================================================
   组件：按钮 / 卡片 / 徽章 / 输入 / 弹层 / 二维码
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 46px;
  padding-inline: var(--s-6);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 100px;
  white-space: nowrap;
  transition: transform 0.25s var(--ease-out),
    background 0.3s var(--ease-out), border-color 0.3s var(--ease-out),
    box-shadow 0.3s var(--ease-out), color 0.3s var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 主按钮 */
.btn--primary {
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.32);
}

.btn--primary:hover:not(:disabled) {
  box-shadow: 0 10px 32px rgba(59, 130, 246, 0.48);
  transform: translateY(-1px);
}

/* 次按钮 */
.btn--ghost {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-2);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-3);
}

/* 小按钮 */
.btn--sm {
  height: 36px;
  padding-inline: var(--s-4);
  font-size: 0.85rem;
}

/* 链接按钮 */
.btn--link {
  height: auto;
  padding: 0;
  color: var(--brand-3);
  border-radius: 0;
}

.btn--link:hover {
  color: var(--brand-1);
}

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  padding: var(--s-6);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.card--glow::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-card);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
  pointer-events: none;
}

.card--glow:hover::before {
  opacity: 1;
}

.card__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: var(--s-5);
  font-size: 1.25rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: var(--r-md);
  color: var(--brand-3);
  transition: transform 0.4s var(--ease-spring),
    background 0.4s var(--ease-out);
}

.card:hover .card__icon {
  transform: scale(1.08) rotate(-4deg);
  background: rgba(59, 130, 246, 0.18);
}

.card h3 {
  margin-bottom: var(--s-3);
  font-size: 1.1rem;
}

.card p {
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--text-3);
}

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 100px;
  border: 1px solid transparent;
}

.badge--brand {
  color: var(--brand-3);
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.24);
}

.badge--ok {
  color: var(--ok);
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.24);
}

.badge--warn {
  color: var(--warn);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.24);
}

.badge--danger {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.24);
}

.badge--muted {
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-2);
}

.badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- 输入框 ---------- */
.field {
  display: grid;
  gap: var(--s-2);
}

.field__label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-3);
}

.input {
  width: 100%;
  height: 46px;
  padding-inline: var(--s-4);
  color: var(--text-1);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  transition: border-color 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out), background 0.25s var(--ease-out);
}

.input::placeholder {
  color: var(--text-4);
}

.input:focus {
  outline: none;
  border-color: var(--brand-1);
  background: var(--bg-4);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.input--error {
  border-color: var(--danger);
}

.field__error {
  font-size: 0.78rem;
  color: var(--danger);
  min-height: 1.1em;
}

/* ---------- 弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--s-5);
  background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.modal[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
}

.modal__panel {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--s-6);
  background: var(--bg-2);
  border: 1px solid var(--line-3);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.35s var(--ease-spring);
}

.modal[data-open="true"] .modal__panel {
  transform: translateY(0) scale(1);
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.modal__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-1);
}

.modal__desc {
  margin-top: var(--s-2);
  font-size: 0.86rem;
  color: var(--text-3);
}

.modal__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  transition: color 0.2s, background 0.2s;
}

.modal__close:hover {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- 二维码区 ---------- */
.qr-box {
  display: grid;
  place-items: center;
  padding: var(--s-4);
  margin-block: var(--s-5);
  background: #fff;
  border-radius: var(--r-lg);
}

.qr-box img,
.qr-box canvas {
  width: 190px;
  height: 190px;
  object-fit: contain;
}

/* ---------- 订单号胶囊 ---------- */
.order-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}

.order-pill__label {
  font-size: 0.72rem;
  color: var(--text-4);
  letter-spacing: 0.04em;
}

.order-pill__value {
  margin-top: 2px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--brand-3);
  word-break: break-all;
}

.order-pill__copy {
  flex-shrink: 0;
  padding: 5px 10px;
  font-size: 0.74rem;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  transition: color 0.2s, background 0.2s;
}

.order-pill__copy:hover {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.09);
}

/* ---------- 状态行 ---------- */
.status-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px var(--s-4);
  margin-top: var(--s-4);
  font-size: 0.88rem;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}

/* 转圈 */
.spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid rgba(34, 211, 238, 0.22);
  border-top-color: var(--brand-3);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 300;
  transform: translate(-50%, 20px);
  padding: 12px var(--s-5);
  font-size: 0.88rem;
  color: var(--text-1);
  background: var(--bg-4);
  border: 1px solid var(--line-3);
  border-radius: 100px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out),
    transform 0.3s var(--ease-out);
}

.toast[data-show="true"] {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-tone="ok"] {
  border-color: rgba(34, 197, 94, 0.4);
}

.toast[data-tone="err"] {
  border-color: rgba(239, 68, 68, 0.4);
}
