/* ========================================
   足模分析与鞋垫定制系统 - 样式表
   设计风格: 医疗专业风格 - 清爽浅色主题
======================================== */

/* === CSS 变量 === */
:root {
    /* 主色调 - 医疗蓝绿色 */
    --primary: #0891b2;
    --primary-light: #22d3ee;
    --primary-dark: #0e7490;
    --primary-glow: rgba(8, 145, 178, 0.15);
    
    /* 强调色 - 医疗配色 */
    --accent-red: #ef4444;
    --accent-blue: #0284c7;
    --accent-green: #059669;
    --accent-purple: #7c3aed;
    --accent-orange: #ea580c;
    --accent-cyan: #06b6d4;
    
    /* 医疗绿 */
    --medical-green: #10b981;
    --medical-green-light: #d1fae5;
    --medical-blue: #0ea5e9;
    --medical-blue-light: #e0f2fe;
    
    /* 背景色 - 清爽浅色 */
    --bg-primary: #f0f9ff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-elevated: #f8fafc;
    --bg-hover: #e0f2fe;
    
    /* 文字色 */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* 边框 */
    --border-color: #e2e8f0;
    --border-highlight: rgba(8, 145, 178, 0.3);
    
    /* 阴影 - 更柔和 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1), 0 6px 10px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 30px var(--primary-glow);
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* 动画 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* 字体 */
    --font-sans: 'Noto Sans SC', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* === 基础样式 === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === 背景装饰 === */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdfa 100%);
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.circle-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.2) 0%, transparent 70%);
    top: -150px;
    right: -100px;
    animation: float 25s ease-in-out infinite;
}

.circle-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
    bottom: -100px;
    left: -50px;
    animation: float 30s ease-in-out infinite reverse;
}

.circle-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, transparent 70%);
    top: 40%;
    left: 60%;
    animation: pulse 20s ease-in-out infinite;
}

.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(14, 165, 233, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(20px, -20px); }
    50% { transform: translate(-15px, 15px); }
    75% { transform: translate(-20px, -15px); }
}

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

/* === 容器布局 === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === 头部 === */
.header {
    padding: 24px 0;
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 56px;
    height: 56px;
    color: var(--primary-light);
    filter: drop-shadow(0 0 12px var(--primary-glow));
}

.logo-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--medical-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

/* === 主内容 === */
.main-content {
    flex: 1;
}

/* === 步骤指示器 === */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 40px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    padding: 0 24px;
}

.step-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all var(--transition-normal);
}

.step-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: color var(--transition-normal);
}

.step.active .step-number {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.step.active .step-label {
    color: var(--primary-light);
}

.step.completed .step-number {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.step.completed .step-label {
    color: var(--accent-green);
}

.step-line {
    width: 80px;
    height: 2px;
    background: var(--border-color);
    margin: 0 8px;
}

/* === 卡片 === */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-highlight);
}

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

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

.card-header .icon {
    width: 24px;
    height: 24px;
    color: var(--primary-light);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* === 步骤内容 === */
.step-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.step-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === 上传区域 === */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }
}

.upload-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-elevated);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.upload-zone.has-file {
    border-style: solid;
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.foot-icon {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.foot-icon svg {
    width: 80px;
    height: 80px;
    transition: all var(--transition-normal);
}

.foot-icon.left svg {
    color: var(--primary);
}

.foot-icon.right svg {
    color: var(--medical-blue);
}

.upload-zone:hover .foot-icon svg {
    transform: scale(1.1);
}

.foot-label {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    background: var(--bg-card);
}

.foot-icon.left .foot-label {
    color: var(--primary);
}

.foot-icon.right .foot-label {
    color: var(--medical-blue);
}

.upload-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.check-icon {
    width: 56px;
    height: 56px;
    color: var(--accent-green);
    filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.4));
}

.upload-success .filename {
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-break: break-all;
    max-width: 200px;
}

/* === 按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    font-family: inherit;
}

.btn .icon {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(8, 145, 178, 0.35);
}

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

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.btn-download {
    background: linear-gradient(135deg, var(--accent-green) 0%, #16a34a 100%);
    color: white;
    width: 100%;
    margin-top: 16px;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.3);
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.card-actions.center {
    justify-content: center;
}

/* === 3D 查看器 === */
.viewer-card {
    overflow: hidden;
}

