:root {
  /* 主要顏色變數 */
  --primary-color: #8ed24d;
  --primary-dark: #7ab33c;
  --secondary-color: #4a7023;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --background-color: #f8f9fa;
  --text-color: #333333;
  --white: #ffffff;
  --dark-color: #343a40;
  --border-radius: 10px; /* Slightly increased for a softer look */
  --transition: all 0.3s ease;
}

/* 基礎重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

/* 頁首樣式 */
.header {
  background: var(--primary-color);
  padding: 2rem 0; /* Increased padding for a more spacious header */
  margin-bottom: 2rem;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  color: var(--white);
}

.header h1 {
  font-size: 2.5rem; /* Increased font size for better visibility */
  font-weight: 700; /* Bolder font weight */
  text-align: center; /* Centered header text */
}

/* 計算器容器 */
.calculator-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* Enhanced shadow for depth */
  overflow: hidden;
  max-width: 1000px;
  margin: 0 auto;
  margin-top: 2rem;
}

/* 側邊導航欄 */
.calculator-nav {
  background: var(--secondary-color);
  padding: 2rem; /* Increased padding for better spacing */
}

.nav-button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border: none;
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--white);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.nav-button i {
  margin-right: 10px;
  font-size: 1.5rem; /* Increased icon size for better visibility */
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-button.active {
  background: var(--primary-color);
}

/* 主要內容區域 */
.calculator-content {
  padding: 3rem; /* Increased padding for a more spacious layout */
}

.calculator-section {
  display: none;
  background-color: var(--white);
  border-radius: var(--border-radius);
  padding: 2.5rem; /* Increased padding for better spacing */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.calculator-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* 區段標題 */
.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
  font-size: 2rem; /* Increased font size for section headers */
}

.section-description {
  color: #666;
  font-size: 1rem; /* Adjusted font size for better readability */
}

/* 表單樣式 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0. 5rem;
  font-weight: 600;
  color: var(--text-color);
}

.form-control {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(142, 210, 77, 0.2);
}

.form-text {
  color: var(--secondary-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* 按鈕樣式 */
.btn {
  background: var(--primary-color);
  color: var(--white);
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--white);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--white);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* 結果顯示區域 */
.result-container {
  display: none;
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f1f8e9;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
}

.result-container.show {
  display: block;
  animation: slideIn 0.3s ease;
}

/* BMI 特定樣式 */
.bmi-display {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 1.5rem 0;
}

.large-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.status-indicator {
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

/* BMI 量表 */
.bmi-gauge {
  margin: 2rem 0;
}

.gauge-bar {
  height: 20px;
  background: linear-gradient(to right,
      var(--primary-color) 0%,
      var(--success-color) 30%,
      var(--warning-color) 60%,
      var(--danger-color) 100%);
  border-radius: 10px;
  position: relative;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  color: var(--secondary-color);
}

/* BMI 分類 */
.bmi-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.category {
  padding: 1.5rem;
  border-radius: var(--border-radius);
  text-align: center;
}

.category.underweight {
  background-color: #cce5ff;
}

.category.normal {
  background-color: #d4edda;
}

.category.overweight {
  background-color: #fff3cd;
}

.category.obese {
  background-color: #f8d7da;
}

/* 單位切換開關 */
.unit-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.switch input:checked+. slider {
  background-color: var(--primary-color);
}

.switch input:checked+.slider:before {
  transform: translateX(26px);
}

/* 資訊框 */
.info-box {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f1f8e9;
  border-radius: var(--border-radius);
}

.info-box h3 {
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

.info-box ul {
  list-style-position: inside;
  margin: 1rem 0;
}

.info-box li {
  margin-bottom: 0.5rem;
}

/* 動畫效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 響應式設計 */
@media (max-width: 768px) {
  .calculator-wrapper {
    grid-template-columns: 1fr;
  }

  .calculator-nav {
    padding: 1rem;
  }

  .nav-button {
    padding: 0.8rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 1rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .bmi-display {
    flex-direction: column;
    text-align: center;
  }
}

/* 列印樣式 */
@media print {
  .calculator-nav,
  .form-actions,
  .unit-toggle {
    display: none;
  }

  .calculator-wrapper {
    box-shadow: none;
    grid-template-columns: 1fr;
  }

  .result-container {
    break-inside: avoid;
  }

  /* 單位範圍提示樣式 */
  .metric-range,
  .imperial-range {
    display: none; /* 預設都隱藏 */
    color: var(--secondary-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
  }

  /* 顯示當前單位的範圍提示 */
  .metric-range.active {
    display: block;
  }

  .imperial-range.active {
    display: block;
  }

  /* 單位文字樣式 */
  .unit-text {
    font-weight: normal;
    color: var(--secondary-color);
  }
}
