:root {
  --bg-color: #fffdf7;
  --surface: #ffffff;
  --text-primary: #17202a;
  --text-secondary: #475569;
  --accent: #f6b84b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #e2e8f0;
}
[data-theme="dark"] {
  --bg-color: #17202a;
  --surface: #1e2832;
  --text-primary: #fffdf7;
  --text-secondary: rgba(255, 253, 247, 0.7);
  --border: rgba(255, 253, 247, 0.15);
}
[data-theme="dim"] {
  --bg-color: #1e3a8a;
  --surface: #2548a8;
  --text-primary: #fffdf7;
  --text-secondary: rgba(255, 253, 247, 0.78);
  --accent: #2bae9a;
  --border: rgba(255, 253, 247, 0.2);
}
[data-theme="black"] {
  --bg-color: #000000;
  --surface: #0a0a0a;
  --text-primary: #fffdf7;
  --text-secondary: rgba(255, 253, 247, 0.7);
  --border: rgba(255, 253, 247, 0.18);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif; background-color: var(--bg-color); color: var(--text-primary); line-height: 1.6;
}
h1, h3, h4, .logo { font-family: 'Georgia', serif; }
.app-container { max-width: 600px; margin: 0 auto; padding: 3rem 1.5rem; }
.header { text-align: center; margin-bottom: 2rem; }
.logo { font-size: 1.5rem; font-weight: bold; margin-bottom: 1rem; }
.dot { color: var(--warning); }
.header h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.header p { color: var(--text-secondary); }

.calculator {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}
.full-width { grid-column: 1 / -1; }
@media(max-width: 500px) { .form-grid { grid-template-columns: 1fr; } }

.input-group label {
  display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem;
}
input[type="number"], select {
  width: 100%; padding: 0.8rem; border: 2px solid var(--border); border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 1rem; outline: none; transition: 0.2s; background: var(--surface); color: var(--text-primary);
}
input[type="number"]:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(246, 184, 75, 0.2);
}

/* Forçar as setinhas dos números a ficarem sempre visíveis */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1; height: 30px;
}

.toggle-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.toggle-group.vertical { flex-direction: column; }
.toggle-group input[type="radio"] { display: none; }
.btn-toggle {
  flex: 1; text-align: center; padding: 0.8rem; background: var(--surface); border: 2px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.2s; color: var(--text-secondary); font-size: 0.95rem; min-width: 100px;
}
.toggle-group input[type="radio"]:checked + .btn-toggle {
  background: rgba(246, 184, 75, 0.15); border-color: var(--warning); color: #d97706; box-shadow: 0 0 10px rgba(246, 184, 75, 0.3);
}

.main-btn {
  width: 100%; background: var(--text-primary); color: white; border: none; padding: 1.2rem; font-size: 1.1rem; border-radius: 8px; cursor: pointer; transition: all 0.3s; margin-top: 2rem; font-weight: bold;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}
.main-btn:hover, .main-btn:active {
  background: var(--warning); color: white; transform: translateY(-2px); box-shadow: 0 0 20px rgba(245, 158, 11, 0.8);
}

.result-card {
  margin-top: 2.5rem; padding-top: 2rem; border-top: 1px dashed var(--border); text-align: center;
}
.result-card h3 { font-size: 1.5rem; margin-bottom: 1.5rem; }

.risk-circle {
  width: 150px; height: 150px; border-radius: 50%; border: 6px solid var(--text-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto 2rem auto; color: var(--text-primary); transition: all 0.5s;
}
#risk-val { font-size: 2.5rem; font-weight: bold; line-height: 1; }
.unit { font-size: 0.9rem; color: var(--text-secondary); font-weight: 600; margin-top: 0.2rem; }

.nutrition-breakdown {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem;
}
.breakdown-card {
  background: rgba(0,0,0,0.02); padding: 1rem 0.5rem; border-radius: 8px; border: 1px solid var(--border);
}
.breakdown-card h4 { font-size: 0.9rem; color: var(--text-primary); margin-bottom: 0.5rem; }
.kcal-val { font-size: 1.2rem; font-weight: bold; font-family: 'Inter', sans-serif; margin-bottom: 0.2rem; }
.kcal-val.danger { color: var(--danger); }
.kcal-val.success { color: var(--success); }
.kcal-val.warning { color: #d97706; }
.breakdown-card span { font-size: 0.75rem; color: var(--text-secondary); }

@media(max-width: 500px) {
  .nutrition-breakdown { grid-template-columns: 1fr; }
}

.advice-list {
  text-align: left; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; list-style: none; display: flex; flex-direction: column; gap: 1rem;
}
.advice-list li { position: relative; padding-left: 1.8rem; font-size: 0.95rem; color: var(--text-primary); }
.advice-list li::before { content: "🍽️"; position: absolute; left: 0; top: 0; }

.footer-note {
  margin-top: 2rem; text-align: center; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6;
}

/* --- CSS DE REFERÊNCIAS --- */
.references { margin-top: 2rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; text-align: left; color: var(--text-primary); }
.references h3 { margin-top: 0; font-size: 1rem; color: var(--text-primary); margin-bottom: 0.5rem; }
.references p { margin-bottom: 1rem; color: var(--text-secondary); }
.references ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.references li { margin-bottom: 0.5rem; color: var(--text-secondary); }
.references a { color: var(--accent); text-decoration: none; font-weight: bold; }
.references .disclaimer { margin-top: 1rem; font-style: italic; color: var(--text-secondary); font-size: 0.85rem; border-top: 1px solid var(--border); padding-top: 0.8rem; }
