/* =========================================
   银发财经智库 — 基础样式
   shared/css/base.css
   版本：2.0（2026-06-04）
   用途：全站共享的 CSS 变量、重置、通用组件
   各页面只写页面特有的样式
   ========================================= */

/* ---- CSS 变量（品牌色） ---- */
:root {
  /* 品牌色（绿色系） */
  --brand-primary: #059669;
  --brand-dark: #065f46;
  --brand-light: #10b981;
  --brand-gradient: linear-gradient(135deg, #065f46, #059669, #10b981);

  /* 功能色 */
  --color-accent: #1e40af;
  --color-warning: #f59e0b;
  --color-danger: #c0392b;
  --color-info: #2980b9;

  /* 中性色 */
  --bg-page: #f0f2f5;
  --bg-card: #ffffff;
  --bg-highlight: #f0fdf4;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #e5e7eb;
  --border-light: #f0f0f0;

  /* 布局 */
  --container-max: 1400px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* 字体 */
  --font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  --font-size-base: 14px;

  /* 阴影 */
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.1);

  /* 头部导航 */
  --header-height: 48px;
}

/* ---- 重置 ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  background: var(--bg-page);
  min-height: 100vh;
  color: var(--text-primary);
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---- 容器 ---- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ---- 跳过导航（无障碍） ---- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--brand-primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 10000;
  text-decoration: none;
  border-radius: 0 0 6px 0;
  font-size: 13px;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* ---- 布局工具 ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.text-center { text-align: center; }
.text-right { text-align: right; }

/* ---- 统一导航 ---- */
.unified-header {
  background: var(--brand-primary);
  color: #fff;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.unified-header .brand {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
}
.unified-header nav {
  display: flex;
  gap: 2px;
}
.unified-header nav a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
}
.unified-header nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.unified-header nav a.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 600;
}

/* ---- 即将上线 / Beta 导航项 ---- */
.unified-header nav .nav-coming-soon {
  color: rgba(255, 255, 255, 0.4);
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.unified-header nav .nav-cs-badge {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 400;
  letter-spacing: 0.5px;
}
.unified-header nav a .nav-beta-badge {
  font-size: 9px;
  background: #f59e0b;
  color: #fff;
  padding: 0 5px;
  border-radius: 6px;
  margin-left: 4px;
  font-weight: 600;
}
@media (max-width: 768px) {
  .unified-header nav .nav-coming-soon {
    padding: 12px 20px;
    font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    justify-content: center;
  }
  .unified-header nav .nav-coming-soon:last-child { border-bottom: none; }
  .unified-header nav a .nav-beta-badge { font-size: 8px; }
}

/* ===== 下拉菜单（v2.0） ===== */
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 导航链接基础 */
.main-nav .nav-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.main-nav .nav-link:hover,
.main-nav .nav-link.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.main-nav .nav-link.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}

/* 下拉容器 */
.nav-item.dropdown {
  position: relative;
}

/* 下拉菜单 */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 200px;
  padding: 8px 0;
  z-index: 1000;
  animation: fadeInUp 0.2s ease;
}

.unified-header .dropdown-menu a,
.unified-header .dropdown-disabled {
  display: block;
  padding: 10px 16px;
  color: #333 !important;
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s;
  white-space: nowrap;
}

.unified-header .dropdown-menu a:hover {
  background: #f0fdf4;
  color: var(--brand-primary) !important;
}

.unified-header .dropdown-disabled {
  color: #999 !important;
  cursor: not-allowed;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* hover 展开（桌面端） */
.nav-item.dropdown:hover .dropdown-menu,
.nav-item.dropdown.open .dropdown-menu {
  display: block;
}

/* 数据产品高亮 - 闪烁效果 */
@keyframes shine {
  0%, 100% { color: #fbbf24; text-shadow: 0 0 8px rgba(251, 191, 36, 0.3); }
  50% { color: #fff; text-shadow: 0 0 12px rgba(251, 191, 36, 0.6); }
}

.nav-item.highlight-product .nav-link {
  color: #fbbf24;
  font-weight: 600;
  animation: shine 2s ease-in-out infinite;
}

.nav-item.highlight-product .nav-link:hover {
  animation: none;
  color: #fff;
}

.nav-item.highlight-product .dropdown-menu {
  border-top: 2px solid #fbbf24;
}

/* 即将上线标签 */
.coming-soon-badge {
  display: inline-block;
  font-size: 10px;
  background: #e67e22;
  color: #fff;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 500;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .main-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0;
  }
  
  .main-nav .nav-link {
    padding: 12px 20px;
    font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    justify-content: center;
    border-radius: 0;
  }
  
  .dropdown-menu {
    position: static;
    display: none;
    box-shadow: none;
    background: rgba(0,0,0,0.05);
    margin: 0;
    border-radius: 0;
    padding: 0;
    min-width: auto;
    animation: none;
  }
  
  .nav-item.dropdown.open .dropdown-menu {
    display: block;
  }
  
  .dropdown-menu a,
  .dropdown-disabled {
    padding: 12px 32px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.8);
    text-align: center;
  }
  
  .dropdown-menu a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
  }
  
  .nav-item.highlight-product .nav-link {
    margin: 8px 16px;
    border-radius: 6px;
    justify-content: center;
  }
}

/* ---- 汉堡菜单按钮 ---- */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 6px;
  border: none;
  background: transparent;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: all 0.25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- 统一底部 ---- */