.viewer-container {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

/* 鞋垫查看器使用深色背景 */
#insoleViewer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

/* 鞋垫展示区域的查看器卡片使用深色风格 */
#step3 .viewer-card {
    background: #16162a;
    border-color: rgba(255, 255, 255, 0.08);
}

#step3 .viewer-card .card-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

#step3 .viewer-card .card-header h2 {
    color: #f8fafc;
}

#step3 .viewer-card .card-header .icon {
    color: #22d3ee;
}

#step3 .viewer-card .viewer-hint {
    color: #64748b;
}

#step3 .viewer-card .tab-btn {
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

#step3 .viewer-card .tab-btn:hover:not(:disabled) {
    border-color: #22d3ee;
    color: #22d3ee;
}

#step3 .viewer-card .tab-btn.active {
    background: #0891b2;
    border-color: #0891b2;
    color: white;
}

.viewer-container canvas {
    display: block;
    touch-action: none;
}

.viewer-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    z-index: 10;
}

/* 鞋垫查看器的加载状态使用深色背景 */
#insoleViewer .viewer-loading {
    background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
    color: #f8fafc;
}

#insoleViewer .viewer-loading p {
    color: #94a3b8;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.viewer-loading p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.viewer-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tab-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    white-space: nowrap;
}

.tab-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary-light);
}

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* 鞋垫+足模 组合视图标签样式 */
.tab-btn[data-side="L_with_foot"],
.tab-btn[data-side="R_with_foot"] {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(8, 145, 178, 0.1) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.tab-btn[data-side="L_with_foot"]:hover:not(:disabled),
.tab-btn[data-side="R_with_foot"]:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(8, 145, 178, 0.2) 100%);
    border-color: var(--medical-green);
}

.tab-btn[data-side="L_with_foot"].active,
.tab-btn[data-side="R_with_foot"].active {
    background: linear-gradient(135deg, var(--medical-green) 0%, var(--primary) 100%);
    border-color: var(--medical-green);
    color: white;
}

.tab-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.viewer-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.icon-small {
    width: 16px;
    height: 16px;
}

/* === 分析结果 === */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.result-card {
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.result-card:has(.result-side.left)::before {
    background: linear-gradient(90deg, var(--primary), var(--medical-green));
}

.result-card:has(.result-side.right)::before {
    background: linear-gradient(90deg, var(--medical-blue), var(--accent-cyan));
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.result-side {
    display: flex;
    align-items: center;
    gap: 12px;
}

.side-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
}

.result-side.left .side-badge {
    background: linear-gradient(135deg, var(--primary), var(--medical-green));
}

.result-side.right .side-badge {
    background: linear-gradient(135deg, var(--medical-blue), var(--accent-cyan));
}

.result-side h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.shoe-size {
    text-align: right;
}

.size-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.size-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-light);
    line-height: 1;
}

.size-unit {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* === 指标网格 === */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.metric {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.metric-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon svg {
    width: 20px;
    height: 20px;
    color: var(--primary-light);
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === 足型徽章 === */
.foot-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-elevated);
    margin-bottom: 20px;
}

.foot-type-badge .type-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.foot-type-badge .type-value {
    font-weight: 600;
    color: var(--text-primary);
}

.foot-type-badge.wide {
    background: rgba(249, 115, 22, 0.1);
}

.foot-type-badge.wide .type-value {
    color: var(--accent-orange);
}

.foot-type-badge.narrow {
    background: rgba(6, 182, 212, 0.1);
}

.foot-type-badge.narrow .type-value {
    color: var(--accent-cyan);
}

.foot-type-badge.normal {
    background: rgba(34, 197, 94, 0.1);
}

.foot-type-badge.normal .type-value {
    color: var(--accent-green);
}

/* === 详细指标 === */
.detailed-metrics h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    margin-top: 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* === 面积分布图 === */
.area-chart {
    margin-top: 12px;
}

.area-bar {
    display: flex;
    height: 36px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-elevated);
}

.area-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width var(--transition-slow);
    min-width: 40px;
}

.area-segment .area-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.area-segment.rearfoot {
    background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
}

