/* ================================================================
   JAM MONEY CALCULATORS — SHARED BASE STYLES (v1.3.4)
   Copyright (c) Mr MoneyJar. All rights reserved.
   Developed by Tribe Squared — https://tribesquared.com
   ================================================================ */

.jm-calc {
  --brand:   #D62828;
  --ink:     #111;
  --muted:   #5a6478;
  --surface: #f7f7f8;
  --ring:    #e5e7eb;

  --fs-base:  16px;
  --fs-h2:    1.2rem;
  --fs-h3:    1rem;
  --fs-label: 1rem;
  --fs-input: 1.05rem;
  --fs-small: 0.82rem;
  --fs-stat:  1.4rem;
  --fs-table: 0.95rem;

  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.jm-calc, .jm-calc * { box-sizing: border-box; }

.jm-calc input[type="number"]::-webkit-inner-spin-button,
.jm-calc input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.jm-calc input[type="number"] { -moz-appearance: textfield; }

/* Card */
.jm-calc .card {
  max-width: 860px;
  margin: 0 auto;
  background: var(--surface);
  border: 2px solid var(--ring);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

/* Typography */
.jm-calc h2 { font-size: var(--fs-h2) !important; margin: 0 0 16px; font-weight: 800; color: #0b1b3a; letter-spacing: -0.01em; line-height: 1.3 !important; }
.jm-calc h3 { font-size: var(--fs-h3) !important; margin: 0 0 10px; font-weight: 700; color: #0b1b3a; line-height: 1.3 !important; }

/* Form */
.jm-calc form { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }

.jm-calc .field {
  grid-column: span 12;
  background: #fff;
  border: 1px solid var(--ring);
  border-radius: 14px;
  padding: 16px;
  transition: border-color 0.15s;
}
.jm-calc .field:focus-within { border-color: var(--brand); }

.jm-calc .field label {
  display: block;
  font-size: var(--fs-label);
  font-weight: 700;
  color: #0b1b3a;
  margin-bottom: 10px;
  line-height: 1.35;
}
.jm-calc .field label.red { color: var(--brand); }

.jm-calc .row { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }

/* Controls */
.jm-calc .control {
  background: #fff;
  border: 1.5px solid var(--ring);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: var(--fs-input);
  color: var(--ink);
  width: 100%;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.jm-calc .control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(214,40,40,0.10);
}

.jm-calc select.control {
  appearance: none; -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23344054' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 36px;
  cursor: pointer;
}
.jm-calc select.control::-ms-expand { display: none; }

.jm-calc .hint { margin-top: 8px; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }

/* Buttons */
.jm-calc .actions { grid-column: span 12; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

.jm-calc button {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 28px;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  letter-spacing: 0.01em;
  transition: opacity 0.2s, transform 0.1s;
}
.jm-calc button:hover  { opacity: 0.88; }
.jm-calc button:active { transform: scale(0.98); }
.jm-calc button.secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--ring); font-weight: 600; }

/* Errors */
.jm-calc .error-msg {
  grid-column: span 12;
  background: #fff4f4;
  border: 1px solid #f2b8b8;
  border-radius: 10px;
  padding: 10px 14px;
  color: #B42318;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Results */
.jm-calc .result { margin-top: 24px; padding: 20px; background: #fff; border: 1.5px solid var(--ring); border-radius: 14px; }

/* Stats grid */
.jm-calc .grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; margin-bottom: 4px; }

.jm-calc .stat { grid-column: span 6; background: var(--surface); border-radius: 12px; padding: 14px 16px; }
.jm-calc .stat h3 { font-size: 0.75rem !important; color: var(--muted); margin: 0 0 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1.3 !important; }
.jm-calc .stat p  { font-weight: 800; margin: 0; font-size: var(--fs-stat); letter-spacing: -0.02em; line-height: 1.15; }

#jm-savings .stat p { color: var(--brand); }

/* Projection table (investment) */
.jm-calc .results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 0; margin-top: 1em; }
.jm-calc .amount-col   { color: var(--muted); font-weight: 600; font-size: 0.88rem; }

.jm-calc .proj { border: 1.5px solid var(--ring); border-radius: 12px; overflow: hidden; background: #fff; font-size: var(--fs-table); }
.jm-calc .proj-row { display: grid; grid-template-columns: 1fr 160px; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--ring); }
.jm-calc .proj-row:first-child { border-top: 0; background: var(--surface); }
.jm-calc .proj-label { font-weight: 600; color: #1f2937; }
.jm-calc .proj-val   { text-align: right; font-weight: 700; }

.jm-calc .final { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding: 14px 16px; background: var(--surface); border-radius: 10px; gap: 12px; }
.jm-calc .final .flabel { font-weight: 800; font-size: 1rem; color: #1f2937; }
.jm-calc .final .fval   { font-weight: 800; font-size: 1.25rem; color: var(--brand); letter-spacing: -0.02em; }

/* Breakdown table (take-home pay) */
.jm-calc .table { margin-top: 16px; border: 1.5px solid var(--ring); border-radius: 12px; overflow: hidden; }

.jm-calc .trow { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 12px; padding: 11px 14px; border-top: 1px solid var(--ring); font-size: var(--fs-table); line-height: 1.45; }
.jm-calc .trow:first-child { border-top: 0; }
.jm-calc .trow.head { background: var(--surface); font-weight: 700; color: #0b1b3a; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.jm-calc .trow.bold { font-weight: 800; background: #fafafa; }
.jm-calc .trow.takehome-row { color: var(--brand); font-weight: 800; background: #fff8f8; }
.jm-calc .trow .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Advanced options (take-home pay) */
.jm-calc details.adv { grid-column: span 12; border: 1.5px solid var(--ring); border-radius: 14px; background: #fff; overflow: hidden; }

.jm-calc details.adv > summary {
  list-style: none; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; font-weight: 700; font-size: 1rem;
  color: var(--brand); cursor: pointer; user-select: none;
}
.jm-calc details.adv > summary::-webkit-details-marker { display: none; }
.jm-calc details.adv > summary::marker { content: ""; }
.jm-calc details.adv > summary::after {
  content: ""; margin-left: auto; width: 10px; height: 10px; flex-shrink: 0;
  border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand);
  transform: rotate(-45deg); transition: transform 0.15s ease;
}
.jm-calc details.adv[open] > summary::after { transform: rotate(45deg); }

.jm-calc .adv-inner { padding: 16px; display: grid; gap: 14px; border-top: 1px solid var(--ring); }
.jm-calc .subcard { border: 1px solid var(--ring); border-radius: 12px; padding: 14px; background: var(--surface); }
.jm-calc .subcard h3 { margin: 0 0 12px; font-size: 0.95rem; font-weight: 800; color: #0b1b3a; }
.jm-calc .subgrid { display: grid; gap: 12px; }

/* Disclaimer */
.jm-calc .disclaimer { margin-top: 14px; color: var(--muted); font-size: var(--fs-small); line-height: 1.5; }

/* Footer credit */
.jm-calc .jm-footer { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--ring); font-size: 0.75rem; color: #bcc2cc; text-align: center; line-height: 1.6; }
.jm-calc .jm-footer a { color: #bcc2cc; text-decoration: none; }
.jm-calc .jm-footer a:hover { color: var(--muted); text-decoration: underline; }

/* Animations */
.jm-calc .fade-in { animation: jm-fade 0.2s ease-out; }
@keyframes jm-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 720px) {
  .jm-calc .card { padding: 18px; }
  .jm-calc .row  { grid-template-columns: 1fr; }
  .jm-calc .stat { grid-column: span 12; }
  .jm-calc .trow { grid-template-columns: 1fr; gap: 4px; }
  .jm-calc .trow .num::before { content: attr(data-col) ": "; font-weight: 600; color: var(--muted); }
  .jm-calc .trow .num { text-align: left; }
  .jm-calc .trow.head { display: none; }
  .jm-calc .proj-row  { grid-template-columns: 1fr; gap: 4px; }
  .jm-calc .proj-val  { text-align: left; }
}

/* ================================================================
   PENSION CALCULATOR ADDITIONS (v1.3.4)
   Sliders, toggle switch, value pill and email-capture panel.
   Scoped to .jm-calc so any calculator can reuse them.
   ================================================================ */

/* Slider + synced number input */
.jm-calc .slider-row { display: grid; grid-template-columns: 1fr 96px; gap: 14px; align-items: center; }
.jm-calc .jm-num     { text-align: center; }

.jm-calc .jm-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px; margin: 6px 0;
  background: var(--ring); cursor: pointer;
}
.jm-calc .jm-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
.jm-calc .jm-range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer;
}
.jm-calc .jm-range:focus { outline: none; }
.jm-calc .jm-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(214,40,40,0.18); }
.jm-calc .jm-range:focus::-moz-range-thumb     { box-shadow: 0 0 0 4px rgba(214,40,40,0.18); }

/* Brand-coloured value pill (e.g. live slider readout) */
.jm-calc .pill { color: var(--brand); font-weight: 800; }

/* Brand-red values in the "The detail" and "How your pot compares" tables */
#jm-pension .proj-val { color: var(--brand); }

/* Toggle switch */
.jm-calc .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.jm-calc .switch-row label { margin-bottom: 0; }
.jm-calc .jm-switch { position: relative; display: inline-block; width: 52px; height: 30px; flex-shrink: 0; }
.jm-calc .jm-switch input { opacity: 0; width: 0; height: 0; }
.jm-calc .jm-switch .track {
  position: absolute; inset: 0; cursor: pointer;
  background: #cbd2dc; border-radius: 999px; transition: background 0.18s;
}
.jm-calc .jm-switch .track::before {
  content: ""; position: absolute; height: 24px; width: 24px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.18s; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.jm-calc .jm-switch input:checked + .track { background: var(--brand); }
.jm-calc .jm-switch input:checked + .track::before { transform: translateX(22px); }
.jm-calc .jm-switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(214,40,40,0.18); }

/* Optional email-capture panel */
.jm-calc .email-wrap {
  margin-top: 18px;
  border: 1.5px solid var(--ring); border-radius: 14px; background: #fff; padding: 18px;
}
.jm-calc .email-wrap h3 { margin: 0 0 6px; }
.jm-calc .email-wrap .hint { margin-top: 0; margin-bottom: 14px; }
.jm-calc .email-wrap form { display: block; }   /* don't inherit the 12-col grid from .jm-calc form */
.jm-calc .email-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
.jm-calc .check-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; }
.jm-calc .check-row input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; accent-color: var(--brand); }
.jm-calc .check-row label { font-weight: 500; color: var(--ink); font-size: 0.92rem; line-height: 1.45; margin: 0; }
.jm-calc .email-msg { margin-top: 12px; font-size: 0.9rem; font-weight: 600; }
.jm-calc .email-msg.ok  { color: #1a7f4b; }
.jm-calc .email-msg.err { color: #B42318; }

@media (max-width: 720px) {
  .jm-calc .slider-row    { grid-template-columns: 1fr 80px; }
  .jm-calc .email-row     { grid-template-columns: 1fr; }
  .jm-calc .email-row button { width: 100%; }
}
