/* ── PPM to Molarity Calculator ────────────────────────────────── */

.ptm-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 860px;
  margin: 2rem auto;
  background: #faf5ff;
  border: 1.5px solid #d8b4fe;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 32px rgba(109,40,217,0.10);
  color: #3b0764;
  box-sizing: border-box;
}

/* Header */
.ptm__header {
  background: linear-gradient(135deg, #1e0533 0%, #3b0764 35%, #6d28d9 75%, #7c3aed 100%);
  padding: clamp(1.4rem, 4vw, 2rem) clamp(1.2rem, 4vw, 2rem);
}
.ptm__header h2 {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  font-weight: 900;
  color: #fff;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}
.ptm__header p {
  font-size: 0.9rem;
  color: #e9d5ff;
  margin: 0;
}

/* Body */
.ptm__body {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.ptm__card {
  flex: 1;
  padding: clamp(1.2rem, 3vw, 1.6rem);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.ptm__card-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #7c3aed;
  border-bottom: 2px solid #f3e8ff;
  padding-bottom: 0.5rem;
}

.ptm__label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #3b0764;
  margin-bottom: 0.35rem;
}

.ptm__input-row {
  display: flex;
  align-items: center;
  border: 2px solid #d8b4fe;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.ptm__input-row:focus-within {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

.ptm__input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  color: #3b0764;
  background: transparent;
  font-weight: 600;
  width: 100%;
  box-sizing: border-box;
}
.ptm__input::placeholder { color: #94a3b8; font-weight: 400; }

.ptm__unit {
  background: #f3e8ff;
  color: #7c3aed;
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Presets */
.ptm__preset-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #9333ea;
  margin-bottom: 0.3rem;
}
.ptm__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ptm__preset-btn {
  background: #faf5ff;
  border: 1.5px solid #d8b4fe;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.72rem;
  color: #6d28d9;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ptm__preset-btn:hover,
.ptm__preset-btn.ptm--active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.ptm__arrow {
  text-align: center;
  font-size: 1.4rem;
  color: #7c3aed;
  line-height: 1;
}

/* Result box */
.ptm__result-box {
  background: #faf5ff;
  border: 2px solid #d8b4fe;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-height: 54px;
}
.ptm__result-box.ptm--has-value {
  background: #ede9fe;
  border-color: #a78bfa;
}
.ptm__result-val {
  font-size: 1.45rem;
  font-weight: 900;
  color: #3b0764;
  line-height: 1;
}
.ptm__result-unit {
  font-size: 0.85rem;
  font-weight: 700;
  color: #7c3aed;
}
.ptm__result-box.ptm--has-value .ptm__result-val { color: #4c1d95; }

/* Formula */
.ptm__formula {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.55;
  background: #f8fafc;
  border-left: 3px solid #d8b4fe;
  padding: 0.5rem 0.75rem;
  border-radius: 0 6px 6px 0;
}

/* Clear */
.ptm__clear-btn {
  align-self: flex-start;
  background: none;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
}
.ptm__clear-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fff5f5;
}

/* Divider */
.ptm__divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-width: 48px;
  background: #faf5ff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #7c3aed;
  border-left: 1px solid #f3e8ff;
  border-right: 1px solid #f3e8ff;
}

/* Table */
.ptm__table-section {
  padding: clamp(1rem, 3vw, 1.5rem);
  background: #fff;
  border-top: 1.5px solid #f3e8ff;
}
.ptm__table-title {
  font-size: clamp(0.85rem, 2.5vw, 0.98rem);
  font-weight: 800;
  color: #3b0764;
  margin: 0 0 0.85rem;
}
.ptm__table-wrap { overflow-x: auto; }
.ptm__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}
.ptm__table thead tr {
  background: linear-gradient(90deg, #3b0764, #7c3aed);
}
.ptm__table thead th {
  color: #fff;
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
}
.ptm__table tbody tr:nth-child(even) { background: #faf5ff; }
.ptm__table tbody tr:hover { background: #f3e8ff; }
.ptm__table tbody td {
  padding: 0.5rem 1rem;
  color: #3b0764;
  font-weight: 500;
  border-bottom: 1px solid #f3e8ff;
}

/* Note */
.ptm__note {
  background: #faf5ff;
  border-top: 1.5px solid #d8b4fe;
  padding: 0.85rem clamp(1rem, 3vw, 1.5rem);
  font-size: 0.82rem;
  color: #3b0764;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 600px) {
  .ptm__body { flex-direction: column; }
  .ptm__divider {
    width: 100%; min-width: unset; height: 36px;
    border-left: none; border-right: none;
    border-top: 1px solid #f3e8ff; border-bottom: 1px solid #f3e8ff;
  }
  .ptm__card { padding: 1rem; }
}
