/* ========================================
   AffordMortCalc.com - 全站标准化重构样式
   配色：金融蓝 #1E50A0 | 深灰 #334155 | 背景 #F8FAFC
   ======================================== */

:root {
  /* 主配色 - 金融蓝（房贷、房产理财赛道专属）*/
  --primary: #1E50A0;
  --primary-dark: #163A73;
  --primary-light: #E8F0FE;
  
  /* 辅助色 */
  --secondary: #334155;
  --success: #16A34A;
  --warning: #F59E0B;
  --error: #DC2626;
  
  /* 背景与卡片 */
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-section: #F1F5F9;
  
  /* 文字 */
  --text-primary: #1E293B;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  
  /* 边框 */
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  
  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(30,80,160,0.06);
  --shadow-md: 0 4px 12px rgba(30,80,160,0.09);
  --shadow-lg: 0 8px 24px rgba(30,80,160,0.12);
  
  /* 间距 */
  --radius: 12px;
  --radius-lg: 16px;
  
  /* 容器 */
  --max-width: 1200px;
}

/* ========================================
   全局重置
   ======================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   全局容器 1200px（全站统一）
   ======================================== */
.container {
  max-width: var(--max-width);
  width: 92%;
  margin: 0 auto;
  padding: 0 12px;
}

/* ========================================
   三行导航栏（参考 EVHomeSavings 布局）
   Row 1: Logo | Row 2: 蓝色主导航(计算器) | Row 3: 辅助导航
   ======================================== */
.three-row-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.nav-row {
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  width: 92%;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  align-items: center;
}

/* ---- Row 1: Logo 行 ---- */
.nav-row-logo {
  background: #fff;
  padding: 14px 0;
  border-bottom: 1px solid #e2e8f0;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo:hover {
  text-decoration: none;
}

.logo-icon {
  font-size: 22px;
  line-height: 1;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.logo-dot {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.logo-row-actions {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 8px;
}

/* ---- Row 2: 蓝色主导航（所有计算器平铺）---- */
.nav-row-main {
  background: var(--primary);
  padding: 0;
  border-bottom: none;
}

.nav-row-main .nav-inner {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 16px;
  flex-wrap: wrap;
}

.nav-row-main .nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-row-main a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  padding: 12px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.nav-row-main a:hover {
  background: rgba(255,255,255,0.1);
  border-bottom-color: #60a5fa;
  text-decoration: none;
}

/* 当前页高亮（主行：深蓝底）*/
.nav-row-main a.active {
  background: rgba(255,255,255,0.16);
  border-bottom-color: #FFD166;
  color: #fff;
  font-weight: 700;
}

.nav-sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
}

/* ---- Row 3: 辅助导航（浅色底）---- */
.nav-row-secondary {
  background: var(--bg-section);
  padding: 0;
}

.nav-row-secondary .nav-inner {
  justify-content: center;
  padding: 0 16px;
  min-height: 42px;
}

.nav-secondary-links {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-secondary-links::-webkit-scrollbar {
  display: none;
}

.nav-secondary-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: color 0.2s;
  flex-shrink: 0;
}

.nav-secondary-links a:hover {
  color: var(--primary);
  text-decoration: none;
}

/* 当前页高亮（辅助行：浅色底）*/
.nav-secondary-links a.active {
  color: var(--primary);
  font-weight: 700;
  border-bottom: 2px solid var(--primary);
}

.theme-toggle-desktop {
  display: flex;
  flex-shrink: 0;
  margin-left: 12px;
}

/* 夜间模式切换按钮 */
.theme-toggle {
  background: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.1);
}

/* 汉堡菜单按钮（移动端）*/
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 3px;
  transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* 移动端菜单遮罩层 */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-overlay.active {
  display: block;
  opacity: 1;
}

