/* ============================================
   A股智能量化 - 移动端样式
   设计语言：Glassmorphism 毛玻璃风格
   ============================================ */

/* --- CSS 变量 --- */
:root {
  /* 主色调 - 柔和紫 */
  --primary: #A855F7;
  --primary-light: #C084FC;
  --primary-dark: #9333EA;
  --primary-gradient: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
  --primary-gradient-hover: linear-gradient(135deg, #C084FC 0%, #F472B6 100%);
  
  /* 辅助色 - 青色 */
  --secondary: #06B6D4;
  --secondary-light: #22D3EE;
  --secondary-dark: #0891B2;
  --secondary-gradient: linear-gradient(135deg, #06B6D4 0%, #0891B2 100%);
  
  /* 功能色 */
  --success: #22C55E;
  --success-gradient: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  --danger: #EF4444;
  --danger-gradient: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  --warning: #F59E0B;
  --warning-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  --info: #3B82F6;
  --info-gradient: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  
  /* ===== 毛玻璃核心变量 ===== */
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bg-hover: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-hover: rgba(255, 255, 255, 0.2);
  --glass-blur: blur(16px);
  --glass-blur-strong: blur(24px);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  
  /* 背景色 - 深色渐变主题 */
  --bg-primary: #0f0c29;
  --bg-secondary: rgba(255, 255, 255, 0.04);
  --bg-card: var(--glass-bg);
  --bg-card-hover: var(--glass-bg-hover);
  --bg-input: rgba(255, 255, 255, 0.08);
  
  /* 文字色 */
  --text-primary: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --text-disabled: #64748B;
  
  /* 边框和阴影 */
  --border-color: var(--glass-border);
  --border-color-hover: var(--glass-border-hover);
  --shadow: var(--glass-shadow);
  --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.15);
  
  /* 渐变边框 */
  --gradient-border: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(236, 72, 153, 0.3));
  
  /* 兼容旧代码 */
  --accent: var(--primary);
  --accent-gold: #F59E0B;
  --accent-blue: var(--info);
  --error: var(--danger);
  --wechat: #07C160;
  --qq: #12B7F5;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-base: 16px;
  --max-width: 420px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: var(--font-base);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  /* 深色多层渐变背景 */
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(120, 80, 255, 0.15) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse at 70% 60%, rgba(168, 85, 247, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* 动态光斑效果 */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 25% 35%, rgba(168, 85, 247, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 75% 65%, rgba(6, 182, 212, 0.06) 0%, transparent 35%);
  animation: bodyGlow 12s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes bodyGlow {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(-5%, -5%) scale(1.1);
  }
}

/* 安全区域适配 */
body {
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-top: env(safe-area-inset-top, 0);
}

/* --- 主容器 --- */
.app-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  /* 底部留足空间：避免被 fixed bottom-nav（~60px）遮挡 */
  padding: 24px 20px calc(80px + env(safe-area-inset-bottom, 0));
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --- Logo 区域 --- */
.logo-area {
  text-align: center;
  padding: 32px 0 24px;
}

.logo-area img {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(108, 99, 255, 0.4));
  transition: transform 0.3s ease;
}

.logo-area img:hover {
  transform: scale(1.05);
}

.logo-area h1 {
  font-size: 22px;
  font-weight: 700;
  color: #F1F5F9;
  letter-spacing: 2px;
}

.logo-area p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 1px;
}

/* --- Tab 切换栏 --- */
.tab-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 28px;
  position: relative;
}

.tab-bar button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  padding: 8px 4px;
  cursor: pointer;
  position: relative;
  transition: color 0.3s;
  font-weight: 500;
}

.tab-bar button.active {
  color: var(--text-primary);
  font-weight: 600;
}

.tab-bar button.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

/* --- 表单面板（Tab 内容） --- */
.form-panel {
  display: none;
  animation: fadeSlideUp 0.35s ease;
}

.form-panel.active {
  display: block;
}

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

/* --- 输入框 --- */
.input-group {
  position: relative;
  margin-bottom: 16px;
}

.input-group input {
  width: 100%;
  height: 48px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 16px 0 44px;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

.input-group input::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

.input-group input:focus {
  border-color: #A855F7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
  background: rgba(255, 255, 255, 0.12);
}

/* 输入框图标 */
.input-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  pointer-events: none;
  opacity: 0.6;
}

/* 密码显示切换 */
.input-group .toggle-pwd {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* 区号选择 */
.input-group .area-code {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  padding-right: 8px;
  border-right: 1px solid var(--border-color);
  padding-right: 10px;
  margin-right: 4px;
  cursor: pointer;
  user-select: none;
}

.input-group.has-area input {
  padding-left: 72px;
}

/* 验证码按钮 */
.input-group .code-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
  border: none;
  color: #fff;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.3);
}

