/* ═══════════════════════════════════════════
   Tracker — Diario Alimentare
   ═══════════════════════════════════════════ */

/* ─── Search & Add ─── */
.tracker-search-wrap { position: relative; max-width: 480px; margin-bottom: 1.5rem; z-index: 10 }
.tracker-search {
  width: 100%; padding: .75rem 1rem .75rem 2.6rem;
  border: 2px solid var(--border); border-radius: 14px;
  font-size: .9rem; background: white; color: var(--dark);
  outline: none; transition: all .25s; box-shadow: var(--shadow);
}
.tracker-search:focus { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(122,155,126,.12), var(--shadow) }
.tracker-search-icon {
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  font-size: 1rem; pointer-events: none;
}
.tracker-suggestions {
  position: absolute; top: calc(100% + .35rem); left: 0; right: 0;
  background: white; border-radius: 12px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); z-index: 100; overflow: hidden;
  display: none; max-height: 260px; overflow-y: auto;
}
.tracker-sugg-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem 1rem; cursor: pointer; font-size: .85rem;
  border-bottom: 1px solid var(--border); transition: background .15s;
}
.tracker-sugg-item:last-child { border: none }
.tracker-sugg-item:hover { background: var(--cream) }

/* ─── Portion Modal ─── */
.portion-row { display: flex; gap: .75rem; align-items: flex-end; margin-bottom: 1rem }
.portion-row .wf-field { flex: 1 }
.portion-presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem }
.portion-preset {
  padding: .3rem .7rem; border-radius: 100px; border: 1.5px solid var(--border);
  background: white; font-size: .75rem; color: var(--mid); cursor: pointer; transition: all .2s;
}
.portion-preset:hover, .portion-preset.active {
  background: var(--sage-p); border-color: var(--sage); color: var(--sage);
}
.meal-type-select {
  display: flex; gap: .35rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.meal-type-btn {
  padding: .35rem .8rem; border-radius: 100px; border: 1.5px solid var(--border);
  background: white; font-size: .78rem; color: var(--mid); cursor: pointer; transition: all .2s;
}
.meal-type-btn.active { background: var(--sage); color: white; border-color: var(--sage) }

/* ─── Daily Log ─── */
.tracker-date-nav {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem;
}
.tracker-date-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--border);
  background: white; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .9rem; transition: all .2s;
}
.tracker-date-btn:hover { border-color: var(--sage); color: var(--sage) }
.tracker-date-label {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 500;
}

.tracker-meal-group { margin-bottom: 1.5rem }
.tracker-meal-header {
  font-size: .7rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--light); margin-bottom: .6rem;
  display: flex; align-items: center; gap: .5rem;
}
.tracker-food-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .85rem; background: var(--cream); border-radius: 10px;
  margin-bottom: .4rem; font-size: .85rem;
}
.tfi-emoji { font-size: 1.1rem; flex-shrink: 0 }
.tfi-name { font-weight: 500; color: var(--dark); flex: 1 }
.tfi-portion { color: var(--light); font-size: .78rem }
.tfi-kcal { font-weight: 600; font-size: .78rem; color: var(--mid); min-width: 55px; text-align: right }
.tfi-remove {
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: transparent; color: var(--light); cursor: pointer;
  font-size: .85rem; display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
}
.tfi-remove:hover { background: #fee8e8; color: #e05555 }

/* ─── Summary Panel ─── */
.tracker-layout { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem }
.tracker-summary { position: sticky; top: 80px }
.summary-total {
  text-align: center; padding: 1rem; background: var(--sage-p);
  border-radius: 14px; margin-bottom: 1.2rem;
}
.summary-total-kcal {
  font-family: var(--serif); font-size: 2.2rem; font-weight: 600; color: var(--sage);
}
.summary-total-label { font-size: .72rem; color: var(--mid); letter-spacing: .08em; text-transform: uppercase }

.summary-nutrient { margin-bottom: .8rem }
.sn-header { display: flex; justify-content: space-between; font-size: .78rem; margin-bottom: .25rem }
.sn-name { font-weight: 500 }
.sn-value { color: var(--light) }
.sn-bar { height: 6px; background: var(--cream); border-radius: 100px; overflow: hidden }
.sn-fill { height: 100%; border-radius: 100px; transition: width .8s ease }
.sn-fill.excellent { background: var(--sage) }
.sn-fill.good { background: #a8c76e }
.sn-fill.low { background: var(--terra) }
.sn-fill.deficient { background: #e05555 }

.missing-nutrients { margin-top: 1rem }
.missing-item {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .5rem .7rem; background: #fee8e8; border-radius: 8px;
  font-size: .78rem; color: #c94a4a; margin-bottom: .4rem; line-height: 1.4;
}
.missing-item.warning { background: var(--terra-p); color: var(--terra) }
.suggestion-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .7rem; background: var(--sage-p); border-radius: 8px;
  font-size: .78rem; color: var(--sage); margin-bottom: .4rem; line-height: 1.4;
}

/* ─── Empty state ─── */
.tracker-empty {
  text-align: center; padding: 3rem 2rem;
  color: var(--light); font-size: .88rem;
}
.tracker-empty-emoji { font-size: 2.5rem; margin-bottom: .75rem }

/* ─── Sources footer ─── */
.sources-section { margin-top: 2rem }
.source-item {
  display: flex; gap: .75rem; padding: .75rem; background: var(--cream);
  border-radius: 10px; margin-bottom: .5rem; font-size: .8rem;
}
.source-badge {
  padding: .15rem .5rem; border-radius: 100px; font-size: .65rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: .06em; flex-shrink: 0; height: fit-content;
}
.source-badge.nutrition { background: var(--sage-p); color: var(--sage) }
.source-badge.requirements { background: var(--terra-p); color: var(--terra) }
.source-badge.guidelines { background: var(--indigo-p); color: var(--indigo) }
.source-name { font-weight: 600; color: var(--dark); margin-bottom: .15rem }
.source-desc { color: var(--mid); line-height: 1.5 }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .tracker-layout { grid-template-columns: 1fr }
  .tracker-summary { position: static }
}
