/* CMH Lawyers — Shared Calculator Widget Styles
   Uses the same brand tokens as the main site stylesheet (assets/css/style.css).
   Navy #0F233C | Gold #C9A84C | Cormorant Garamond (display) | Inter (body) */

.calc-widget {
  max-width: 700px;
  margin: 0 auto 2rem;
}

.calc-card, .calc-results-card {
  background: var(--white);
  border: 1px solid var(--grey-light);
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(15,35,60,0.08);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.calc-card-header, .calc-results-header {
  background: var(--navy);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calc-results-header { background: var(--gold); }
.calc-results-header svg { stroke: var(--navy); }
.calc-results-header h3 { color: var(--navy); font-family: var(--font-display); font-size: 1.05rem; margin: 0; }

.calc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }

.calc-card-header h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--white);
  font-weight: 600;
  margin: 0;
}

.calc-card-body { padding: 1.75rem; }

/* Mode tabs */
.calc-mode-tabs {
  display: flex;
  border: 1.5px solid var(--grey-light);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.calc-mode-tab {
  flex: 1;
  padding: 0.7rem 0.85rem;
  background: var(--white);
  border: none;
  border-right: 1.5px solid var(--grey-light);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--grey-mid);
}
.calc-mode-tab:last-child { border-right: none; }
.calc-mode-tab.active { background: var(--navy); color: var(--gold); font-weight: 600; }
.calc-mode-tab:hover:not(.active) { background: var(--off-white); color: var(--navy); }
.calc-mode-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* Fields */
.calc-field { margin-bottom: 1.25rem; }
.calc-widget label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 0.4rem;
  text-decoration: none;
}
.calc-input-wrap { position: relative; display: flex; align-items: center; }
.calc-input-prefix { position: absolute; left: 0.9rem; font-weight: 500; color: var(--grey-mid); pointer-events: none; }
.calc-widget select, .calc-widget input[type="text"]:not(.calc-currency-input), .calc-widget input[type="number"], .calc-widget input[type="date"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--off-white);
  border: 1.5px solid var(--grey-light);
  border-radius: 4px;
  outline: none;
}
.calc-currency-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--off-white);
  border: 1.5px solid var(--grey-light);
  border-radius: 4px;
  outline: none;
}
.calc-widget select:focus, .calc-widget input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15,35,60,0.08); background: var(--white); }

/* Buttons */
.calc-btn-primary {
  width: 100%;
  padding: 0.9rem;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 0.5rem;
}
.calc-btn-primary:hover { background: var(--gold-hover); }
.calc-btn-primary:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.calc-btn-text {
  display: block;
  background: transparent;
  border: none;
  color: var(--grey-mid);
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  margin: 0.75rem auto 0;
  padding: 0.5rem;
}