.input-group .code-btn:hover {
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.4);
  transform: translateY(-50%) translateY(-1px);
}

.input-group .code-btn:disabled {
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* --- 错误状态 --- */
.input-group.error input {
  border-color: var(--error);
  animation: shake 0.4s ease;
}

.input-group .error-msg {
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
  padding-left: 4px;
  display: none;
}

.input-group.error .error-msg {
  display: block;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* --- 密码强度条 --- */
.pwd-strength {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  margin-bottom: 10px;
}

.pwd-strength .bar {
  flex: 1;
  height: 3px;
  background: var(--border-color);
  border-radius: 2px;
  transition: background 0.3s;
}

.pwd-strength .bar.weak   { background: var(--error); }
.pwd-strength .bar.medium { background: var(--accent-gold); }
.pwd-strength .bar.strong { background: var(--success); }

.pwd-strength .label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- 主按钮 --- */
.btn-primary {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  margin-top: 8px;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(168, 85, 247, 0.45);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: scale(0.97) translateY(0);
  box-shadow: 0 2px 12px rgba(168, 85, 247, 0.3);
}

.btn-primary .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.btn-primary.loading .btn-text { display: none; }
.btn-primary.loading .spinner  { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* 涟漪效果 */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: scale(0);
  animation: ripple-anim 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* --- 辅助链接 --- */
.aux-links {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 13px;
}

.aux-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s;
}

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

/* --- 第三方登录分割线 --- */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 20px;
  color: var(--text-muted);
  font-size: 12px;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* --- 第三方图标 --- */
.social-login {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 32px;
}

.social-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 20px;
  box-shadow: var(--shadow-card);
}

.social-btn:hover {
  transform: scale(1.08) translateY(-2px);
  border-color: #A855F7;
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.25);
  background: rgba(255, 255, 255, 0.1);
}

.social-btn.wechat  { color: var(--wechat); }
.social-btn.qq      { color: var(--qq); }
.social-btn.biometric { color: var(--secondary); }

/* --- 底部协议 --- */
.footer-agreement {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 24px;
}

.footer-agreement a {
  color: var(--accent-blue);
  text-decoration: none;
}

/* ===========================
   注册页 / 忘记密码页 专用样式
   =========================== */

/* 顶部导航 */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 20px;
}

.page-header .back-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.page-header h2 {
  font-size: 18px;
  font-weight: 600;
}

/* 协议勾选 */
.agreement-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.agreement-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.agreement-check a {
  color: var(--accent-blue);
  text-decoration: none;
}

/* --- Toast 提示 --- */
.toast {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 9999;
  transition: top 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  white-space: nowrap;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.toast.show {
  top: 24px;
  top: calc(env(safe-area-inset-top, 0) + 24px);
}

.toast.success { 
  border-left: 3px solid var(--success);
  box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
}
.toast.error   { 
  border-left: 3px solid var(--danger);
  box-shadow: 0 4px 20px rgba(255, 82, 82, 0.3);
}
.toast.info    { 
  border-left: 3px solid var(--info);
  box-shadow: 0 4px 20px rgba(33, 150, 243, 0.3);
}

/* --- 页面滑动过渡（SPA 模式） --- */
.page {
  display: none;
  animation: fadeSlideUp 0.35s ease;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* --- 响应式微调 --- */
@media (max-width: 374px) {
  .app-container { padding: 16px 14px calc(72px + env(safe-area-inset-bottom, 0)); }
  .logo-area h1 { font-size: 18px; }
  .social-login { gap: 20px; }
}

@media (min-width: 421px) {
  body {
    background:
      radial-gradient(ellipse at 20% 50%, rgba(168, 85, 247, 0.08) 0%, transparent 60%),
      radial-gradient(ellipse at 80% 50%, rgba(6, 182, 212, 0.06) 0%, transparent 60%),
      linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  }
  .app-container {
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
    min-height: 100vh;
  }
}

/* ===========================
   骨架屏加载效果
   =========================== */

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-secondary) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 60%; }
.skeleton-text.long { width: 80%; }

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-rect {
  width: 100%;
  height: 200px;
  border-radius: 8px;
}

.skeleton-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.skeleton-card .skeleton-line {
  height: 12px;
  margin-bottom: 8px;
  border-radius: 4px;
}

/* ===========================
   下拉刷新
   =========================== */