.area-segment.midfoot {
    background: linear-gradient(135deg, var(--accent-green), #16a34a);
}

.area-segment.forefoot {
    background: linear-gradient(135deg, var(--accent-orange), #ea580c);
}

.area-labels {
    display: flex;
    justify-content: space-around;
    margin-top: 8px;
}

.area-labels span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === 鞋垫结果卡片 === */
.insole-card {
    position: relative;
    overflow: hidden;
}

.insole-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.insole-card:has(.insole-side.left)::before {
    background: linear-gradient(90deg, var(--medical-green), var(--accent-cyan));
}

.insole-card:has(.insole-side.right)::before {
    background: linear-gradient(90deg, var(--primary), var(--medical-blue));
}

.insole-header {
    margin-bottom: 20px;
}

.insole-side {
    display: flex;
    align-items: center;
    gap: 12px;
}

.insole-side.left .side-badge {
    background: linear-gradient(135deg, var(--medical-green), var(--accent-cyan));
}

.insole-side.right .side-badge {
    background: linear-gradient(135deg, var(--primary), var(--medical-blue));
}

.insole-dims {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.dim-item {
    text-align: center;
    padding: 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.dim-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.dim-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.samples-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.samples-label {
    color: var(--text-muted);
}

.samples-count {
    font-weight: 600;
    color: var(--primary-light);
}

/* === 加载遮罩 === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(240, 249, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.loading-overlay[hidden] {
    display: none !important;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.spinner-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 3px solid transparent;
    animation: spin 1.5s linear infinite;
}

.spinner-ring:nth-child(1) {
    width: 80px;
    height: 80px;
    margin: -40px 0 0 -40px;
    border-top-color: var(--primary);
    animation-duration: 1.5s;
}

.spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border-right-color: var(--medical-green);
    animation-duration: 2s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-bottom-color: var(--medical-blue);
    animation-duration: 1s;
}

.loading-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* === Toast 提示 === */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 1001;
    animation: slideUp 0.3s ease forwards;
}

.toast[hidden] {
    display: none !important;
}

.toast:not([hidden]) {
    transform: translateX(-50%) translateY(0);
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.toast-icon {
    width: 24px;
    height: 24px;
    display: none;
}

.toast.success .toast-icon.success {
    display: block;
    color: var(--accent-green);
}

.toast.error .toast-icon.error {
    display: block;
    color: var(--accent-red);
}

.toast-message {
    font-size: 0.95rem;
    font-weight: 500;
}

/* === 页脚 === */
.footer {
    text-align: center;
    padding: 24px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === 响应式 === */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .stepper {
        flex-wrap: wrap;
        gap: 16px;
        padding: 16px;
    }
    
    .step-line {
        display: none;
    }
    
    .step {
        padding: 8px 16px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .insole-dims {
        grid-template-columns: 1fr;
    }
    
    .viewer-container {
        height: 300px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* === 生成进度页面 === */
#generatingPage.active {
    border: 3px solid white;
    border-radius: var(--radius-lg);
    padding: 30px;
    margin: 20px 0;
    background: var(--bg-elevated);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.generating-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 40px 20px;
}

.generating-visual {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 40px;
}

.generating-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
}

.ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 2px solid transparent;
}

.ring-1 {
    width: 200px;
    height: 200px;
    margin: -100px 0 0 -100px;
    border-top-color: var(--primary);
    border-right-color: var(--primary-light);
    animation: spin 3s linear infinite;
}

.ring-2 {
    width: 160px;
    height: 160px;
    margin: -80px 0 0 -80px;
    border-bottom-color: var(--medical-green);
    border-left-color: var(--accent-cyan);
    animation: spin 2s linear infinite reverse;
}

.ring-3 {
    width: 120px;
    height: 120px;
    margin: -60px 0 0 -60px;
    border-top-color: var(--medical-blue);
    border-right-color: var(--primary-light);
    animation: spin 1.5s linear infinite;
}

.center-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.center-icon svg {
    width: 50px;
    height: 50px;
    color: var(--primary-light);
    animation: pulse-icon 2s ease-in-out infinite;
}

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

/* 粒子效果 */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    animation: particle-float 3s ease-in-out infinite;
}

.particle:nth-child(1) { left: 50%; top: 0; animation-delay: 0s; background: var(--accent-cyan); }
.particle:nth-child(2) { left: 85%; top: 25%; animation-delay: 0.5s; background: var(--primary-light); }
.particle:nth-child(3) { left: 85%; top: 75%; animation-delay: 1s; background: var(--medical-green); }
.particle:nth-child(4) { left: 50%; top: 100%; animation-delay: 1.5s; background: var(--medical-blue); }
.particle:nth-child(5) { left: 15%; top: 75%; animation-delay: 2s; background: var(--primary); }
.particle:nth-child(6) { left: 15%; top: 25%; animation-delay: 2.5s; background: var(--medical-green); }

@keyframes particle-float {
    0%, 100% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(calc(var(--dx, 0) * 20px), calc(var(--dy, 0) * 20px)) scale(1);
        opacity: 1;
    }
}

.particle:nth-child(1) { --dx: 0; --dy: -1; }
.particle:nth-child(2) { --dx: 1; --dy: -0.5; }
.particle:nth-child(3) { --dx: 1; --dy: 0.5; }
.particle:nth-child(4) { --dx: 0; --dy: 1; }
.particle:nth-child(5) { --dx: -1; --dy: 0.5; }
.particle:nth-child(6) { --dx: -1; --dy: -0.5; }

/* 生成信息 */
.generating-info {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.generating-info h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--medical-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.generating-step {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    min-height: 1.5em;
}

/* 进度条 */
.progress-container {
    margin-bottom: 32px;
}

.progress-bar {
    height: 12px;
    background: var(--bg-elevated);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--medical-green) 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-glow {
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--primary-glow), transparent);
    border-radius: 8px;
    filter: blur(8px);
    opacity: 0.5;
    pointer-events: none;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

.progress-percent {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.progress-status {
    font-size: 0.9rem;
    color: var(--text-secondary);
    align-self: center;
}

/* 生成步骤指示 */
.generating-steps {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.gen-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    min-width: 80px;
}

.gen-step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.gen-step-icon svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: all var(--transition-normal);
}

.gen-step span {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color var(--transition-normal);
}

.gen-step.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.gen-step.active .gen-step-icon {
    background: var(--primary);
    animation: pulse-step 1s ease-in-out infinite;
}

.gen-step.active .gen-step-icon svg {
    color: white;
}

.gen-step.active span {
    color: var(--primary-light);
    font-weight: 600;
}

@keyframes pulse-step {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.gen-step.completed {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.05);
}

.gen-step.completed .gen-step-icon {
    background: var(--accent-green);
}

.gen-step.completed .gen-step-icon svg {
    color: white;
}

.gen-step.completed span {
    color: var(--accent-green);
}

.generating-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.generating-hint .icon-small {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.generating-hint[hidden] {
    display: none !important;
}

/* 生成完成状态 */
.generating-visual.complete .ring {
    animation-play-state: paused;
    border-color: var(--accent-green) !important;
    opacity: 0.3;
}

.generating-visual.complete .center-icon svg {
    color: var(--accent-green);
    animation: none;
}

/* 完成按钮区域 */
.generate-complete-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-top: 16px;
    animation: fadeInUp 0.5s ease;
}

.generate-complete-actions[hidden] {
    display: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.complete-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.complete-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-green);
    filter: drop-shadow(0 0 20px rgba(34, 197, 94, 0.5));
    animation: successPop 0.5s ease;
}

@keyframes successPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.complete-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-green);
}

