/* static/style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #1a1a1a;
  background: #fff;
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem;
}

h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); margin-bottom: 0.5rem; }
h2 { font-size: 1.4rem; margin: 2rem 0 0.75rem; border-bottom: 2px solid #e0e0e0; padding-bottom: 0.25rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
p  { margin-bottom: 1rem; }

/* Calculator wrapper */
.calc-wrapper { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 1.5rem; margin: 1.5rem 0; }
@media (max-width: 400px) { .calc-wrapper { padding: 1rem; } }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 1.5rem; border-bottom: 2px solid #dee2e6; }
.tab-btn {
  padding: 0.5rem 1.25rem;
  border: none; border-bottom: 3px solid transparent;
  background: none; cursor: pointer; font-size: 1rem;
  color: #666; margin-bottom: -2px;
}
.tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 0.25rem; }
.form-group label { font-size: 0.9rem; font-weight: 500; color: #444; }
.form-group input, .form-group select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ced4da; border-radius: 6px;
  font-size: 1rem; width: 100%;
}
.input-currency { display: flex; gap: 4px; }
.input-currency select { width: auto; min-width: 100px; }
.input-currency input { flex: 1; }

/* Calculate button */
.btn-calc {
  margin-top: 1.25rem;
  padding: 0.75rem 2rem;
  background: #2563eb; color: #fff;
  border: none; border-radius: 6px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer; width: 100%;
}
.btn-calc:hover { background: #1d4ed8; }

/* Results */
#results-section { margin-top: 1.5rem; }
.results-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.result-card { background: #fff; border: 1px solid #dee2e6; border-radius: 8px; padding: 1rem; text-align: center; }
.result-card .label { font-size: 0.8rem; color: #666; text-transform: uppercase; letter-spacing: 0.05em; }
.result-card .value { font-size: clamp(1.1rem, 4vw, 1.5rem); font-weight: 700; color: #2563eb; margin-top: 0.25rem; }

/* Chart */
#chart-container { margin: 1.5rem 0; }

/* Amortization table */
.table-controls { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.btn-sm {
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  border: 1px solid #ced4da; border-radius: 4px;
  background: #fff; cursor: pointer; font-size: 0.875rem;
}
.btn-sm:hover { background: #f8f9fa; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { background: #f1f3f5; padding: 0.5rem 0.75rem; text-align: left; font-weight: 600; white-space: nowrap; }
td { padding: 0.4rem 0.75rem; border-bottom: 1px solid #f1f3f5; }
tr:hover td { background: #f8f9fa; }

/* Field tooltip */
.field-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  min-height: 1.4em;
  font-size: 0.85em;
  color: #6b7280;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
}
.field-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 0.4rem 0.65rem;
  border-radius: 5px;
  white-space: normal;
  width: max-content;
  max-width: min(260px, calc(100vw - 2rem));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
.field-tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
.field-tip:hover::after,
.field-tip:hover::before,
.field-tip.tip-open::after,
.field-tip.tip-open::before { opacity: 1; }

/* Article body */
.article-body { margin-top: 2rem; }
.formula-block {
  background: #f8f9fa; border-left: 4px solid #2563eb;
  padding: 1rem 1.25rem; margin: 1rem 0;
  font-family: monospace; font-size: 1.1rem;
}
.comparison-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.comparison-table th, .comparison-table td { padding: 0.5rem 0.75rem; border: 1px solid #dee2e6; }
.comparison-table th { background: #f1f3f5; }

/* FAQ */
.faq-item { border-bottom: 1px solid #e0e0e0; }
.faq-question {
  width: 100%; background: none; border: none; text-align: left;
  padding: 1rem 2rem 1rem 0; font-size: 1rem; font-weight: 600;
  color: #1a1a1a; cursor: pointer; position: relative;
}
.faq-question::after {
  content: '+'; position: absolute; right: 0; top: 50%;
  transform: translateY(-50%); font-size: 1.4rem; color: #2563eb;
  transition: transform 0.2s;
}
.faq-question[aria-expanded="true"]::after { content: '−'; }
.faq-answer { display: none; padding-bottom: 1rem; }
.faq-answer.open { display: block; }

/* Footer cross-links */
.lang-links { display: flex; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 1rem; padding-top: 1rem; border-top: 1px solid #dee2e6; }
.lang-links a { color: #2563eb; text-decoration: none; font-size: 0.9rem; }
.lang-links a:hover { text-decoration: underline; }

/* AdSense placeholders */
.adsense-unit { min-height: 90px; background: #f8f9fa; border: 1px dashed #dee2e6; margin: 1.5rem 0; display: flex; align-items: center; justify-content: center; color: #999; font-size: 0.8rem; }

/* Affiliate placeholder — hidden at launch */
.affiliate-section { display: none; }
