/* ============================================
   吃瓜网社交媒体数据分析与趋势洞察平台 - 主样式表
   ============================================ */

/* CSS变量定义 */
:root {
  --primary: #0A2463;
  --secondary: #00BCD4;
  --bg: #F5F5F5;
  --card-bg: #FFFFFF;
  --accent: #00ACC1;
  --text: #1A1A1A;
  --text-light: #666666;
  --border: #E0E0E0;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: all 0.3s ease;
  --shadow: 0 2px 12px rgba(10, 36, 99, 0.08);
  --shadow-hover: 0 8px 24px rgba(10, 36, 99, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
}

/* 暗黑模式变量 */
[data-theme="dark"] {
  --primary: #1A3A7A;
  --bg: #0D1117;
  --card-bg: #161B22;
  --text: #E6EDF3;
  --text-light: #8B949E;
  --border: #30363D;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--primary);
}

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

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

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

/* ============================================
   布局系统
   ============================================ */

/* 顶部导航栏 */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__logo img {
  height: 36px;
  width: auto;
}

.header__logo span {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.header__search {
  flex: 1;
  max-width: 480px;
  margin: 0 32px;
  position: relative;
}

.header__search input {
  width: 100%;
  padding: 10px 44px 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.875rem;
  transition: var(--transition);
}

.header__search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.header__search input:focus {
  outline: none;
  border-color: var(--secondary);
  background: rgba(255, 255, 255, 0.15);
}

.header__search button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font-size: 1.1rem;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header__time-select {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
}

.header__user {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* 汉堡菜单按钮 */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--transition);
}

/* 左侧边栏 */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 900;
  transition: var(--transition);
  padding: 16px 0;
}

.sidebar__nav {
  list-style: none;
}

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

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  color: var(--text);
  font-size: 0.9rem;
  transition: var(--transition);
}

.sidebar__link:hover,
.sidebar__link.active {
  background: rgba(0, 188, 212, 0.08);
  color: var(--secondary);
  border-left: 3px solid var(--secondary);
}

.sidebar__link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar__toggle {
  position: absolute;
  top: 16px;
  right: -12px;
  width: 24px;
  height: 24px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  font-size: 0.7rem;
  box-shadow: var(--shadow);
}

/* 主内容区 */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
  transition: var(--transition);
}

.main--full {
  margin-left: 0;
}

/* ============================================
   网格布局系统
   ============================================ */

.grid {
  display: grid;
  gap: 24px;
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.grid--kpi {
  grid-template-columns: repeat(4, 1fr);
}

.grid--dashboard {
  grid-template-columns: 2fr 1fr;
}

/* ============================================
   卡片组件
   ============================================ */

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.card__export {
  padding: 6px 12px;
  background: rgba(0, 188, 212, 0.1);
  border: 1px solid var(--secondary);
  border-radius: 4px;
  color: var(--secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.card__export:hover {
  background: var(--secondary);
  color: #fff;
}

/* KPI 卡片 */
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--secondary);
  transition: var(--transition);
}

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

.kpi-card__label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-card__value {
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.kpi-card__change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 12px;
}

.kpi-card__change--up {
  color: var(--success);
  background: rgba(76, 175, 80, 0.1);
}

.kpi-card__change--down {
  color: var(--danger);
  background: rgba(244, 67, 54, 0.1);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
  position: relative;
  background: var(--primary);
  border-radius: var(--radius-lg);
  padding: 60px 48px;
  margin-bottom: 24px;
  overflow: hidden;
  color: #fff;
}

.hero__bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
}

.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.hero__number {
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 4rem;
  font-weight: 900;
  color: var(--secondary);
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(0, 188, 212, 0.5);
}

.hero__label {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 24px;
}

.hero__search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.hero__search input {
  width: 100%;
  padding: 16px 56px 16px 24px;
  border: 2px solid var(--secondary);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1rem;
  backdrop-filter: blur(10px);
}

.hero__search input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.hero__search button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--secondary);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.hero__search button:hover {
  background: var(--accent);
}

/* ============================================
   图表容器
   ============================================ */

.chart-container {
  width: 100%;
  min-height: 300px;
  position: relative;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ============================================
   词云组件
   ============================================ */

.word-cloud {
  position: relative;
  width: 100%;
  min-height: 280px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.word-cloud__item {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  animation: float 3s ease-in-out infinite;
}

.word-cloud__item:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.word-cloud__item--positive { color: var(--success); }
.word-cloud__item--neutral { color: var(--secondary); }
.word-cloud__item--negative { color: var(--danger); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* ============================================
   KOL排行表格
   ============================================ */

.kol-table {
  width: 100%;
  border-collapse: collapse;
}

.kol-table th {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
}

.kol-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.kol-table tr:hover {
  background: rgba(0, 188, 212, 0.05);
}

.kol-table__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.kol-table__name {
  font-weight: 600;
  color: var(--primary);
}

.kol-table__influence {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(0, 188, 212, 0.1);
  color: var(--secondary);
}

/* ============================================
   按钮系统
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: #0D2D7A;
  color: #fff;
}

.btn--secondary {
  background: var(--secondary);
  color: #fff;
}

.btn--secondary:hover {
  background: var(--accent);
  color: #fff;
}

.btn--outline {
  background: transparent;
  border: 2px solid var(--secondary);
  color: var(--secondary);
}

.btn--outline:hover {
  background: var(--secondary);
  color: #fff;
}

/* ============================================
   数据导出按钮
   ============================================ */

.export-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--secondary);
  border-radius: 4px;
  color: var(--secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.export-btn:hover {
  background: var(--secondary);
  color: #fff;
}

.export-btn__dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  display: none;
  min-width: 120px;
  z-index: 100;
}

.export-btn__dropdown.active {
  display: block;
}

.export-btn__dropdown a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  font-size: 0.8rem;
}

.export-btn__dropdown a:hover {
  background: rgba(0, 188, 212, 0.08);
}

/* ============================================
   Section 标题
   ============================================ */

.section-title {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--secondary);
  display: inline-block;
}