/* Results */
.calc-results-card { display: none; }
.calc-results-card.visible { display: block; }
.calc-results-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 500px) { .calc-results-grid { grid-template-columns: 1fr; } }
.calc-result-cell { padding: 1.25rem 1.5rem; border-right: 1px solid var(--grey-light); border-bottom: 1px solid var(--grey-light); }
.calc-result-cell:last-child { border-right: none; }
@media (max-width: 500px) { .calc-result-cell { border-right: none; } }
.calc-result-cell .calc-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--grey-mid); margin-bottom: 0.35rem; }
.calc-result-cell .calc-amount { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.calc-result-cell.calc-highlight { background: var(--navy); }
.calc-result-cell.calc-highlight .calc-label { color: var(--gold); }
.calc-result-cell.calc-highlight .calc-amount { color: var(--white); }
.calc-result-cell.calc-emphasis { background: var(--off-white); }
.calc-result-cell.calc-emphasis .calc-amount { color: var(--gold-hover); }
.calc-note-row { padding: 1rem 1.5rem; background: var(--off-white); border-top: 1px solid var(--grey-light); font-size: 0.85rem; color: var(--grey-dark); line-height: 1.6; }
.calc-note-row strong { color: var(--navy); }

/* Disclaimer (step 4) — distinct block beneath results */
.calc-disclaimer {
  background: #FFFBEB;
  border: 1px solid #F2E2A8;
  border-left: 4px solid var(--gold);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #6B4E00;
  line-height: 1.6;
}
.calc-disclaimer strong { display: block; margin-bottom: 0.3rem; color: #6B4E00; }
.calc-disclaimer p { margin: 0; }

.calc-content h2 { margin-top: 2rem; }

/* ── Step badge (multi-card wizards) ── */
.calc-step-badge {
  width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--navy);
  font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.calc-card-header .calc-step-badge { background: var(--gold); color: var(--navy); }

/* ── Tile grid (property type / asset type selectors) ── */
.calc-tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; margin-bottom: 0.25rem; }
.calc-tile-option { position: relative; cursor: pointer; }
.calc-tile-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.calc-tile {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 0.9rem 0.6rem; border: 2px solid var(--grey-light); border-radius: 6px;
  text-align: center; background: var(--off-white); transition: all 0.15s;
}
.calc-tile-option input:checked + .calc-tile { border-color: var(--gold); background: #FBF5E6; box-shadow: 0 0 0 3px rgba(201,168,76,0.15); }
.calc-tile:hover { border-color: var(--gold); }
.calc-tile .calc-tile-icon { font-size: 1.4rem; }
.calc-tile .calc-tile-label { font-size: 0.78rem; font-weight: 600; color: var(--navy); }
.calc-tile .calc-tile-sub { font-size: 0.68rem; color: var(--grey-mid); }

/* ── Toggle / checkbox items (additional circumstances, transaction lists) ── */
.calc-toggle-grid, .calc-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
@media (max-width: 540px) { .calc-toggle-grid, .calc-check-grid { grid-template-columns: 1fr; } }
.calc-toggle-item, .calc-check-tile-wrap { position: relative; }
.calc-toggle-item input, .calc-check-tile-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.calc-toggle-label, .calc-check-tile {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.75rem; border: 1.5px solid var(--grey-light); border-radius: 6px;
  font-size: 0.82rem; font-weight: 500; color: var(--grey-dark); background: var(--off-white);
  cursor: pointer; transition: all 0.15s;
}
.calc-toggle-item input:checked + .calc-toggle-label,
.calc-check-tile-wrap input:checked + .calc-check-tile {
  border-color: var(--gold); background: #FBF5E6; color: var(--navy); font-weight: 600;
}
.calc-check-dot {
  width: 16px; height: 16px; border: 1.5px solid var(--grey-light); border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: var(--white);
}
.calc-toggle-item input:checked + .calc-toggle-label .calc-check-dot,
.calc-check-tile-wrap input:checked + .calc-check-tile .calc-check-dot { background: var(--gold); border-color: var(--gold); }
.calc-toggle-item input:disabled + .calc-toggle-label,
.calc-check-tile-wrap input:disabled + .calc-check-tile { opacity: 0.4; cursor: not-allowed; }

/* ── Tabs (fee schedule browsers) ── */
.calc-tab-bar { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--grey-light); flex-wrap: wrap; padding: 0 0.5rem; }
.calc-tab-btn {
  padding: 0.7rem 0.9rem 0.6rem; border: none; background: none; cursor: pointer;
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 600; color: var(--grey-mid);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.calc-tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }
.calc-tab-content { display: none; padding: 1rem; }
.calc-tab-content.active { display: block; }

/* ── Fee tables ── */
.calc-fee-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.calc-fee-table thead th { background: var(--navy); color: var(--white); padding: 0.6rem 0.9rem; text-align: left; font-weight: 600; font-size: 0.72rem; letter-spacing: 0.03em; }
.calc-fee-table thead th:not(:first-child) { text-align: right; }
.calc-fee-table tbody tr { border-bottom: 1px solid var(--grey-light); }
.calc-fee-table td { padding: 0.55rem 0.9rem; }
.calc-fee-table td:not(:first-child) { text-align: right; font-weight: 600; color: var(--navy); white-space: nowrap; }
.calc-fee-table .calc-cat-row td { background: var(--off-white); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-hover); }
.calc-table-scroll { overflow-x: auto; }

/* ── Dark results panel (multi-line breakdowns) ── */
.calc-results-panel-dark { display: none; background: var(--navy); border-radius: 6px; padding: 1.4rem; margin-top: 1rem; color: var(--white); }
.calc-results-panel-dark.visible { display: block; }
.calc-results-panel-dark .calc-rp-title { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 1rem; }
.calc-rp-line { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; gap: 0.6rem; }
.calc-rp-line:last-of-type { border-bottom: none; }
.calc-rp-line .calc-rp-desc { color: rgba(255,255,255,0.75); flex: 1; }
.calc-rp-line .calc-rp-desc small { display: block; font-size: 0.72rem; color: rgba(255,255,255,0.4); margin-top: 1px; }
.calc-rp-line .calc-rp-amt { font-weight: 600; color: var(--gold); white-space: nowrap; }
.calc-rp-total { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; background: rgba(201,168,76,0.15); border: 1px solid rgba(201,168,76,0.3); border-radius: 6px; margin-top: 0.85rem; font-weight: 700; }
.calc-rp-total .calc-rp-total-val { color: var(--gold); font-size: 1.2rem; }