.pull-to-refresh {
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pull-refresh-indicator {
  position: absolute;
  top: -50px;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 13px;
  transition: transform 0.3s;
}

.pull-refresh-indicator.visible {
  transform: translateY(50px);
}

.pull-refresh-indicator.refreshing i {
  animation: spin 1s linear infinite;
}

/* ===========================
   优化的加载状态
   =========================== */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.loading-spinner {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.loading-spinner i {
  font-size: 32px;
  margin-bottom: 16px;
  color: var(--primary-color);
}

.loading-text {
  font-size: 14px;
  margin-top: 12px;
}

.loading-progress {
  width: 60%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  background: var(--primary-color);
  border-radius: 2px;
  animation: progress-anim 2s ease-in-out infinite;
}

@keyframes progress-anim {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

/* ===========================
   空状态优化
   =========================== */

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state .empty-hint {
  font-size: 14px;
  opacity: 0.7;
}

.empty-state .empty-action {
  margin-top: 20px;
}

.empty-state .empty-action button {
  padding: 10px 24px;
  border: none;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s;
}

.empty-state .empty-action button:active {
  transform: scale(0.95);
}

/* ===========================
   页面切换动画（单页应用模式）
   =========================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.page-transition {
  animation: fadeIn 0.3s ease;
}

/* 卡片悬停效果 */
.card-hover {
  transition: all 0.3s ease;
}

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

/* 按钮点击效果 */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 1s;
}

.btn-ripple:active::after {
  transform: scale(0);
  opacity: 1;
  transition: 0s;
}

/* ===========================
   滚动条美化
   =========================== */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===========================
   底部导航栏 - Glassmorphism
   =========================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  background: rgba(15, 12, 41, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.25);
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.bottom-nav .nav-item.active {
  color: #A855F7;
  background: rgba(168, 85, 247, 0.12);
}

.bottom-nav .nav-item i {
  font-size: 20px;
  transition: transform 0.3s;
}

.bottom-nav .nav-item.active i {
  transform: scale(1.1);
}

.bottom-nav .nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.bottom-nav .nav-item:active {
  background: rgba(168, 85, 247, 0.15);
}

/* ===========================
   持仓页面专属样式
   =========================== */

/* 持仓概览 - Glassmorphism */
.positions-summary {
  display: flex;
  justify-content: space-around;
  padding: 16px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  margin: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), var(--glass-inset);
  transition: all 0.3s;
}

.positions-summary:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--glass-shadow);
}
.summary-item { text-align: center; }
.summary-label { font-size: 12px; color: var(--text-muted); display: block; }
.summary-value { font-size: 18px; font-weight: 700; color: var(--text-primary); display: block; margin-top: 4px; }

/* 过滤选项卡 */
.filter-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin-bottom: 12px;
}
.filter-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.filter-tab.active {
  background: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.3);
  border-color: transparent;
}

/* 操作按钮区 */
.positions-actions {
  display: flex;
  gap: 10px;
  padding: 0 16px 12px;
}
.action-btn {
  flex: 1;
  padding: 10px;
  border: 1.5px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.action-btn:active {
  border-color: #A855F7;
  color: #A855F7;
  background: rgba(168, 85, 247, 0.08);
}

/* 持仓卡片 - Glassmorphism */
.position-card {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 0 16px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), var(--glass-inset);
  transition: all 0.3s;
}

.position-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--glass-shadow);
  transform: translateY(-2px);
}
.position-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.position-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.position-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.stock-code {
  font-size: 12px;
  color: var(--text-muted);
}
.position-profit {
  text-align: right;
}
.profit-value {
  display: block;
  font-size: 16px;
  font-weight: 700;
}
.profit-pct {
  font-size: 12px;
}
.profit .profit-value,
.profit .profit-pct { color: var(--success); }
.loss .profit-value,
.loss .profit-pct { color: var(--error); }

.position-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-label {
  font-size: 11px;
  color: var(--text-muted);
}
.detail-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.position-card-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.delete-btn {
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 82, 82, 0.12);
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
}

.delete-btn:hover {
  background: rgba(255, 82, 82, 0.2);
}

.delete-btn:active {
  background: rgba(255, 82, 82, 0.3);
}

.edit-btn {
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(168, 85, 247, 0.15);
  color: #A855F7;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s;
  margin-right: 8px;
}

.edit-btn:hover {
  background: rgba(168, 85, 247, 0.25);
}

.edit-btn:active {
  background: rgba(108, 99, 255, 0.3);
}

/* 空状态操作按钮 */
.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
  width: 100%;
  max-width: 260px;
  align-items: center;
}
.empty-actions .btn-primary,
.empty-actions .btn-secondary {
  width: 100%;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s;
}
.empty-actions .btn-primary {
  background: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
  transition: all 0.3s;
}

.empty-actions .btn-primary:hover {
  box-shadow: 0 6px 24px rgba(168, 85, 247, 0.4);
  transform: translateY(-2px);
}
.empty-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  transition: all 0.3s;
}

.empty-actions .btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.empty-actions button:active { 
  opacity: 0.8; 
  transform: scale(0.98);
}

