/* ============================================================
   NutriVida — Hoja de estilos principal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --verde-oscuro: #1B5E3B;
  --verde-medio: #4CAF7D;
  --verde-claro: #A8D5B5;
  --verde-fondo: #E8F5EE;
  --crema:       #FAF8F3;
  --crema-borde: #E0D8CC;
  --gris-texto:  #5A7263;
  --texto-dark:  #1C2B20;
  --blanco:      #FFFFFF;
  --rojo-soft:   #C4687A;
  --naranja-soft:#C8956C;
  --azul-soft:   #7B7BC4;
  --radio:       12px;
  --radio-lg:    18px;
  --sombra:      0 2px 12px rgba(27,94,59,.08);
  --font-display:'Playfair Display', Georgia, serif;
  --font-body:   'DM Sans', system-ui, sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--crema); color: var(--texto-dark); line-height: 1.6; }

/* ── Tamaño de texto accesible (clase .grande en body) ─────── */
body.grande { font-size: 18px; }
body.grande h1 { font-size: 2rem !important; }
body.grande h2 { font-size: 1.5rem !important; }
body.grande h3 { font-size: 1.25rem !important; }
body.grande .btn, body.grande input, body.grande select { font-size: 1.1rem; padding: 0.75rem 1.25rem; }
body.grande .card { padding: 1.5rem; }
body.grande .badge { font-size: 0.85rem; }