/* 深色模式变量 */
[data-theme="dark"] {
  --bg-page: #0F172A;
  --bg-card: #1E293B;
  --bg-section: #334155;
  --text-primary: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --border: #475569;
  --border-light: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

[data-theme="dark"] .three-row-nav {
  background: #1E293B;
}

[data-theme="dark"] .nav-row-logo {
  background: #1E293B;
  border-bottom-color: #334155;
}

[data-theme="dark"] .nav-row-secondary {
  background: #0F172A;
  border-bottom-color: #1E293B;
}

[data-theme="dark"] .site-footer {
  background: #0F172A;
}

[data-theme="dark"] .calculator-box {
  background: #1E293B;
  border-color: #334155;
}

[data-theme="dark"] input,
[data-theme="dark"] select {
  background: #334155;
  color: #F1F5F9;
  border-color: #475569;
}

[data-theme="dark"] .theme-toggle {
  border-color: #475569;
}

[data-theme="dark"] .theme-toggle:hover {
  background: #334155;
}

/* ========================================
   Hero 横幅
   ======================================== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #2563EB 100%);
  color: white;
  padding: 60px 24px;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.95;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ========================================
   计算器盒子（防广告遮挡核心容器）
   ======================================== */
.calculator-box {
  width: 100%;
  padding: 32px;
  margin: 36px 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.calculator-box h2 {
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.calculator-box h3 {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 12px;
}

/* Results table — clear column separation */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
  overflow: visible;
}

.results-table th,
.results-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.results-table th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.results-table tr:nth-child(even) td {
  background: var(--bg-alt);
}

.results-table td:first-child {
  font-weight: 600;
  color: var(--text-primary);
}

/* Amortization / comparison table — allow wrapping for large numbers */
.amortization-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9rem;
  table-layout: fixed;
}

.amortization-table th,
.amortization-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border-light);
  overflow-wrap: break-word;
  word-break: break-word;
}

.amortization-table th:first-child,
.amortization-table td:first-child {
  text-align: left;
}

.amortization-table th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.amortization-table tr:nth-child(even) td {
  background: var(--bg-alt);
}

/* ========================================
   表单元素
   ======================================== */
label {
  display: block;
  margin-top: 20px;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

input[type="number"],
input[type="text"],
input[type="email"],
select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-card);
  font-family: inherit;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,80,160,0.1);
}

/* ========================================
   Rent vs Buy 紧凑表单（输入框 2–3 列栅格）
   ======================================== */
.rvb-form h2 {
  margin-top: 20px;
  margin-bottom: 10px;
}
.rvb-grid,
.rvb-grid-3 {
  display: grid;
  gap: 14px 18px;
  margin-top: 12px;
}
.rvb-grid { grid-template-columns: repeat(2, 1fr); }
.rvb-grid-3 { grid-template-columns: repeat(3, 1fr); }
.rvb-field {
  display: flex;
  flex-direction: column;
}
.rvb-field label {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.rvb-field input,
.rvb-field select {
  width: 100%;
  padding: 11px 13px;
  font-size: 0.95rem;
}
@media (max-width: 620px) {
  .rvb-grid, .rvb-grid-3 { grid-template-columns: 1fr; }
}

/* ========================================
   按钮
   ======================================== */
button, .btn {
  background: var(--primary);
  color: white;
  padding: 14px 32px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: inherit;
}

button:hover, .btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--primary);
  border: 2px solid var(--primary);
}

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

/* ========================================
   结果展示
   ======================================== */
.result {
  background: var(--bg-section);
  border-left: 4px solid var(--success);
  padding: 24px;
  border-radius: 8px;
  margin-top: 24px;
  display: none;
}

.result h3 {
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.result table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
}

.result th, .result td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.result th {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

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

/* ========================================
   结果操作按钮（打印/分享/保存）
   ======================================== */
.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.result-actions button {
  padding: 10px 20px;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: none;
}

.result-actions button:hover {
  background: var(--bg-section);
  border-color: var(--primary);
  color: var(--primary);
  transform: none;
}

/* ========================================
   FAQ 区域
   ======================================== */
.faq-section {
  max-width: 1200px;
  margin: 60px auto;
  padding: 0 24px;
}

.faq-section h2 {
  color: var(--primary);
  margin-bottom: 30px;
  text-align: center;
  font-size: 1.8rem;
}

.faq-item {
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 18px 24px;
  background: none;
  border: none;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: inherit;
}

.faq-question:hover {
  background: var(--bg-section);
}

.faq-question:focus,
.faq-question:active,
.faq-item.active .faq-question {
  color: var(--text-primary);
  background: none;
}

.faq-question::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--primary);
  font-weight: 300;
}

