/* Price Check (calc.html). Builds on app.css for colours, header and type. */

.calc-main {
  flex: 1;
  padding: 14px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.calc-card.cheapest {
  border-color: var(--primary);
  background: #f0fdf4;
}

.calc-card.tied {
  border-color: var(--warning);
}

.calc-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc-letter {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: var(--bg-app);
  color: var(--text-main);
}

.calc-card.cheapest .calc-letter {
  background: var(--primary);
  color: #fff;
}

.calc-label {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  padding: 4px 0;
}

.calc-label:focus {
  outline: none;
  border-bottom: 1px solid var(--border-focus);
}

.calc-remove {
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}

.calc-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-dollar {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* 16px or more stops iOS zooming in on focus. */
.calc-price,
.calc-amount,
.calc-pack-input,
.calc-weight,
.calc-weight-unit {
  font: inherit;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--bg-card);
  color: var(--text-main);
  min-width: 0;
}

.calc-price {
  flex: 1.4;
  font-size: 1.6rem;
  font-weight: 700;
  padding: 8px 12px;
}

.calc-amount {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 600;
}

.calc-price:focus,
.calc-amount:focus,
.calc-pack-input:focus,
.calc-weight:focus {
  outline: none;
  border-color: var(--border-focus);
}

.calc-for {
  color: var(--text-muted);
  font-weight: 600;
}

.calc-units {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.calc-chip {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 40px;
  min-width: 48px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
}

.calc-chip.active {
  background: var(--text-main);
  border-color: var(--text-main);
  color: #fff;
}

.calc-pack-row,
.calc-pack,
.calc-weight-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.calc-pack-input,
.calc-weight {
  width: 80px;
}

.calc-pack-toggle {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--primary-dark);
  padding: 4px 0;
  cursor: pointer;
}

.calc-weight-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-app);
}

.calc-breakeven {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.calc-breakeven:empty {
  display: none;
}

.calc-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 0.95rem;
}

.calc-result:empty {
  display: none;
}

.calc-unit-price {
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.calc-unit-price + .calc-unit-price {
  font-weight: 500;
  color: var(--text-muted);
}

.calc-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
}

.calc-badge-tie {
  background: var(--warning);
}

.calc-add,
.calc-clear {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-full);
}

.calc-add {
  min-height: 48px;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
}

.calc-clear {
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
}

.calc-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* The answer stays in view while the keyboard is up. */
.calc-verdict {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
}

.calc-verdict strong {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.calc-verdict span {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.calc-verdict-win strong {
  color: var(--primary-dark);
}

.calc-verdict-tie strong {
  color: #92400e;
}

.calc-verdict-idle strong {
  color: var(--text-muted);
  font-weight: 700;
}

.hidden {
  display: none !important;
}
