/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.card h2 {
    color: #4a5568;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #4a5568;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

button:active {
    transform: translateY(0);
}

.results {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f1f5f9;
    border-radius: 5px;
}

.results h3 {
    margin-bottom: 1rem;
    color: #4a5568;
}

.search-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-container input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 1rem;
}

#search-results {
    max-height: 300px;
    overflow-y: auto;
}

.food-item {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.food-item:hover {
    background-color: #ebf4ff;
}

.food-item:last-child {
    border-bottom: none;
}

.food-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.nutrient-item {
    background: #edf2f7;
    padding: 0.75rem;
    border-radius: 5px;
    text-align: center;
}

.nutrient-item .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.nutrient-item .label {
    font-size: 0.9rem;
    color: #718096;
}

#selected-foods-list {
    list-style: none;
}

#selected-foods-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

#selected-foods-list li:last-child {
    border-bottom: none;
}

.remove-food {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
}

.remove-food:hover {
    background: #c53030;
}

#intake-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #edf2f7;
    border-radius: 5px;
}

.stat-item .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.stat-item .label {
    font-size: 0.9rem;
    color: #718096;
}

.progress-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 5px;
}

#intake-history-list {
    list-style: none;
}

#intake-history-list li {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

#intake-history-list li:last-child {
    border-bottom: none;
}

footer {
    text-align: center;
    padding: 2rem;
    background-color: #2d3748;
    color: white;
    margin-top: 2rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    main {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .card h2 {
        font-size: 1.5rem;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .food-details {
        grid-template-columns: 1fr;
    }
    
    #intake-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .search-container input {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    #intake-stats {
        grid-template-columns: 1fr;
    }
}