/* ===== NutriRuta design system ===== */
:root {
  --primary: #2BB5A0;        /* verde agua */
  --primary-dark: #1E8A7A;
  --primary-soft: #DCF3EF;
  --secondary: #6FA8DC;      /* azul suave */
  --secondary-soft: #E8F1FA;
  --accent: #FF8A6B;         /* coral */
  --accent-soft: #FFE9E2;
  --bg: #F7FAF9;
  --card: #FFFFFF;
  --ink: #233833;
  --ink-soft: #5C7570;
  --green: #3BAE5C;
  --yellow: #E8A93C;
  --red: #E05B4B;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(35, 56, 51, 0.08);
  --nav-h: 64px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 24px);
  min-height: 100vh;
}

.hidden { display: none !important; }

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-bottom: 8px; }
h3 { font-size: 1.02rem; }
p { color: var(--ink-soft); }
strong { color: var(--ink); }

/* ===== Splash ===== */
.splash { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; gap: 8px; }
.splash-logo { font-size: 4rem; }

/* ===== Cards & layout ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { display: flex; align-items: center; gap: 8px; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.muted { color: var(--ink-soft); font-size: 0.9rem; }
.small { font-size: 0.82rem; }
.mt { margin-top: 10px; }
.mb { margin-bottom: 10px; }
.center { text-align: center; }

/* ===== Buttons ===== */
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff;
  border-radius: 12px; padding: 12px 20px;
  font-weight: 600; font-size: 1rem;
  transition: transform 0.06s ease, opacity 0.15s;
  box-shadow: var(--shadow);
}
.btn:active { transform: scale(0.97); }
.btn.full { width: 100%; }
.btn.accent { background: var(--accent); }
.btn.ghost { background: var(--card); color: var(--primary-dark); border: 1.5px solid var(--primary-soft); box-shadow: none; }
.btn.sm { padding: 8px 14px; font-size: 0.88rem; border-radius: 10px; }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: 0.45; cursor: default; }

.link-btn { color: var(--primary-dark); font-weight: 600; text-decoration: underline; }

/* ===== Chips / options ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid #D8E6E2; background: var(--card);
  border-radius: 999px; padding: 9px 15px; font-size: 0.92rem;
  color: var(--ink); transition: all 0.12s;
}
.chip.selected { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.chip.small { padding: 5px 11px; font-size: 0.8rem; }

.tag { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 0.75rem; font-weight: 600; }
.tag.verde { background: #E3F5E9; color: #21753C; }
.tag.amarillo { background: #FBF0DA; color: #96690F; }
.tag.rojo { background: #FBE3E0; color: #A33124; }
.tag.info { background: var(--secondary-soft); color: #2E6396; }
.tag.perfil { background: var(--primary-soft); color: var(--primary-dark); }

/* Semáforo dot */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.verde { background: var(--green); }
.dot.amarillo { background: var(--yellow); }
.dot.rojo { background: var(--red); }

/* ===== Quiz ===== */
.quiz-progress { height: 8px; background: #E2EEEB; border-radius: 999px; overflow: hidden; margin: 14px 0 22px; }
.quiz-progress > div { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.25s ease; }
.quiz-step h2 { font-size: 1.3rem; margin-bottom: 4px; }
.quiz-step .chips { margin-top: 16px; }
.quiz-nav { display: flex; gap: 10px; margin-top: 26px; }
.quiz-nav .btn { flex: 1; }

/* ===== Header ===== */
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.app-header .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--primary-dark); font-size: 1.2rem; }
.icon-btn { font-size: 1.35rem; padding: 6px; border-radius: 50%; }

