/* --- 核心重置与变量 --- */
:root {
    --bg-dark: #0a0e17;
    --card-bg: #111827;
    --primary: #3b82f6;
    --accent: #10b981;
    --text-main: #f3f4f6;
    --text-sub: #9ca3af;
    --border: #1f2937;
    --glass: rgba(17, 24, 39, 0.7);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    /* 科技感网格背景 */
    background-image: 
        linear-gradient(rgba(31, 41, 55, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(31, 41, 55, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
}
.navbar {
    display: flex;           /* 启用 Flex 布局 */
    justify-content: space-between; /* 这一行其实是关键，但如果有 spacer div，这行可有可无 */
    align-items: center;     /* 垂直居中 */
    backdrop-filter: blur(12px);
    border-bottom: solid 1px var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;            /* 给个固定高度更好看 */
    padding: 0 20px;         /* 左右留白 */

}
/* 标题区域 */
.header-area{
    display: flex;
    align-items: center;
    justify-content: space-between;
}
    
}
.header-area h1 {
    font-size: 24px;
    margin-bottom: 5px;
    
}
.header-area p {
    font-size: 13px;
    opacity: 0.7;
    margin-left: 0 !important; /* 手机上左对齐，不缩进 */
    margin-top: 5px;
    display: block; /* 强制换行显示 */
}

/* --- 通用容器 --- */
.app-container {
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    position: relative;
    margin: 0px auto;
    padding: 40px 20px;
    /* 手机端适配：单列布局 */
}
@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        padding: 16px;
        height: 100vh; /* 手机端全屏 */
        align-content: start;
    }
    .sidebar { display: none; } /* 手机端暂时隐藏右侧时间轴，专注表单 */
    /* 或者是把它变成顶部进度条，这里先做隐藏处理简化 */
}

/* --- 卡片风格 --- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}
/* 跳动的小点 */
.typing-dots {
    display: flex; /* 关键：必须是 flex 才能横排 */
    gap: 2px;
    font-size: 14px;
    justify-content: center;
    align-items: center;
}
.typing-dots span {
    animation: type-bounce 1.4s infinite ease-in-out both;
    font-size: 30px;
    color: var(--primary);
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes type-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
/* --- 场景切换控制 --- */
.scene {
    display: none; /* 默认隐藏 */
    animation: fadeIn 0.5s ease-out;
}
.scene.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- 场景1：表单 (Scene 1) --- */
h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; background: linear-gradient(to right, #fff, #94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
p.subtitle { color: var(--accent); font-size: 14px;display: flex; align-items: center; gap: 6px; }
p.subtitle::before { content: ''; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent); animation: pulse 2s infinite; }

.form-group { margin-bottom: 24px; }
label { display: block; color: var(--text-sub); font-size: 12px; font-weight: 600; margin-bottom: 8px; letter-spacing: 0.05em; }
input, select, textarea {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    color: #fff;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: rgba(255,255,255,0.05);
}

/* 单选按钮组 (Condition) */
.radio-group { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.radio-option { position: relative; }
.radio-option input { position: absolute; opacity: 0; }
.radio-option label {
    display: block;
    text-align: center;
    padding: 12px 0;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--text-sub);
    margin: 0;
}
.radio-option input:checked + label {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}

/* 主按钮 */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover { filter: brightness(1.1); }

/* --- 场景2：扫描动画 (Scene 2) --- */
.map-wrapper {
    position: relative;
    width: 60%;
    margin:auto;
    /* 核心：保持宽高比，防止地图变形 (4:3 或 6:5 均可，看你图片实际比例) */
    aspect-ratio: 6/5; 
    background: radial-gradient(circle, rgba(16,24,39,0.5) 0%, rgba(16,24,39,1) 100%);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
}

/* 背景图 */
.map-image {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 关键：保证图片完整显示，留黑边 */
    opacity: 0.6; /*稍微暗一点，突显光点*/
    mix-blend-mode: screen; /* 滤色模式，让黑色背景变透明 (如果图底是纯黑) */
}
.scan-container {
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}
/* 仓库光点 (Dot) */
.dot {
    position: absolute;
    width: 12px; height: 12px;
    background: var(--bg-dark);
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    
    /* 【核心修改】用 margin 负值来实现居中，解放 transform */
    margin-left: -6px; /* 宽度的一半 */
    margin-top: -6px;  /* 高度的一半 */
    
    /* transform 删掉 translate，只保留可能的 scale */
    /* transform: translate(-50%, -50%);  <-- 删掉这一行 */
    
    z-index: 10;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    opacity: 0.3;
    transition: all 0.3s;
}
.dot-label{
    font-size: 12px;
    margin-left: 20px;
    margin-top:-40px;
}

/* 激活状态：呼吸蓝光 */
.dot.active {
    opacity: 1;
    background: var(--primary);
    border-color: #fff;
    box-shadow: 0 0 20px var(--primary);
    /* 动画里只控制 scale，不需要管位移了 */
    animation: pulse 1.5s infinite;
}

/* 成功状态：绿光常亮 */
.dot.success {
    opacity: 1;
    background: var(--accent);
    border-color: #fff;
    box-shadow: 0 0 20px var(--accent);
    animation: none;
    transform: translate(-50%, -50%) scale(1.2);
}

/* 标签文字 */
.dot.success {
    opacity: 1;
    background: var(--accent);
    border-color: #fff;
    box-shadow: 0 0 20px var(--accent);
    animation: none;
    /* 只需要控制缩放 */
    transform: scale(1.2);
}
.dot.active .dot-label, .dot.success .dot-label { opacity: 1; }
/* 扫描波纹 */
.ripple {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 100%;
    border: 1px solid var(--primary);
    border-radius: 50%;
    opacity: 0;
}
.dot.active .ripple { animation: ripple 1.5s infinite; }

/* 全局扫描线 */
.scan-line {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 50%;
    background: linear-gradient(to bottom, transparent, rgba(59, 130, 246, 0.1), transparent);
    animation: scanDown 3s linear infinite;
    pointer-events: none;
}
@keyframes pulse { 
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); } 
    70% { transform: scale(1.5); box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); } 
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } 
}
@keyframes ripple { 0% { width: 0; height: 0; opacity: 1; } 100% { width: 60px; height: 60px; opacity: 0; } }
@keyframes scanDown { 0% { top: -50%; } 100% { top: 150%; } }
/* 日志框 */
.log-box {
    margin-top: 20px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--accent);
    min-height: 20px;
}
/* 数据流 */
.data-log {
    margin-top: 32px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--accent);
    text-align: center;
    min-height: 60px;
}
.log-item { opacity: 0; animation: fadeInUp 0.3s forwards; }

