/* Civil Service Pension Calculator (UK) - scoped, theme-proof CSS */
.cspc-wrap { 
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; 
  color: #111827; 
  padding: 20px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.cspc { 
  max-width: 1400px; 
  margin: 0 auto; 
  width: 100%;
  box-sizing: border-box;
  padding: 0;
}
@media (min-width: 1440px) {
  .cspc { 
    max-width: 1400px;
  }
}
.cspc h2 { 
  margin: 0 0 16px 0; 
  line-height: 1.3; 
  font-size: 28px;
  font-weight: 800;
  color: #111827;
}
.cspc h3 { 
  margin: 0 0 12px 0; 
  line-height: 1.3; 
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}
.cspc p { margin: 0 0 12px 0; color: #374151; line-height: 1.6; }

.cspc-card { 
  background: #ffffff; 
  border: 1px solid #e5e7eb; 
  border-radius: 16px; 
  padding: 24px; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04); 
  margin-bottom: 20px;
}
.cspc-card:last-child { margin-bottom: 0; }

.cspc-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { 
  .cspc-grid.cspc-grid-2 { grid-template-columns: 1fr 1fr; }
  .cspc-grid.cspc-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
  .cspc-grid.cspc-grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1200px) {
  .cspc-grid.cspc-grid-2 { gap: 20px; }
  .cspc-grid.cspc-grid-3 { gap: 20px; }
}

.cspc-group-title { font-weight: 700; margin-bottom: 6px; color: #111827; }

.cspc-field { margin-bottom: 16px; }
.cspc-field:last-child { margin-bottom: 0; }
.cspc-field label { 
  display: block; 
  font-size: 14px; 
  font-weight: 600; 
  color: #111827; 
  margin-bottom: 8px; 
}
.cspc-field input, .cspc-field select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.cspc-field input:hover, .cspc-field select:hover { border-color: #9ca3af; }
.cspc-field input:focus, .cspc-field select:focus { 
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cspc-options { display:flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cspc-help { font-size: 12px; color: #6b7280; margin-top: 6px; }

.cspc-inst {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #111827;
}

.cspc-btnrow { display:flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }

.cspc-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827; /* keep black in all states */
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
}
.cspc-btn:hover { background: #f3f4f6; color:#111827; }
.cspc-btn:active { transform: translateY(1px); color:#111827; }

.cspc-btn--primary {
  border-color: #1e4fd6;
  background: #2563eb;
  color: #ffffff;
}
.cspc-btn--primary:hover { background: #1e4fd6; color:#ffffff; }
.cspc-btn--primary:active { color:#ffffff; }

/* Prominent CSV CTA (primary results action - MailerLite gate) */
.cspc-csv-cta {
  border: 2px solid #1e40af;
  border-top: 4px solid #1e3a8a;
  background: linear-gradient(145deg, #eff6ff 0%, #dbeafe 45%, #e0e7ff 100%);
  margin: 2rem 0 1.25rem;
  padding: 1.75rem 1.5rem 2rem;
  text-align: center;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(30, 58, 138, 0.12);
}
/* Inner column beats theme rules like .entry-content p { text-align: left } */
.cspc-csv-cta__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}
div.cspc-wrap div.cspc div.cspc-csv-cta .cspc-csv-cta__inner .cspc-csv-cta__badge,
div.cspc-wrap div.cspc div.cspc-csv-cta .cspc-csv-cta__inner .cspc-csv-cta__title,
div.cspc-wrap div.cspc div.cspc-csv-cta .cspc-csv-cta__inner .cspc-csv-cta__text {
  text-align: center !important;
}
.cspc-csv-cta__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1e40af;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(30, 64, 175, 0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}
.cspc-csv-cta__title {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.25;
}
.cspc-csv-cta__text {
  margin: 0 auto 1.25rem;
  max-width: 40rem;
  font-size: 0.98rem;
  line-height: 1.55;
  text-align: center;
  color: #334155;
}
.cspc-btn--csv-cta {
  min-height: 64px;
  max-width: 100%;
  width: 100%;
  font-weight: 800;
  font-size: 1.2rem;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: 12px;
  border-bottom: 4px solid #1e3a8a;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.cspc-btn--csv-cta:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.5);
}
.cspc-btn--csv-cta:active {
  transform: translateY(1px);
  border-bottom-width: 2px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Modal (MailerLite email gate) */
.cspc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
}
.cspc-modal {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.cspc-modal--cs {
  max-width: 440px;
  border-top: 4px solid #1e40af;
}
.cspc-modal-body { min-height: 1px; }
.cspc-modal-title { margin: 0 0 0.5rem; font-size: 1.35rem; font-weight: 900; color: #0f172a; line-height: 1.2; }
.cspc-modal-success {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #059669;
  text-align: center;
  padding: 1.25rem 0.5rem;
  line-height: 1.45;
}
.cspc-modal-blurb {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #475569;
}
.cspc-modal label { display: block; margin-top: 0.75rem; margin-bottom: 0.25rem; font-weight: 600; }
.cspc-modal-input { width: 100%; padding: 0.5rem; box-sizing: border-box; margin-bottom: 0.5rem; }
.cspc-modal-error { color: #b91c1c; font-size: 0.9rem; margin-bottom: 0.5rem; display: none; }
.cspc-modal-error--warn { color: #92400e; background: #fffbeb; border: 1px solid #fcd34d; padding: 0.5rem 0.65rem; border-radius: 8px; }
.cspc-modal-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; justify-content: stretch; }
.cspc-modal-actions .cspc-btn { flex: 1 1 auto; min-width: 120px; }
.cspc-modal-submit--large {
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 800;
}
.cspc-modal-close { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }

.cspc-badges { display:flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.cspc-badge {
  display:inline-flex; gap: 8px; align-items:center;
  border-radius: 999px; padding: 8px 12px;
  font-weight: 800; font-size: 13px;
  border: 1px solid #e5e7eb;
  background: #fff;
}
.cspc-badge.ok { border-color: rgba(16,185,129,0.35); background: rgba(16,185,129,0.08); }
.cspc-badge.bad { border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); }

.cspc-summ { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: 16px; 
  margin: 20px 0;
}
@media (min-width: 768px) { 
  .cspc-summ { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1200px) { 
  .cspc-summ { grid-template-columns: repeat(4, 1fr); }
}
.cspc-summ .box {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.cspc-summ .box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.cspc-summ .k { 
  font-size: 13px; 
  color: #6b7280; 
  margin-bottom: 8px; 
  font-weight: 500;
  line-height: 1.4;
}
.cspc-summ .v { 
  font-size: 24px; 
  font-weight: 900; 
  color: #111827; 
  line-height: 1.2;
}
/* Pension boxes - Blue theme */
.cspc-summ .box.box-pension {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
  border: 2px solid #3b82f6 !important;
}
.cspc-summ .box.box-pension .v { color: #1e40af !important; }
.cspc-summ .box.box-pension:hover { border-color: #2563eb !important; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important; }
/* Pension alt - Light blue */
.cspc-summ .box.box-pension-alt {
  background: linear-gradient(135deg, #bae6fd 0%, #93c5fd 100%) !important;
  border: 2px solid #0ea5e9 !important;
}
.cspc-summ .box.box-pension-alt .v { color: #0369a1 !important; }
.cspc-summ .box.box-pension-alt:hover { border-color: #0284c7 !important; box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important; }
/* Lump sum - Green theme */
.cspc-summ .box.box-lump-sum {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
  border: 2px solid #10b981 !important;
}
.cspc-summ .box.box-lump-sum .v { color: #059669 !important; }
.cspc-summ .box.box-lump-sum:hover { border-color: #059669 !important; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important; }
/* Bridge - Orange/Amber theme */
.cspc-summ .box.box-bridge {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  border: 2px solid #f59e0b !important;
}
.cspc-summ .box.box-bridge .v { color: #d97706 !important; }
.cspc-summ .box.box-bridge:hover { border-color: #d97706 !important; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3) !important; }
/* State Pension - Purple theme */
.cspc-summ .box.box-state-pension {
  background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 100%) !important;
  border: 2px solid #a855f7 !important;
}
.cspc-summ .box.box-state-pension .v { color: #7c3aed !important; }
.cspc-summ .box.box-state-pension:hover { border-color: #9333ea !important; box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3) !important; }
/* Service - Teal theme */
.cspc-summ .box.box-service {
  background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%) !important;
  border: 2px solid #14b8a6 !important;
}
.cspc-summ .box.box-service .v { color: #0d9488 !important; }
.cspc-summ .box.box-service:hover { border-color: #0d9488 !important; box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3) !important; }

.cspc-tablewrap { overflow-x: auto; }
.cspc-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.cspc-table th, .cspc-table td { padding: 10px 10px; border-bottom: 1px solid #eef2f7; text-align: right; font-size: 13px; white-space: nowrap; }
.cspc-table th:first-child, .cspc-table td:first-child { text-align: left; }
.cspc-table thead th { background: #ebf2f4; color: #111827; font-weight: 900; border-bottom: 1px solid #e5e7eb; }
.cspc-table tbody tr:hover td { background: #fafafa; }

.cspc-small .cspc-table th, .cspc-small .cspc-table td { padding: 8px 8px; font-size: 12px; }

.cspc-disclaimer { font-size: 12px; color:#6b7280; line-height: 1.35; margin-top: 60px; padding-top: 24px; border-top: 1px solid #e5e7eb; }

/* Charts */
.cspc-chart-container {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
}
.cspc-chart-container h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}
.cspc-chart {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
}
@media (max-width: 768px) {
  .cspc-chart-container {
    padding: 16px;
    overflow-x: auto;
  }
  .cspc-chart {
    min-width: 600px;
  }
}
.cspc-chart-grid line {
  pointer-events: none;
}
.cspc-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}
.cspc-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #374151;
}
.cspc-chart-legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Key insights */
.cspc-insights {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 20px 0;
}
@media (min-width: 768px) {
  .cspc-insights {
    grid-template-columns: repeat(2, 1fr);
  }
}
.cspc-insight {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid #3b82f6;
  border-left: 5px solid #3b82f6;
  border-radius: 12px;
  padding: 16px;
}
.cspc-insight.warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
  border-left-color: #f59e0b;
}
.cspc-insight.error {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #ef4444;
  border-left-color: #dc2626;
}
.cspc-insight.success {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #10b981;
  border-left-color: #059669;
}
.cspc-insight.info {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #2563eb;
  border-left-color: #1e40af;
}
.cspc-insight-title {
  font-weight: 700;
  font-size: 14px;
  color: #111827;
  margin-bottom: 6px;
}
.cspc-insight-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
}

@media print {
  .cspc-wrap { padding: 0; }
  .cspc-btnrow, .cspc-inst, .cspc-no-print, .cspc-chart-container { display: none !important; }
  .cspc-card { 
    box-shadow: none; 
    border-color: #d1d5db; 
    page-break-inside: avoid;
    margin-bottom: 16px;
  }
  .cspc-table { min-width: 0; page-break-inside: auto; }
  .cspc-table tr { page-break-inside: avoid; }
  .cspc-summ { page-break-inside: avoid; }
  .cspc-badges { page-break-inside: avoid; }
  @page { size: A4; margin: 15mm; }
}
