/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏样式 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo i {
    margin-right: 10px;
    color: #ff6b6b;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-item {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

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

/* 首页样式 */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 60px 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
    margin-bottom: 40px;
}

.hero-content {
    flex: 1;
    padding: 0 40px;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 700;
}

.hero-content p {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 30px;
    line-height: 1.8;
}

.cta-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image i {
    font-size: 8rem;
    color: #667eea;
    opacity: 0.7;
}

/* 功能特色区域 */
.features-section {
    text-align: center;
    padding: 40px 0;
}

.features-section h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: #2c3e50;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-card {
    background: white;
    padding: 40px 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
}

.feature-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
}

.feature-icon.red {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.feature-icon.yellow {
    background: linear-gradient(135deg, #feca57, #ff9ff3);
}

.feature-icon.green {
    background: linear-gradient(135deg, #48dbfb, #0abde3);
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.feature-card p {
    color: #7f8c8d;
    line-height: 1.6;
}

/* 分析页面样式 */
.analyze-container {
    max-width: 800px;
    margin: 0 auto;
}

.analyze-container h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: #2c3e50;
}

.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 15px;
    padding: 60px 40px;
    text-align: center;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-content i {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.upload-content p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.upload-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.upload-button:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

/* 图片预览样式 */
.image-preview {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.preview-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* 加载状态样式 */
.loading-section {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-section p {
    font-size: 1.1rem;
    color: #7f8c8d;
}

/* 结果展示样式 */
.results-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.results-section h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: #2c3e50;
    text-align: center;
}

.results-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    display: block;
    padding: 25px;
    border-radius: 15px;
    background: #f8f9fa;
    border-left: 5px solid;
    margin-bottom: 25px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.result-item.high {
    border-left-color: #ff6b6b;
    background: #fff5f5;
}

.result-item.medium {
    border-left-color: #feca57;
    background: #fffbf0;
}

.result-item.low {
    border-left-color: #48dbfb;
    background: #f0fcff;
}

.result-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    color: white;
    font-size: 1.2rem;
}

.result-item.high .result-icon {
    background: #ff6b6b;
}

.result-item.medium .result-icon {
    background: #feca57;
}

.result-item.low .result-icon {
    background: #48dbfb;
}

.result-info h4 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: #2c3e50;
}

.result-info p {
    color: #7f8c8d;
    margin-bottom: 5px;
}

.energy-value {
    font-weight: bold;
    font-size: 0.95rem;
    padding: 5px 10px;
    border-radius: 6px;
    margin: 8px 0;
    display: inline-block;
}

.energy-value.energy-low {
    color: #28a745;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border-left: 3px solid #28a745;
}

.energy-value.energy-medium {
    color: #f39c12;
    background: linear-gradient(135deg, #fef9e7 0%, #fcf4dd 100%);
    border-left: 3px solid #f39c12;
}

.energy-value.energy-high {
    color: #e74c3c;
    background: linear-gradient(135deg, #fdf2f2 0%, #fce4ec 100%);
    border-left: 3px solid #e74c3c;
}

.purine-level {
    font-weight: bold;
    font-size: 0.9rem;
}

.result-item.high .purine-level {
    color: #ff6b6b;
}

.result-item.medium .purine-level {
    color: #f39c12;
}

.result-item.low .purine-level {
    color: #48dbfb;
}

/* 结果项头部样式 */
.result-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.result-basic-info {
    flex: 1;
}

.result-basic-info h4 {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

.result-basic-info p {
    color: #7f8c8d;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

/* 详细信息区域样式 */
.result-details {
    margin-top: 20px;
}

.nutrition-section,
.food-description-section {
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.nutrition-section h5,
.food-description-section h5 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.nutrition-section h5 i {
    color: #667eea;
}

.food-description-section h5 i {
    color: #28a745;
}

/* 营养成分网格 */
.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.nutrition-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.nutrition-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.nutrition-value {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

/* 食物说明样式 */
.description-content {
    background: #f8fff8;
    border: 1px solid #e8f5e8;
    border-radius: 8px;
    padding: 15px;
}

.description-text {
    color: #2c5530;
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0;
    text-align: justify;
}



/* 响应式设计 */
@media (max-width: 768px) {
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .benefits-risks-section {
        grid-template-columns: 1fr;
    }
}

/* 建议区域样式 */
.suggestions {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    border-left: 5px solid #667eea;
}

.suggestions h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.suggestions ul {
    list-style: none;
    padding: 0;
}

.suggestions li {
    padding: 8px 0;
    color: #555;
    position: relative;
    padding-left: 25px;
}

.suggestions li:before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* 历史记录样式 */
.history-container h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: #2c3e50;
}

.empty-state {
    text-align: center;
    padding: 80px 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.empty-state i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 25px;
}

.history-item {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

.history-image {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    object-fit: cover;
}

.history-info {
    flex: 1;
}

.history-info h4 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.history-info p {
    color: #7f8c8d;
    margin-bottom: 5px;
}

.history-date {
    font-size: 0.9rem;
    color: #adb5bd;
}

/* 科普知识样式 */
.knowledge-container h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: #2c3e50;
}

.knowledge-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.knowledge-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.knowledge-section p {
    line-height: 1.8;
    color: #555;
    margin-bottom: 15px;
}

.knowledge-section ul {
    padding-left: 20px;
}

.knowledge-section li {
    margin-bottom: 10px;
    color: #555;
    line-height: 1.6;
}

.purine-levels {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.level-item {
    padding: 25px;
    border-radius: 10px;
    border-left: 5px solid;
}

.level-item.red {
    border-left-color: #ff6b6b;
    background: #fff5f5;
}

.level-item.yellow {
    border-left-color: #feca57;
    background: #fffbf0;
}

.level-item.green {
    border-left-color: #48dbfb;
    background: #f0fcff;
}

.level-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.level-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 15px;
}

.level-item.red .level-color {
    background: #ff6b6b;
}

.level-item.yellow .level-color {
    background: #feca57;
}

.level-item.green .level-color {
    background: #48dbfb;
}

.level-header h4 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin: 0;
}

.level-item p {
    margin-bottom: 10px;
    color: #555;
}

.level-item strong {
    color: #2c3e50;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .nav-menu {
        gap: 15px;
    }
    
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding: 40px 20px;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-image i {
        font-size: 4rem;
        margin-top: 20px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .preview-actions {
        flex-direction: column;
    }
    
    .history-item {
        flex-direction: column;
        text-align: center;
    }
    
    .purine-levels {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .features-section h2,
    .analyze-container h2,
    .history-container h2,
    .knowledge-container h2 {
        font-size: 1.8rem;
    }
}