/* ============================================================
   Shared site styles — FinCalcKit
   SaaS Modern Design Redux
   ============================================================ */

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

:root {
  --bg: #F9FAFB;        /* Slate 50 / Gray 50 */
  --paper: #FFFFFF;     /* White cards */
  --ink: #111827;       /* Gray 900 for high contrast text */
  --muted: #6B7280;     /* Gray 500 for secondary text */
  --line: #E5E7EB;      /* Gray 200 for borders */
  --accent: #059669;    /* Emerald 600 - Main Brand / Financial color */
  --accent-hover: #047857; /* Emerald 700 */
  --accent-soft: #ECFDF5;  /* Emerald 50 - Highlight backgrounds */
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 40px 20px 80px; }

/* ------------------------------------------------------------
   Site header / nav
   ------------------------------------------------------------ */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .bar {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.site-header .brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-header .brand .em { 
  color: var(--accent); 
  font-style: normal; 
}
.site-header nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.site-header nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-header nav a:hover,
.site-header nav a.active {
  color: var(--ink);
}
.site-header nav a.active {
  position: relative;
}
.site-header nav a.active::after {
  content: "";
  position: absolute;
  bottom: -22px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent);
}

/* ------------------------------------------------------------
   Page header (per-calculator title block)
   ------------------------------------------------------------ */
header.page-header { 
  margin-bottom: 32px; 
}
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
h1 { 
  font-size: 36px; 
  margin: 0; 
  font-weight: 800; 
  letter-spacing: -0.02em;
  line-height: 1.2;
}
h1 .em { 
  color: var(--accent); 
  font-style: normal; 
}
.sub { 
  color: var(--muted); 
  font-size: 16px; 
  margin-top: 12px; 
  max-width: 700px;
}

/* ------------------------------------------------------------
   Breadcrumb
   ------------------------------------------------------------ */
.breadcrumb {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 24px;
}
.breadcrumb a { 
  color: var(--muted); 
  text-decoration: none; 
  transition: color 0.15s ease;
}
.breadcrumb a:hover { 
  color: var(--ink); 
}

/* ------------------------------------------------------------
   Form grid / inputs
   ------------------------------------------------------------ */
form {
  background: var(--paper);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  margin-bottom: 32px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
  margin-bottom: 28px;
}
@media (max-width: 700px) { 
  .grid { grid-template-columns: 1fr; } 
  form { padding: 24px 20px; }
}

.field { display: flex; flex-direction: column; }
label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
input, select {
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2); /* Emerald ring */
}
input:hover, select:hover {
  border-color: #D1D5DB;
}

button.calc {
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}
button.calc:hover { 
  background: var(--accent-hover); 
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
button.calc:active {
  transform: translateY(0);
}

/* ------------------------------------------------------------
   Results (Dashboard Style)
   ------------------------------------------------------------ */
.results {
  margin-top: 32px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: none;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.results.show { display: block; }
.results .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--muted);
}
.results .row:last-child { border-bottom: none; }
.results .row .val { 
  font-weight: 700; 
  font-size: 18px; 
  color: var(--ink);
}
.results .highlight { 
  background: var(--accent-soft); 
  padding: 20px 24px;
}
.results .highlight span:first-child {
  color: var(--accent-hover);
  font-weight: 600;
}
.results .highlight .val { 
  color: var(--accent); 
  font-size: 24px;
  font-weight: 800;
}

.note {
  font-size: 14px;
  color: var(--muted);
  margin-top: 16px;
  padding: 16px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  line-height: 1.5;
}
.note strong { color: var(--ink); }

/* ------------------------------------------------------------
   Article / educational content
   ------------------------------------------------------------ */
article { 
  margin-top: 64px; 
  border-top: 1px solid var(--line); 
  padding-top: 40px; 
}
article h2 { 
  font-size: 24px; 
  font-weight: 700;
  margin-bottom: 16px; 
  letter-spacing: -0.01em;
}
article h3 { 
  font-size: 18px; 
  font-weight: 600;
  margin: 32px 0 12px; 
}
article p { 
  font-size: 16px; 
  color: var(--muted); 
  line-height: 1.7;
}

/* ------------------------------------------------------------
   Amortization / schedule tables
   ------------------------------------------------------------ */
