/* 配方模拟器样式 */

* {
  box-sizing: border-box;
}

.formulator-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.formulator-header {
  text-align: center;
  margin-bottom: 30px;
}

.formulator-header h1 {
  font-size: 2rem;
  color: #2c3e50;
  margin-bottom: 10px;
}

.formulator-header p {
  color: #666;
  font-size: 1rem;
}

.disclaimer {
  color: #999;
  font-size: 0.8rem;
  margin-top: 10px;
}

/* 布局 */
.formulator-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 30px;
}

@media (max-width: 900px) {
  .formulator-layout {
    grid-template-columns: 1fr;
  }
}

/* 原料选择区 */
.ingredients-panel {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
}

.category-section {
  margin-bottom: 25px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e0e0;
}

.category-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.category-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: #333;
}

.ingredient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.ingredient-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.ingredient-card:hover {
  border-color: #4a90d9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ingredient-card.selected {
  border-color: #4a90d9;
  background: #e8f4fd;
}

.ingredient-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.ingredient-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
}

.ingredient-desc {
  font-size: 0.7rem;
  color: #888;
  line-height: 1.3;
}

/* 香精刺鼻等级 */
.pungency-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff3cd;
  color: #856404;
  margin-top: 4px;
}

.pungency-1 { background: #d4edda; color: #155724; }
.pungency-2 { background: #fff3cd; color: #856404; }
.pungency-3 { background: #ffe5d0; color: #a0522d; }
.pungency-4 { background: #f8d7da; color: #721c24; }

/* 配比调节区 */
.ratio-panel {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  position: sticky;
  top: 20px;
}

.ratio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ratio-header h2 {
  font-size: 1.2rem;
  color: #2c3e50;
}

.total-ratio {
  font-size: 0.9rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: #e8f4fd;
  color: #1976d2;
}

.total-ratio.valid {
  background: #d4edda;
  color: #155724;
}

.total-ratio.invalid {
  background: #f8d7da;
  color: #721c24;
}

.ratio-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.ratio-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ratio-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ratio-item-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: #333;
}

.ratio-item-value {
  font-weight: 600;
  color: #1976d2;
}

.ratio-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  border-radius: 3px;
  outline: none;
}

.ratio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1976d2;
  cursor: pointer;
  transition: transform 0.1s;
}

.ratio-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.ratio-item-remove {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
}

.ratio-item-remove:hover {
  background: #fee;
}

/* 分析结果 */
.analysis-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid #e0e0e0;
}

.analysis-section h3 {
  font-size: 1rem;
  color: #2c3e50;
  margin-bottom: 12px;
}

.chart-container {
  width: 100%;
  max-width: 350px;
  margin: 0 auto;
}

.props-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.prop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  font-size: 0.85rem;
}

.prop-name {
  color: #666;
}

.prop-value {
  font-weight: 600;
  color: #1976d2;
}

/* 操作按钮 */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #1976d2;
  color: white;
}

.btn-primary:hover {
  background: #1565c0;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* 加载状态 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f0f0f0;
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