.section-desc {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 24px;
  max-width: 800px;
}

/* ============================================
   报告卡片
   ============================================ */

.report-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

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

.report-card__image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.report-card__body {
  padding: 20px;
}

.report-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.report-card__excerpt {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.report-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ============================================
   合作伙伴
   ============================================ */

.partners {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  padding: 24px;
  opacity: 0.7;
}

.partners img {
  height: 40px;
  filter: grayscale(100%);
  transition: var(--transition);
}

.partners img:hover {
  filter: grayscale(0%);
  opacity: 1;
}

/* ============================================
   页脚
   ============================================ */

.footer {
  background: var(--primary);
  color: rgba(255, 255, 255, 0.8);
  padding: 48px 24px 24px;
  margin-left: var(--sidebar-width);
  transition: var(--transition);
}

.footer--full {
  margin-left: 0;
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer__title {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 16px;
}

.footer__links {
  list-style: none;
}

.footer__links li {
  margin-bottom: 8px;
}

.footer__links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

.footer__links a:hover {
  color: var(--secondary);
}

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

.footer__compliance {
  margin-top: 12px;
  font-size: 0.75rem;
  opacity: 0.6;
}

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

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius);
}

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

/* ============================================
   滚动动画
   ============================================ */

.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   页面过渡
   ============================================ */

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

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

/* ============================================
   搜索结果页
   ============================================ */

.search-result {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.search-result__title {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.search-result__url {
  font-size: 0.8rem;
  color: var(--success);
  margin-bottom: 8px;
}

.search-result__desc {
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* ============================================
   404页面
   ============================================ */

.error-page {
  text-align: center;
  padding: 80px 24px;
}

.error-page__code {
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 8rem;
  font-weight: 900;
  color: var(--secondary);
  opacity: 0.3;
  line-height: 1;
}

.error-page__title {
  font-size: 2rem;
  margin: 16px 0;
}

.error-page__desc {
  color: var(--text-light);
  margin-bottom: 32px;
}

/* ============================================
   合规页面
   ============================================ */

.legal-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.legal-content h1 {
  font-size: 1.75rem;
  margin-bottom: 24px;
}

.legal-content h2 {
  font-size: 1.25rem;
  margin: 24px 0 12px;
}

.legal-content p {
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.8;
}

.legal-content ul {
  margin: 12px 0 16px 24px;
}

.legal-content li {
  margin-bottom: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ============================================
   APP下载页
   ============================================ */

.app-download {
  text-align: center;
  padding: 60px 24px;
}

.app-download__mockup {
  max-width: 600px;
  margin: 32px auto;
  border-radius: var(--radius-lg);
}

.app-download__buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}

/* ============================================
   数据大屏（全屏模式）
   ============================================ */

.dashboard-fullscreen {
  position: relative;
  background: #050A1A;
  min-height: 100vh;
  padding: 24px;
  color: #fff;
}

.dashboard-fullscreen .card {
  background: rgba(10, 36, 99, 0.6);
  border: 1px solid rgba(0, 188, 212, 0.3);
  backdrop-filter: blur(10px);
}

/* ============================================
   API文档页
   ============================================ */

.api-endpoint {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.api-endpoint__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 188, 212, 0.05);
  border-bottom: 1px solid var(--border);
}

.api-endpoint__method {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'Courier New', Courier, monospace;
}

.api-endpoint__method--get { background: #E8F5E9; color: #2E7D32; }
.api-endpoint__method--post { background: #E3F2FD; color: #1565C0; }
.api-endpoint__method--put { background: #FFF3E0; color: #E65100; }
.api-endpoint__method--delete { background: #FFEBEE; color: #C62828; }

.api-endpoint__path {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875rem;
  color: var(--text);
}

.api-endpoint__body {
  padding: 16px;
}

.code-block {
  background: #1E1E1E;
  color: #D4D4D4;
  padding: 16px;
  border-radius: var(--radius);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  overflow-x: auto;
  line-height: 1.6;
}

/* ============================================
   热搜榜单
   ============================================ */

.hot-list {
  list-style: none;
}

.hot-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.hot-list__item:hover {
  background: rgba(0, 188, 212, 0.05);
}

.hot-list__rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-light);
}

.hot-list__rank--top {
  background: var(--secondary);
  color: #fff;
}

.hot-list__title {
  flex: 1;
  font-size: 0.9rem;
}

.hot-list__heat {
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 600;
}

.hot-list__trend {
  font-size: 0.75rem;
}

.hot-list__trend--up { color: var(--danger); }
.hot-list__trend--down { color: var(--success); }

/* ============================================
   响应式适配
   ============================================ */

@media (max-width: 1200px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--kpi { grid-template-columns: repeat(2, 1fr); }
  .footer__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--dashboard { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .hamburger { display: flex; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .footer {
    margin-left: 0;
  }

  .grid--2,
  .grid--3,
  .grid--4,
  .grid--kpi {
    grid-template-columns: 1fr;
  }

  .header__search {
    display: none;
  }

  .hero {
    padding: 40px 24px;
  }

  .hero__number {
    font-size: 2.5rem;
  }

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

  .app-download__buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0 16px;
  }

  .main {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }

  .kpi-card__value {
    font-size: 1.5rem;
  }
}

/* ============================================
   打印样式
   ============================================ */

@media print {
  .header, .sidebar, .footer {
    display: none;
  }

  .main {
    margin: 0;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