/* ── Info box grid ── */
.calc-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; margin-bottom: 1.5rem; }
@media (max-width: 700px) { .calc-info-grid { grid-template-columns: 1fr; } }
.calc-info-box { background: var(--white); border: 1px solid var(--grey-light); border-radius: 6px; padding: 1rem 1.1rem; }
.calc-info-box .calc-info-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold-hover); margin-bottom: 0.35rem; }
.calc-info-box .calc-info-body { font-size: 0.78rem; color: var(--grey-mid); line-height: 1.5; }

/* ── Conflict / exemption alerts ── */
.calc-alert { display: none; border-radius: 6px; padding: 0.75rem 1rem; font-size: 0.82rem; margin-top: 0.6rem; line-height: 1.55; }
.calc-alert.visible { display: block; }
.calc-alert-danger { background: #FDF0F0; border: 1px solid #E8A0A0; color: #8B1A1A; }
.calc-alert-info { background: #E8EEF8; border: 1px solid #6A8FC0; color: #1A3A6B; }
.calc-alert-success { background: #EEFAF5; border: 1px solid #A0D4B8; color: #1A6B3C; padding: 1.1rem 1.25rem; }

.calc-conditional-section { display: none; margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px dashed var(--grey-light); }
.calc-conditional-section.visible { display: block; }

/* ── Property/asset type button grid (stamp duty step 1) ── */
.calc-tile-btn {
  border: 2px solid var(--grey-light); border-radius: 6px; padding: 0.85rem 0.6rem;
  cursor: pointer; background: var(--white); text-align: center; transition: all 0.15s;
  font-family: var(--font-body); position: relative;
}
.calc-tile-btn:hover { border-color: var(--navy); transform: translateY(-1px); }
.calc-tile-btn.active { border-color: var(--navy); background: #FBF5E6; }
.calc-tile-btn.active::after { content: '✓'; position: absolute; top: 5px; right: 7px; font-size: 0.7rem; color: var(--navy); font-weight: 700; }
.calc-tile-btn .calc-tile-icon { font-size: 1.4rem; margin-bottom: 0.4rem; }
.calc-tile-btn .calc-tile-label { font-size: 0.78rem; font-weight: 700; color: var(--text); display: block; }
.calc-tile-btn .calc-tile-sub { font-size: 0.68rem; color: var(--grey-mid); display: block; margin-top: 2px; }
.calc-tile-btn.active .calc-tile-label { color: var(--navy); }

/* ── Toggle rows (on/off switches with icon + description) ── */
.calc-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.85rem; border: 1.5px solid var(--grey-light); border-radius: 6px;
  cursor: pointer; margin-bottom: 0.6rem; transition: all 0.15s;
}
.calc-toggle-row:hover { border-color: var(--navy); }
.calc-toggle-row.active { border-color: var(--gold); background: #FBF5E6; }
.calc-toggle-row-left { display: flex; align-items: center; gap: 0.6rem; }
.calc-toggle-icon { font-size: 1.1rem; }
.calc-toggle-row .calc-toggle-label { font-size: 0.85rem; font-weight: 600; color: var(--navy); display: block; text-transform: none; letter-spacing: normal; }
.calc-toggle-row .calc-toggle-sub { font-size: 0.72rem; color: var(--grey-mid); display: block; }
.calc-toggle-switch { width: 36px; height: 20px; border-radius: 10px; background: var(--grey-light); position: relative; flex-shrink: 0; transition: background 0.15s; }
.calc-toggle-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); transition: transform 0.15s; }
.calc-toggle-row.active .calc-toggle-switch { background: var(--gold); }
.calc-toggle-row.active .calc-toggle-switch::after { transform: translateX(16px); }

/* ── Progress steps (stamp duty wizard) ── */
.calc-progress-bar { display: flex; align-items: center; margin-bottom: 1.25rem; }
.calc-progress-step { display: flex; align-items: center; gap: 0.4rem; flex: 1; }
.calc-progress-step .calc-p-num { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--grey-light); background: var(--white); color: var(--grey-mid); font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.calc-progress-step .calc-p-label { font-size: 0.72rem; font-weight: 600; color: var(--grey-mid); white-space: nowrap; }
.calc-progress-step.active .calc-p-num { background: var(--navy); border-color: var(--navy); color: var(--white); }
.calc-progress-step.active .calc-p-label { color: var(--navy); }
.calc-progress-step.done .calc-p-num { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.calc-progress-step.done .calc-p-label { color: var(--gold-hover); }
.calc-progress-line { flex: 1; height: 2px; background: var(--grey-light); margin: 0 0.5rem; max-width: 50px; }
.calc-progress-line.done { background: var(--gold); }
@media (max-width: 500px) { .calc-p-label { display: none; } .calc-progress-line { max-width: 20px; } }

/* ── Breakdown table (stamp duty / other itemised results) ── */
.calc-results-section { display: none; }
.calc-results-section.visible { display: block; }
.calc-result-header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; padding: 1rem 1.25rem; background: var(--off-white); }
.calc-result-title { font-family: var(--font-display); font-size: 1.15rem; color: var(--navy); font-weight: 600; }
.calc-result-sub { font-size: 0.8rem; color: var(--grey-mid); }
.calc-total-box { text-align: right; }
.calc-total-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--grey-mid); }
.calc-total-amount { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--navy); }
.calc-breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.calc-breakdown-table th { text-align: left; padding: 0.6rem 1rem; background: var(--off-white); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--grey-mid); }
.calc-breakdown-table th:last-child, .calc-breakdown-table td:last-child { text-align: right; }
.calc-breakdown-table td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--grey-light); vertical-align: top; }
.calc-breakdown-table tr.calc-subtotal-row td { font-weight: 700; background: var(--off-white); }
.calc-breakdown-table tr.calc-concession-row td { color: #1a6b3c; }
.calc-row-label { font-weight: 600; color: var(--navy); }
.calc-row-desc { font-size: 0.76rem; color: var(--grey-mid); margin-top: 1px; }
.calc-concession-badge { display: inline-block; background: #eefaf5; border: 1px solid #a0d4b8; color: #1a6b3c; padding: 0.4rem 0.85rem; border-radius: 20px; font-size: 0.8rem; font-weight: 600; margin: 0.75rem 1.25rem 0; }
.calc-last-reviewed { font-size: 0.75rem; color: var(--grey-mid); margin: 0.5rem 1.25rem; }
.calc-action-bar { display: flex; gap: 0.6rem; padding: 1rem 1.25rem; flex-wrap: wrap; }
.calc-btn-ghost { padding: 0.55rem 1.1rem; border: 1.5px solid var(--navy); color: var(--navy); background: var(--white); border-radius: 4px; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.calc-btn-ghost:hover { background: var(--off-white); }

/* ── Radio pill group (party type / concession status) ── */
.calc-radio-group { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.calc-radio-pill { display: flex; align-items: center; gap: 0.4rem; border: 1.5px solid var(--grey-light); border-radius: 24px; padding: 0.4rem 0.85rem; cursor: pointer; font-size: 0.85rem; font-weight: 500; color: var(--grey-dark); }
.calc-radio-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.calc-radio-pill:has(input:checked) { border-color: var(--gold); background: #FBF5E6; color: var(--navy); font-weight: 600; }
.calc-pill-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; flex-shrink: 0; }
.calc-radio-pill:has(input:checked) .calc-pill-dot { background: var(--gold); border-color: var(--gold); }

/* ── Result banner + fee table (court filing fees) ── */
.calc-result-banner { background: linear-gradient(135deg, var(--navy), #162D4A); padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; }
.calc-result-banner .calc-banner-title { color: var(--white); font-size: 0.9rem; font-weight: 600; }
.calc-result-banner .calc-banner-date { color: rgba(255,255,255,0.7); font-size: 0.78rem; }
.calc-total-row td { background: var(--navy) !important; color: var(--white) !important; font-weight: 700 !important; font-size: 1rem !important; }
.calc-fee-table .calc-fee-desc { color: var(--grey-mid); font-size: 0.78rem; margin-top: 2px; }
.calc-last-updated-note { background: var(--off-white); border: 1px solid var(--grey-light); border-radius: 6px; padding: 0.5rem 0.9rem; font-size: 0.78rem; color: var(--navy); display: inline-flex; gap: 0.4rem; margin: 0.75rem 1.25rem 0; }

@media print {
  .calc-mode-tabs, .calc-btn-primary, .calc-btn-text, .calc-tab-bar, .calc-progress-bar, .calc-action-bar, .site-header, .site-footer { display: none !important; }
  .calc-tab-content { display: block !important; }
}
