/* ── Mg/Kg to PPM Converter – Styles ───────────────────────────────────── */

.mpc-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 860px;
  margin: 2rem auto;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 18px;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  box-shadow: 0 6px 32px rgba(79, 70, 229, 0.12);
  color: #1e293b;
  box-sizing: border-box;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.mpc__header {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.75rem;
}

.mpc__logo { font-size: 2.4rem; line-height: 1; flex-shrink: 0; }

.mpc__title {
  font-size: clamp(1.2rem, 3.5vw, 1.5rem);
  font-weight: 800;
  margin: 0 0 0.2rem;
  color: #312e81;
}

.mpc__desc {
  font-size: 0.9rem;
  color: #4338ca;
  margin: 0;
  line-height: 1.5;
}

/* ── Form grid ───────────────────────────────────────────────────────────── */

.mpc__form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.mpc__form--mass {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0;
}

@media (max-width: 620px) {
  .mpc__form { grid-template-columns: 1fr; }
  .mpc__form--mass { grid-template-columns: 1fr; }
}

.mpc__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mpc__field--value {
  grid-column: 1 / -1;
}

@media (min-width: 621px) {
  .mpc__field--value { grid-column: 1 / 2; }
}

.mpc__field label {
  font-size: 0.83rem;
  font-weight: 700;
  color: #3730a3;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.mpc__field-icon { font-size: 1rem; }

.mpc__input,
.mpc__select {
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #a5b4fc;
  border-radius: 9px;
  font-size: 0.98rem;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
  appearance: auto;
}

.mpc__input:focus,
.mpc__select:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.mpc__field-hint {
  font-size: 0.75rem;
  color: #818cf8;
  margin-top: 0.1rem;
}

/* ── Optional mass panel ─────────────────────────────────────────────────── */

.mpc__optional-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.87rem;
  font-weight: 700;
  color: #4f46e5;
  cursor: pointer;
  margin-bottom: 0.75rem;
  user-select: none;
  width: fit-content;
}

.mpc__optional-toggle:hover { text-decoration: underline; }

.mpc__toggle-icon {
  display: inline-block;
  font-size: 0.95rem;
  transition: transform 0.2s;
  font-style: normal;
}

.mpc__optional-toggle.open .mpc__toggle-icon { transform: rotate(45deg); }

.mpc__optional-panel {
  display: none;
  background: #e0e7ff;
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}

.mpc__optional-panel.open { display: block; }

/* ── Convert button ──────────────────────────────────────────────────────── */

.mpc__btn-calc {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  margin-bottom: 1.75rem;
  letter-spacing: 0.01em;
}

.mpc__btn-calc:hover  { filter: brightness(1.1); }
.mpc__btn-calc:active { transform: scale(0.99); }

/* ── Results ─────────────────────────────────────────────────────────────── */

.mpc__results { display: none; }
.mpc__results.visible { display: block; }

/* ── Hero ────────────────────────────────────────────────────────────────── */

.mpc__hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 50%, #6366f1 100%);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.mpc__hero::before {
  content: '⚗️';
  position: absolute;
  font-size: 9rem;
  opacity: 0.07;
  top: -2rem;
  right: -1rem;
  line-height: 1;
}

.mpc__hero-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.mpc__hero-label {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.65);
}

.mpc__hero-value {
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1;
  word-break: break-all;
}

.mpc__hero-side--right .mpc__hero-value { color: #c7d2fe; }

.mpc__hero-eq {
  font-size: 2rem;
  color: rgba(255,255,255,0.45);
  font-weight: 300;
  flex-shrink: 0;
}

/* ── Section title ───────────────────────────────────────────────────────── */

.mpc__section-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #312e81;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 1.25rem 0 0.7rem;
}

/* ── Conversion table ────────────────────────────────────────────────────── */

.mpc__table {
  background: #e0e7ff;
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.mpc__table-row {
  display: flex;
  align-items: center;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #c7d2fe;
  gap: 0.75rem;
}

.mpc__table-row:last-child { border-bottom: none; }
.mpc__table-row:nth-child(even) { background: #eef2ff; }

.mpc__table-row--highlight {
  background: #c7d2fe !important;
  font-weight: 700;
}

.mpc__table-icon { font-size: 1.2rem; flex-shrink: 0; }

.mpc__table-info { flex: 1; min-width: 0; }

.mpc__table-unit {
  font-size: 0.9rem;
  font-weight: 700;
  color: #312e81;
}

.mpc__table-name {
  font-size: 0.75rem;
  color: #4f46e5;
  margin-top: 0.1rem;
}

.mpc__table-value {
  font-size: 0.97rem;
  font-weight: 800;
  color: #4338ca;
  text-align: right;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

/* ── Amount section ──────────────────────────────────────────────────────── */

.mpc__amount-section { display: none; }
.mpc__amount-section.visible { display: block; }

.mpc__amount-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

@media (max-width: 580px) {
  .mpc__amount-cards { grid-template-columns: 1fr 1fr; }
}

.mpc__amount-card {
  background: #e0e7ff;
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  padding: 1rem 0.85rem;
  text-align: center;
}

.mpc__amount-icon { font-size: 1.4rem; margin-bottom: 0.3rem; }

.mpc__amount-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #4338ca;
  line-height: 1.2;
  word-break: break-all;
}

.mpc__amount-label {
  font-size: 0.77rem;
  color: #4f46e5;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* ── Context cards ───────────────────────────────────────────────────────── */

.mpc__context {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 0.25rem;
}

@media (max-width: 500px) {
  .mpc__context { grid-template-columns: 1fr; }
}

.mpc__ctx-card {
  background: #e0e7ff;
  border: 1.5px solid #c7d2fe;
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.mpc__ctx-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 0.1rem; }

.mpc__ctx-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #312e81;
  margin-bottom: 0.25rem;
}

.mpc__ctx-text {
  font-size: 0.82rem;
  color: #3730a3;
  line-height: 1.55;
}

/* ── Error ───────────────────────────────────────────────────────────────── */

.mpc__error {
  padding: 0.85rem 1rem;
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 10px;
  color: #dc2626;
  font-size: 0.93rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
  display: none;
}

.mpc__error.visible { display: block; }

/* ── Info box ────────────────────────────────────────────────────────────── */

.mpc__info {
  margin-top: 1.75rem;
  padding: 1.1rem 1.2rem;
  background: #e0e7ff;
  border-radius: 10px;
  border-left: 4px solid #4f46e5;
  font-size: 0.92rem;
  color: #312e81;
  line-height: 1.75;
}

.mpc__info strong { color: #0f172a; }