.faq-item.active .faq-question::after {
  content: '−';
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 24px;
  background: var(--bg-section);
}

.faq-item.active .faq-answer {
  padding: 20px 24px;
  max-height: 500px;
  border-top: 1px solid var(--border);
}

.faq-answer p {
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ========================================
   工具卡片网格
   ======================================== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin: 40px 0;
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s;
  text-decoration: none;
  color: var(--text-primary);
  border: 2px solid transparent;
  display: block;
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--primary);
  color: var(--text-primary);
  text-decoration: none;
}

.tool-card h3 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 1.15rem;
}

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

.tool-card .icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

/* ========================================
   页脚（统一页脚）
   ======================================== */
.site-footer {
  background: var(--text-primary);
  color: white;
  padding: 60px 24px 0;
  margin-top: 80px;
}

.footer-container {
  max-width: var(--max-width);
  width: 92%;
  margin: 0 auto;
  padding: 0 12px;
}

/* 网格布局：品牌区 + 3列链接 */
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px 32px;
  padding-bottom: 40px;
}

/* 左侧品牌区 */
.footer-brand {
  padding-right: 16px;
}

.footer-logo {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.footer-brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: white;
  letter-spacing: -0.2px;
}

.footer-brand-desc {
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  line-height: 1.7;
  margin: 0;
}

/* 链接列 */
.footer-col {
  min-width: 0;
}

.footer-col-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.5);
  margin: 0 0 14px;
}

.footer-col-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col-links li {
  margin-bottom: 9px;
}

.footer-col-links a {
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s;
}

.footer-col-links a:hover {
  color: #60A5FA;
}

/* 底部版权栏 */
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 20px 0;
  text-align: center;
}

.footer-bottom p {
  color: rgba(255,255,255,0.55);
  font-size: 0.82rem;
  margin: 0;
}

.footer-bottom a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-bottom a:hover {
  color: #60A5FA;
}

.footer-disclaimer {
  max-width: 900px;
  margin: 0 auto 12px !important;
  padding: 0 16px;
  line-height: 1.6;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.7) !important;
}

.footer-eeat {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
}

.footer-eeat a {
  color: #60A5FA;
}

/* ========================================
   权威外链区块
   ======================================== */
.authority-links {
  max-width: var(--max-width);
  width: 92%;
  margin: 40px auto;
  padding: 0 12px;
}

