/* ============================================================
   Nutrition Label Analyzer — tool-specific styles
   /assets/css/tools/nutrition-label-analyzer.css
   ============================================================ */

/* ---------- Search combobox ---------- */
.nla-search-wrap {
  position: relative;
}
.nla-search-wrap .evvy-hero-input {
  padding-right: 3rem;
}
.nla-search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--evvy-text-secondary, #666);
  font-size: 1.25rem;
  opacity: 0.55;
}
.nla-search-wrap .evvy-hero-input:focus + .nla-search-icon {
  color: var(--cluster-dark);
  opacity: 1;
}
.nla-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  max-height: 340px;
  overflow-y: auto;
  z-index: 50;
  padding: 0.35rem;
  display: none;
}
.nla-search-results.open {
  display: block;
}
.nla-search-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--evvy-radius-sm, 8px);
  cursor: pointer;
  transition: background 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nla-search-result:hover,
.nla-search-result:focus,
.nla-search-result.nla-focused {
  background: var(--cluster-surface, #EDF4E9);
  outline: none;
}
.nla-search-result-body {
  flex: 1;
  min-width: 0;
}
.nla-search-result-name {
  font-weight: 600;
  color: var(--evvy-text-primary, #1a1a2e);
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nla-search-result-brand {
  font-size: 0.75rem;
  color: var(--evvy-text-secondary, #666);
  margin-top: 0.125rem;
}
.nla-search-result-source {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--evvy-text-secondary, #999);
  margin-left: 0.5rem;
}
.nla-mini-grade {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.nla-empty {
  padding: 0.75rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--evvy-text-secondary, #666);
  text-align: center;
}

/* ---------- Grade colors (used across badges) ---------- */
.nla-grade-a { background: #1E8E3E; }
.nla-grade-b { background: #81C784; }
.nla-grade-c { background: #F4B400; color: #1a1a2e !important; }
.nla-grade-d { background: #EF8B37; }
.nla-grade-e { background: #D93025; }
.nla-grade-unknown { background: #8a8a8a; }

/* ---------- Hero grade badge (the star of the show) ---------- */
.nla-grade-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--cluster-surface, #EDF4E9);
  border-radius: var(--evvy-radius-lg, 12px);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  margin-bottom: 1rem;
}
.nla-grade-circle {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  text-transform: uppercase;
  transform: scale(0.4) rotate(-180deg);
  opacity: 0;
  transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.4s ease,
              background-color 0.4s ease;
}
.nla-grade-circle.nla-landed {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}
.nla-grade-circle::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  transform: scale(0.95);
}
.nla-grade-circle.nla-landed::after {
  animation: nla-grade-ring 1.2s ease-out 0.35s 1;
}
@keyframes nla-grade-ring {
  0%   { opacity: 0.7; transform: scale(0.95); }
  100% { opacity: 0;   transform: scale(1.25); }
}
.nla-grade-headline {
  text-align: center;
}
.nla-grade-headline-title {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--evvy-text-primary, #1a1a2e);
}
.nla-grade-headline-sub {
  font-size: 0.875rem;
  color: var(--evvy-text-secondary, #666);
  margin-top: 0.125rem;
}
.nla-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  color: var(--evvy-text-secondary, #666);
  font-weight: 600;
}

/* ---------- NOVA + processing chips row ---------- */
.nla-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.nla-meta-card {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.nla-meta-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--evvy-text-secondary, #666);
  font-weight: 600;
}
.nla-meta-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--evvy-text-primary, #1a1a2e);
}
.nla-meta-sub {
  font-size: 0.75rem;
  color: var(--evvy-text-secondary, #666);
  line-height: 1.35;
}
.nla-nova-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 0.35rem;
}
.nla-nova-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--evvy-border-color, #DEE2E6);
}
.nla-nova-dot.active-1 { background: #1E8E3E; }
.nla-nova-dot.active-2 { background: #81C784; }
.nla-nova-dot.active-3 { background: #F4B400; }
.nla-nova-dot.active-4 { background: #D93025; }

/* ---------- Macro bars ---------- */
.nla-macros {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.nla-macros-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}
.nla-macros-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--evvy-text-secondary, #666);
}
.nla-macros-serving {
  font-size: 0.75rem;
  color: var(--evvy-text-secondary, #666);
}
.nla-macro-row {
  display: grid;
  grid-template-columns: 140px 1fr 70px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.875rem;
}
.nla-macro-name {
  font-weight: 600;
  color: var(--evvy-text-primary, #1a1a2e);
}
.nla-macro-name small {
  display: block;
  font-weight: 400;
  color: var(--evvy-text-secondary, #666);
  font-size: 0.75rem;
}
.nla-macro-bar-track {
  height: 10px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.nla-macro-bar-fill {
  height: 100%;
  background: var(--cluster-dark);
  border-radius: 999px;
  width: 0%;
  transition: width 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.nla-macro-bar-fill.nla-over {
  background: #D93025;
}
.nla-macro-bar-fill.nla-good {
  background: #1E8E3E;
}
.nla-macro-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--evvy-text-primary, #1a1a2e);
}
.nla-macro-value small {
  display: block;
  font-weight: 500;
  color: var(--evvy-text-secondary, #666);
  font-size: 0.7rem;
}

/* ---------- Concerns + positives list ---------- */
.nla-insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.nla-insight-card {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  padding: 1rem 1.125rem;
}
.nla-insight-card-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nla-insight-card.nla-concerns .nla-insight-card-title { color: #D93025; }
.nla-insight-card.nla-positives .nla-insight-card-title { color: #1E8E3E; }
.nla-insight-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}
.nla-insight-list li {
  padding: 0.3rem 0;
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px dashed var(--evvy-border-color, #DEE2E6);
}
.nla-insight-list li:last-child {
  border-bottom: none;
}
.nla-insight-list li i {
  flex: 0 0 auto;
  margin-top: 2px;
}
.nla-insight-list li strong {
  color: var(--evvy-text-primary, #1a1a2e);
}
.nla-insight-empty {
  font-size: 0.8125rem;
  color: var(--evvy-text-secondary, #666);
  font-style: italic;
}

/* ---------- Allergen pills ---------- */
.nla-allergen-block {
  margin-bottom: 1rem;
}
.nla-allergen-header {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--evvy-text-secondary, #666);
  margin-bottom: 0.5rem;
}
.nla-allergen-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.nla-allergen-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(217, 48, 37, 0.12);
  color: #9A1F18;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  opacity: 0;
  transform: translateY(6px) scale(0.9);
  animation: nla-allergen-in 0.35s ease forwards;
}
@keyframes nla-allergen-in {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.nla-allergen-pill.nla-allergen-none {
  background: rgba(30, 142, 62, 0.12);
  color: #145C29;
}

/* ---------- Comparison table ---------- */
.nla-compare-wrap {
  margin-bottom: 1rem;
}
.nla-compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.nla-compare-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--evvy-text-secondary, #666);
}
.nla-compare-grid {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  overflow: hidden;
}
.nla-compare-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.8125rem;
  align-items: center;
  border-bottom: 1px dashed var(--evvy-border-color, #DEE2E6);
}
.nla-compare-row:last-child { border-bottom: none; }
.nla-compare-row.nla-compare-head {
  background: var(--cluster-surface, #EDF4E9);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--evvy-text-primary, #1a1a2e);
  border-bottom: 1px solid var(--evvy-border-color, #DEE2E6);
}
.nla-compare-row > span:first-child {
  color: var(--evvy-text-secondary, #666);
  font-weight: 600;
}
.nla-compare-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--evvy-text-primary, #1a1a2e);
}
.nla-compare-cell.nla-winner {
  color: #1E8E3E;
}
.nla-compare-cell.nla-winner::before {
  content: "\F26B";
  font-family: "bootstrap-icons";
  font-size: 0.95em;
}
.nla-compare-pin-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
}

/* ---------- Alternatives (premium) ---------- */
.nla-alt-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 0.5rem;
}
.nla-alt-card {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: center;
}
.nla-alt-card .nla-mini-grade {
  margin: 0 auto;
}
.nla-alt-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--evvy-text-primary, #1a1a2e);
  line-height: 1.2;
}
.nla-alt-brand {
  font-size: 0.7rem;
  color: var(--evvy-text-secondary, #666);
}
.nla-alt-empty {
  font-size: 0.8125rem;
  color: var(--evvy-text-secondary, #666);
  font-style: italic;
  grid-column: 1 / -1;
  padding: 0.5rem 0;
}

/* ---------- Daily intake log (premium) ---------- */
.nla-log-wrap {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  padding: 1rem 1.125rem;
}
.nla-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.nla-log-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--evvy-text-secondary, #666);
}
.nla-log-items {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
  font-size: 0.8125rem;
  max-height: 200px;
  overflow-y: auto;
}
.nla-log-items li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--evvy-border-color, #DEE2E6);
}
.nla-log-items li:last-child { border-bottom: none; }
.nla-log-remove {
  border: none;
  background: transparent;
  color: var(--evvy-text-secondary, #888);
  padding: 0.1rem 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 6px;
}
.nla-log-remove:hover {
  background: rgba(217, 48, 37, 0.1);
  color: #D93025;
}
.nla-log-empty {
  font-size: 0.8125rem;
  color: var(--evvy-text-secondary, #666);
  font-style: italic;
  padding: 0.35rem 0;
}
.nla-log-meters {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.55rem;
}
.nla-log-meter {
  background: var(--cluster-surface, #EDF4E9);
  border-radius: var(--evvy-radius-sm, 8px);
  padding: 0.5rem 0.55rem;
  text-align: center;
  color: var(--evvy-text-primary, #1a1a2e);
}
.nla-log-meter-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  opacity: 0.7;
}
.nla-log-meter-value {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-top: 0.1rem;
  font-variant-numeric: tabular-nums;
}
.nla-log-meter-pct {
  font-size: 0.65rem;
  margin-top: 0.1rem;
  color: var(--evvy-text-secondary, #666);
}
.nla-log-meter.nla-warning {
  background: rgba(244, 180, 0, 0.18);
}
.nla-log-meter.nla-over {
  background: rgba(217, 48, 37, 0.15);
}

/* ---------- Ingredient decoder (premium) ---------- */
.nla-decoder-wrap {
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  padding: 1rem 1.125rem;
  margin-top: 0.75rem;
}
.nla-decoder-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.nla-decoder-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--evvy-text-secondary, #666);
}
.nla-clean-score {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--cluster-surface, #EDF4E9);
  color: var(--evvy-text-primary, #1a1a2e);
}
.nla-ingredient-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.8125rem;
}
.nla-ingredient-chip {
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--evvy-text-primary, #1a1a2e);
  border: 1px solid transparent;
  line-height: 1.35;
}
.nla-ingredient-chip.nla-ing-red {
  background: rgba(217, 48, 37, 0.12);
  color: #9A1F18;
  border-color: rgba(217, 48, 37, 0.3);
  font-weight: 600;
}
.nla-ingredient-chip.nla-ing-yellow {
  background: rgba(244, 180, 0, 0.2);
  color: #7A5900;
  border-color: rgba(244, 180, 0, 0.4);
  font-weight: 600;
}
.nla-ingredient-chip.nla-ing-green {
  background: rgba(30, 142, 62, 0.1);
  color: #145C29;
  border-color: rgba(30, 142, 62, 0.25);
}

/* ---------- Dietary flag highlight state ---------- */
.nla-macro-row.nla-flagged {
  background: rgba(244, 180, 0, 0.12);
  border-radius: 6px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

/* ---------- Dark mode ---------- */
[data-bs-theme="dark"] .nla-search-results,
[data-bs-theme="dark"] .nla-meta-card,
[data-bs-theme="dark"] .nla-macros,
[data-bs-theme="dark"] .nla-insight-card,
[data-bs-theme="dark"] .nla-compare-grid,
[data-bs-theme="dark"] .nla-alt-card,
[data-bs-theme="dark"] .nla-log-wrap,
[data-bs-theme="dark"] .nla-decoder-wrap {
  background: var(--evvy-gray-100, #1E1E1E);
  border-color: var(--evvy-border-color, #333);
}
[data-bs-theme="dark"] .nla-grade-hero {
  background: rgba(255, 255, 255, 0.04);
}
[data-bs-theme="dark"] .nla-macro-bar-track {
  background: rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] .nla-source-badge {
  background: rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] .nla-ingredient-chip {
  background: rgba(255, 255, 255, 0.05);
}
[data-bs-theme="dark"] .nla-log-meter {
  background: rgba(255, 255, 255, 0.06);
}
[data-bs-theme="dark"] .nla-grade-c { color: #1a1a2e; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .nla-grade-circle {
    transition: opacity 0.2s ease, background-color 0.3s ease;
    transform: none !important;
  }
  .nla-grade-circle.nla-landed::after { animation: none; }
  .nla-allergen-pill { animation: none; opacity: 1; transform: none; }
  .nla-macro-bar-fill { transition: width 0.2s linear; }
}

/* ---------- Mobile ---------- */
@media (max-width: 575.98px) {
  .nla-meta-row,
  .nla-insight-grid {
    grid-template-columns: 1fr;
  }
  .nla-macro-row {
    grid-template-columns: 110px 1fr 60px;
    font-size: 0.8125rem;
  }
  .nla-log-meters {
    grid-template-columns: repeat(3, 1fr);
  }
  .nla-alt-grid {
    grid-template-columns: 1fr;
  }
  .nla-compare-row {
    grid-template-columns: 1fr 1fr 1fr;
    font-size: 0.75rem;
    padding: 0.5rem 0.6rem;
  }
  .nla-grade-circle {
    width: 104px;
    height: 104px;
    font-size: 4rem;
  }
}
