/* BMI 指数计算器样式 */
:root {
  --bg: #ffffff;
  --bg-card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --primary-light: rgba(79, 70, 229, 0.3);
  --primary-dark: #4338ca;
  /* BMI 分级配色 */
  --seg-thin: #60a5fa;
  --seg-normal: #34d399;
  --seg-over: #fbbf24;
  --seg-obese: #f87171;
}

/* ==================== 输入区域样式 ==================== */
.calc-input-section {
  margin-bottom: 32px;
}

.calc-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calc-card-header {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  padding: 24px 32px;
}

.calc-card-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: #ffffff;
}

.calc-card-header p {
  font-size: 14px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

.calc-card-body {
  padding: 32px;
}

/* 表单区域 */
.form-section {
  margin-bottom: 28px;
}

.form-section:last-of-type {
  margin-bottom: 24px;
}

.form-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

/* 单位制式 / 评估标准选择卡片 */
.unit-type-group,
.standard-type-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.radio-card {
  position: relative;
  cursor: pointer;
}

.radio-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
  background: var(--bg);
}

.radio-card:hover .radio-card-content {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.radio-card.active .radio-card-content,
.radio-card input:checked + .radio-card-content {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.radio-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.radio-card-desc {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
}

/* 身高体重表单卡片 */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.form-group-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(79, 70, 229, 0.03);
  border-bottom: 1px solid var(--border);
}

.form-group-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.form-group-card-badge {
  font-size: 12px;
  color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 8px;
}

.input-with-unit {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.input-with-unit:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-with-unit input {
  flex: 1;
  padding: 10px 12px;
  border: none;
  font-size: 15px;
  background: transparent;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.input-with-unit input::placeholder {
  color: var(--text-light);
}

.input-with-unit .unit {
  font-size: 13px;
  color: var(--text-light);
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.02);
  border-left: 1px solid var(--border);
  align-self: stretch;
  display: flex;
  align-items: center;
}

/* 英制身高双输入框 */
.imperial-height {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* 操作按钮 */
.calc-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.btn-lg {
  flex: 1;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.btn-primary.btn-lg {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
}

.btn-primary.btn-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.btn-outline.btn-lg {
  border-width: 2px;
}

.btn-outline.btn-lg:hover {
  background: var(--bg);
}

/* ==================== 结果区域样式 ==================== */
.calc-result-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

/* 结果概览卡片 */
.result-overview-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.result-overview-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
}

.result-overview-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
}

.result-overview-header p {
  font-size: 13px;
  color: var(--text-light);
  margin: 0;
}

.result-overview-body {
  padding: 32px;
}

/* BMI 高亮显示 */
.result-highlight {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(79, 70, 229, 0.1));
  border-radius: 12px;
}

.result-highlight-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.result-highlight-label {
  font-size: 14px;
  color: var(--text-light);
}

.result-highlight-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -1px;
}

.result-highlight-unit {
  font-size: 14px;
  color: var(--text-light);
}

/* 结果网格 */
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.result-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.result-item:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.result-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 10px;
  color: var(--primary);
  flex-shrink: 0;
}

.result-item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.result-item-label {
  font-size: 13px;
  color: var(--text-light);
}

.result-item-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.result-item-unit {
  font-size: 12px;
  color: var(--text-light);
}

/* 图表卡片 */
.result-chart-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.result-chart-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
}

.result-chart-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.result-chart-body {
  padding: 24px 32px;
}

/* BMI 分级标尺 */
.bmi-scale {
  margin: 12px 0 8px;
}