/* ===== Water tracker ===== */
.water-glasses { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.glass { font-size: 1.5rem; opacity: 0.25; transition: opacity 0.15s, transform 0.1s; padding: 2px; }
.glass.filled { opacity: 1; }
.glass:active { transform: scale(1.2); }

/* ===== Habit checklist ===== */
.habit { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #EFF5F3; }
.habit:last-child { border-bottom: none; }
.habit input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.habit label { flex: 1; }
.habit.done label { text-decoration: line-through; color: var(--ink-soft); }

/* ===== Meals / recipes ===== */
.meal { border-left: 4px solid var(--primary-soft); padding: 8px 12px; margin-bottom: 10px; border-radius: 6px; background: #FBFDFC; }
.meal-name { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 700; }
.meal .spread { margin-top: 2px; }

.recipe-item { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid #EFF5F3; width: 100%; text-align: left; }
.recipe-item:last-child { border-bottom: none; }
.recipe-item .info { flex: 1; }
.recipe-emoji { font-size: 1.6rem; flex: none; }

.ingredient { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #EFF5F3; font-size: 0.94rem; }
.ingredient:last-child { border-bottom: none; }
.sub-note { color: var(--secondary); font-size: 0.8rem; font-weight: 600; }

.steps { padding-left: 20px; color: var(--ink-soft); }
.steps li { margin-bottom: 6px; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 34, 30, 0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 60;
}
.modal {
  background: var(--card); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slide-up 0.22s ease;
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }
.modal-close { position: sticky; top: 0; float: right; font-size: 1.3rem; color: var(--ink-soft); }

/* ===== Progress ===== */
.streak-hero { text-align: center; padding: 24px 16px; }
.streak-hero .num { font-size: 3rem; font-weight: 800; color: var(--primary-dark); line-height: 1; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 12px 6px; border-radius: 14px; background: #FBFDFC; border: 1.5px solid #EFF5F3; }
.badge .emoji { font-size: 1.8rem; }
.badge.locked { opacity: 0.35; filter: grayscale(1); }
.badge .small { display: block; margin-top: 4px; }

/* ===== SOS ===== */
.sos-hero { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); color: #fff; border-radius: var(--radius); padding: 22px 18px; margin-bottom: 14px; }
.sos-hero p { color: rgba(255,255,255,0.9); }
.breath-circle {
  width: 130px; height: 130px; margin: 18px auto; border-radius: 50%;
  background: var(--primary-soft); border: 3px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--primary-dark); text-align: center; font-size: 0.9rem;
  transition: transform 3.5s ease-in-out;
}
.breath-circle.in { transform: scale(1.35); }

/* ===== Lessons ===== */
.lesson-item { width: 100%; text-align: left; }
details.glossary { border-bottom: 1px solid #EFF5F3; padding: 10px 0; }
details.glossary summary { font-weight: 600; cursor: pointer; }
details.glossary p { margin-top: 6px; font-size: 0.92rem; }

/* ===== Legal ===== */
.legal-note {
  background: var(--secondary-soft); border-radius: 12px; padding: 12px 14px;
  font-size: 0.86rem; color: #2E6396; margin: 12px 0;
}

/* ===== Bottom nav ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  background: var(--card); box-shadow: 0 -2px 12px rgba(35,56,51,0.09);
  display: flex; justify-content: space-around; align-items: flex-start;
  padding: 6px 4px env(safe-area-inset-bottom); z-index: 50;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 0.68rem; color: var(--ink-soft); padding: 4px 10px; border-radius: 12px; font-weight: 600;
}
.nav-btn.active { color: var(--primary-dark); background: var(--primary-soft); }
.nav-icon { font-size: 1.35rem; line-height: 1.2; }
.nav-sos .nav-icon { background: var(--accent-soft); border-radius: 50%; padding: 2px 6px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 18px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 10px 20px; font-size: 0.9rem; z-index: 70; max-width: 90vw; text-align: center;
  animation: slide-up 0.2s ease;
}

/* ===== Shopping list ===== */
.shop-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #EFF5F3; }
.shop-item input { width: 20px; height: 20px; accent-color: var(--primary); }
.shop-item.done span { text-decoration: line-through; color: var(--ink-soft); }

@media (min-width: 600px) {
  body { padding-top: 10px; }
}
