/* NutroApp - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --green:      #1D9E75;
  --green-dark: #0F6E56;
  --green-light:#E1F5EE;
  --amber:      #EF9F27;
  --amber-light:#FAEEDA;
  --coral:      #D85A30;
  --coral-light:#FAECE7;
  --gray-50:    #F8F8F6;
  --gray-100:   #F1EFE8;
  --gray-200:   #D3D1C7;
  --gray-400:   #888780;
  --gray-700:   #444441;
  --gray-900:   #1A1A18;
  --white:      #ffffff;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --shadow:     0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- NAVBAR ---- */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--gray-900);
  text-decoration: none;
}
.nav-logo span { font-style: italic; color: var(--green); }

.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { text-decoration: none; font-size: 14px; color: var(--gray-400); transition: color .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--gray-900); }

.btn-register {
  background: var(--green) !important;
  color: var(--white) !important;
  padding: 6px 16px;
  border-radius: var(--radius-md);
  font-size: 13px !important;
}
.btn-logout {
  color: var(--coral) !important;
  font-size: 13px !important;
}

/* ---- MAIN ---- */
.main-content {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1rem 3rem;
  width: 100%;
}

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 1.5rem;
}
.alert-success { background: var(--green-light); color: var(--green-dark); }
.alert-error   { background: #FCEBEB; color: #A32D2D; }
.alert-info    { background: #E6F1FB; color: #185FA5; }

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gray-400);
  margin-bottom: 1rem;
}
.card-heading {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  margin-bottom: .25rem;
}

/* ---- PAGE HEADER ---- */
.page-header { margin-bottom: 2rem; }
.page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 30px;
  color: var(--gray-900);
}
.page-subtitle { font-size: 14px; color: var(--gray-400); margin-top: 4px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 5px;
  letter-spacing: .02em;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .15s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(29,158,117,.1);
}
select.form-control { cursor: pointer; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ---- PILL SELECTOR ---- */
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 7px 16px;
  border-radius: 99px;
  border: 1px solid var(--gray-200);
  font-size: 13px;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-700);
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
  user-select: none;
}
.pill:hover { border-color: var(--green); color: var(--green); }
.pill.active { background: var(--green); border-color: var(--green); color: var(--white); }
.pill.budget-low.active  { background: #639922; border-color: #639922; }
.pill.budget-high.active { background: #3C3489; border-color: #3C3489; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
  text-align: center;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--green); color: var(--white); }
.btn-primary:hover { opacity: .9; }
.btn-outline  { background: transparent; border-color: var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-danger   { background: #FCEBEB; color: #A32D2D; border-color: #F7C1C1; }
.btn-full     { width: 100%; display: block; }
.btn-generate {
  width: 100%;
  padding: 15px;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--green);
  color: var(--white);
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  font-style: italic;
  cursor: pointer;
  margin-top: .5rem;
  transition: opacity .2s, transform .1s;
}
.btn-generate:hover { opacity: .9; }
.btn-generate:disabled { opacity: .5; cursor: not-allowed; }

/* ---- MACRO CHIPS ---- */
.macro-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.macro-chip { font-size: 12px; padding: 4px 12px; border-radius: 99px; font-weight: 500; }
.chip-p { background: var(--green-light); color: var(--green-dark); }
.chip-c { background: var(--amber-light); color: #854F0B; }
.chip-f { background: var(--coral-light); color: #993C1D; }

/* ---- METRIC CARDS ---- */
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 1rem; }
.metric-card {
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}
.metric-val   { font-size: 24px; font-weight: 500; color: var(--green); }
.metric-label { font-size: 11px; color: var(--gray-400); margin-bottom: 4px; }
.metric-sub   { font-size: 11px; color: var(--gray-400); }
.metric-card.neutral .metric-val { color: var(--gray-700); }

/* ---- MEAL TABLE ---- */
.day-block { margin-bottom: 1.5rem; }
.day-label {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: .75rem;
}
.meal-row {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.meal-row:last-child { border-bottom: none; }
.meal-type { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); padding-top: 2px; }
.meal-name { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.meal-detail { font-size: 12px; color: var(--gray-400); line-height: 1.5; }
.meal-cal { font-size: 13px; font-weight: 500; color: var(--green); text-align: right; white-space: nowrap; }

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  margin-top: 8px;
}
.total-label { font-size: 13px; color: var(--gray-400); }
.total-cal   { font-size: 18px; font-weight: 500; color: var(--green); }

/* ---- HISTORY LIST ---- */
.plan-list { display: flex; flex-direction: column; gap: .75rem; }
.plan-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s;
}
.plan-item:hover { border-color: var(--green); }
.plan-item-title { font-weight: 500; margin-bottom: 3px; }
.plan-item-meta  { font-size: 12px; color: var(--gray-400); }
.plan-item-cal   { font-size: 20px; font-weight: 500; color: var(--green); text-align: right; }
.plan-item-days  { font-size: 11px; color: var(--gray-400); }

/* ---- AUTH FORMS ---- */
.auth-wrap {
  max-width: 420px;
  margin: 0 auto;
}
.auth-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  text-align: center;
  margin-bottom: .25rem;
}
.auth-logo span { font-style: italic; color: var(--green); }
.auth-sub { text-align: center; font-size: 13px; color: var(--gray-400); margin-bottom: 2rem; }
.auth-footer { text-align: center; font-size: 13px; color: var(--gray-400); margin-top: 1.25rem; }
.auth-footer a { color: var(--green); text-decoration: none; }

/* ---- LOADING BAR ---- */
.loading-bar {
  height: 3px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
  margin: 1.5rem 0;
  display: none;
}
.loading-bar.visible { display: block; }
.loading-fill {
  height: 100%;
  background: var(--green);
  width: 0;
  border-radius: 99px;
  animation: loadbar 3s ease-in-out forwards;
}
@keyframes loadbar { to { width: 90%; } }

/* ---- SPINNER ---- */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- FOOTER ---- */
.footer {
  border-top: 1px solid var(--gray-200);
  padding: 1.25rem 2rem;
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
  background: var(--white);
}

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state p { margin-bottom: 1.25rem; }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .navbar { padding: 0 1rem; }
  .nav-links { gap: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .meal-row { grid-template-columns: 90px 1fr 60px; }
  .plan-item { flex-direction: column; align-items: flex-start; gap: 8px; }
}
