/* Energy Brokers brand */
:root {
  --seb-green: #91C061;
  --seb-blue: #1768A1;
  --seb-blue-dark: #115580;
  --seb-green-dark: #76a247;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5a6678;
  --border: #e3e8ee;
  --shadow: 0 2px 8px rgba(23, 104, 161, 0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 20px rgba(23, 104, 161, 0.10), 0 2px 4px rgba(0,0,0,0.04);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* Header */
header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  height: 48px;
  width: auto;
  display: block;
  object-fit: contain;
}
.logo-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--seb-blue), var(--seb-green));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
}
.brand-text { font-weight: 600; color: var(--seb-blue); font-size: 18px; }
.brand-text small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }

nav.site-nav { display: flex; gap: 8px; }
nav.site-nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
}
nav.site-nav a.active { background: var(--seb-blue); color: white; }
nav.site-nav a:hover:not(.active) { background: #eef3f8; color: var(--seb-blue); }

/* Main container */
main {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px 60px;
}
h1.page-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--seb-blue);
}
.page-sub { color: var(--muted); margin: 0 0 28px; font-size: 15px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin-bottom: 22px;
}
.card h2 {
  font-size: 16px;
  margin: 0 0 18px;
  color: var(--seb-blue);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}
.field { display: flex; flex-direction: column; }
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.field input,
.field select {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--seb-blue);
  box-shadow: 0 0 0 3px rgba(23, 104, 161, 0.12);
}

/* Optimisation goal cards — 3 across in the left column */
.goal-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
/* Fix [hidden] not working because of display: grid above. The browser default
   `[hidden] { display: none }` rule has lower specificity than .goal-cards. */
.goal-cards[hidden] { display: none; }

.goal-cards label {
  position: relative;
  cursor: pointer;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fafbfc;
  transition: all .15s;
}
.goal-cards label:hover { border-color: var(--seb-green); }
.goal-cards input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.goal-cards label:has(input:checked) {
  border-color: var(--seb-green);
  background: #f4faed;
  box-shadow: 0 0 0 3px rgba(145, 192, 97, 0.18);
}
.goal-cards .goal-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.goal-cards .goal-desc  { font-size: 12px; color: var(--muted); line-height: 1.4; }
/* Single-tech cards have no description, so the title sits on its own */
.single-tech-cards .goal-title { margin-bottom: 0; }

/* Mode toggle — pill switch between "Find the best solution" and
   "Compare a specific proposal". Only one set of 3 cards is shown at a time. */
.mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 4px 0 14px;
  background: #eef1f4;
  border-radius: 999px;
}
.mode-pill {
  background: transparent;
  border: none;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.mode-pill:hover { color: var(--text); }
.mode-pill.is-active {
  background: var(--seb-blue, #1768A1);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.mode-pill:focus-visible {
  outline: 2px solid var(--seb-green, #91c061);
  outline-offset: 2px;
}
.mode-hint {
  margin-top: -4px;
  margin-bottom: 10px;
}

/* Preview tiles */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tile {
  background: linear-gradient(135deg, var(--seb-blue), var(--seb-blue-dark));
  color: white;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-lg);
}
.tile.green { background: linear-gradient(135deg, var(--seb-green), var(--seb-green-dark)); }
.tile-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.85;
  font-weight: 600;
  margin-bottom: 6px;
}
.tile-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tile-unit { font-size: 13px; opacity: 0.85; margin-left: 4px; font-weight: 500; }

/* Profile description below preview tiles */
.profile-desc {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* CTA */
.cta-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.btn {
  background: var(--seb-blue);
  color: white;
  border: none;
  padding: 13px 28px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--seb-blue-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #b8c2cc !important; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: #b8c2cc !important; }
.btn.green { background: var(--seb-green); }
.btn.green:hover { background: var(--seb-green-dark); }
.btn.secondary {
  background: white;
  color: var(--seb-blue);
  border: 1.5px solid var(--seb-blue);
}
.btn.secondary:hover { background: #eef3f8; }

/* Disclaimer */
.disclaimer {
  background: #fff8e7;
  border: 1px solid #f0d98f;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13px;
  color: #6c5400;
  margin-top: 22px;
  line-height: 1.55;
}

/* Output page */
.output-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}
.metric {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.metric::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--seb-blue);
}
.metric.green::before { background: var(--seb-green); }
.metric-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.metric-value { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1.1; }
.metric-unit { font-size: 14px; color: var(--muted); margin-left: 4px; }
.metric-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Tenor toggle */
.tenor-toggle {
  display: inline-flex;
  background: #eef3f8;
  border-radius: 8px;
  padding: 4px;
  gap: 2px;
}
.tenor-toggle button {
  border: none;
  background: transparent;
  padding: 9px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.tenor-toggle button.active {
  background: var(--seb-blue);
  color: white;
  box-shadow: 0 2px 4px rgba(23, 104, 161, 0.2);
}
.tenor-toggle button:hover:not(.active) { color: var(--seb-blue); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

/* Summary callout */
.summary-callout {
  background: linear-gradient(135deg, #f4faed 0%, #eaf2fa 100%);
  border-left: 4px solid var(--seb-green);
  padding: 20px 24px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
}
.summary-callout strong { color: var(--seb-blue); }

/* Chart */
.chart-container {
  position: relative;
  height: 360px;
  margin-top: 12px;
}

/* Input page side-by-side layout */
.input-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 22px;
  align-items: start;
  margin-bottom: 24px;
}
.input-layout .input-col { display: flex; flex-direction: column; gap: 22px; }
.input-layout .chart-col { position: sticky; top: 18px; }
.input-layout .chart-card { margin-bottom: 0; }
.input-layout .chart-card .chart-container { height: 320px; }
@media (max-width: 980px) {
  .input-layout { grid-template-columns: 1fr; }
  .input-layout .chart-col { position: static; }
}

/* Loading overlay shown between Calculate click and output page */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #ffffff 0%, #eef3f8 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 220ms ease;
}
.loading-overlay.visible {
  display: flex;
  opacity: 1;
}
.loading-inner {
  text-align: center;
  max-width: 520px;
  padding: 32px 28px;
}
.loading-logo {
  width: 220px;
  max-width: 60%;
  height: auto;
  display: block;
  margin: 0 auto 28px;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.72; transform: scale(0.97); }
}
.loading-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 4px solid rgba(23, 104, 161, 0.15);
  border-top-color: var(--seb-blue);
  border-right-color: var(--seb-green);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--seb-blue);
  margin-bottom: 8px;
  line-height: 1.35;
}
.loading-sub {
  font-size: 14px;
  color: var(--muted);
  min-height: 1.6em;
  transition: opacity 200ms ease;
}
.loading-counter {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(23, 104, 161, 0.06);
  border: 1px solid rgba(23, 104, 161, 0.14);
  border-radius: 999px;
  font-family: 'Courier New', ui-monospace, monospace;
  font-size: 13px;
  color: var(--seb-blue);
  font-variant-numeric: tabular-nums;  /* keeps digit width stable so numbers don't shift */
}
.loading-counter #loading-counter {
  font-weight: 700;
  min-width: 5ch;
  text-align: right;
}
.loading-counter-label {
  color: var(--muted);
  font-weight: 500;
}
.loading-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--seb-green);
  box-shadow: 0 0 0 0 rgba(145, 192, 97, 0.7);
  animation: pulseDot 1.2s ease-out infinite;
}
@keyframes pulseDot {
  0%   { box-shadow: 0 0 0 0 rgba(145, 192, 97, 0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(145, 192, 97, 0); }
  100% { box-shadow: 0 0 0 0 rgba(145, 192, 97, 0); }
}

/* Detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 6px;
}
.detail-grid.three { grid-template-columns: repeat(3, 1fr); }
.detail {
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.detail-value { font-size: 18px; font-weight: 600; color: var(--text); }
.detail-unit { font-size: 12px; color: var(--muted); margin-left: 3px; }

/* PDF download card */
.pdf-download {
  margin-top: 22px;
  background: linear-gradient(135deg, #1d6fa9 0%, #17518a 100%);
  border-radius: var(--radius);
  padding: 40px 36px;
  color: white;
  text-align: center;
  box-shadow: 0 6px 24px rgba(23, 104, 161, 0.25);
}
.pdf-download h2 {
  color: white;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  margin: 0 0 10px;
}
.pdf-sub {
  color: rgba(255,255,255,0.88);
  font-size: 15px;
  margin: 0 auto 24px;
  max-width: 560px;
}
.pdf-perks {
  list-style: none;
  padding: 0;
  margin: 0 auto 24px;
  max-width: 560px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.pdf-perks li {
  position: relative;
  padding-left: 28px;
  color: rgba(255,255,255,0.92);
  font-size: 14px;
  line-height: 1.45;
}
.pdf-perks li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--seb-green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.pdf-form {
  display: flex;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto 12px;
  justify-content: center;
}
.pdf-form input[type="email"] {
  flex: 1;
  font-size: 15px;
  padding: 14px 18px 14px 44px;
  border-radius: 8px;
  border: none;
  background: white url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aab2bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z'/><polyline points='22,6 12,13 2,6'/></svg>") no-repeat 14px center / 18px;
  color: var(--text);
}
.pdf-form input[type="email"]:focus {
  outline: 2px solid var(--seb-green);
  outline-offset: 1px;
}
.pdf-form button {
  background: white;
  color: var(--seb-blue);
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .05s, background .15s;
}
.pdf-form button:hover { background: #f4faff; }
.pdf-form button:disabled { opacity: 0.65; cursor: not-allowed; }
.pdf-privacy {
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  margin: 8px 0 0;
}
.pdf-status {
  margin: 16px auto 0;
  max-width: 560px;
  font-size: 13px;
  min-height: 18px;
  color: rgba(255,255,255,0.92);
}
.pdf-status.ok { color: #d6f3bc; }
.pdf-status.error { color: #ffd1c9; }
.pdf-divider {
  position: relative;
  margin: 32px auto;
  max-width: 80%;
  text-align: center;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  font-size: 13px;
}
.pdf-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.25);
  z-index: 0;
}
.pdf-divider span {
  position: relative;
  background: #1968a3;
  padding: 4px 14px;
  border-radius: 12px;
  z-index: 1;
}
.btn-outline-white {
  display: inline-block;
  border: 1.5px solid white;
  color: white;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.btn-outline-white:hover { background: white; color: var(--seb-blue); }
.pdf-website-link {
  margin: 14px 0 0;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}
.pdf-website-link a {
  color: rgba(255,255,255,0.9);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .15s;
}
.pdf-website-link a:hover { color: white; }

@media (max-width: 600px) {
  .pdf-form { flex-direction: column; }
  .pdf-download { padding: 30px 22px; }
}

/* Empty / error state */
.no-data {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.no-data a { color: var(--seb-blue); font-weight: 600; }

/* Responsive */
@media (max-width: 740px) {
  .form-grid, .preview-grid, .output-hero { grid-template-columns: 1fr; }
  .goal-cards { grid-template-columns: 1fr; }
  .detail-grid, .detail-grid.three { grid-template-columns: repeat(2, 1fr); }
  .header-inner { flex-direction: column; gap: 14px; align-items: flex-start; }
}