/* ============ 弹窗 ============ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: rgba(20, 18, 50, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-md);
  width: 92%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4), var(--glass-inset);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-body {
  padding: 16px;
}
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}
.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
.modal-footer .btn-primary {
  background: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
  color: #fff;
}
.modal-footer .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
.modal-footer button:active { opacity: 0.8; }

/* 文件上传区 */
.upload-area {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-md);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: rgba(255, 255, 255, 0.03);
}
.upload-area:active {
  border-color: #A855F7;
  background: rgba(168, 85, 247, 0.05);
}
.upload-area i {
  font-size: 36px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}
.upload-area p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0;
}
.upload-area .hint {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* 预览表格 */
.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.preview-table th {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  padding: 8px;
  text-align: left;
  position: sticky;
  top: 0;
  font-weight: 500;
}
.preview-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}
.preview-table-wrapper {
  max-height: 240px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-top: 12px;
}

/* 手动添加表单 */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-size: 14px;
  box-sizing: border-box;
}
.form-group input:focus {
  border-color: #A855F7;
  outline: none;
}
.form-group .hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

/* 小按钮（预览表格内） */
.btn-small {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.btn-danger {
  background: rgba(233,69,96,0.15);
  color: var(--error);
}


/* ===========================
   首页组件样式 - 现代渐变风格
   =========================== */

/* 市场指数卡片 - Glassmorphism */
.market-indices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}

.index-card {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), var(--glass-inset);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.index-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.index-card:hover::before {
  opacity: 1;
}

.index-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), var(--glass-inset);
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
}

.index-card .index-name {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.index-card .index-value {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #F1F5F9;
  letter-spacing: -0.5px;
}

.index-card .index-change {
  font-size: 14px;
  font-weight: 500;
}

.index-card .index-change.positive {
  color: var(--success);
}

.index-card .index-change.negative {
  color: var(--danger);
}

/* 分区标题 */
.section-title {
  padding: 20px 16px 10px;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}

.section-title .more-link {
  font-size: 14px;
  font-weight: normal;
  color: var(--primary-light);
  text-decoration: none;
  transition: all 0.3s;
}

.section-title .more-link:hover {
  color: var(--primary);
}

/* 持仓概览 - Glassmorphism */
.portfolio-summary {
  margin: 0 16px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), var(--glass-inset);
  position: relative;
  overflow: hidden;
}

.portfolio-summary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--secondary-gradient);
  opacity: 0.8;
}

.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-item {
  text-align: center;
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.stat-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.07);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.positive {
  color: var(--success);
}

.stat-value.negative {
  color: var(--danger);
}

/* 快速操作按钮 - Glassmorphism */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.action-btn:hover,
.action-btn:active {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(0.97);
}

.action-btn i {
  font-size: 26px;
  margin-bottom: 8px;
  color: var(--primary-light);
  transition: transform 0.3s ease, color 0.3s;
}

.action-btn:hover i {
  transform: scale(1.1);
  color: var(--primary);
}

.action-btn span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 信号预览 - Glassmorphism */
.signal-preview {
  margin: 0 16px;
}

.signal-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.signal-item:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
}

.signal-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  font-size: 18px;
  flex-shrink: 0;
}

.signal-icon.buy {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.signal-icon.sell {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.signal-info {
  flex: 1;
}

.signal-stock {
  font-weight: 600;
  margin-bottom: 3px;
  font-size: 14px;
  color: var(--text-primary);
}

.signal-reason {
  font-size: 12px;
  color: var(--text-muted);
}

.signal-strength {
  font-weight: 700;
  font-size: 16px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
}

.signal-strength.buy {
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.signal-strength.sell {
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* 加载和空状态 */
.loading-spinner {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.loading-spinner i {
  font-size: 32px;
  color: var(--primary-light);
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
  color: var(--primary-light);
}

/* ===========================
   顶部导航栏（全局）
   .nav-header  → 子页面（带返回按钮）：升级/订阅/支付等
   .app-header  → 主页面（标题 + 操作按钮）：首页/持仓/信号等
   =========================== */

/* ── 子页面导航栏（带返回按钮） ─ */
.nav-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: var(--max-width, 480px);
  margin: 0 auto;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(15, 12, 41, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 200;
  box-sizing: border-box;
}

.nav-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.nav-back:active {
  background: rgba(255, 255, 255, 0.1);
}

.nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
}

.nav-actions {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── 主页面导航栏（标题 + 右侧操作） ─ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: var(--max-width, 480px);
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(15, 12, 41, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 200;
  box-sizing: border-box;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ── 为使用固定导航的页面自动添加顶部安全间距 ─ */
body {
  padding-top: 0; /* 默认不占位，由各页面的内容区自行处理 */
}