.unified-footer {
  background: #f8f9fa;
  border-top: 1px solid var(--border-color);
  padding: 24px 28px;
  text-align: center;
  flex-shrink: 0;
}
.unified-footer .qr-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.unified-footer .qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.unified-footer .qr-box {
  width: 88px;
  height: 88px;
  background: var(--bg-highlight);
  border-radius: 8px;
  border: 1px solid #d4d0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.unified-footer .qr-box span {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}
.unified-footer .qr-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.unified-footer .qr-label strong {
  color: var(--brand-primary);
  font-size: 12px;
}
.unified-footer .info {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.unified-footer .info strong {
  color: var(--text-primary);
  font-size: 13px;
}
.unified-footer .copyright {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- 通告栏 ---- */
.top-notice,
.notice-bar {
  background: var(--color-accent);
  color: #fff;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  line-height: 1.6;
}
.top-notice a,
.notice-bar a { color: #93c5fd; }
.top-notice a:hover,
.notice-bar a:hover { color: #fff; }

/* ---- 卡片 ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); }

.card-header {
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  user-select: none;
}
.card-header .card-link {
  font-size: 11px;
  font-weight: 500;
  color: var(--brand-light);
  text-decoration: none;
  white-space: nowrap;
}
.card-header .card-link:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}
.card-header .card-toggle {
  font-size: 12px;
  transition: transform 0.25s;
  color: var(--text-muted);
}
.card.collapsed .card-toggle { transform: rotate(-90deg); }
.card.collapsed .card-header { border-bottom: none; }
.card.collapsed .card-body { display: block; }
.card.collapsed .card-detail { display: none; }

.card-body { padding: 16px 20px; }

/* ---- 按钮 ---- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--brand-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-dark);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* ---- 徽章 ---- */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: white;
}
.badge-A { background: var(--color-danger); }
.badge-B { background: var(--color-warning); }
.badge-C { background: var(--color-info); }
.badge-D { background: #7f8c8d; }

/* ---- 标签 ---- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.tag-blue { background: #dbeafe; color: var(--color-accent); }
.tag-green { background: #d1fae5; color: var(--brand-dark); }
.tag-orange { background: #fef3c7; color: #92400e; }
.tag-red { background: #fee2e2; color: #991b1b; }

/* ---- 等级标签 ---- */
.g-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: white;
}
.g-A { background: var(--color-danger); }
.g-B { background: var(--color-warning); }
.g-C { background: var(--color-info); }
.g-D { background: #7f8c8d; }

/* ---- 表格 ---- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  background: #f8f9fa;
  color: var(--text-muted);
  padding: 8px 12px;
  text-align: left;
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
}
td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-light);
}
tr:hover td { background: var(--bg-highlight); }

/* ---- 表格横向滚动容器 ---- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- 加载文字 ---- */
.loading-text {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---- 骨架屏占位 ---- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}
.skeleton-line { height: 14px; margin-bottom: 8px; width: 100%; }
.skeleton-line:nth-child(2) { width: 80%; }
.skeleton-line:nth-child(3) { width: 60%; }
.skeleton-block { height: 120px; margin-bottom: 12px; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- 动画关键帧 ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease forwards;
}
.animate-fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

/* ---- 导航滚动阴影 ---- */
.unified-header.header-scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 99;
}
/* 当通告栏 + 导航同时存在时，导航的sticky生效 */
.top-notice + .unified-header.header-scrolled {
  top: 0;
}

/* ---- 响应式 ---- */
@media (max-width: 1100px) {
  .unified-header .brand { font-size: 15px; }
}

@media (max-width: 900px) {
  .unified-header nav { gap: 1px; }
  .unified-header nav a { padding: 6px 10px; font-size: 12px; }
}

@media (max-width: 768px) {
  .container { box-shadow: none; }

  .unified-header {
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    position: relative;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .unified-header .brand { font-size: 13px; white-space: normal; line-height: 1.3; }

  .nav-toggle {
    display: flex;
    flex-shrink: 0;
    margin-left: auto;
    padding: 8px;
    z-index: 101;
  }

  .unified-header nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    flex-direction: column;
    background: rgba(6, 95, 70, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    padding: 80px 0 20px;
    gap: 0;
    overflow-y: auto;
  }
  .unified-header nav.open {
    display: flex;
    animation: fadeIn 0.2s ease;
  }
  .unified-header nav a {
    padding: 16px 24px;
    border-radius: 0;
    font-size: 16px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    letter-spacing: 2px;
  }
  .unified-header nav a:last-child { border-bottom: none; }
  .unified-header nav a.active {
    background: rgba(255,255,255,0.15);
    font-weight: 700;
  }

  .unified-footer .qr-row { gap: 16px; }
  .unified-footer { padding: 20px 16px; }
}

@media (max-width: 480px) {
  .unified-header { padding: 10px 12px; }
  .unified-header .brand { font-size: 12px; }
  .nav-toggle span { width: 20px; height: 2px; }
  .nav-toggle.open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
  .unified-footer .qr-row { gap: 12px; }
  .unified-footer .qr-box { width: 72px; height: 72px; }
}

/* ---- 平滑滚动（全局） ---- */
html {
  scroll-behavior: smooth;
}

/* ---- 减少 motion 偏好 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---- 打印 ---- */
@media print {
  .unified-header, .unified-footer, .top-notice, .notice-bar { display: none; }
}
