/* ─── Historical Trends Section ───────────────────────────── */
.historical-section { margin-top: 40px; }

/* ─── Layout ────────────────────────────────────────────── */
.historical-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
  align-items: start;
}

/* ─── Left List Card ────────────────────────────────────── */
.historical-list-card {
  background: #fff;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 500px;
}
.historical-list-card .list-header {
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.historical-list-card .list-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 12px;
}
.list-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #0f172a);
}
.list-item:hover { background: #f8fafc; }
.list-item.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}
.list-item:last-child { border-bottom: none; }

/* ─── Right Chart Card ──────────────────────────────────── */
.historical-chart-card {
  background: #fff;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 500px;
}
.historical-chart-card .chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ─── Segmented Control (Tabs) ──────────────────────────── */
.segmented-control {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
}
.segmented-control button {
  background: transparent;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.segmented-control button.active {
  background: #fff;
  color: var(--text, #0f172a);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ─── Time Range Selector (Stock Style) ─────────────────── */
.time-range-selector {
  display: flex;
  gap: 4px;
}
.time-range-selector button {
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.2s;
}
.time-range-selector button:hover {
  color: var(--text, #0f172a);
}
.time-range-selector button.active {
  background: #f1f5f9;
  color: var(--primary, #3b82f6);
}

/* ─── Chart Content ─────────────────────────────────────── */
.chart-content {
  flex: 1;
  position: relative;
}
.tab-pane {
  display: none;
  height: 100%;
  width: 100%;
}
.tab-pane.active {
  display: block;
}
.chart-canvas {
  width: 100%;
  height: 100%;
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .segmented-control {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .segmented-control::-webkit-scrollbar { display: none; }
  .segmented-control button { flex: 0 0 auto; white-space: nowrap; }
  .historical-chart-card .chart-header { flex-direction: column; align-items: flex-start; }
  .time-range-selector { align-self: flex-end; }
}

/* ─── Toggle Pair ───────────────────────────────────────── */
.toggle-pair {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.toggle-pair button {
  background: #fff;
  border: none;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.toggle-pair button:last-child { border-right: none; }
.toggle-pair button.active {
  background: #f8fafc;
  color: var(--text, #0f172a);
}

/* ─── Mobile Select Picker ──────────────────────────────── */
.mobile-select {
  display: none;
  width: 100%;
  padding: 12px 16px;
  font-size: 16px; /* 16px avoids iOS zoom on focus */
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text, #0f172a);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2364748b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 16px top 50%;
  background-size: 12px auto;
}



/* ─── Responsive ────────────────────────── */
@media (max-width: 992px) {
  .historical-layout { grid-template-columns: 1fr; }
  .historical-list-card { height: auto; }
  .list-body { display: none; }
  .mobile-select { 
    display: block !important; 
    margin: 0 auto 16px auto; 
    width: calc(100% - 40px);
    box-sizing: border-box;
  }
  .historical-chart-card { height: 400px; }
}
