/* ========== 期货页面专用样式 ========== */

.futures-page {
  padding: 24px 0;
}

/* 页面标题 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 24px;
  color: var(--primary-dark);
  font-weight: 700;
}
.header-info {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: #666;
}
.time-info {
  background: var(--bg2);
  padding: 6px 12px;
  border-radius: 4px;
}

/* 主力合约 */
.main-contract {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.main-quote {
  padding: 24px;
}
.quote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.quote-header h3 {
  font-size: 18px;
  color: var(--primary-dark);
}
.quote-tag {
  background: var(--accent);
  color: var(--primary-dark);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.quote-main {
  padding: 20px 0;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 20px;
}
.current-price {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 8px;
}
.current-price.up { color: var(--red); }
.current-price.down { color: var(--green); }
.price-change {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}
.price-change.up .arrow,
.price-change.up .num,
.price-change.up .percent { color: var(--red); }
.price-change.down .arrow,
.price-change.down .num,
.price-change.down .percent { color: var(--green); }

.quote-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.detail-item {
  text-align: center;
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
}
.detail-item .label {
  display: block;
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}
.detail-item .value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.detail-item .value.up { color: var(--red); }
.detail-item .value.down { color: var(--green); }

/* 图表区域 */
.chart-area {
  padding: 20px;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chart-header h3 {
  font-size: 16px;
  color: var(--primary-dark);
}
.chart-tabs {
  display: flex;
  gap: 4px;
}
.chart-tabs button {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: all .2s;
}
.chart-tabs button:hover,
.chart-tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.chart-placeholder {
  height: 320px;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
}
.chart-grid {
  display: flex;
  height: 100%;
}
.y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-right: 12px;
  border-right: 1px solid var(--border);
  margin-right: 12px;
}
.y-axis span {
  font-size: 11px;
  color: #888;
}
.chart-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.mock-chart {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 10px;
}
.kline {
  width: 28px;
  background: var(--red);
  border-radius: 2px;
}
.kline.kline-up { background: var(--red); }
.kline.kline-down { background: var(--green); }
.x-axis {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.x-axis span {
  font-size: 11px;
  color: #888;
}

/* 合约列表 */
.contracts-section {
  margin-bottom: 32px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-title h2 {
  font-size: 19px;
  color: var(--primary-dark);
  font-weight: 700;
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}
.filter-tabs {
  display: flex;
  gap: 4px;
}
.filter-tabs button {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: all .2s;
}
.filter-tabs button:hover,
.filter-tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.contracts-table th {
  background: var(--bg2);
  font-size: 12px;
  white-space: nowrap;
}
.contracts-table td {
  font-size: 13px;
}
.contracts-table .price {
  font-weight: 700;
}
.main-contract-row {
  background: #fff8e1;
}

/* 期现对比 */
.spot-futures-section {
  margin-bottom: 32px;
}
.spot-futures-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.spot-card,
.basis-card,
.forecast-card {
  padding: 24px;
}
.spot-card h4,
.basis-card h4,
.forecast-card h4 {
  font-size: 14px;
  color: var(--primary-dark);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.spot-price {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 8px;
}
.spot-change {
  font-size: 14px;
  margin-bottom: 16px;
}
.spot-meta {
  font-size: 12px;
  color: #666;
}
.spot-meta p {
  margin-bottom: 4px;
}

.basis-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.basis-desc {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}
.basis-analysis {
  font-size: 12px;
  color: #666;
}
.basis-analysis p {
  margin-bottom: 4px;
}

.forecast-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.forecast-item:last-child {
  border-bottom: none;
}
.forecast-item .broker {
  width: 80px;
  font-size: 13px;
  color: var(--text);
}
.forecast-item .view {
  width: 50px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 3px;
  text-align: center;
}
.forecast-item .view.up {
  background: #ffebee;
  color: var(--red);
}
.forecast-item .view.down {
  background: #e8f5e9;
  color: var(--green);
}
.forecast-item .view.flat {
  background: var(--bg);
  color: #888;
}
.forecast-item .target {
  margin-left: auto;
  font-size: 12px;
  color: #666;
}

/* 交易规则 */
.rules-section {
  margin-bottom: 32px;
}
.rules-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.rule-card {
  padding: 24px;
  text-align: center;
}
.rule-icon {
  width: 56px;
  height: 56px;
  background: var(--bg2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 16px;
}
.rule-card h4 {
  font-size: 15px;
  color: var(--primary-dark);
  margin-bottom: 12px;
}
.rule-card ul {
  text-align: left;
}
.rule-card li {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 8px;
  padding-left: 16px;
  position: relative;
}
.rule-card li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* 返回顶部 */
.back-to-top {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transition: all .3s;
  z-index: 1000;
}
.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* 响应式 */
@media(max-width: 1024px) {
  .main-contract {
    grid-template-columns: 1fr;
  }
  .spot-futures-grid {
    grid-template-columns: 1fr;
  }
  .rules-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media(max-width: 768px) {
  .contracts-table {
    font-size: 12px;
  }
  .contracts-table th,
  .contracts-table td {
    padding: 8px 6px;
  }
}
@media(max-width: 600px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .rules-grid {
    grid-template-columns: 1fr;
  }
  .chart-placeholder {
    height: 250px;
  }
}
