/* ==========================================================================
   提前还贷在线计算器 - Design System & Modern Stylesheet
   Theme: Fresh Mint & Emerald / Glassmorphism / Clean Responsive Layout
   Website: http://www.hui1111.cn/tools/prepayloancalc
   ========================================================================== */

/* 1. Design Tokens & CSS Variables */
:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #ccfbf1;
  --primary-gradient: linear-gradient(135deg, #0d9488 0%, #059669 100%);
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --gold-gradient: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  
  --bg-main: #f4f7f6;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-dark: #0f172a;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  --border-color: #e2e8f0;
  --border-focus: #0d9488;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(13, 148, 136, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Global Reset & Basic Styling */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  color: var(--text-main);
  background-color: var(--bg-main);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  background: radial-gradient(circle at 10% 10%, rgba(13, 148, 136, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 90% 90%, rgba(59, 130, 246, 0.04) 0%, transparent 40%),
              var(--bg-main);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* 3. Header & Navigation */
.site-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-main);
}

.brand-logo svg {
  width: 36px;
  height: 36px;
  color: var(--primary);
}

.brand-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--primary-light);
  color: var(--primary-hover);
  border-radius: var(--radius-full);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

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

/* 4. Hero Banner Header Section */
.hero-section {
  padding: 2rem 0 1rem;
  text-align: center;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero-title span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 1.5rem;
}

/* 5. Main Calculator Workspace Grid */
.calculator-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 992px) {
  .calculator-workspace {
    grid-template-columns: 1fr;
  }
}

.calc-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.calc-card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-title svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.form-label-hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.input-control {
  width: 100%;
  height: 46px;
  padding: 0 3.5rem 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition-fast);
}

.input-control:focus {
  border-color: var(--border-focus);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.input-unit {
  position: absolute;
  right: 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* Preset Buttons Pills */
.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.preset-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

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

/* Radio & Switch Button Groups */
.segmented-control {
  display: flex;
  background: var(--bg-card-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.segmented-control label {
  flex: 1;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.segmented-control input[type="radio"] {
  display: none;
}

.segmented-control input[type="radio"]:checked + span {
  color: var(--primary-hover);
  font-weight: 700;
}

.segmented-control label:has(input[type="radio"]:checked) {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Row Dual Inputs */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

/* Action Buttons */
.btn-submit {
  width: 100%;
  height: 50px;
  background: var(--primary-gradient);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
}

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

/* 6. Results KPI Section (Right Column) */
.results-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  display: flex;
  flex-direction: column;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-box.highlight {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border-color: #a7f3d0;
}

.kpi-box.highlight .kpi-value {
  color: #047857;
}

.kpi-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Comparison Bar / Badges */
.comparison-box {
  background: var(--bg-dark);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.comp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #94a3b8;
}

.comp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.95rem;
}

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

.comp-label {
  color: #cbd5e1;
}

.comp-val {
  font-weight: 700;
  color: #38bdf8;
}

.comp-val.accent {
  color: #34d399;
}

/* 7. Decision Helper Module (决策辅助模块) */
.decision-card {
  margin-top: 1rem;
  background: #ffffff;
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.decision-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.decision-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.decision-badge.recommend {
  background: #d1fae5;
  color: #065f46;
}

.decision-badge.not-recommend {
  background: #fef3c7;
  color: #92400e;
}

.decision-badge.neutral {
  background: #e0f2fe;
  color: #075985;
}

.decision-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.slider-group {
  margin-top: 0.75rem;
}

.range-input {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.disclaimer-text {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.75rem;
  line-height: 1.4;
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
}

/* 8. Canvas Chart & Schedule Table Drawer */
.chart-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-bottom: 2.5rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-canvas-wrap {
  width: 100%;
  height: 280px;
  position: relative;
}

canvas {
  width: 100% !important;
  height: 100% !important;
}

.schedule-drawer {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.drawer-toggle {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: right;
}

.schedule-table th,
.schedule-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.schedule-table th {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.schedule-table tr:hover td {
  background-color: #f1f5f9;
}

/* 9. Ad Container Banner (Google AdSense Slot) */
.ad-banner-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 2.5rem;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  text-align: center;
  overflow: hidden;
}

/* 10. Middle Section: Formulas & Math Principles */
.section-block {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-bottom: 2.5rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary-light);
}

.section-title svg {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.formula-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

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

.formula-card {
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.formula-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-hover);
  margin-bottom: 0.75rem;
}

.formula-math-box {
  background: #ffffff;
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0.75rem 0;
  overflow-x: auto;
}

.formula-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 11. Bottom Section: Calculation Examples & Instruction Guide */
.example-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.example-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.75rem;
}

.example-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.example-list li {
  font-size: 0.92rem;
  color: var(--text-main);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.example-list li::before {
  content: "✔";
  color: #16a34a;
  font-weight: bold;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.faq-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-question:hover {
  color: var(--primary);
}

.faq-answer {
  padding: 0 1.25rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 12. Footer */
.site-footer {
  background: var(--bg-dark);
  color: #94a3b8;
  padding: 3rem 0 2rem;
  margin-top: auto;
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  color: #cbd5e1;
}

.footer-links a:hover {
  color: #38bdf8;
}

.copyright {
  font-size: 0.8rem;
  color: #64748b;
}

/* 13. Responsive Adaptations */
@media (max-width: 768px) {
  .hero-title {
    font-size: 1.7rem;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .nav-links {
    display: none; /* Mobile menu can be simplified */
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .calc-card {
    padding: 1.25rem;
  }
}
