/* HELOC Calculator - style.css */
/* Color palette: white background + blue-green primary (financial trust) */

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #99f6e4;
  --secondary: #1e40af;
  --secondary-light: #dbeafe;
  --bg: #ffffff;
  --bg-section: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-section);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}
/* Header */
.site-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary) 100%);
  color: #fff;
  padding: 20px 0;
  box-shadow: var(--shadow-md);
}

.site-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.site-header p {
  font-size: 0.95rem;
  opacity: 0.85;
  margin-top: 4px;
}

/* Main content */
.main-content {
  padding: 32px 0 48px;
}

/* Card */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-light);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: 100px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(255,255,255,0.6);
  color: var(--text);
}

.tab-btn.active {
  background: var(--bg);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.tab-content,
.tab-panel { display: none; }

.tab-content.active,
.tab-panel.active { display: block; }
/* Form inputs */
.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}

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

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-block { width: 100%; margin-top: 8px; }
/* Result cards */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s;
}

.result-card:hover { box-shadow: var(--shadow-md); }

.result-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.result-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.2;
}

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

.result-card.highlight {
  border-color: var(--primary);
  background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
}

.result-card.highlight .value { color: var(--primary-dark); }

/* Pie chart container */
.chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}

.chart-wrap {
  position: relative;
  width: 200px;
  height: 200px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* Amortization table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--bg);
}

table.amort-table thead tr {
  background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
  color: #fff;
}

table.amort-table th {
  padding: 12px 14px;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

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

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

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

table.amort-table tbody tr:last-child td { border-bottom: none; }

table.amort-table tbody tr:nth-child(even) { background: var(--bg-section); }

table.amort-table tbody tr:hover { background: #f0fdfa; }

table.amort-table tfoot tr {
  background: var(--secondary-light);
  font-weight: 700;
}

table.amort-table tfoot td {
  border-top: 2px solid var(--primary-light);
  color: var(--secondary);
}

/* Table pagination */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.table-controls .page-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  gap: 4px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}

.pagination button:hover { background: var(--bg-section); }
.pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
/* Comparison section */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .comparison-grid { grid-template-columns: 1fr; }
}

.comparison-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.comparison-col .col-header {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
}

.comparison-col:first-child .col-header { background: var(--primary); }
.comparison-col:last-child .col-header { background: var(--secondary); }

.comparison-col .col-body { padding: 16px; }

/* Info tooltip */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
}

/* Alert / notice */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border-left: 4px solid;
}

.notice-info {
  background: var(--secondary-light);
  border-color: var(--secondary);
  color: var(--secondary);
}

.notice-warning {
  background: #fffbeb;
  border-color: var(--warning);
  color: #92400e;
}

/* Footer */
.site-footer {
  background: var(--text);
  color: #94a3b8;
  text-align: center;
  padding: 20px 0;
  font-size: 0.82rem;
  margin-top: 48px;
}

.site-footer a { color: var(--primary-light); }

/* Responsive */
@media (max-width: 768px) {
  .site-header h1 { font-size: 1.4rem; }
  .card { padding: 16px; }
  .result-card .value { font-size: 1.2rem; }
  .tabs { gap: 1px; }
  .tab-btn { padding: 9px 10px; font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .results-grid { grid-template-columns: 1fr 1fr; }
  .chart-wrap { width: 160px; height: 160px; }
}

/* Outline button */
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 7px 16px;
  font-size: 0.875rem;
  font-weight: 500;
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

/* FAQ */
.faq { margin-top: 8px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-q {
  background: var(--bg-section);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 0.95rem;
}
.faq-a {
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text);
  border-top: 1px solid var(--border);
}

/* SEO content section */
.seo-content {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 48px 0;
}
.seo-content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 1.8rem 0 0.6rem;
}
.seo-content h2:first-child { margin-top: 0; }
.seo-content p {
  margin-bottom: 0.8rem;
  color: var(--text);
  line-height: 1.75;
}

/* Utility */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ── New Design Additions (v2) ─────────────────────────────────────── */

/* Material Symbols */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

/* Glass card */
.glass-card {
  background: rgba(216, 227, 251, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Power gradient */
.power-gradient {
  background: linear-gradient(135deg, #115cb9 0%, #002147 100%);
}

/* Range slider */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #d8e3fb;
  outline: none;
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #115cb9;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(17,92,185,0.35);
  transition: box-shadow 0.2s;
}
input[type='range']::-webkit-slider-thumb:hover {
  box-shadow: 0 4px 12px rgba(17,92,185,0.5);
}
input[type='range']::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: #115cb9;
  cursor: pointer;
}

/* Bar chart */
#drawBar, #repayBar {
  transition: height 0.6s cubic-bezier(0.4,0,0.2,1);
  min-height: 8px;
}

/* Metric card */
.metric-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s;
}
.metric-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.metric-card .metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #44474e;
  margin-bottom: 6px;
}
.metric-card .metric-value {
  font-family: 'Manrope', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: #002147;
  line-height: 1.1;
}
.metric-card.highlight {
  background: linear-gradient(135deg, #f0f3ff 0%, #e7eeff 100%);
  border: 1.5px solid #115cb9;
}
.metric-card.highlight .metric-value { color: #115cb9; }

/* Display input — looks like bold text, editable on click */
.display-input {
  font-family: 'Manrope', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #115cb9;
  background: transparent;
  border: none;
  border-bottom: 1.5px dashed transparent;
  outline: none;
  width: 7.5ch;
  text-align: right;
  padding: 0;
  cursor: text;
  transition: border-color 0.15s, background 0.15s;
  -moz-appearance: textfield;
}
.display-input::-webkit-outer-spin-button,
.display-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.display-input:hover {
  border-bottom-color: #115cb9;
}
.display-input:focus {
  border-bottom-color: #115cb9;
  background: rgba(17,92,185,0.06);
  border-radius: 4px 4px 0 0;
  padding: 0 4px;
}
.display-input-pct { width: 5ch; }
.display-input-yr  { width: 4ch; }
