/* Fresh & Vibrant Design System */
:root {
  /* Light Mode (Default) - Fresh Vibrant Palette */
  --bg: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #ffffff;
  --panel: #ffffff;
  --panel-hover: #f8fafc;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --muted: #94a3b8;
  
  /* Vibrant Colors */
  --brand: #6366f1;
  --brand-hover: #4f46e5;
  --brand-light: rgba(99, 102, 241, 0.1);
  --accent: #8b5cf6;
  --accent-secondary: #f59e0b;
  
  /* Fresh Gradient Colors */
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  
  /* Status Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
  --shadow-hover: 0 8px 30px rgba(102, 126, 234, 0.25);
  --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.05);
  --radius: 16px;
  --radius-small: 10px;
  --radius-large: 24px;
  --spacing: 24px;
  --spacing-small: 16px;
  --spacing-large: 40px;
  --spacing-xlarge: 60px;
  
  /* Dark Mode - Vibrant Dark Palette */
  --bg-dark: #0f172a;
  --bg-secondary-dark: #1e293b;
  --bg-tertiary-dark: #334155;
  --panel-dark: #1e293b;
  --panel-hover-dark: #334155;
  --text-dark: #f1f5f9;
  --text-secondary-dark: #94a3b8;
  --text-tertiary-dark: #64748b;
  --border-dark: #334155;
  --border-light-dark: #1e293b;
}

/* System Font Stack (Apple) */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.47059;
  font-weight: 400;
  letter-spacing: -0.022em;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* 强制所有直接子元素不超出视口 */
html, body, .container, main, section, .layout, .panel {
  max-width: 100vw;
  overflow-x: hidden;
}

body.dark-mode {
  --bg: var(--bg-dark);
  --bg-secondary: var(--bg-secondary-dark);
  --bg-tertiary: var(--bg-tertiary-dark);
  --panel: var(--panel-dark);
  --panel-hover: var(--panel-hover-dark);
  --text: var(--text-dark);
  --text-secondary: var(--text-secondary-dark);
  --text-tertiary: var(--text-tertiary-dark);
  --muted: var(--text-secondary-dark);
  --border: var(--border-dark);
  --border-light: var(--border-light-dark);
}

.container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: var(--spacing-large) var(--spacing-large);
  box-sizing: border-box;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xlarge);
  padding-bottom: var(--spacing);
  border-bottom: none;
  width: 100%;
  position: relative;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-hero);
  border-radius: 2px;
}

.app-header h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.04em;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 17px;
  color: var(--text-secondary);
  font-weight: 400;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--spacing);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.panel:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
  transform: translateY(-1px);
}

.controls {
  padding: var(--spacing);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-small);
}

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--radius-small);
  border: none;
  background: var(--gradient-1);
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: -0.01em;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.category-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-tab {
  padding: 14px 18px;
  border-radius: var(--radius-small);
  border: 1px solid transparent;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: -0.01em;
  position: relative;
}

.category-tab:hover {
  background: var(--bg-secondary);
  color: var(--brand);
  transform: translateX(4px);
}

.category-tab.active {
  background: var(--gradient-1);
  color: #ffffff;
  font-weight: 600;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transform: translateX(0);
}

.category-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 0 2px 2px 0;
}

.content-area {
  padding: var(--spacing-large);
  min-height: 600px;
}

.view-default h2 {
  margin: 0 0 var(--spacing);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.index-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-large);
  flex-wrap: wrap;
  gap: var(--spacing-small);
}

.index-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.index-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text-secondary);
}

.index-controls select {
  padding: 8px 12px;
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.index-controls select:hover {
  border-color: var(--brand);
}

.index-latest {
  margin-bottom: var(--spacing-large);
}

.index-latest-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing);
  margin-bottom: var(--spacing-large);
}

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

@media (max-width: 600px) {
  .index-latest-grid {
    grid-template-columns: 1fr;
  }
}

.index-card {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--spacing);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.index-card:nth-child(1)::before { background: var(--gradient-1); }
.index-card:nth-child(2)::before { background: var(--gradient-4); }
.index-card:nth-child(3)::before { background: var(--gradient-5); }
.index-card:nth-child(4)::before { background: var(--gradient-3); }

