/* ========================================
   Credit Card Payoff Calculator — Styles
   Professional financial tool design
   ======================================== */

:root {
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #f59e0b;
  --accent-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --success: #10b981;
  --success-light: #ecfdf5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

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

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

/* ---- Navigation ---- */

.nav {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  overflow-x: auto;
}

.nav a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.15s;
}

.nav a:hover { background: var(--primary-light); color: var(--primary); }
.nav a.active { background: var(--primary); color: #fff; }

.nav-brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--text) !important;
  margin-right: 16px;
  padding-left: 0 !important;
}

.nav-brand:hover { background: transparent !important; color: var(--primary) !important; }

/* ---- Layout ---- */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Hero ---- */

.hero {
  text-align: center;
  padding: 56px 24px 40px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto;
}

/* ---- Calculator Card ---- */

.calc-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 36px;
  margin-bottom: 32px;
}

.calc-card.compact { padding: 28px; }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

@media (max-width: 768px) {
  .calc-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .calc-card { padding: 24px; }
}

/* ---- Input Fields ---- */

.input-group { margin-bottom: 20px; }

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.input-group .hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  pointer-events: none;
  z-index: 2;
}

.input-suffix {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  z-index: 2;
}

input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
  appearance: textfield;
}

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

input.with-prefix { padding-left: 32px; }
input.with-suffix { padding-right: 36px; }

input[type="number"]:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: #fff;
}

/* ---- Preset Buttons ---- */

.presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.preset-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.preset-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ---- Button ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}

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

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-secondary);
}

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

/* ---- Results Section ---- */

.results { display: none; }

.results.visible { display: block; }

.results-header {
  margin-bottom: 28px;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.result-status.free { background: var(--success-light); color: var(--success); }
.result-status.warn { background: var(--accent-light); color: #b45309; }

.result-big-number {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.result-big-label {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Summary Cards ---- */

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

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

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

.summary-card.accent { background: var(--accent-light); border-color: #fcd34d; }
.summary-card.danger { background: var(--danger-light); border-color: #fecaca; }
.summary-card.success { background: var(--success-light); border-color: #a7f3d0; }

.summary-card .label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.summary-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.summary-card .sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Comparison Table ---- */

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.comparison-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

.comparison-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.comparison-table .highlight { color: var(--success); font-weight: 600; }
.comparison-table .warn { color: var(--danger); font-weight: 600; }

/* ---- Amortization Table ---- */

.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.amort-table th {
  text-align: right;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

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

.amort-table td {
  text-align: right;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
}

.amort-table td:first-child { text-align: left; font-family: inherit; font-size: 14px; }

.amort-table .year-row { background: var(--bg); font-weight: 600; }
.amort-table .paid-off { color: var(--success); font-weight: 700; }

/* ---- Scenario Tabs ---- */

.scenario-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.scenario-tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.scenario-tab:hover { color: var(--text); }
.scenario-tab.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---- Info Section ---- */

.info-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 32px;
  margin-bottom: 32px;
}

.info-section h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.info-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--text);
}

.info-section p, .info-section li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.info-section ul, .info-section ol {
  padding-left: 24px;
  margin: 8px 0 16px;
}

.info-section li { margin-bottom: 6px; }

/* ---- Footer ---- */

.footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

.footer p {
  font-size: 13px;
  color: var(--text-muted);
}

.footer a { color: var(--text-secondary); }

/* ---- Tool Grid (long-tail pages) ---- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 32px 0;
}

.tool-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.tool-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tool-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.tool-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.tool-card h3 a:hover { color: var(--primary); }

.tool-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- Pie Chart ---- */

.pie-container {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px 0;
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.pie-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ---- Section Title ---- */

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 16px;
  color: var(--text);
}

/* ---- Disclaimer ---- */

.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 24px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
