/* ========================================
   光伏情报站 - 全局样式
   ======================================== */

:root {
  --primary: #3b70fc;
  --primary-light: #e8f0fe;
  --primary-dark: #2a5bd8;
  --green: #10b981;
  --green-light: #d1fae5;
  --orange: #f59e0b;
  --orange-light: #fef3c7;
  --red: #ef4444;
  --red-light: #fee2e2;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 6px rgba(0,0,0,0.05), 0 10px 25px rgba(0,0,0,0.1);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========================================
   博客导航栏
   ======================================== */
.blog-nav {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.blog-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 18px;
}

.blog-nav-brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.blog-nav-links {
  display: flex;
  gap: 28px;
}

.blog-nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  transition: color 0.3s;
}

.blog-nav-links a:hover {
  color: var(--primary);
}

.blog-nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.blog-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.3s;
}

/* ========================================
   应用容器
   ======================================== */
.pv-intel-container {
  padding-top: 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%);
  color: white;
  padding: 32px 24px;
}

.app-header-inner {
  max-width: 1440px;
  margin: 0 auto;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-icon {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  backdrop-filter: blur(4px);
}

.app-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px;
}

.app-subtitle {
  font-size: 14px;
  opacity: 0.9;
  margin: 0;
}

/* ========================================
   主内容区布局
   ======================================== */
.app-main {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
  gap: 24px;
}

/* ========================================
   侧边栏通用
   ======================================== */
.sidebar-left,
.sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 15px;
}

.panel-icon {
  font-size: 16px;
}

/* ========================================
   信息源状态
   ======================================== */
.source-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.source-name {
  font-weight: 500;
  color: var(--text);
}

.source-status {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.source-status.online {
  background: var(--green-light);
  color: var(--green);
}

.source-status.offline {
  background: var(--red-light);
  color: var(--red);
}

.source-status.loading,
.source-item.loading .source-status {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========================================
   分类筛选
   ======================================== */
.filter-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s;
}

.filter-item input {
  display: none;
}

.filter-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.filter-tag::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 2px solid currentColor;
  display: inline-block;
  opacity: 0.4;
  transition: all 0.2s;
}

.filter-item.active .filter-tag::before {
  opacity: 1;
  background: currentColor;
  box-shadow: inset 0 0 0 2px #fff;
}

.filter-tag.price {
  background: var(--green-light);
  color: #047857;
}

.filter-tag.news {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.filter-tag.policy {
  background: var(--orange-light);
  color: #b45309;
}

.filter-tag.tech {
  background: var(--purple-light);
  color: #6d28d9;
}

/* ========================================
   按钮
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 112, 252, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-ai {
  background: linear-gradient(135deg, var(--green) 0%, #059669 100%);
  color: white;
}

.btn-ai:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ========================================
   中间内容区
   ======================================== */
.content-center {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.search-bar {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.search-input-wrap {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-icon {
  font-size: 18px;
  color: var(--text-muted);
}

.search-input {
  flex: 1;
  border: none;
  font-size: 15px;
  padding: 8px 0;
  outline: none;
  color: var(--text);
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  padding: 10px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.search-btn:hover {
  background: var(--primary-dark);
}

.search-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-left: 30px;
}

.search-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 20px;
  font-size: 12px;
}

.search-tag .remove {
  cursor: pointer;
  opacity: 0.6;
}

.search-tag .remove:hover {
  opacity: 1;
}

/* 统计栏 */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 4px;
}

/* 卡片流 */
.card-stream {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 加载状态 */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 信息卡片 */
.info-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  cursor: pointer;
  border-left: 4px solid transparent;
}

.info-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.info-card.price {
  border-left-color: var(--green);
}

.info-card.news {
  border-left-color: var(--primary);
}

.info-card.policy {
  border-left-color: var(--orange);
}

.info-card.tech {
  border-left-color: var(--purple);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 12px;
}

.card-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.card-type.price {
  background: var(--green-light);
  color: #047857;
}

.card-type.news {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.card-type.policy {
  background: var(--orange-light);
  color: #b45309;
}

.card-type.tech {
  background: var(--purple-light);
  color: #6d28d9;
}

.card-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.5;
}

.card-summary {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.card-source {
  font-size: 12px;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-btn {
  padding: 5px 12px;
  background: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.card-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* 价格卡片特有 */
.price-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 12px 0;
}

.price-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.price-change {
  font-size: 16px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.price-change.up {
  background: var(--green-light);
  color: #047857;
}

.price-change.down {
  background: var(--red-light);
  color: #b91c1c;
}

.price-meta {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* 加载更多 */
.load-more-wrap {
  text-align: center;
  padding: 10px 0;
}

/* ========================================
   右侧边栏 AI 面板
   ======================================== */
.ai-panel {
  min-height: 200px;
}

.ai-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
}

.ai-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.ai-empty-sub {
  font-size: 13px;
  margin-top: 4px;
}

.ai-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-thinking {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #e0f2fe;
  font-size: 13px;
  font-weight: 600;
  color: #0369a1;
}

.toggle-thinking {
  background: none;
  border: none;
  color: #0369a1;
  font-size: 12px;
  cursor: pointer;
}

.thinking-body {
  padding: 14px;
  font-size: 13px;
  color: #0c4a6e;
  line-height: 1.7;
  max-height: 200px;
  overflow-y: auto;
}

.thinking-body.collapsed {
  display: none;
}

.ai-result {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.ai-result h3,
.ai-result h4 {
  margin: 16px 0 8px;
  color: var(--text);
}

.ai-result p {
  margin-bottom: 10px;
}

.ai-result ul,
.ai-result ol {
  padding-left: 20px;
  margin-bottom: 10px;
}

.ai-result li {
  margin-bottom: 4px;
}

.ai-result code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

.ai-result blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 14px;
  margin: 12px 0;
  color: var(--text-secondary);
}

.ai-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.ai-loading small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
}

/* 热门标签 */
.hot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hot-tag {
  padding: 5px 12px;
  background: var(--bg);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.hot-tag:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========================================
   AI 弹窗（移动端）
   ======================================== */
.ai-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ai-modal-content {
  background: var(--card-bg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.ai-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.ai-modal-header h3 {
  font-size: 16px;
  margin: 0;
}

.ai-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

.ai-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(85vh - 60px);
}

/* ========================================
   Toast
   ======================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========================================
   空状态
   ======================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1200px) {
  .app-main {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
  
  .sidebar-right {
    display: none;
  }
}

@media (max-width: 768px) {
  .blog-nav {
    padding: 0 16px;
  }
  
  .blog-nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    flex-direction: column;
    padding: 16px 24px;
    gap: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  
  .blog-nav-links.show {
    display: flex;
  }
  
  .blog-nav-links a {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  
  .blog-nav-links a:last-child {
    border-bottom: none;
  }
  
  .blog-nav-toggle {
    display: flex;
  }
  
  .app-header {
    padding: 24px 16px;
  }
  
  .app-title {
    font-size: 20px;
  }
  
  .app-main {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }
  
  .sidebar-left {
    order: 2;
  }
  
  .content-center {
    order: 1;
  }
  
  .search-input-wrap {
    flex-wrap: wrap;
  }
  
  .search-btn {
    width: 100%;
  }
  
  .price-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .price-value {
    font-size: 24px;
  }
}