.index-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

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

.index-card-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.index-card-value {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: var(--spacing-small);
  letter-spacing: -0.03em;
  line-height: 1.1;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.index-card:nth-child(1) .index-card-value { background: var(--gradient-1); -webkit-background-clip: text; background-clip: text; }
.index-card:nth-child(2) .index-card-value { background: var(--gradient-4); -webkit-background-clip: text; background-clip: text; }
.index-card:nth-child(3) .index-card-value { background: var(--gradient-5); -webkit-background-clip: text; background-clip: text; }
.index-card:nth-child(4) .index-card-value { background: var(--gradient-3); -webkit-background-clip: text; background-clip: text; }

.index-card-changes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.change-item {
  color: var(--text-secondary);
  line-height: 1.4;
}

.index-legend {
  margin-bottom: var(--spacing);
}

.index-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing);
  padding: var(--spacing-small);
  background: var(--bg-secondary);
  border-radius: var(--radius-small);
}

.index-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.index-legend-item:hover {
  background: var(--panel-hover);
}

.index-legend-item input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.chart-container-full {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-large);
  padding: var(--spacing-large);
  height: 500px;
  margin-bottom: var(--spacing-large);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

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

.chart-container-full::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-1);
  border-radius: var(--radius-large) var(--radius-large) 0 0;
}

.chart-container-full:hover {
  box-shadow: var(--shadow-hover);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

/* Y轴边距控制滑块（垂直） */
.chart-with-y-control {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.chart-with-y-control canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

.y-axis-slider-vertical {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 5px;
  position: absolute;
  left: 24px;
  top: 80px;
  bottom: 72px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to bottom, #c4b5fd, #a78bfa, #8b5cf6);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.y-axis-slider-vertical:hover {
  opacity: 1;
}

.y-axis-slider-vertical::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #8b5cf6;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.5);
  transition: transform 0.15s ease;
}

.y-axis-slider-vertical::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.y-axis-slider-vertical::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #8b5cf6;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.5);
}

/* 产品选择器行布局 */
.product-selector-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-small);
  margin-bottom: var(--spacing);
  flex-wrap: wrap;
}

/* 农药下拉选择器 */
.pesticide-dropdown {
  position: relative;
  min-width: 200px;
  max-width: 100%;
  flex-shrink: 1;
}

.pesticide-dropdown-trigger {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--panel);
  overflow: hidden;
  transition: all 0.2s ease;
}

.pesticide-dropdown-trigger:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.pesticide-dropdown-trigger input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.pesticide-dropdown-trigger input::placeholder {
  color: var(--text-tertiary);
}

.pesticide-dropdown-arrow {
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}

.pesticide-dropdown.open .pesticide-dropdown-arrow {
  transform: rotate(180deg);
}

.pesticide-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-hover);
  max-height: 400px;
  overflow: hidden;
  z-index: 100;
  display: none;
}

.pesticide-dropdown.open .pesticide-dropdown-menu {
  display: block;
}

.pesticide-dropdown-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

/* 农药项目 */
.pesticide-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.pesticide-item:hover {
  background: var(--bg-secondary);
}

.pesticide-item-expand {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  margin-right: 4px;
}

.pesticide-item-expand.expanded {
  transform: rotate(90deg);
}

.pesticide-item-expand.no-children {
  visibility: hidden;
}

.pesticide-item-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 10px;
}

.pesticide-item-label {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}

/* 价格记录数量标签 */
.pesticide-price-count {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  margin-left: 6px;
  flex-shrink: 0;
}

.pesticide-price-count.no-price {
  color: var(--muted);
  opacity: 0.6;
}

/* 子项（规格） */
.pesticide-children {
  margin-left: 44px;
  display: none;
}

.pesticide-children.expanded {
  display: block;
}

