@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8fafc;
  --nav: #0f172a;
  --primary: #2563eb;
  --emerald: #10b981;
  --amber: #f59e0b;
  --danger: #ef4444;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

/* ---- HEADER ---- */
header {
  background: var(--nav);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.logo span { color: #60a5fa; }

nav { display: flex; gap: 8px; align-items: center; }

nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}

nav a:hover { color: #fff; background: rgba(255,255,255,.1); }

.nav-cta {
  background: var(--primary) !important;
  color: #fff !important;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  padding: 4px;
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 80px 24px 72px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero p {
  font-size: 1.125rem;
  color: #94a3b8;
  max-width: 560px;
  margin: 0 auto 36px;
}

.trust-badges {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: #e2e8f0;
  padding: 8px 20px;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ---- MAIN CONTAINER ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.calc-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---- SECTION HEADERS ---- */
.section-header {
  margin: 56px 0 28px;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.section-header h3 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ---- CALCULATOR GRID (homepage) ---- */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-bottom: 60px;
}

.calc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.calc-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.icon-blue { background: #eff6ff; }
.icon-green { background: #f0fdf4; }
.icon-purple { background: #faf5ff; }
.icon-orange { background: #fff7ed; }
.icon-teal { background: #f0fdfa; }

.calc-card h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.calc-card p {
  font-size: 0.875rem;
  color: var(--muted);
  flex: 1;
}

.calc-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

/* ---- CALCULATOR PAGE LAYOUT ---- */
.page-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  padding: 40px 24px 36px;
  color: #fff;
}

.page-hero .breadcrumb {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 12px;
}

.page-hero .breadcrumb a { color: #60a5fa; text-decoration: none; }

.page-hero h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.3;
  margin-bottom: 8px;
}

.page-hero p {
  color: #94a3b8;
  font-size: 1rem;
}

/* ---- CARDS ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 20px; }

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group label .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.input-prefix {
  position: relative;
}

.input-prefix span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  pointer-events: none;
}

.input-prefix input { padding-left: 40px; }

input[type="range"] {
  width: 100%;
  margin-top: 8px;
  accent-color: var(--primary);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.toggle-group {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.toggle-group button {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.toggle-group button.active {
  background: var(--primary);
  color: #fff;
}

.quick-select {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.quick-btn {
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}

.quick-btn:hover, .quick-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}

/* ---- COLLAPSIBLE ---- */
.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 12px 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
}

.collapsible-header svg { transition: transform .2s; }
.collapsible-header.open svg { transform: rotate(180deg); }

.collapsible-body { display: none; padding-top: 8px; }
.collapsible-body.open { display: block; }

/* ---- RESULTS ---- */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.result-card.highlight {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #bfdbfe;
}

.result-card.emerald {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #a7f3d0;
}

.result-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.result-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}

.result-value.emerald { color: var(--emerald); }
.result-value.primary { color: var(--primary); }
.result-value.amber { color: var(--amber); }
.result-value.danger { color: var(--danger); }

.result-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.result-full {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-top: 16px;
}

/* ---- EXPLANATION BOXES ---- */
.explanation {
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
}

.explanation strong { color: var(--primary); }

.tip-box {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 0.875rem;
  display: flex;
  gap: 10px;
}

.tip-box .icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

.warning-box {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 0.875rem;
}

/* ---- DISCLAIMER ---- */
.disclaimer {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ---- SHARE BUTTON ---- */
.action-bar {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

.btn-outline {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ---- TABLES ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 12px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f1f5f9;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

/* ---- PROGRESS / CHART ---- */
.progress-bar-wrapper {
  margin: 12px 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}

.progress-track {
  height: 10px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  display: flex;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width .4s ease;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  margin-top: 16px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 4px;
}

.bar-fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height .4s ease;
}

.bar-label {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- INFO BANNER ---- */
.info-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: #1e40af;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* ---- FOOTER ---- */
footer {
  background: var(--nav);
  color: #94a3b8;
  margin-top: 80px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 24px 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .logo { font-size: 1.1rem; display: inline-block; margin-bottom: 12px; }

.footer-brand p {
  font-size: 0.85rem;
  line-height: 1.7;
  max-width: 280px;
}

.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #e2e8f0;
  margin-bottom: 14px;
}

.footer-col a {
  display: block;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 8px;
  transition: color .15s;
}

.footer-col a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
}

/* ---- UTILITY ---- */
.text-muted { color: var(--muted); }
.text-emerald { color: var(--emerald); }
.text-primary { color: var(--primary); }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.full-width { grid-column: 1 / -1; }

/* ---- MOBILE NAV ---- */
@media (max-width: 768px) {
  nav { display: none; }
  nav.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--nav); padding: 16px; gap: 4px; }
  .hamburger { display: block; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}

@media (max-width: 480px) {
  .calc-grid { grid-template-columns: 1fr; }
  .result-value { font-size: 1.4rem; }
  .hero { padding: 56px 20px 48px; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---- PRINT ---- */
@media print {
  header, footer, .action-bar, .hamburger { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .page-hero { background: #f1f5f9 !important; color: #000 !important; -webkit-print-color-adjust: exact; }
}