.table-wrap { 
  max-height: 400px; 
  overflow-y: auto; 
  margin-top: 24px; 
  border: 1px solid var(--line); 
  border-radius: var(--radius-lg); 
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  /* Custom scrollbar for modern feel */
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}
.table-wrap::-webkit-scrollbar { width: 8px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background-color: #CBD5E1; border-radius: 4px; }

table.amort {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: right;
}
table.amort th, table.amort td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
table.amort th:first-child, table.amort td:first-child { text-align: left; }
table.amort th {
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: #F3F4F6;
  position: sticky;
  top: 0;
  z-index: 10;
}
table.amort tbody tr:hover {
  background: #F9FAFB;
}
.pmi-row td, .highlight-row td { 
  color: var(--accent); 
  font-weight: 600; 
  background: var(--accent-soft) !important;
}

/* ------------------------------------------------------------
   Ad slots
   ------------------------------------------------------------ */
.ad-slot {
  margin: 40px auto;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9CA3AF; /* Gray 400 */
}
.ad-slot .ad-inner {
  border: 1px dashed #D1D5DB;
  border-radius: var(--radius);
  padding: 32px 20px;
  background: #F9FAFB;
  transition: background 0.2s ease;
}
.ad-slot .ad-inner:hover {
  background: var(--paper);
}

/* ------------------------------------------------------------
   Calculator index / cards (home page)
   ------------------------------------------------------------ */
.intro { 
  color: var(--muted); 
  font-size: 18px; 
  max-width: 680px; 
  margin: 0 0 40px; 
  line-height: 1.6;
}

.category { margin-top: 56px; }
.category h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.category .category-desc {
  color: var(--muted);
  font-size: 15px;
  margin: 12px 0 24px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 700px) { .card-grid { grid-template-columns: 1fr; } }

.calc-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.calc-card:hover { 
  border-color: var(--accent); 
  transform: translateY(-3px); 
  box-shadow: var(--shadow-md);
}
.calc-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  line-height: 1.4;
}
.calc-card p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  flex-grow: 1;
}
.calc-card .tag {
  align-self: flex-start;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.calc-card.coming-soon {
  opacity: 0.6;
  pointer-events: none;
  border-style: dashed;
}
.calc-card.coming-soon .tag { 
  color: var(--muted); 
  background: #F3F4F6;
}

/* ------------------------------------------------------------
   Dynamic debt list (debt payoff calculators)
   ------------------------------------------------------------ */
.debt-list { margin-bottom: 16px; }
.debt-list-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 36px;
  gap: 12px;
  padding: 0 4px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.debt-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 36px;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
}
.debt-row input { width: 100%; }
.remove-debt {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  width: 36px;
  height: 36px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.remove-debt:hover { border-color: #DC2626; color: #DC2626; }
.add-debt-btn {
  background: none;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  width: 100%;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 24px;
}
.add-debt-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 700px) {
  .debt-list-header { display: none; }
  .debt-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "balance apr"
      "min remove";
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
  }
  .debt-row input:nth-child(1) { grid-area: name; }
  .debt-row input:nth-child(2) { grid-area: balance; }
  .debt-row input:nth-child(3) { grid-area: apr; }
  .debt-row input:nth-child(4) { grid-area: min; }
  .remove-debt { grid-area: remove; justify-self: end; }
}

/* ------------------------------------------------------------
   Strategy comparison cards
   ------------------------------------------------------------ */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 32px;
}
@media (max-width: 700px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.compare-card.winner { border-color: var(--accent); border-width: 2px; }
.compare-card h3 {
  margin: 0;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  background: #F3F4F6;
  border-bottom: 1px solid var(--line);
}
.compare-card.winner h3 { background: var(--accent-soft); color: var(--accent-hover); }
.compare-card .badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 8px;
}
.compare-card .row {
  display: flex;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.compare-card .row:last-child { border-bottom: none; }
.compare-card .row .val { font-weight: 700; color: var(--ink); }
.compare-card .order-list {
  padding: 14px 20px;
  font-size: 13px;
  color: var(--muted);
}
.compare-card .order-list ol { margin: 4px 0 0; padding-left: 20px; }

/* ------------------------------------------------------------
   Rating badges (DTI and similar ratio calculators)
   ------------------------------------------------------------ */
.rating-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 4px;
  margin-left: 10px;
  vertical-align: middle;
}
.rating-good { color: var(--accent-hover); background: var(--accent-soft); }
.rating-ok { color: #B45309; background: #FFFBEB; }
.rating-high { color: #DC2626; background: #FEF2F2; }

/* ------------------------------------------------------------
   Site footer
   ------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  margin-top: 80px;
}
.site-footer .bar {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 20px;
  font-size: 14px;
  color: var(--muted);
}
.site-footer .bar p { margin: 0 0 16px; }
.site-footer .links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.site-footer .links a { 
  color: var(--muted); 
  text-decoration: none; 
  font-weight: 500;
  transition: color 0.15s ease;
}
.site-footer .links a:hover { color: var(--ink); }
.site-footer .disclaimer { 
  font-size: 12px; 
  line-height: 1.6; 
  color: #9CA3AF;
  max-width: 800px;
}