.authority-links h3 {
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.authority-links ul {
  list-style: disc;
  padding-left: 20px;
}

.authority-links li {
  margin-bottom: 8px;
  line-height: 1.8;
}

.authority-links a {
  color: var(--primary);
  font-weight: 500;
}

/* ========================================
   站群互链区块
   ======================================== */
.site-network {
  max-width: var(--max-width);
  width: 92%;
  margin: 40px auto;
  padding: 0 12px;
}

.site-network h3 {
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.site-network ul {
  list-style: disc;
  padding-left: 20px;
}

.site-network li {
  margin-bottom: 8px;
  line-height: 1.8;
}

.site-network a {
  color: var(--primary);
  font-weight: 500;
}

/* ========================================
   面包屑导航（Breadcrumb）
   ======================================== */
.breadcrumb {
  max-width: var(--max-width);
  width: 92%;
  margin: 0 auto;
  padding: 14px 12px 0;
}
.breadcrumb-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.4;
}
.breadcrumb-item {
  display: flex;
  align-items: center;
  color: var(--text-muted, #64748b);
}
.breadcrumb-item:not(:last-child)::after {
  content: "\203A";          /* › */
  margin-left: 8px;
  color: #cbd5e1;
  font-weight: 400;
}
.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
}
.breadcrumb-item a:hover {
  text-decoration: underline;
}
.breadcrumb-item.current {
  color: var(--text-secondary, #475569);
  font-weight: 600;
}

/* ========================================
   正文排版（SEO 450词正文规范）
   ======================================== */
.page-content {
  max-width: var(--max-width);
  width: 92%;
  margin: 0 auto;
  padding: 40px 12px;
}

.page-content h2 {
  color: var(--primary);
  font-size: 1.6rem;
  margin-top: 40px;
  margin-bottom: 20px;
  font-weight: 700;
}

.page-content h3 {
  color: var(--text-primary);
  font-size: 1.25rem;
  margin-top: 32px;
  margin-bottom: 16px;
  font-weight: 600;
}

.page-content p {
  line-height: 1.75;
  margin: 16px 0;
  color: var(--text-secondary);
}

.page-content ul, .page-content ol {
  padding-left: 24px;
  margin: 16px 0;
}

.page-content li {
  line-height: 1.75;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ========================================
   Tab 切换（首页双计算器）
   ======================================== */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border);
}

.tab-nav button {
  padding: 14px 28px;
  background: var(--bg-section);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -2px;
  border-bottom: 2px solid transparent;
}

.tab-nav button.active {
  background: var(--bg-card);
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.tab-nav button:hover {
  background: var(--bg-card);
  color: var(--primary);
  transform: none;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========================================
   响应式 — 移动端：三行导航变汉堡菜单
   ======================================== */

/* 汉堡菜单按钮 */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--text-primary);
  border-radius: 3px;
  transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* 移动端菜单遮罩层 */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-overlay.active {
  display: block;
  opacity: 1;
}

/* 移动端侧滑菜单面板（包含所有导航链接）*/
.mobile-menu-panel {
  display: none;
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  transition: right 0.3s ease;
  z-index: 999;
  overflow-y: auto;
  padding-top: 60px;
  flex-direction: column;
}

.mobile-menu-panel.active {
  right: 0;
}

.mobile-menu-section {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.mobile-menu-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
  padding: 8px 24px 4px;
}

.mobile-menu-panel a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s;
}

.mobile-menu-panel a:hover {
  background: var(--bg-section);
  color: var(--primary);
  text-decoration: none;
}

/* 当前页高亮（移动端侧滑菜单）*/
.mobile-menu-panel a.active {
  background: var(--bg-section);
  color: var(--primary);
  font-weight: 700;
}

.menu-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 700;
  padding: 10px 24px 6px;
}

/* ====== 平板/桌面端 (>768px)：显示完整三行导航 ====== */
@media (min-width: 769px) {
  .logo-row-actions {
    display: none;
  }

  .hamburger {
    display: none !important;
  }

  .mobile-menu-panel {
    display: none !important;
  }
}

/* ====== 移动端 (<=768px)：隐藏Row2/Row3，显示汉堡菜单 ====== */
@media (max-width: 768px) {
  /* Logo行：显示汉堡+夜间切换 */
  .logo-row-actions {
    display: flex;
  }

  /* 隐藏第二、三行 */
  .nav-row-main,
  .nav-row-secondary {
    display: none !important;
  }

  .theme-toggle-desktop {
    display: none !important;
  }

  /* 显示汉堡按钮 */
  .hamburger {
    display: flex;
  }

  /* 显示移动端面板容器 */
  .mobile-menu-panel {
    display: flex;
  }

  /* 导航整体紧凑些 */
  .nav-row-logo {
    padding: 10px 0;
  }

  .logo-text {
    font-size: 17px;
  }

  .logo-icon {
    font-size: 18px;
  }
}

