/* ================================================
   基金理财助手 — 手机端专属样式 v1
   Mobile-First Enhancement Layer
   ================================================ */

/* === 底部Tab导航 === */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: rgba(255,255,255,.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid #e2e8f0; padding: 6px 0 env(safe-area-inset-bottom, 6px);
  justify-content: space-around; align-items: flex-start;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: #94a3b8; font-size: .65rem; font-weight: 500;
  padding: 4px 8px; min-width: 52px; transition: color .15s;
}
.mobile-nav-item.active { color: #3b82f6; }
.mobile-nav-icon { font-size: 1.25rem; line-height: 1; }
.mobile-nav-dot {
  width: 4px; height: 4px; border-radius: 50%; background: #3b82f6;
  opacity: 0; transition: opacity .15s;
}
.mobile-nav-item.active .mobile-nav-dot { opacity: 1; }

/* === 顶部导航手机端隐藏 + 底部显示 === */
@media (max-width: 768px) {
  .navbar { position: sticky; top: 0; }
  .navbar-menu { display: none !important; }
  .navbar-right { display: none; }
  .nav-toggle { display: none !important; }
  .mobile-nav { display: flex; }

  /* 页面底部留出Tab高度 */
  body { padding-bottom: 70px; }
  .main-content { min-height: calc(100vh - 60px - 110px); }
  .footer { margin-bottom: 56px; padding: .75rem; font-size: .7rem; }

  /* === 统计卡片2列 === */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: .85rem 1rem; }
  .stat-value { font-size: 1.25rem; }

  /* === 图表行纵向 === */
  .chart-row { grid-template-columns: 1fr; gap: 8px; }
  .chart-card { padding: .75rem; }

  /* === 持仓表格 → 竖排卡片 === */
  .table-card { background: transparent; border: none; overflow: visible; }
  .holdings-table, .holdings-table tbody, .holdings-table thead { display: block; }
  .holdings-table thead { display: none; }
  .holdings-table tbody { display: flex; flex-direction: column; gap: 8px; }
  .holdings-table tr {
    display: flex; flex-wrap: wrap; gap: 8px 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; position: relative;
  }
  .holdings-table td {
    border: none; padding: 0; font-size: .85rem;
  }
  .holdings-table td:nth-child(1) { width: 100%; order: 0; }
  .holdings-table td:nth-child(5) { width: 50%; order: 1; }
  .holdings-table td:nth-child(4) { width: 50%; order: 2; text-align: right; }
  .holdings-table td:nth-child(6) { width: 50%; order: 3; }
  .holdings-table td:nth-child(7) { width: 50%; order: 4; text-align: right; font-size: 1rem; }
  /* 隐藏列 */
  .hide-sm { display: none; }

  .fund-name-link { font-size: .95rem; }
  .nav-date, .profit-rate, .daily-profit-cell { font-size: .75rem; }

  /* 卡片标签式显示 */
  .holdings-table td:nth-child(1)::before { display: none; }

  /* === 排行榜 === */
  .rank-row { padding: 10px 12px; }
  .rank-gain { font-size: .9rem; min-width: 80px; }
  .rank-name { font-size: .85rem; }
  .rank-tabs { gap: 4px; }
  .rank-tab { padding: 5px 12px; font-size: .8rem; }

  /* === VIP卡 === */
  .vip-card-grid { grid-template-columns: 1fr; gap: 12px; }
  .vip-hero-card { flex-direction: column; text-align: center; gap: 1rem; padding: 1.25rem; }
  .vip-hero-right { flex-wrap: wrap; justify-content: center; gap: 16px; }
  .vip-hero-icon { font-size: 2.5rem; }

  /* === 推荐页 === */
  .recommend-grid { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .calc-stats { grid-template-columns: 1fr 1fr; }

  /* === 自选 === */
  .watchlist-grid { grid-template-columns: 1fr; gap: 10px; }

  /* === 表单全宽 === */
  .form-row { grid-template-columns: 1fr; }
  .auth-card { padding: 1.5rem; border-radius: 0; border: none; box-shadow: none; }
  .auth-page { padding: 1rem; }

  /* === Modal底部弹出 === */
  .modal { margin: 0; border-radius: 14px 14px 0 0; position: fixed; bottom: 0; max-height: 85vh; }
  .modal-overlay { align-items: flex-end; }
  .modal-body { padding: 1rem 1.25rem; }
  .modal-header { padding: .75rem 1.25rem; }

  /* === 推荐结果优化 === */
  .rec-item { padding: 10px; }

  /* === 大按钮 === */
  .btn { padding: 10px 20px; font-size: .9rem; min-height: 44px; }
  .btn-sm { padding: 7px 14px; min-height: 36px; }

  /* === 页面标题 === */
  .page-title { font-size: 1.2rem; }
  .container { padding: 0 .75rem; }

  /* === 公告栏 === */
  .site-notice-bar { font-size: .78rem; padding: 8px 36px 8px .75rem; }

  /* === 弹窗全宽 === */
  .vip-compare-table { font-size: .75rem; overflow-x: auto; }
}

/* 小屏手机 375px */
@media (max-width: 420px) {
  .stats-grid { gap: 6px; }
  .stat-card { padding: .7rem .8rem; }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: .72rem; }

  .holdings-table tr { gap: 6px 8px; padding: 12px; }
  .holdings-table td { font-size: .8rem; }

  .mobile-nav-icon { font-size: 1.15rem; }
  .mobile-nav-item { font-size: .6rem; min-width: 40px; padding: 3px 2px; }
.mobile-nav-icon { font-size: 1.1rem; }
}

/* === 下拉刷新动画 === */
.pull-indicator {
  display: none; text-align: center; padding: 12px; color: #94a3b8; font-size: .85rem;
  position: relative; top: -8px;
}
.pull-indicator.show { display: block; }
.pull-spinner {
  display: inline-block; width: 20px; height: 20px; border: 2px solid #e2e8f0;
  border-top-color: #3b82f6; border-radius: 50%; animation: spin .6s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === 左滑删除 === */
.swipe-container { position: relative; overflow: hidden; }
.swipe-delete-btn {
  position: absolute; right: 0; top: 0; bottom: 0; width: 72px;
  background: #dc2626; color: #fff; border: none; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transform: translateX(100%); transition: transform .2s;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.swipe-delete-btn.show { transform: translateX(0); }

/* === PWA安装提示 === */
.pwa-install-banner {
  display: none; position: fixed; bottom: 70px; left: 12px; right: 12px; z-index: 299;
  background: #0f172a; color: #fff; border-radius: 14px; padding: 12px 16px;
  font-size: .85rem; box-shadow: 0 4px 20px rgba(0,0,0,.25);
  align-items: center; justify-content: space-between; gap: 10px;
}
.pwa-install-banner.show { display: flex; }
.pwa-install-close { background: none; border: none; color: #94a3b8; font-size: 1.2rem; cursor: pointer; }
.pwa-install-btn { background: #3b82f6; color: #fff; border: none; border-radius: 8px; padding: 6px 14px; font-size: .8rem; cursor: pointer; white-space: nowrap; }