.btn-large {
    padding: 18px 48px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-large .icon {
    width: 24px;
    height: 24px;
}

/* 响应式 */
@media (max-width: 640px) {
    .generating-container {
        min-height: 60vh;
        padding: 20px;
    }
    
    .generating-visual {
        width: 150px;
        height: 150px;
        margin-bottom: 24px;
    }
    
    .ring-1 {
        width: 150px;
        height: 150px;
        margin: -75px 0 0 -75px;
    }
    
    .ring-2 {
        width: 120px;
        height: 120px;
        margin: -60px 0 0 -60px;
    }
    
    .ring-3 {
        width: 90px;
        height: 90px;
        margin: -45px 0 0 -45px;
    }
    
    .center-icon {
        width: 45px;
        height: 45px;
    }
    
    .center-icon svg {
        width: 35px;
        height: 35px;
    }
    
    .generating-info h2 {
        font-size: 1.25rem;
    }
    
    .generating-steps {
        gap: 8px;
    }
    
    .gen-step {
        padding: 8px 12px;
        min-width: 60px;
    }
    
    .gen-step-icon {
        width: 28px;
        height: 28px;
    }
    
    .gen-step-icon svg {
        width: 14px;
        height: 14px;
    }
    
    .gen-step span {
        font-size: 0.65rem;
    }
}