.bmi-scale-bar {
  position: relative;
  height: 56px;
  border-radius: 10px;
  overflow: visible;
  display: flex;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bmi-scale-segment {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  position: relative;
}

.bmi-scale-segment.seg-thin {
  background: linear-gradient(135deg, #93c5fd, var(--seg-thin));
}

.bmi-scale-segment.seg-normal {
  background: linear-gradient(135deg, #6ee7b7, var(--seg-normal));
}

.bmi-scale-segment.seg-over {
  background: linear-gradient(135deg, #fcd34d, var(--seg-over));
}

.bmi-scale-segment.seg-obese {
  background: linear-gradient(135deg, #fca5a5, var(--seg-obese));
}

.seg-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.seg-range {
  font-size: 11px;
  opacity: 0.95;
  line-height: 1.2;
}

/* BMI 指针 */
.bmi-marker {
  position: absolute;
  top: -28px;
  transform: translateX(-50%);
  transition: left 0.6s ease;
  z-index: 2;
}

.bmi-marker-pin {
  width: 3px;
  height: 84px;
  background: var(--gray-900);
  margin: 0 auto;
  border-radius: 2px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.bmi-marker-value {
  display: inline-block;
  background: var(--gray-900);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.legend-color.seg-thin {
  background: var(--seg-thin);
}

.legend-color.seg-normal {
  background: var(--seg-normal);
}

.legend-color.seg-over {
  background: var(--seg-over);
}

.legend-color.seg-obese {
  background: var(--seg-obese);
}

.legend-text {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* 健康建议卡片 */
.advice-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.advice-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
}

.advice-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.advice-body {
  padding: 24px 32px;
}

.advice-body p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  margin: 0;
}

/* ==================== 信息区域样式 ==================== */
.info-section {
  margin-top: 32px;
}

.info-section > h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-section > h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

.info-content {
  display: grid;
  gap: 24px;
}

.info-block {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.info-block h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

.info-block p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 16px;
}

.info-block p:last-child {
  margin-bottom: 0;
}

.info-block ol {
  padding-left: 24px;
  margin: 0;
}

.info-block li {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 12px;
  padding-left: 4px;
}

.info-block li::marker {
  color: var(--primary);
  font-weight: 600;
}

/* 公式块 */
.formula-block {
  background: rgba(79, 70, 229, 0.04);
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: 12px;
  padding: 20px 24px;
}

.formula {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 12px 0 !important;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.formula-block p:last-child {
  margin: 0;
  font-size: 13px;
  color: var(--text-light);
}

/* 分级标准表格 */
.rate-table {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.rate-table table {
  width: 100%;
  border-collapse: collapse;
}

.rate-table th,
.rate-table td {
  padding: 14px 20px;
  text-align: left;
}

.rate-table th {
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.rate-table td {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.rate-table tbody tr:last-child td {
  border-bottom: none;
}

.rate-table tbody tr:hover td {
  background: rgba(79, 70, 229, 0.05);
}

.rate-note {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
  margin-top: 12px;
  padding-left: 12px;
  border-left: 3px solid var(--border);
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 992px) {
  .unit-type-group,
  .standard-type-group {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .result-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .calc-card-header {
    padding: 20px 24px;
  }

  .calc-card-body {
    padding: 24px;
  }

  .unit-type-group,
  .standard-type-group {
    gap: 12px;
  }

  .radio-card-content {
    padding: 14px 12px;
  }

  .radio-card-title {
    font-size: 16px;
  }

  .radio-card-desc {
    font-size: 11px;
  }

  .calc-actions {
    gap: 12px;
  }

  .result-overview-header,
  .result-overview-body,
  .result-chart-header,
  .result-chart-body,
  .advice-header,
  .advice-body {
    padding-left: 24px;
    padding-right: 24px;
  }

  .info-block {
    padding: 24px;
  }

  .bmi-scale-bar {
    height: 48px;
  }

  .seg-label {
    font-size: 12px;
  }

  .seg-range {
    font-size: 10px;
  }

  .bmi-marker-pin {
    height: 76px;
  }
}

@media (max-width: 480px) {
  .calc-card-header {
    padding: 16px 20px;
  }

  .calc-card-header h2 {
    font-size: 18px;
  }

  .calc-card-body {
    padding: 20px;
  }

  .form-section h3 {
    font-size: 15px;
  }

  .unit-type-group,
  .standard-type-group {
    grid-template-columns: 1fr;
  }

  .imperial-height {
    grid-template-columns: 1fr 1fr;
  }

  .result-highlight-value {
    font-size: 32px;
  }

  .result-item {
    padding: 16px;
  }

  .result-item-value {
    font-size: 18px;
  }

  .result-overview-header,
  .result-overview-body,
  .result-chart-header,
  .result-chart-body,
  .advice-header,
  .advice-body {
    padding-left: 20px;
    padding-right: 20px;
  }

  .chart-legend {
    gap: 12px;
  }

  .legend-text {
    font-size: 12px;
  }

  .seg-range {
    display: none;
  }
}

/* ==================== 页面统一元素（与新版工具页一致） ==================== */
/* 顶部主题色渐变底 */
body {
  background:
    radial-gradient(1200px 300px at 50% -80px, rgba(79, 70, 229, 0.06), transparent 70%),
    var(--gray-50, #f9fafb);
}

/* 面包屑 */
.calc-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.calc-crumb a {
  color: var(--primary);
  text-decoration: none;
}

.calc-crumb a:hover {
  text-decoration: underline;
}

.calc-crumb i {
  font-style: normal;
  color: var(--gray-400, #9ca3af);
}
