/* NutritionCalcPro.com — shared stylesheet */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #ffffff;
  color: #111827;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #16a34a;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: #16a34a;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nav-links a {
  color: #374151;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
  background: #f0fdf4;
  color: #16a34a;
  text-decoration: none;
}

.nav-links a.active {
  background: #16a34a;
  color: #ffffff;
}

/* Layout */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

h1 {
  font-size: 2rem;
  margin: 16px 0 12px;
  letter-spacing: -0.02em;
  color: #111827;
}

h2 {
  font-size: 1.4rem;
  margin: 32px 0 12px;
  color: #111827;
}

h3 {
  font-size: 1.1rem;
  margin: 20px 0 8px;
  color: #111827;
}

.intro {
  color: #4b5563;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

/* Calculator card */
.calc {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
  font-size: 0.95rem;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  font-size: 1rem;
  font-family: inherit;
  color: #111827;
  transition: border 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.row {
  display: flex;
  gap: 12px;
}

.row > .field {
  flex: 1;
}

.unit-toggle {
  display: inline-flex;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 8px;
}

.unit-toggle button {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: #6b7280;
  font-family: inherit;
}

.unit-toggle button.active {
  background: #16a34a;
  color: #ffffff;
}

button.calc-btn {
  background: #16a34a;
  color: #ffffff;
  border: none;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
  transition: background 0.15s;
}

button.calc-btn:hover {
  background: #15803d;
}

/* Results */
.results {
  margin-top: 24px;
  padding: 20px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}

.results h3 {
  margin-top: 0;
  color: #15803d;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid #dcfce7;
}

.result-item:last-child {
  border-bottom: none;
}

.result-label {
  color: #374151;
  font-weight: 500;
}

.result-value {
  font-weight: 700;
  color: #15803d;
  font-size: 1.15rem;
}

.big-result {
  font-size: 2.4rem;
  font-weight: 700;
  color: #16a34a;
  text-align: center;
  margin: 12px 0;
  letter-spacing: -0.02em;
}

.muted {
  color: #6b7280;
  font-size: 0.9rem;
}

/* Macro bar */
.macro-bar {
  display: flex;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 0;
  background: #e5e7eb;
}

.macro-bar > div {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
}

.macro-protein { background: #16a34a; }
.macro-carbs { background: #f59e0b; }
.macro-fat { background: #3b82f6; }

.macro-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.9rem;
  margin-top: 8px;
}

.macro-legend span::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-protein::before { background: #16a34a; }
.legend-carbs::before { background: #f59e0b; }
.legend-fat::before { background: #3b82f6; }

/* BMI scale */
.bmi-scale {
  display: flex;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 0;
  position: relative;
}

.bmi-scale > div {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
}

.bmi-under { background: #3b82f6; }
.bmi-normal { background: #16a34a; }
.bmi-over { background: #f59e0b; }
.bmi-obese { background: #dc2626; }

.bmi-marker {
  position: absolute;
  top: -6px;
  width: 4px;
  height: 48px;
  background: #111827;
  border-radius: 2px;
  transition: left 0.3s;
}

.category-card {
  padding: 16px;
  border-radius: 10px;
  text-align: center;
  margin: 16px 0;
  color: #ffffff;
  font-weight: 600;
  font-size: 1.05rem;
}

.cat-under { background: #3b82f6; }
.cat-normal { background: #16a34a; }
.cat-over { background: #f59e0b; }
.cat-obese { background: #dc2626; }

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background: #f0fdf4;
  font-weight: 600;
  color: #15803d;
  font-size: 0.92rem;
}

tr:last-child td {
  border-bottom: none;
}

/* Disclaimer */
.disclaimer {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 12px 16px;
  border-radius: 6px;
  margin: 20px 0;
  font-size: 0.92rem;
  color: #78350f;
}

/* Footer */
footer {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  padding: 28px 20px;
  margin-top: 48px;
  color: #6b7280;
  font-size: 0.9rem;
  text-align: center;
}

footer .foot-links {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

footer .foot-links a {
  color: #374151;
}

/* Responsive */
@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }
  .nav-inner { padding: 10px 14px; }
  .nav-links { gap: 2px; }
  .nav-links a { padding: 5px 8px; font-size: 0.85rem; }
  main { padding: 16px 14px 32px; }
  .calc { padding: 18px; }
  .row { flex-direction: column; gap: 0; }
  .big-result { font-size: 2rem; }
}