.pesticide-child-item {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pesticide-child-item:hover {
  background: var(--bg-secondary);
}

/* 时间范围选择和币种选择（紧凑） */
.time-range-compact,
.currency-compact {
  flex-shrink: 0;
}

.time-range-compact select,
.currency-compact select {
  padding: 10px 14px;
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.time-range-compact select:hover,
.currency-compact select:hover {
  border-color: var(--brand);
}

.time-range-compact select:focus,
.currency-compact select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.index-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.index-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.index-controls select {
  padding: 8px 12px;
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.index-controls select:hover {
  border-color: var(--brand);
}

.index-controls select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* 已选标签 */
.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-height: 32px;
  align-items: center;
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  color: var(--brand);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all 0.2s ease;
}

.selected-tag:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
}

.selected-tag-remove {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-1);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.2s ease;
}

.selected-tag-remove:hover {
  transform: scale(1.1);
}

/* 无匹配提示 */
.pesticide-no-match {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.news-section,
.recent-news-section {
  background: var(--panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-large);
  padding: var(--spacing);
  margin-top: var(--spacing-large);
  position: relative;
}

.news-section::before,
.recent-news-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-3);
  border-radius: var(--radius-large) var(--radius-large) 0 0;
}

.news-section h3,
.recent-news-section h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-section h3::before,
.recent-news-section h3::before {
  content: '📰';
  font-size: 18px;
}

/* 新闻区头部：标题+搜索框 */
.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing);
  flex-wrap: wrap;
  gap: 12px;
}

/* 新闻搜索框 */
.news-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.news-search-box input {
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  width: 200px;
  transition: all 0.2s ease;
}

.news-search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  width: 240px;
}

.news-search-box input::placeholder {
  color: var(--muted);
}

.news-search-icon {
  position: absolute;
  left: 10px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0.6;
}

@media (max-width: 600px) {
  .news-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .news-search-box input {
    width: 100%;
  }
  
  .news-search-box input:focus {
    width: 100%;
  }
  
  .news-search-box {
    width: 100%;
  }
}

/* 新闻网格布局 */
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-small);
}

@media (max-width: 900px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

.news-grid-item {
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  position: relative;
  overflow: hidden;
}

.news-grid-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.news-grid-item:hover {
  background: var(--bg-secondary);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.news-grid-item:hover::before {
  opacity: 1;
}

.news-grid-item .news-title-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-grid-item .news-title-link:hover {
  color: var(--brand);
}

.news-grid-item .news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.news-grid-item .news-origin-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
}

.news-grid-item .news-origin-link:hover {
  text-decoration: underline;
  color: var(--brand);
}

/* 分页 */
.news-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: var(--spacing);
  flex-wrap: wrap;
}

.news-pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.news-pagination button:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.news-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.news-pagination button.active {
  background: var(--gradient-1);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.news-pagination .page-info {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 8px;
}

.news-pagination input[type="number"] {
  width: 50px;
  height: 36px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.news-pagination input[type="number"]:focus {
  outline: none;
  border-color: var(--brand);
}

.news-time {
  color: var(--text-secondary);
  font-size: 13px;
  margin-left: 8px;
}

#status {
  margin-top: var(--spacing);
  color: var(--text-secondary);
  min-height: 22px;
  font-size: 14px;
  padding: var(--spacing-small);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
  border-radius: var(--radius-small);
  border: 1px solid rgba(99, 102, 241, 0.1);
}

.lang-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: 24px;
  border: 1px solid var(--border-light);
}

.lang-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.25s ease;
  font-family: inherit;
}

.lang-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--brand);
}

.lang-btn.active {
  background: var(--gradient-1);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

/* Dark Mode Toggle (Optional) */
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  transform: translateY(-2px) rotate(15deg);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
}

.theme-toggle:active {
  transform: translateY(0) rotate(0);
}

/* Responsive Design */
@media (max-width: 1440px) {
  .container {
    padding: var(--spacing-large) var(--spacing);
  }
}

@media (max-width: 1024px) {
  .container {
    padding: var(--spacing);
  }
  
  .layout {
    grid-template-columns: 1fr;
  }
  
  /* 禁用可能导致溢出的hover动画 */
  .panel:hover,
  .chart-container-full:hover,
  .news-grid-item:hover {
    transform: none;
  }
}

