/* GeoPark Dashboard styles */
* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
}

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

/* Metric buttons (Gross / WI / WI*COS / WI*COS*Dt) */
.metric-btn {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  min-width: 72px;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.3px;
}
.metric-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}
.metric-btn-active {
  background: #c4262e;
  background-image: linear-gradient(180deg, #d4313a 0%, #b51e26 100%);
  color: #ffffff;
  border-color: #8a161c;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.15);
}
.metric-btn-active:hover {
  background-image: linear-gradient(180deg, #b51e26 0%, #a01a21 100%);
  border-color: #6e1116;
}

/* Floating axis range sliders (Power BI style) */
.chart-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.chart-row .chart-container {
  flex: 1;
  height: 220px;
}

/* Vertical Y-axis range slider (left of the chart) */
.y-range-slider {
  position: relative;
  width: 22px;
  flex: 0 0 22px;
  margin-right: 4px;
  /* Match chart drawing area vertical extent: leave room for top/bottom padding */
  padding: 6px 0;
  cursor: pointer;
}
.y-range-slider .range-track {
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #d1d5db;
  border-radius: 2px;
  transform: translateX(-50%);
}
.y-range-slider .range-fill-vert {
  position: absolute;
  left: 50%;
  width: 2px;
  background: #9ca3af;
  border-radius: 2px;
  transform: translateX(-50%);
  pointer-events: none;
}
.range-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2px solid #4b5563;
  border-radius: 50%;
  box-sizing: border-box;
  cursor: grab;
  z-index: 2;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.range-handle:hover {
  border-color: #c4262e;
  box-shadow: 0 0 0 3px rgba(196,38,46,0.15);
}
.range-handle:active,
.range-handle.dragging {
  cursor: grabbing;
  border-color: #c4262e;
  box-shadow: 0 0 0 4px rgba(196,38,46,0.25);
}
.y-range-slider .range-handle {
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Horizontal X-axis range slider (below the chart) */
.x-range-wrapper {
  display: flex;
  align-items: center;
  margin-top: 4px;
}
.x-range-spacer {
  width: 26px;       /* matches y-range-slider width + margin */
  flex: 0 0 26px;
}
.x-range-slider {
  position: relative;
  flex: 1;
  height: 22px;
  padding: 0 4px;
  cursor: pointer;
}
.x-range-slider .range-track {
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 2px;
  background: #d1d5db;
  border-radius: 2px;
  transform: translateY(-50%);
}
.x-range-slider .range-fill-horiz {
  position: absolute;
  top: 50%;
  height: 2px;
  background: #9ca3af;
  border-radius: 2px;
  transform: translateY(-50%);
  pointer-events: none;
}
.x-range-slider .range-handle {
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Reset button */
.axis-reset.active {
  color: #c4262e;
}

.filter-menu {
  min-width: 220px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.filter-option:hover { background-color: #f3f4f6; }
.filter-option input[type="checkbox"] { cursor: pointer; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

/* Legend tweaks */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  margin-top: 4px;
  padding-left: 4px;
}
.chart-legend .item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.chart-legend .item.disabled { opacity: 0.35; text-decoration: line-through; }
.chart-legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

/* ---------------------- Summary tables (Q + Cum Q) ---------------------- */
/* One single pair of tables shown below the charts, reflecting current filters */
.summary-tables {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 24px;
}
.summary-tables .data-table-block {
  flex: 1;
  max-height: 360px;
}
.data-table-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #ffffff;
  overflow: hidden;
}
.data-table-title {
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  padding: 4px 8px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}
.data-table-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: #ffffff;
  font-weight: 700;
  color: #4b5563;
  text-align: left;
  padding: 3px 6px;
  border-bottom: 1px solid #d1d5db;
  font-size: 10px;
  z-index: 1;
}
.data-table thead th.num { text-align: right; }
.data-table tbody td {
  padding: 2px 6px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
  white-space: nowrap;
}
.data-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: #fef2f2; }
.data-table tfoot td {
  padding: 4px 6px;
  border-top: 1.5px solid #9ca3af;
  font-weight: 700;
  background: #f9fafb;
  color: #111827;
}
.data-table tfoot td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Slightly narrower on smaller screens */
@media (max-width: 1400px) {
  .data-table { font-size: 10px; }
}

/* ============ Tabs ============ */
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  position: relative;
  top: 1px;
}
.tab-btn:hover {
  color: #b91c1c;
  background: #fef2f2;
}
.tab-btn-active {
  color: #b91c1c;
  border-bottom-color: #b91c1c;
  background: white;
}
.tab-content.hidden { display: none; }
