/* ==========================================================================
   SenrMold AI System - V7.0 Style Core
   ========================================================================== */

/* 1. 变量配置 */
:root {
    --primary: #3b82f6; --primary-dark: #2563eb; --accent: #8b5cf6;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    --surface-glass: rgba(255, 255, 255, 0.85);
    --surface-border: 1px solid rgba(255, 255, 255, 0.9);
    --text-main: #1e293b; --text-sub: #64748b;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; 
    background: var(--bg-gradient); color: var(--text-main); 
    height: 100vh; overflow: hidden; position: relative; 
}

/* 2. 背景与布局 */
.bg-decoration { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; animation: float 10s infinite alternate; }
.orb-1 { width: 400px; height: 400px; background: #c7d2fe; top: -10%; left: -10%; }
.orb-2 { width: 300px; height: 300px; background: #ddd6fe; bottom: -10%; right: -5%; animation-delay: 2s; }
.orb-3 { width: 200px; height: 200px; background: #bae6fd; top: 40%; left: 40%; animation-delay: 4s; }
@keyframes float { from { transform: translate3d(0,0,0); } to { transform: translate3d(20px, 30px, 0); } }

.app-container { display: flex; height: 100vh; width: 100vw; }

/* 3. 侧边栏 */
.sidebar { width: 360px; background: var(--surface-glass); border-right: var(--surface-border); display: flex; flex-direction: column; z-index: 10; backdrop-filter: blur(20px); }
.brand { height: 80px; display: flex; align-items: center; padding: 0 24px; border-bottom: var(--surface-border); gap: 12px; }
.logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 8px; color: white; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text span:first-child { font-weight: 800; font-size: 18px; letter-spacing: -0.5px; }
.badge { font-size: 10px; background: #eff6ff; color: var(--primary); padding: 1px 6px; border-radius: 4px; font-weight: 600; width: fit-content; }
.badge.gold { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: #b45309; border: 1px solid #fcd34d; }

.sync-status { padding: 8px 24px; font-size: 11px; color: var(--text-sub); display: flex; align-items: center; gap: 6px; opacity: 0; transition: opacity 0.3s; }
.sync-status i { color: #22c55e; }

.scrollable-form { flex: 1; overflow-y: auto; padding: 24px; }
.scrollable-form::-webkit-scrollbar { width: 4px; }
.scrollable-form::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.form-section { margin-bottom: 32px; }
.form-section h3 { font-size: 12px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* 高级面板折叠动画 */
.hidden-panel { display: none; }
.hidden-panel.active { display: block; animation: slideDown 0.3s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.input-group { display: flex; gap: 10px; margin-bottom: 16px; }
.three-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; }
.mt-4 { margin-top: 16px; }

/* 表单组件 */
.floating-input { position: relative; width: 100%; }
.floating-input input { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: rgba(255,255,255,0.5); font-size: 14px; transition: 0.2s; font-family: 'Inter', sans-serif; }
.floating-input input:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), inset 0 0 0 1px var(--primary); }
.floating-input label { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 13px; pointer-events: none; transition: 0.2s; }
.floating-input input:focus ~ label, .floating-input input:not(:placeholder-shown) ~ label { top: 0; left: 8px; font-size: 10px; color: var(--primary); background: white; padding: 0 4px; height: auto; }
.select-wrapper { position: relative; width: 100%; }
.select-label { font-size: 11px; color: var(--text-sub); margin-bottom: 4px; display: block; font-weight: 600; }
select { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: rgba(255,255,255,0.5); font-size: 13px; cursor: pointer; appearance: none; color: #334155; }
.arrow-icon { position: absolute; right: 12px; bottom: 12px; font-size: 10px; color: #94a3b8; pointer-events: none; }
.action-area { padding: 20px; border-top: var(--surface-border); background: rgba(255,255,255,0.4); backdrop-filter: blur(10px); }
.btn-primary-glow { width: 100%; padding: 14px; border: none; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.3s; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3); font-size: 15px; }
.btn-primary-glow:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4); }

/* 4. 主内容区 */
.main-content { flex: 1; padding: 40px; overflow-y: auto; position: relative; }
.hidden { display: none !important; }
.fade-in-up { animation: fadeInUp 0.5s ease-out backwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }

/* 5. 工业风注塑机动画 (GPU Optimized) */
.loading-overlay { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.98); z-index: 50; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 0.4s; }
.im-container { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; transform: scale(1.1); }
.im-machine { position: relative; width: 400px; height: 160px; display: flex; align-items: center; }
.im-platen.moving, .im-screw, .im-product, .im-ejector-pin { will-change: transform; }

.im-injection-unit { position: absolute; left: 0; top: 50px; width: 140px; z-index: 2; }
.im-hopper { position: absolute; top: -25px; left: 20px; width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent; border-top: 25px solid #94a3b8; z-index: 3; }
.im-granules { position: absolute; top: -25px; left: -5px; width: 10px; height: 10px; background: #f59e0b; border-radius: 50%; opacity: 0; animation: feed-granules 4s linear infinite; }
.im-barrel { width: 120px; height: 24px; background: #475569; border-radius: 4px 0 0 4px; position: relative; overflow: hidden; border: 2px solid #334155; }
.im-screw { width: 140px; height: 100%; background: repeating-linear-gradient(45deg, #64748b, #64748b 5px, #475569 5px, #475569 10px); position: absolute; top: 0; left: -20px; animation: screw-cycle 4s ease-in-out infinite; }

.im-clamping-unit { position: absolute; right: 0; width: 260px; height: 120px; display: flex; align-items: center; }
.im-tie-bar { position: absolute; width: 100%; height: 6px; background: #cbd5e1; border-radius: 3px; z-index: 0; }
.im-tie-bar.top { top: 20px; } .im-tie-bar.bottom { bottom: 20px; }
.im-platen { width: 25px; height: 90px; background: #334155; border-radius: 4px; position: absolute; z-index: 2; box-shadow: 2px 2px 5px rgba(0,0,0,0.1); }
.im-platen.fixed { left: 20px; } 
.im-platen.moving { left: 160px; animation: mold-cycle 4s infinite; }
.im-mold { width: 15px; height: 50px; background: #e2e8f0; border: 1px solid #94a3b8; position: absolute; top: 20px; }
.im-mold.fixed-half { right: -15px; border-radius: 0 4px 4px 0; }
.im-mold.moving-half { left: -15px; border-radius: 4px 0 0 4px; }
.im-ejector-pin { position: absolute; left: -10px; top: 43px; width: 20px; height: 4px; background: #94a3b8; opacity: 0; animation: eject-cycle 4s ease-in-out infinite; }
.im-product-wrap { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.im-product { position: absolute; left: 48px; top: 55px; width: 10px; height: 30px; background: transparent; border-radius: 2px; z-index: 5; animation: product-cycle 4s ease-in-out infinite; }
.im-base { position: absolute; bottom: 0; left: 10%; width: 80%; height: 10px; background: #e2e8f0; border-radius: 5px; z-index: 0; }

@keyframes mold-cycle { 
    0% { transform: translate3d(0,0,0); animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1); } 
    10% { transform: translate3d(-105px,0,0); } 
    15% { transform: translate3d(-106px,0,0); } 
    60% { transform: translate3d(-105px,0,0); } 
    70% { transform: translate3d(-90px,0,0); animation-timing-function: ease-in; } 
    85% { transform: translate3d(0,0,0); } 100% { transform: translate3d(0,0,0); } 
}
@keyframes screw-cycle { 
    0%, 15% { transform: translate3d(0,0,0); } 
    22% { transform: translate3d(28px,0,0); } 
    45% { transform: translate3d(28px,0,0); } 
    65% { transform: translate3d(0,0,0); } 100% { transform: translate3d(0,0,0); } 
}
@keyframes product-cycle { 
    0% { opacity: 0; transform: scale(0.8); } 
    22% { opacity: 1; background: #ff4d4d; width: 0; left: 52px; transform: scale(1); } 
    28% { opacity: 1; background: #ff4d4d; width: 12px; left: 52px; } 
    40% { background: #a855f7; } 60% { background: #3b82f6; } 
    70% { left: 52px; opacity: 1; transform: translate3d(15px,0,0); } 
    85% { left: 52px; opacity: 1; transform: translate3d(105px,0,0); } 
    88% { opacity: 1; transform: translate3d(115px,-5px,0) rotate(15deg); } 
    95% { opacity: 0; transform: translate3d(135px,80px,0) rotate(90deg); } 100% { opacity: 0; } 
}
@keyframes eject-cycle { 
    0%, 85% { opacity: 0; transform: translate3d(0,0,0); } 
    87% { opacity: 1; transform: translate3d(12px,0,0); } 
    92% { opacity: 0; transform: translate3d(0,0,0); } 100% { opacity: 0; } 
}
@keyframes feed-granules { 0%, 45% { transform: translate3d(0,0,0); opacity: 0; } 55% { transform: translate3d(0,10px,0); opacity: 1; } 65% { transform: translate3d(0,20px,0); opacity: 0; } 100% { opacity: 0; } }

.loading-status { text-align: center; }
.loading-status h3 { font-size: 14px; font-weight: 600; color: #64748b; margin-bottom: 10px; }
.progress-track { width: 200px; height: 4px; background: #e2e8f0; border-radius: 2px; margin: 0 auto; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg, #3b82f6, #8b5cf6); transition: width 0.3s linear; }

/* 6. 仪表盘 */
.empty-state.center-box { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 80%; text-align: center; color: var(--text-sub); }
.icon-circle { width: 80px; height: 80px; background: #eff6ff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--primary); margin-bottom: 20px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 40px; }
.main-title { font-size: 28px; color: var(--text-main); font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.meta-info { display: flex; gap: 8px; }
.tag { font-size: 11px; padding: 4px 10px; border-radius: 6px; font-weight: 600; }
.tag.pro { background: #dbeafe; color: var(--primary-dark); }
.tag.date { background: #f1f5f9; color: var(--text-sub); }
.hero-price-card { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); padding: 20px 30px; border-radius: 16px; box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4); text-align: right; color: white; min-width: 200px; }
.price-label { font-size: 10px; opacity: 0.8; display: block; margin-bottom: 4px; letter-spacing: 1px; }
#resUnitPrice { background: linear-gradient(to bottom, #fff, #bfdbfe); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.price-value-wrapper h2 { font-size: 36px; font-family: 'JetBrains Mono', monospace; font-weight: 700; margin: 0; line-height: 1; }
.price-badge { font-size: 10px; background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 4px; display: inline-block; margin-top: 6px; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 24px; }
.grid-column { display: flex; flex-direction: column; gap: 24px; }
.glass-card { background: rgba(255,255,255,0.7); backdrop-filter: blur(12px); border: 1px solid white; border-radius: 16px; padding: 24px; box-shadow: var(--shadow-sm); }
.glass-card h3 { font-size: 14px; margin-bottom: 20px; color: var(--text-main); display: flex; align-items: center; gap: 8px; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 12px; }

.params-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.param-box { background: rgba(255,255,255,0.6); padding: 12px 16px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.5); position: relative; transition: 0.2s; }
.param-box:hover { background: white; border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.box-header { font-size: 11px; color: var(--text-sub); margin-bottom: 4px; }
.param-box strong { font-size: 18px; color: var(--text-main); display: block; }
.param-box strong.small { font-size: 16px; font-family: 'JetBrains Mono', monospace; }
.text-gradient { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }
.clean-tooltip { position: absolute; bottom: 105%; left: 50%; transform: translateX(-50%) translateY(5px); width: 200px; background: #1e293b; color: white; border-radius: 6px; padding: 8px 12px; font-size: 11px; opacity: 0; pointer-events: none; transition: 0.2s; z-index: 10; text-align: center; }
.interactive:hover .clean-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

.cycle-bar-wrapper { margin-top: 15px; display: flex; flex-direction: column; gap: 5px; }
.cycle-text { font-size: 11px; color: var(--text-sub); text-align: center; background: rgba(255,255,255,0.5); padding: 6px; border-radius: 6px; }
.warning-text { color: #d97706; background: #fef3c7; }
.chart-container { height: 220px; position: relative; display: flex; align-items: center; justify-content: center; }

.cost-list { list-style: none; }
.cost-list li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed #e2e8f0; }
.label-group { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-main); font-weight: 500; }
.icon-box { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.icon-box.blue { background: #dbeafe; color: #2563eb; } .icon-box.red { background: #fee2e2; color: #ef4444; } .icon-box.purple { background: #f3e8ff; color: #9333ea; } .icon-box.yellow { background: #fef3c7; color: #d97706; } .icon-box.gray { background: #f1f5f9; color: #475569; }
.val { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 14px; color: var(--text-main); }
.final-total { display: flex; justify-content: space-between; margin-top: 20px; padding-top: 16px; border-top: 2px solid #cbd5e1; align-items: center; }
.final-total strong { font-size: 24px; color: var(--primary-dark); font-family: 'JetBrains Mono', monospace; }

/* 底部操作区 & AI卡片 */
.footer-actions { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.ai-disclaimer-card { display: flex; align-items: center; gap: 12px; background: linear-gradient(to right, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05)); border: 1px solid rgba(59, 130, 246, 0.2); padding: 12px 16px; border-radius: 12px; text-decoration: none; transition: all 0.3s ease; margin-bottom: 8px; cursor: pointer; }
.ai-disclaimer-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15); background: white; }
.ai-icon { width: 32px; height: 32px; background: #eff6ff; color: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.ai-content { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ai-title { font-size: 12px; font-weight: 700; color: var(--text-main); font-family: 'JetBrains Mono', monospace; }
.ai-desc { font-size: 11px; color: var(--text-sub); }
.ai-arrow { font-size: 12px; color: #cbd5e1; transition: transform 0.3s; }
.ai-disclaimer-card:hover .ai-arrow { transform: translateX(4px); color: var(--primary); }

.btn-export { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; color: var(--text-main); font-weight: 600; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; }
.btn-export:hover { background: #f8fafc; border-color: var(--text-sub); }

@media print { .bg-decoration, .sidebar, .btn-export { display: none; } }

@media (max-width: 1024px) { 
    .app-container { flex-direction: column; overflow-y: auto; height: auto; } 
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid white; height: auto; flex-shrink: 0; } 
    .main-content { padding: 20px; min-height: 100vh; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .hero-price-card { text-align: center; padding: 20px; margin-top: 20px; width: 100%; }
    .dashboard-header { flex-direction: column; align-items: stretch; gap: 0; }
    .three-cols { grid-template-columns: 1fr 1fr 1fr; }
}