:root { --primary-color: #4CAF50; --secondary-color: #45a049; --background-color: #f4f4f4; --text-color: #333; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Microsoft YaHei', sans-serif; line-height: 1.6; background-color: var(--background-color); color: var(--text-color); } .navbar { background-color: var(--primary-color); padding: 1rem; color: white; } .nav-brand { font-size: 1.5rem; font-weight: bold; } .nav-menu { list-style: none; display: flex; gap: 2rem; } .nav-menu a { color: white; text-decoration: none; } .container { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; } .hero { text-align: center; padding: 3rem 1rem; background-color: white; border-radius: 8px; margin-bottom: 2rem; } .features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; padding: 1rem; } .feature-card { background: white; padding: 2rem; border-radius: 8px; text-align: center; } .card { background: white; border-radius: 8px; padding: 2rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .form-group { margin-bottom: 1rem; } .form-group label { display: block; margin-bottom: 0.5rem; font-weight: bold; } .form-group input, .form-group textarea { width: 100%; padding: 0.5rem; border: 1px solid #ddd; border-radius: 4px; } .btn { display: inline-block; background-color: var(--primary-color); color: white; padding: 0.5rem 1rem; text-decoration: none; border-radius: 4px; margin-top: 1rem; } .btn:hover { background-color: var(--secondary-color); } .result { margin-top: 2rem; padding: 1rem; border-left: 4px solid var(--primary-color); background: white; } .footer { text-align: center; padding: 1rem; background: #333; color: white; position: fixed; bottom: 0; width: 100%; } /* 添加食谱页面的特定样式 */ .ingredients-section, .cooking-section, .nutrition-section { margin-top: 1.5rem; padding: 1rem; background: #f9f9f9; border-radius: 4px; } .ingredients-section ul { list-style-position: inside; padding-left: 1rem; } .ingredients-section li { padding: 0.5rem 0; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; } .ingredients-section li:last-child { border-bottom: none; } .cooking-section { counter-reset: step-counter; } .cooking-section p { margin-bottom: 0.8rem; padding: 0.5rem 0; position: relative; padding-left: 2rem; } .cooking-section p:before { content: counter(step-counter); counter-increment: step-counter; position: absolute; left: 0; top: 50%; transform: translateY(-50%); background-color: var(--primary-color); color: white; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; } .nutrition-section p { display: flex; justify-content: space-between; margin-bottom: 0.3rem; padding: 0.3rem 0; border-bottom: 1px solid #eee; } .nutrition-section h4 { color: var(--primary-color); margin: 1.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary-color); } .nutrition-section h4:first-child { margin-top: 0; } .nutrition-details { padding-left: 1rem; } .nutrition-item { margin-bottom: 1rem; } .nutrition-item h5 { color: #666; margin-bottom: 0.5rem; font-size: 0.95rem; } .nutrition-item p { color: #333; line-height: 1.6; margin-left: 1rem; position: relative; } .nutrition-item p::before { content: "•"; position: absolute; left: -1rem; color: var(--primary-color); } /* 加载动画样式 */ .loading-spinner { display: none; text-align: center; margin: 2rem auto; } .spinner { width: 50px; height: 50px; border: 5px solid var(--background-color); border-top: 5px solid var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; } .loading-text { margin-top: 1rem; color: var(--text-color); font-size: 0.9rem; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } /* 添加淡入淡出效果 */ .fade-in { animation: fadeIn 0.5s ease-in; } .fade-out { animation: fadeOut 0.5s ease-out; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } } /* 营养分析网格布局 */ .nutrition-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin-top: 1rem; } .nutrition-card { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.2s ease; } .nutrition-card:hover { transform: translateY(-2px); } .nutrition-card h4 { color: var(--primary-color); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary-color); font-size: 1.1rem; } .nutrition-content { color: var(--text-color); line-height: 1.6; font-size: 0.95rem; text-align: justify; } /* 营养分析样式优化 */ .nutrition-analysis-wrapper { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 1rem; } .meal-card { background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); } .meal-header { background-color: var(--primary-color); padding: 1rem; } .meal-header h4 { color: white; margin: 0; font-size: 1.1rem; text-align: center; } .meal-content { padding: 1.5rem; } .meal-content p { color: var(--text-color); margin-bottom: 0.8rem; line-height: 1.6; font-size: 0.95rem; } .meal-content p:last-child { margin-bottom: 0; } /* 推荐结果样式 */ .recommendation-wrapper { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 1rem; } .meal-card { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .meal-title { color: var(--primary-color); padding-bottom: 0.5rem; margin-bottom: 1rem; border-bottom: 2px solid var(--primary-color); font-size: 1.2rem; } .meal-details { display: grid; gap: 1rem; } .analysis-item { background: #f8f9fa; padding: 1rem; border-radius: 6px; } .analysis-item h4 { color: #666; margin-bottom: 0.5rem; font-size: 0.9rem; font-weight: 600; } .analysis-item p { color: var(--text-color); line-height: 1.6; font-size: 0.95rem; margin: 0; } .overall-advice { grid-column: 1 / -1; background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-top: 1rem; } .overall-advice h3 { color: var(--primary-color); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary-color); } .overall-advice p { line-height: 1.6; color: var(--text-color); } /* 营养分析卡片样式 */ .meal-analysis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; margin: 1rem 0; } .meal-analysis-card { background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); transition: transform 0.2s ease; } .meal-analysis-card:hover { transform: translateY(-2px); } .meal-header { background: var(--primary-color); color: white; padding: 1rem; position: relative; } .meal-header h3 { margin: 0; font-size: 1.2rem; } .meal-food { display: inline-block; background: rgba(255, 255, 255, 0.2); padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.9rem; margin-top: 0.5rem; } .meal-analysis-content { padding: 1.5rem; } .analysis-section { margin-bottom: 1.5rem; } .analysis-section:last-child { margin-bottom: 0; } .analysis-section h4 { color: var(--primary-color); font-size: 1rem; margin-bottom: 0.8rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary-color); } .analysis-section p { color: var(--text-color); line-height: 1.6; font-size: 0.95rem; margin: 0; text-align: justify; } /* 功能介绍卡片样式 */ .feature-intro { background: linear-gradient(to right, var(--primary-color), #2196F3); color: white; padding: 2rem; border-radius: 8px 8px 0 0; margin: -2rem -2rem 2rem -2rem; text-align: center; } .feature-intro h2 { font-size: 1.8rem; margin-bottom: 1rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; } .intro-text { font-size: 1.1rem; line-height: 1.6; max-width: 800px; margin: 0 auto; opacity: 0.9; text-shadow: 0 1px 2px rgba(0,0,0,0.1); } .feature-intro i { margin-right: 0.5rem; } /* 响应式调整 */ @media (max-width: 768px) { .nav-menu { flex-direction: column; gap: 1rem; } .container { padding: 0 0.5rem; } .nutrition-grid { grid-template-columns: 1fr; } .nutrition-card { padding: 1rem; } .nutrition-analysis-wrapper { grid-template-columns: 1fr; } .meal-card { margin-bottom: 1rem; } .meal-analysis-grid { grid-template-columns: 1fr; } .meal-analysis-card { margin-bottom: 1rem; } .feature-intro { padding: 1.5rem; } .feature-intro h2 { font-size: 1.5rem; } .intro-text { font-size: 1rem; } } /* 无数据状态 */ .no-data { text-align: center; color: #666; padding: 2rem; background: #f9f9f9; border-radius: 8px; } /* 个人信息页面样式 */ .health-stats { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid #eee; } .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-top: 1rem; } .stat-item { background: #f8f9fa; padding: 1.5rem; border-radius: 8px; text-align: center; } .stat-item h4 { color: var(--primary-color); margin-bottom: 0.5rem; } .stat-item p { font-size: 1.2rem; margin: 0.5rem 0; } #bmiValue { font-weight: bold; font-size: 1.5rem; } #bmiStatus { color: #666; font-size: 0.9rem; }