/* ============ Credits 积分中心 ============ */
#view-credits {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding-bottom: 50px;
  background: var(--bg-primary);
  padding: 20px;
}

.credits-container {
  width: 100%;
  max-width: 600px;
  padding-top: 20px;
}

.credits-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.credits-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============ 余额卡片 ============ */
.credits-balance-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.credits-balance-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.balance-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.balance-label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ============ 操作区 ============ */
.credits-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.redeem-section,
.purchase-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.redeem-section h3,
.purchase-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.redeem-form {
  display: flex;
  gap: 8px;
}

.redeem-form input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color var(--transition);
}

.redeem-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.redeem-form input::placeholder {
  color: var(--text-muted);
}

.redeem-form .btn-primary {
  padding: 8px 16px;
  white-space: nowrap;
}

/* ============ 套餐列表 ============ */
.package-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.package-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  position: relative;
  transition: border-color 0.2s, transform 0.15s;
}

.package-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.package-tag {
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 0 10px 0 10px;
}

.package-price {
  margin-bottom: 6px;
}

.price-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}

.package-points {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.points-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--success);
}

.package-bonus {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 500;
}

.package-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.btn-pay {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.btn-pay-wechat {
  background: rgba(7, 193, 96, 0.1);
  color: #07c160;
  border-color: rgba(7, 193, 96, 0.3);
}

.btn-pay-wechat:hover {
  background: rgba(7, 193, 96, 0.2);
  border-color: #07c160;
}

.btn-pay-alipay {
  background: rgba(0, 166, 255, 0.1);
  color: #00a6ff;
  border-color: rgba(0, 166, 255, 0.3);
}

.btn-pay-alipay:hover {
  background: rgba(0, 166, 255, 0.2);
  border-color: #00a6ff;
}

/* ============ 支付弹窗 ============ */
.payment-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.payment-modal-content {
  background: #1a1a3e;
  border: 1px solid #3a3a5a;
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.payment-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.payment-modal-close:hover {
  color: #fff;
}

.payment-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 16px;
}

.payment-modal-qrcode {
  margin-bottom: 12px;
}

.payment-modal-qrcode img {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  border: 2px solid #3a3a5a;
}

.qr-fallback {
  padding: 24px;
  color: #aaa;
  font-size: 14px;
}

.qr-fallback a {
  color: var(--accent);
  text-decoration: underline;
}

.payment-modal-info {
  font-size: 16px;
  color: #ccc;
  margin-bottom: 12px;
}

.payment-modal-info strong {
  color: var(--success);
}

.payment-modal-status {
  font-size: 14px;
  color: #aaa;
  padding: 8px 0;
  margin-bottom: 8px;
}

.payment-polling-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 4px;
}

.status-success {
  color: var(--success) !important;
  font-weight: 600;
  font-size: 16px;
}

.status-timeout {
  color: #ff9800 !important;
}

.payment-modal-tips {
  font-size: 12px;
  color: #666;
  line-height: 1.8;
}

.payment-modal-tips p {
  margin: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============ 积分记录 ============ */
.credits-history {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.credits-history h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.transaction-item:last-child {
  border-bottom: none;
}

.transaction-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.transaction-type {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.transaction-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.transaction-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.transaction-amount {
  font-size: 15px;
  font-weight: 700;
}

.transaction-amount.positive {
  color: var(--success);
}

.transaction-amount.negative {
  color: var(--error);
}

.transaction-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* 空状态 */
.transaction-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px 0;
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .package-list {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .package-card {
    padding: 12px;
  }

  .price-amount {
    font-size: 22px;
  }

  .points-total {
    font-size: 16px;
  }

  .balance-number {
    font-size: 36px;
  }

  .btn-pay {
    font-size: 11px;
    padding: 5px 2px;
  }
}

@media (max-width: 400px) {
  .package-list {
    grid-template-columns: 1fr;
  }
}