/* --- 场景3：结果 & 支付 (Scene 3) --- */
.result-header { text-align: center; margin-bottom: 20px; }
.success-icon { 
    width: 32px; height: 32px; 
    background: rgba(16, 185, 129, 0.1); 
    color: var(--accent); 
    border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.price-tag {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-main);
    text-shadow: 0 0 20px rgba(255,255,255,0.2);
    margin: 10px 0;
}
.info-grid-box{
    border: solid 5px rgba(255, 255, 255, 0.03);
    padding: 10px 20px 0px 20px;
    margin-bottom: 10px;
    border-radius: 12px;
}
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}
.info-item {
    background: rgba(255,255,255,0.03);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}
.info-label { color: var(--text-sub); font-size: 12px; margin-bottom: 4px; }
.info-value { color: var(--text-main); font-weight: 600; }

/* --- 右侧时间轴 (Sidebar) --- */
.timeline {
    position: relative;
    padding-left: 20px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 0; bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item {
    position: relative;
    margin-bottom: 32px;
    opacity: 0.4;
    transition: all 0.3s;
}
.timeline-item.active { opacity: 1; }
.timeline-item.completed .dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.timeline-item.active .dot { background: var(--primary); box-shadow: 0 0 10px var(--primary); animation: pulse 2s infinite; }

.dot {
    position: absolute;
    left: -20px; top: 4px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--border);
    border: 3px solid var(--card-bg);
    z-index: 1;
    transition: all 0.3s;
}
.timeline-content h4 { font-size: 14px; margin-bottom: 4px; }
.timeline-content p { font-size: 12px; color: var(--text-sub); }

/* --- 动画关键帧 --- */
@keyframes pulse { 0% { opacity: 0.5; transform: scale(0.95); } 50% { opacity: 1; transform: scale(1.05); } 100% { opacity: 0.5; transform: scale(0.95); } }
@keyframes radar-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes radar-ping { 0% { transform: scale(0.8); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- 弹窗 (Toast) --- */
#toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(16, 185, 129, 0.9); color: #fff;
    padding: 12px 24px; border-radius: 30px;
    font-size: 14px; font-weight: 600;
    opacity: 0; transition: opacity 0.3s;
    pointer-events: none; z-index: 100;
    backdrop-filter: blur(5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.sd-box{
        /* background: rgba(16, 185, 129, 0.1); */
    font-size: 14px;
    display: flex;
    justify-content: center;
    /* align-content: center; */
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.sd-time{
    background: rgba(16, 185, 129, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    color: var(--accent);
    font-weight: bold;
}

/* 支付二维码弹窗 */
.payment-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1100;
  animation: fadeIn 0.3s ease;
}

.payment-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.payment-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.payment-modal-content {
  position: relative;
  z-index: 1101;
  width: 90%;
  max-width: 420px;
  animation: slideUp 0.3s ease;
}

.payment-modal .modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1102;
}

.payment-modal .modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* 支付卡片 */
.payment-card {
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-5) 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.payment-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(148,163,184,.12);
}

.payment-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.payment-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-1);
  margin: 0 0 8px 0;
}

.payment-subtitle {
  color: var(--text-3);
  font-size: 14px;
  margin: 0;
}

/* 二维码容器 */
.qr-code-container {
  
}

.qr-code-wrapper {
  position: relative;
  width: 70%;
  background: white;
  border-radius: 12px;
  margin-bottom: 16px;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  margin-left: auto;
  margin-right: auto;
}

.qr-code-wrapper img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.qr-code-loading {
  text-align: center;
  color: var(--text-3);
}

.qr-code-loading .loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border: 4px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.qr-code-loading p {
  margin: 0;
  font-size: 14px;
}

.qr-code-tip {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  margin: 0;
}