/* 小屏微调 */
@media (max-width: 480px) {
  .nav-inner {
    padding: 0 8px;
  }

  .logo-text {
    font-size: 15px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-brand {
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
}

/* ====== 非导航元素移动端适配 ====== */
@media (max-width: 768px) {
  .hero {
    padding: 40px 16px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .calculator-box {
    padding: 20px;
    margin: 24px 0;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions button {
    width: 100%;
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px 20px;
  }

  .footer-brand {
    grid-column: 1 / -1;
    padding-right: 0;
    margin-bottom: 8px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .calculator-box {
    padding: 16px;
  }
}

/* ========================================
   Floating Action Bar (右下角悬浮按钮组)
   ======================================== */
.floating-bar {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fab-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  color: white;
  text-decoration: none;
}
.fab-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(30,80,160,0.35);
}
.fab-btn.top { background: #1E50A0; }
.fab-btn.print { background: #16a34a; }
.fab-btn.share { background: #2563eb; }

.fab-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
  transition: opacity 0.3s, transform 0.3s;
}
.fab-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Toast notification */
.print-toast {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: #1e293b;
  color: white;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  z-index: 10000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  animation: fadeInUp 0.25s ease-out;
  max-width: 280px;
  line-height: 1.5;
  pointer-events: none;
}
.print-toast .toast-key {
  background: rgba(255,255,255,0.15);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   州页面专用样式（State Guide Pages）
   ======================================== */

.state-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 32px 0;
}

.state-stat-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  text-align: center;
}

.state-stat-card h3 {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
  margin-top: 0;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  margin: 8px 0;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
}

.state-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px 32px;
  margin: 16px 0;
}

.info-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.info-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}

.state-program-card {
  background: #f8f9ff;
  padding: 24px;
  border-radius: var(--radius);
  margin-top: 12px;
}

.state-text-block {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 8px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.state-faq-item {
  margin-bottom: 14px;
  padding: 16px 18px;
  background: var(--bg-section);
  border-radius: var(--radius);
  cursor: pointer;
}

.state-faq-item summary {
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  outline: none;
}

.state-faq-item summary::-webkit-details-marker {
  display: none;
}

.state-faq-item p {
  margin-top: 12px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* 州指南：导语段落与相关链接 */
.lead-paragraph {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 18px 0 26px;
  padding: 18px 22px;
  background: var(--bg-section);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.related-links {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.related-links li {
  padding: 12px 16px;
  background: var(--bg-section);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  line-height: 1.6;
}

.related-links li a {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.related-links li a:hover {
  text-decoration: underline;
}

@media (min-width: 720px) {
  .related-links {
    grid-template-columns: 1fr 1fr;
  }
}

/* ========================================
   打印样式（隐藏悬浮按钮和Toast，优化图表显示）
   ======================================== */
@media print {
  .three-row-nav, .site-footer,
  .floating-bar, .print-toast, button, script, style,
  .hamburger, .theme-toggle, .nav-overlay {
    display: none !important;
  }
  
  .calculator-box, #afford-results, #refi-results, .result {
    display: block !important;
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  
  /* 确保图表在打印时正确显示 */
  canvas {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }
  
  /* 图表容器适配打印 */
  .chart-container, [class*="chart"] {
    max-width: 500px !important;
    margin: 20px auto !important;
    page-break-inside: avoid;
  }
  
  /* High-DPI canvas print optimization */
  canvas.chart-canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }
  
  table {
    page-break-inside: avoid;
    border-collapse: collapse;
    width: 100%;
  }
  
  th, td {
    border: 1px solid #000;
    padding: 8px;
  }
  
  /* 确保链接在打印时显示URL */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #666;
  }
  
  /* 隐藏外部链接的URL显示（避免过长）*/
  .authority-links a:after,
  .site-network a:after {
    display: none;
  }
  
  /* 确保图表在分页时不被截断 */
  .calculator-box {
    page-break-inside: avoid;
  }
  
  /* 隐藏图表动画（打印时不需要）*/
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ========================================
   计算结果动画效果
   ======================================== */
.result, .calculator-result {
  display: none;
  animation: slideInUp 0.4s ease-out;
}

.result.show, .calculator-result.show {
  display: block;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 数字动画效果 */
.result-value, .calc-result-number {
  display: inline-block;
  animation: countUp 0.6s ease-out;
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 输入框焦点动画 */
input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
select:focus {
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

/* 按钮点击反馈 */
button:active, .btn:active {
  transform: scale(0.98);
  transition: transform 0.1s;
}

/* 卡片悬停动画增强 */
.tool-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* FAQ展开动画优化 */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item.active .faq-answer {
  padding: 20px 24px;
  max-height: 500px;
  border-top: 1px solid var(--border);
}
