/* =============================================================================
   Kalkulator food cost — tool-specific styles
   Tokens from /styles.css. No default Tailwind colors, only brand tokens.
   ============================================================================= */

.tool-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Calculator shell -------------------------------------------------- */
.calc {
  margin-top: 8px;
}

.calc-dishes {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Dish card --------------------------------------------------------- */
.dish {
  background: var(--paper);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--st, var(--gray-300));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
}

.dish[data-status="good"] {
  --st: var(--success);
}
.dish[data-status="warn"] {
  --st: #d98a1f;
}
.dish[data-status="bad"] {
  --st: var(--danger);
}

.dish-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.dish-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.dish-name {
  flex: 1 1 220px;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--navy);
  border: none;
  border-bottom: 2px solid var(--gray-200);
  border-radius: 0;
  padding: 6px 2px;
  background: transparent;
}

.dish-name:focus {
  outline: none;
  border-bottom-color: var(--accent-deep);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input-affix {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
}

.input-affix:focus-within {
  border-color: var(--accent-deep);
  box-shadow: var(--shadow-glow);
}

.input-affix input {
  border: none;
  outline: none;
  width: 84px;
  text-align: right;
  padding: 8px 4px 8px 10px;
  font-size: 15px;
  background: transparent;
  color: var(--navy);
}

.input-affix .affix {
  padding: 0 10px 0 2px;
  font-size: 13px;
  color: var(--gray-500);
}

/* ---- Dish metrics (visible right under the name, incl. mobile) --------- */
.dish-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 16px 0 4px;
  padding: 12px 14px;
  background: var(--cream);
  border-radius: var(--radius-md);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--navy);
}

.m-fc {
  color: var(--st, var(--navy));
}

/* ---- Ingredients ------------------------------------------------------- */
.ingredients {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ing-cols {
  grid-template-columns: minmax(0, 1fr) 84px 72px 116px 96px 36px;
}

.ing-head {
  display: grid;
  gap: 8px;
  padding: 0 4px 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ing-head span:nth-child(2),
.ing-head span:nth-child(3),
.ing-head span:nth-child(4),
.ing-head span:nth-child(5) {
  text-align: right;
}

.ing {
  display: grid;
  gap: 8px;
  align-items: center;
}

.ing-f {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ing-l {
  display: none;
}

.ing input {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 15px;
  color: var(--navy);
  background: var(--paper);
}

.ing input:focus {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: var(--shadow-glow);
}

.ing-qty input,
.ing-price input,
.ing-f.ing-num input {
  text-align: right;
}

.ing-cost {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--gray-700);
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition:
    color 0.15s,
    background 0.15s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  color: var(--danger);
  background: var(--gray-100);
}

.ing-remove {
  width: 36px;
  height: 36px;
  justify-self: center;
}

.ing-remove .btn-txt {
  display: none;
}

.dish-remove {
  width: 40px;
  height: 40px;
  flex: none;
}

.add-ing {
  align-self: flex-start;
  margin-top: 4px;
  border: 1px dashed var(--gray-300);
  background: transparent;
  color: var(--gray-700);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}

.add-ing:hover {
  border-color: var(--accent-deep);
  color: var(--navy);
}

/* ---- Calculator actions ------------------------------------------------ */
.calc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.calc-clear {
  border: none;
  background: transparent;
  color: var(--gray-500);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.calc-clear:hover {
  color: var(--danger);
}

/* ---- Summary ----------------------------------------------------------- */
.calc-summary {
  margin-top: 24px;
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}

.summary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
}

.summary-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.summary-metric .metric-label {
  color: var(--accent);
}

.summary-metric .metric-value {
  color: var(--paper);
  font-size: 24px;
}

.summary-hint {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(147, 181, 255, 0.25);
  font-size: 14px;
  line-height: 1.55;
  color: var(--accent);
}

.summary-hint strong {
  color: var(--paper);
  font-weight: 600;
}

/* ---- Tool header + CTA spacing ----------------------------------------- */
.tool-header {
  max-width: 960px;
  margin: 0 auto 32px;
  padding: 0 24px;
}

.tool-lead {
  margin-top: 14px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--gray-700);
  max-width: 640px;
}

.tool-seo {
  margin-top: 64px;
}

.tool-cta {
  max-width: 800px;
  margin: 48px auto 0;
  padding: 0 24px;
}

/* This page loads styles.css + legal-shared.css (not blog.css), so .article-cta
   has no styling here — give the CTA an intentional, on-brand look instead of
   leaning on inherited globals (which rendered the heading as black Inter). No
   navy box: the summary bar above is already navy, so a plain CTA reads lighter. */
.tool-cta .article-cta h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin: 0 0 10px;
}

.tool-cta .article-cta p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-700);
  max-width: 620px;
  margin: 0 0 28px;
}

/* =============================================================================
   Mobile — ingredients become labeled cards, no horizontal scroll
   ============================================================================= */
@media (max-width: 640px) {
  .tool-container,
  .tool-header,
  .tool-cta {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dish {
    padding: 18px 16px;
  }

  .ing-head {
    display: none;
  }

  .ing {
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    padding: 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--cream);
  }

  .ing-f-name {
    grid-column: 1 / -1;
  }

  .ing-l {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .ing-cost {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 1px solid var(--gray-200);
  }

  .ing-cost .ing-l {
    margin-bottom: 0;
  }

  .ing-remove {
    grid-column: 1 / -1;
    width: auto;
    height: auto;
    justify-self: stretch;
    padding: 11px;
    border: 1px solid var(--gray-300);
    background: var(--paper);
    color: var(--gray-500);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
  }

  .ing-remove .btn-txt {
    display: inline;
  }

  .add-ing {
    align-self: stretch;
    text-align: center;
  }

  .calc-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .calc-actions .btn {
    width: 100%;
  }

  .calc-clear {
    text-align: center;
  }

  .summary-metric .metric-value {
    font-size: 21px;
  }
}