/* ── Barra de navegación ───────────────────────────────────── */
.navbar {
  background: var(--verde-oscuro);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 58px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.navbar-brand { display: flex; align-items: center; gap: .6rem; }
.navbar-brand h1 { font-family: var(--font-display); color: #fff; font-size: 1.3rem; font-weight: 700; }
.navbar-brand span { color: #80C8A0; font-size: .85rem; }
.navbar-right { display: flex; align-items: center; gap: .75rem; }
.navbar-user { text-align: right; }
.navbar-user p { color: #fff; font-size: .82rem; font-weight: 500; line-height: 1.2; }
.navbar-user small { color: #80C8A0; font-size: .72rem; }

/* ── Botones ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: var(--radio); border: none;
  font-family: var(--font-body); font-size: .9rem; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: opacity .18s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--verde-oscuro); color: #fff; }
.btn-secondary { background: rgba(255,255,255,.18); color: #fff; }
.btn-outline   { background: var(--crema); color: var(--verde-oscuro); border: .5px solid var(--verde-claro); }
.btn-success   { background: var(--verde-medio); color: #fff; }
.btn-danger    { background: var(--rojo-soft); color: #fff; }
.btn-sm        { padding: .35rem .8rem; font-size: .8rem; border-radius: 8px; }
.btn:hover     { opacity: .88; }
.btn-a+        { font-size: 1.1rem; font-weight: 700; padding: .45rem .9rem; }

/* ── Barra de sub-navegación / tabs ───────────────────────── */
.subnav {
  background: var(--blanco); border-bottom: .5px solid var(--crema-borde);
  display: flex; overflow-x: auto; padding: 0 1.5rem;
}
.subnav a {
  display: inline-block; padding: .85rem 1rem; font-size: .88rem; font-weight: 500;
  color: var(--gris-texto); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.subnav a.active, .subnav a:hover { color: var(--verde-oscuro); border-color: var(--verde-oscuro); }

/* ── Summary bar ─────────────────────────────────────────── */
.summary-bar {
  background: var(--blanco); border-bottom: .5px solid var(--crema-borde);
  padding: .9rem 1.5rem; display: flex; gap: 2rem; flex-wrap: wrap; align-items: center;
}
.summary-item p { font-size: .68rem; color: var(--gris-texto); text-transform: uppercase; letter-spacing: .06em; }
.summary-item strong { font-size: 1.1rem; font-weight: 700; display: block; line-height: 1.2; }

/* ── Contenido principal ─────────────────────────────────── */
.main-content { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--blanco); border-radius: var(--radio-lg);
  border: .5px solid var(--crema-borde); padding: 1.25rem;
  box-shadow: var(--sombra);
}
.card-title { font-size: .9rem; font-weight: 600; color: var(--texto-dark); margin-bottom: 1rem; }

/* ── Grid helpers ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: .75rem; }
@media(max-width:900px) { .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } }
@media(max-width:1100px){ .grid-4 { grid-template-columns: repeat(2,1fr); } }
.gap-sm { gap: .75rem; }
.mb-1 { margin-bottom: 1rem; } .mb-2 { margin-bottom: 1.5rem; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: .75rem; } .gap-2 { gap: 1rem; }
.flex-1 { flex: 1; }
.text-right { text-align: right; }
.w-100 { width: 100%; }

/* ── Métricas (stat cards) ───────────────────────────────── */
.stat-card { background: var(--crema); border-radius: 10px; padding: .9rem 1rem; }
.stat-card .label { font-size: .68rem; color: var(--gris-texto); text-transform: uppercase; letter-spacing: .06em; }
.stat-card .value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; margin-top: .25rem; }
.stat-card .sub   { font-size: .75rem; color: var(--gris-texto); margin-top: .1rem; }

/* ── Paciente list item ──────────────────────────────────── */
.patient-card {
  background: var(--blanco); border-radius: var(--radio-lg); padding: 1rem 1.1rem;
  border: .5px solid var(--crema-borde); cursor: pointer; transition: border-color .2s, background .2s;
  text-decoration: none; color: inherit; display: block;
}
.patient-card:hover { border-color: var(--verde-claro); background: #F7FBF8; }
.patient-card.active { border-color: var(--verde-medio); background: #F0F8F4; }
.avatar {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}

/* ── Badge / etiqueta condición ──────────────────────────── */
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .2rem .65rem; border-radius: 6px; border-width: .5px; border-style: solid;
  white-space: nowrap;
}

/* ── Barra de progreso ───────────────────────────────────── */
.progress-bar { background: #E8F5EE; border-radius: 6px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 6px; transition: width .5s ease; }

/* ── Formularios ─────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 500; color: var(--texto-dark); margin-bottom: .35rem; }
.form-control {
  width: 100%; padding: .6rem .9rem; border: .5px solid #CCC; border-radius: 10px;
  font-family: var(--font-body); font-size: .9rem; background: #FAFAFA;
  outline: none; transition: border-color .15s;
}
.form-control:focus { border-color: var(--verde-oscuro); background: #fff; }
.form-error { color: var(--rojo-soft); font-size: .8rem; margin-top: .25rem; }

/* ── Tabla ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radio-lg); }
table.nv-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.nv-table th { background: var(--crema); padding: .6rem .9rem; color: var(--gris-texto); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; text-align: left; }
table.nv-table td { padding: .7rem .9rem; border-top: .5px solid #F0EBE1; vertical-align: middle; }
table.nv-table tr:hover td { background: #FAFCFB; }

/* ── Alertas / Nota clínica ──────────────────────────────── */
.alert-note { background: #FEF9F0; border: .5px solid #E8D8B8; border-radius: 14px; padding: 1rem 1.15rem; }
.alert-note .note-title { font-size: .88rem; font-weight: 600; color: var(--texto-dark); margin-bottom: .5rem; }
.alert-note p { font-size: .85rem; color: #5A4A30; line-height: 1.65; }

/* ── Comida card (paciente) ──────────────────────────────── */
.meal-card {
  background: var(--blanco); border-radius: var(--radio-lg); padding: 1rem 1.15rem;
  border: .5px solid var(--crema-borde); transition: border-color .25s, background .25s;
}
.meal-card.done { background: #F0F8F4; border-color: #80C8A0; }
.meal-icon { font-size: 2.2rem; flex-shrink: 0; }
.meal-label { font-size: .68rem; color: var(--gris-texto); text-transform: uppercase; letter-spacing: .06em; }
.meal-name  { font-size: 1rem; font-weight: 700; color: var(--texto-dark); margin: .15rem 0 .25rem; }
.meal-desc  { font-size: .82rem; color: var(--gris-texto); line-height: 1.55; }
.meal-kcal  { font-size: .82rem; font-weight: 600; color: var(--verde-oscuro); }

/* ── Nutrient bar ────────────────────────────────────────── */
.nutr-row { margin-bottom: .9rem; }
.nutr-row .nutr-label { font-size: .85rem; font-weight: 500; color: var(--texto-dark); }
.nutr-row .nutr-pct   { font-size: .9rem; font-weight: 700; }
.nutr-row .nutr-track { background: #F0EBE1; border-radius: 6px; height: 10px; margin-top: .3rem; }
.nutr-row .nutr-fill  { border-radius: 6px; height: 10px; transition: width .6s; }

/* ── Slider síntomas ─────────────────────────────────────── */
.symptom-row { margin-bottom: 1.25rem; }
.symptom-row label { font-size: .88rem; font-weight: 600; color: var(--texto-dark); display: flex; align-items: center; gap: .4rem; }
.symptom-row small  { display: block; font-size: .74rem; color: var(--gris-texto); margin-bottom: .4rem; }
input[type=range] {
  width: 100%; accent-color: var(--verde-oscuro);
  height: 6px; cursor: pointer; margin: .25rem 0 .15rem;
}
.slider-labels { display: flex; justify-content: space-between; font-size: .72rem; color: #AAA; }
.slider-value  { font-size: 1.5rem; font-weight: 700; color: var(--verde-oscuro); min-width: 2rem; text-align: right; }

/* ── Login page ───────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .logo-icon { width: 60px; height: 60px; border-radius: 18px; background: var(--verde-oscuro); display: inline-flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.login-logo h1 { font-family: var(--font-display); font-size: 2rem; color: var(--texto-dark); }
.login-logo p  { color: var(--gris-texto); font-size: .9rem; margin-top: .25rem; }
.login-box { width: 100%; max-width: 480px; }
.demo-btn {
  width: 100%; background: var(--crema); border: none; border-radius: 10px;
  padding: .7rem 1rem; cursor: pointer; text-align: left; display: flex;
  align-items: center; gap: .75rem; font-family: var(--font-body); transition: background .15s;
}
.demo-btn:hover { background: #EEF2EC; }
.demo-btn strong { font-size: .85rem; font-weight: 600; display: block; line-height: 1.2; }
.demo-btn span   { font-size: .75rem; opacity: .8; }

/* ── Tooltips de gráfica ─────────────────────────────────── */
.chart-wrapper { position: relative; }

/* ── Alertas flash ───────────────────────────────────────── */
.flash { padding: .7rem 1rem; border-radius: 10px; font-size: .88rem; margin-bottom: 1rem; }
.flash-success { background: #E8F5EE; color: #1B5E3B; border: .5px solid #80C8A0; }
.flash-error   { background: #FCE8ED; color: #8B2A3E; border: .5px solid #E8A0B0; }

/* ── Sección de plan de dieta ─────────────────────────────── */
.plan-card { border-radius: var(--radio-lg); padding: 1.15rem; border: .5px solid var(--crema-borde); background: var(--blanco); display: flex; flex-direction: column; gap: .5rem; }
.plan-card h3 { font-size: .95rem; font-weight: 600; color: var(--texto-dark); }
.plan-card p  { font-size: .82rem; color: var(--gris-texto); line-height: 1.55; flex: 1; }
.plan-key     { font-size: .78rem; color: var(--gris-texto); }
.plan-key strong { color: var(--texto-dark); }

/* ── Recordatorios adulto mayor ──────────────────────────── */
.reminder-item { display: flex; gap: .75rem; align-items: center; padding: .8rem 0; border-bottom: .5px solid #F0EBE1; }
.reminder-item:last-child { border-bottom: none; }
.reminder-circle { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--verde-medio); flex-shrink: 0; }
.reminder-circle.done { background: var(--verde-medio); border-color: var(--verde-oscuro); }

/* ── Detalle dos columnas ─────────────────────────────────── */
.detail-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1.25rem; align-items: start; }
@media(max-width:1000px){ .detail-layout { grid-template-columns: 1fr; } }

/* ── Calorie ring / barra ────────────────────────────────── */
.cal-bar { background: var(--verde-fondo); border-radius: 8px; height: 14px; overflow: hidden; }
.cal-fill { height: 100%; border-radius: 8px; transition: width .5s; }

/* ── Tip list ────────────────────────────────────────────── */
.tip-item { display: flex; gap: .6rem; margin-bottom: .7rem; }
.tip-item::before { content: '•'; color: var(--verde-oscuro); font-weight: 700; flex-shrink: 0; }
.tip-item p { font-size: .82rem; color: #5A4A30; line-height: 1.6; margin: 0; }

/* ── Footer ──────────────────────────────────────────────── */
.footer { text-align: center; padding: 1.5rem; font-size: .78rem; color: #aaa; margin-top: 2rem; }

/* ── Print util ──────────────────────────────────────────── */
@media print {
  .navbar, .subnav, .summary-bar, .btn, .footer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
