/* widget.us.com - Embeddable Widget Tools */

:root {
  --blue-dark: #1e3a5f;
  --blue-mid: #2563eb;
  --blue-light: #3b82f6;
  --blue-pale: #eff6ff;
  --blue-border: #bfdbfe;
  --green-confirm: #16a34a;
  --green-pale: #f0fdf4;
  --orange-accent: #ea580c;
  --orange-pale: #fff7ed;
  --text-primary: #1b1b1b;
  --text-secondary: #4a4a4a;
  --text-light: #6b6b6b;
  --bg-white: #ffffff;
  --bg-off: #f8fafc;
  --border-light: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1100px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  background: var(--bg-off);
}

a { color: var(--blue-mid); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--blue-dark); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* --- Header --- */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blue-dark);
}

.site-logo span { color: var(--blue-light); }

.nav-links { display: flex; gap: 24px; list-style: none; }
.nav-links a { font-size: 0.93rem; font-weight: 500; color: var(--text-secondary); }
.nav-links a:hover { color: var(--blue-mid); }
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

/* --- Hero (compact) --- */
.hero-compact {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
  color: #fff;
  padding: 40px 24px;
  text-align: center;
}

.hero-compact h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.hero-compact p {
  font-size: 1.05rem;
  opacity: 0.88;
  max-width: 560px;
  margin: 0 auto;
}

/* --- Calculator Container --- */
.calc-wrapper {
  max-width: 960px;
  margin: -32px auto 48px;
  position: relative;
  z-index: 10;
  padding: 0 24px;
}

.calc-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.calc-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.calc-inputs {
  padding: 36px 32px;
  border-right: 1px solid var(--border-light);
}

.calc-results {
  padding: 36px 32px;
  background: var(--bg-off);
}

.calc-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 24px;
}

/* --- Form Controls --- */
.form-group {
  margin-bottom: 20px;
}

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

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-hint {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 4px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn-calculate {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--blue-mid);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.btn-calculate:hover {
  background: var(--blue-dark);
}

/* --- Results Display --- */
.result-hero {
  text-align: center;
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.result-hero .label {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.result-hero .amount {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--blue-dark);
  line-height: 1;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.93rem;
}

.result-row:last-child {
  border-bottom: none;
}

.result-row .label {
  color: var(--text-secondary);
}

.result-row .value {
  font-weight: 600;
  color: var(--text-primary);
}

.result-row .value.highlight {
  color: var(--orange-accent);
}

/* --- Amortization Chart --- */
.chart-container {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.chart-container h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 16px;
}

.bar-chart {
  display: flex;
  height: 32px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.bar-principal {
  background: var(--blue-mid);
  transition: width 0.4s ease;
}

.bar-interest {
  background: var(--orange-accent);
  transition: width 0.4s ease;
}

.chart-legend {
  display: flex;
  gap: 20px;
  font-size: 0.82rem;
  color: var(--text-light);
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.principal { background: var(--blue-mid); }
.legend-dot.interest { background: var(--orange-accent); }

/* --- Amortization Table --- */
.amort-toggle {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 20px;
  background: var(--blue-pale);
  color: var(--blue-mid);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

.amort-toggle:hover {
  background: var(--blue-border);
}

.amort-table-wrap {
  display: none;
  margin-top: 16px;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.amort-table-wrap.open {
  display: block;
}

.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.amort-table th {
  position: sticky;
  top: 0;
  background: var(--blue-dark);
  color: #fff;
  padding: 8px 10px;
  text-align: right;
  font-weight: 600;
}

.amort-table th:first-child { text-align: center; }

.amort-table td {
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.amort-table td:first-child {
  text-align: center;
  color: var(--text-light);
}

.amort-table tbody tr:hover {
  background: var(--blue-pale);
}

/* --- Widget Cards (homepage) --- */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.widget-card {
  display: block;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.widget-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--blue-light);
}

.widget-card .icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.widget-card h3 {
  font-size: 1.1rem;
  color: var(--blue-dark);
  margin-bottom: 8px;
}

.widget-card p {
  font-size: 0.9rem;
  color: var(--text-light);
}

.widget-card .tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green-confirm);
  background: var(--green-pale);
  padding: 3px 10px;
  border-radius: 50px;
}

/* --- Section --- */
.section { padding: 56px 24px; }
.section-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 12px; color: var(--blue-dark); }
.section-subtitle { text-align: center; color: var(--text-light); font-size: 0.95rem; max-width: 520px; margin: 0 auto 36px; }

/* --- Footer --- */
.site-footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.7);
  padding: 36px 24px 24px;
  margin-top: 48px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-col h4 { color: #fff; font-size: 0.95rem; margin-bottom: 10px; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 6px; }
.footer-col a { color: rgba(255,255,255,0.6); font-size: 0.88rem; }
.footer-col a:hover { color: #fff; }

.footer-bottom {
  max-width: var(--max-width);
  margin: 24px auto 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.12);
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
}

/* --- Embed Mode (strips chrome when loaded via ?embed=1) --- */
body.embed-mode { background: #fff; margin: 0; }
body.embed-mode .site-header,
body.embed-mode .hero-compact,
body.embed-mode .site-footer,
body.embed-mode .embed-section,
body.embed-mode .section { display: none !important; }

.embed-badge {
  display: none;
  text-align: center;
  padding: 10px 0;
  font-size: 0.78rem;
  color: var(--text-light);
}
.embed-badge a { color: var(--blue-mid); font-weight: 600; }
body.embed-mode .embed-badge { display: block; }

/* --- Embed Section (shown on full page) --- */
.embed-section {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px 48px;
}
.embed-section .embed-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}
.embed-section .embed-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 8px;
}
.embed-section .embed-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.embed-section textarea {
  width: 100%;
  height: 100px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
  resize: vertical;
  background: var(--bg-off);
}
.embed-section .copy-embed-btn {
  margin-top: 10px;
  padding: 9px 20px;
  background: var(--bg-white);
  color: var(--blue-mid);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.embed-section .copy-embed-btn:hover { background: var(--blue-pale); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .calc-body {
    grid-template-columns: 1fr;
  }

  .calc-inputs {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 28px 24px;
  }

  .calc-results {
    padding: 28px 24px;
  }

  .result-hero .amount {
    font-size: 2.2rem;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .hero-compact h1 {
    font-size: 1.6rem;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    padding: 16px 24px;
    gap: 14px;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }

  .footer-inner { flex-direction: column; }
  .widget-grid { grid-template-columns: 1fr; }
}
