﻿/* 务实简约 · 现代移动软件风格设计规范 */
:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-sub: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: 40px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px;
}

/* 顶部导航与状态 */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background-color: rgba(255, 255, 255, 0.92);
}

.header-content {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.brand-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.service-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--success-light);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.service-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
}

/* 模块卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-top: 16px;
  padding: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 相机取景器 */
.scanner-viewport {
  position: relative;
  width: 100%;
  height: 240px;
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-frame {
  width: 180px;
  height: 180px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
}

.scan-frame::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--success), transparent);
  box-shadow: 0 0 8px var(--success);
  animation: scan-move 2.2s infinite ease-in-out;
}

@keyframes scan-move {
  0% { top: 4px; }
  50% { top: 172px; }
  100% { top: 4px; }
}

.scan-placeholder {
  position: absolute;
  color: #e2e8f0;
  font-size: 13px;
  text-align: center;
  padding: 0 20px;
  pointer-events: none;
  z-index: 2;
}

/* 操作按钮群组 */
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:active {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:active {
  background: #e2e8f0;
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* 手动输入折叠栏 */
.input-toggle {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.input-toggle summary {
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  user-select: none;
}

.input-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.input-field {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}

.input-field:focus {
  border-color: var(--border-focus);
  background: #ffffff;
}

/* 设备详情信息 */
.device-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 2px;
}

.meta-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  word-break: break-all;
}

/* SKU 服务选择 */
.sku-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 12px 0 8px 0;
}

.sku-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.sku-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: var(--bg-card);
  transition: all 0.15s ease;
}

.sku-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.sku-item-left {
  display: flex;
  flex-direction: column;
}

.sku-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.sku-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sku-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.sku-item.selected .sku-name {
  color: var(--primary);
}

.sku-item.selected .sku-price {
  color: var(--primary);
}

/* 结算与保障栏 */
.order-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.order-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.order-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--success);
}

.order-amount small {
  font-size: 13px;
  font-weight: normal;
}

.security-note {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 8px;
  text-align: center;
}

/* 优雅进度 Timeline (脱敏极简日志) */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}

.timeline-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}

.step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-icon.done {
  background: var(--success-light);
  color: var(--success);
}

.step-icon.pending {
  background: var(--bg-subtle);
  color: var(--text-sub);
}

.step-icon.failed {
  background: var(--danger-light);
  color: var(--danger);
}

.step-body {
  flex: 1;
}

.step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.step-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* 运行状态反馈卡片 */
.status-banner {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-banner.running {
  background: var(--primary-light);
  color: var(--primary);
}

.status-banner.success {
  background: var(--success-light);
  color: var(--success);
}

.status-banner.warn {
  background: var(--warning-light);
  color: var(--warning);
}

.status-banner.error {
  background: var(--danger-light);
  color: var(--danger);
}

/* 页脚 */
footer {
  text-align: center;
  padding: 24px 16px 8px;
  font-size: 12px;
  color: var(--text-sub);
}

.footer-qr {
  margin: 12px auto;
  width: 110px;
  height: 110px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-qr svg {
  width: 100%;
  height: 100%;
}