@media (max-width: 768px) {
  .container {
    padding: var(--spacing-small);
  }
  
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-small);
    margin-bottom: var(--spacing-large);
  }
  
  .app-header h1 {
    font-size: 32px;
  }
  
  .index-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .index-latest-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-small);
  }
  
  .chart-container-full {
    height: 400px;
    padding: var(--spacing);
  }
  
  .content-area {
    padding: var(--spacing);
  }
  
  .layout {
    gap: var(--spacing-small);
  }
  
  /* 分类视图移动端适配 */
  .product-selector-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .pesticide-dropdown {
    min-width: 100%;
    width: 100%;
  }
  
  .index-controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  
  .index-controls label {
    width: 100%;
    justify-content: space-between;
  }
  
  .index-controls select {
    flex: 1;
  }
  
  /* 分类视图所有元素限制 - 768px */
  .view-category,
  .product-content,
  .chart-container-full,
  .chart-with-y-control,
  .news-section {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  
  .view-category canvas {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 480px) {
  .container {
    padding: var(--spacing-small);
  }
  
  .app-header h1 {
    font-size: 28px;
  }
  
  .subtitle {
    font-size: 14px;
  }
  
  .chart-container-full {
    height: 350px;
    padding: var(--spacing-small);
  }
  
  .index-card-value {
    font-size: 32px;
  }
  
  .index-card {
    padding: var(--spacing-small);
  }
  
  /* 分类视图移动端适配 */
  .product-selector-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .pesticide-dropdown {
    min-width: 100%;
    width: 100%;
  }
  
  .time-range-compact,
  .currency-compact {
    width: 100%;
  }
  
  .time-range-compact select,
  .currency-compact select {
    width: 100%;
  }
  
  .selected-tags {
    width: 100%;
  }
  
  /* 分类视图所有元素限制 */
  .view-category,
  .view-category *,
  .product-content,
  .product-content *,
  .chart-container-full,
  .chart-with-y-control {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .view-category canvas,
  .product-content canvas {
    width: 100% !important;
  }
  
  /* 新闻区域 */
  .news-section,
  .news-grid,
  .news-header {
    width: 100%;
    max-width: 100%;
  }
}

/* 确保分类视图内容不会溢出 */
.view-category,
.view-default {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.product-content {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.product-content .chart-container-full {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.product-content .chart-container-full canvas {
  width: 100% !important;
  max-width: 100%;
}

/* 确保所有内容区域不溢出 */
.content-area {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Smooth Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  animation: fadeIn 0.3s ease;
}

/* Focus States (Accessibility) */
button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Scrollbar Styling (Webkit) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

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

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

/* 最近新闻：标题可点开本地阅读 */
.recent-news-section ul li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px;
}
.news-title-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--brand);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.news-title-link:hover {
  text-decoration: underline;
}
.news-origin-link {
  color: var(--text-secondary);
  font-size: 0.9em;
  text-decoration: none;
}
.news-origin-link:hover {
  text-decoration: underline;
}

/* 文章详情弹层 */
.article-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.article-modal.article-modal-visible {
  opacity: 1;
  visibility: visible;
}
.article-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.article-modal-box {
  position: relative;
  width: 90%;
  max-width: 900px;
  min-width: 320px;
  max-height: 90vh;
  background: var(--panel);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-hover);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.article-modal-header {
  flex-shrink: 0;
  padding: var(--spacing);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}
.article-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  flex: 1 1 100%;
}
.article-modal-meta {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9em;
  color: var(--text-secondary);
}
.article-modal-meta a {
  color: var(--brand);
  text-decoration: none;
}
.article-modal-meta a:hover {
  text-decoration: underline;
}
.article-modal-close {
  position: absolute;
  top: var(--spacing-small);
  right: var(--spacing-small);
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.article-modal-close:hover {
  background: var(--panel-hover);
  color: var(--text);
}
.article-modal-body {
  flex: 1;
  overflow: auto;
  padding: var(--spacing);
  font-size: 0.95rem;
  line-height: 1.6;
}
.article-modal-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-small);
}
.article-modal-body p {
  margin: 0 0 0.75em;
}
.article-modal-body p:last-child {
  margin-bottom: 0;
}
