/* Tooltip css */
.tooltip {
  position: fixed;
  background: rgba(6, 16, 12, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 14px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  transform: translateY(-50%);
  min-width: 150px;
  max-width: 220px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tooltip-title {
  font-weight: 600;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-feature-settings: "calt" off;
}

.tooltip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  margin: 4px 0;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.15s ease;
}

.tooltip-item:hover {
  color: rgba(255, 255, 255, 0.95);
  transform: translateX(2px);
}

.tooltip-item-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  min-width: 0;
  flex: 1;
  letter-spacing: -0.1px;
}

.tooltip-color-box {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tooltip-item-value {
  font-weight: 600;
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
  font-size: 11px;
  letter-spacing: -0.1px;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tooltip-item:first-child .tooltip-color-box {
  background: rgba(34, 197, 94, 0.8);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.tooltip-item:first-child .tooltip-item-value {
  color: rgba(34, 197, 94, 0.9);
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.15);
}

.tooltip::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(34, 197, 94, 0.3) 20%,
    rgba(34, 197, 94, 0.3) 80%,
    transparent 100%
  );
  border-radius: 8px 8px 0 0;
}

.tooltip::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  z-index: -1;
}

/* Box Container CSS */

section.box-container {
  position: relative;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(6, 16, 12, 0.6);
  --box-container-padding: 24px;
  padding: var(--box-container-padding);
  color: white;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

/* Box Container Header */
div.box-container-header {
  display: flex;
  justify-content: space-between;
  align-items: center; /* Changed from flex-start to center */
  margin-bottom: 16px;
  position: relative;
  gap: 16px;
  flex-wrap: wrap;
}

div.box-title-container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1; /* Allow title to take available space */
}

div.box-controls {
  display: flex;
  align-items: center;
  gap: 8px; /* Reduced gap for tighter control grouping */
  flex-shrink: 0; /* Prevent controls from shrinking */
}
div.box-title-container > h3 {
  font-weight: 600;
  font-size: clamp(14px, 4vw, 16px);
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

div.box-container-chart {
  width: 100%;
}

/* Explainer CSS */

div.explainer-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  background-color: rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
  margin-top: 1;
}

span.explainer-box-info {
  display: block;
  position: fixed;
  background: rgba(6, 16, 12, 1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  padding: 14px 16px;
  max-width: min(220px, 70vw);
  z-index: 2000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}

/* Time Period Selector CSS */

.time-period-group {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}
.time-period-btn {
  width: 36px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  position: relative;
  font-family: "Inter", sans-serif;
}
.time-period-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}
.time-period-btn.active {
  background: rgba(34, 197, 94, 0.15);
  color: rgba(34, 197, 94, 1);
}
.time-period-btn:active {
  transform: scale(0.98);
}
.time-period-btn:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
}
.time-period-btn.active:not(:last-child)::after {
  background: transparent;
}

/* for all chart containers */
*.chart-container {
  position: relative;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(6, 16, 12, 0.6);
  color: white;
  overflow: hidden;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

/* Range Slider CSS */
.range-slider-wrapper {
  position: relative;
  margin-top: 16px;
}

.range-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-family: "Inter", sans-serif;
  font-weight: 400;
}

.range-slider-labels-right {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.range-slider-container {
  position: relative;
  height: 40px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.range-slider-mini-chart {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.range-slider-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: crosshair;
  user-select: none;
}

.range-slider-dimmed-left,
.range-slider-dimmed-right {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(6, 16, 12, 0.8);
  pointer-events: none;
}

.range-slider-dimmed-left {
  left: 0;
}
.range-slider-dimmed-right {
  right: 0;
}

.range-slider-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(34, 197, 94, 0.6);
  border-right: 1px solid rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.05);
  pointer-events: none;
}

.range-slider-selection:hover,
.range-slider-selection.dragging {
  background: rgba(34, 197, 94, 0.08);
}

.range-slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background: rgba(34, 197, 94, 0.8);
  cursor: ew-resize;
  transition: all 0.15s ease;
  pointer-events: all;
}

.range-slider-handle:hover {
  background: rgba(34, 197, 94, 1);
  width: 8px;
}

.range-slider-handle-left {
  left: 0;
  border-radius: 3px 0 0 3px;
}

.range-slider-handle-right {
  right: 0;
  border-radius: 0 3px 3px 0;
}

/* for all filters selectors */
*.filter-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 8px;
  margin-bottom: 6px;
  opacity: 1;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  color: rgba(255, 255, 255, 0.8);
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: opacity 150ms ease-in-out, background-color 150ms ease-in-out;
}

*.filter-selector > div.selector {
  width: 11.5px;
  height: 11.5px;
  border-radius: 3px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  background-color: var(--selector-color);
  transition: border-width 150ms linear, background-color 150ms linear;
}

*.filter-selector.not-selected {
  opacity: 0.5;
  background-color: transparent;
}

*.filter-selector.not-selected > div.selector {
  background-color: transparent;
}


/* Export Menu */

.export-menu-wrapper {
  position: relative;
  display: inline-block;
  margin-right: 1px; /* Space between export button and period selector */
}

.export-menu-button {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  padding: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.export-menu-button:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

.export-menu-icon {
  flex-shrink: 0;
}


.export-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: rgba(6, 16, 12, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  backdrop-filter: blur(20px);
  animation: exportDropdownFadeIn 0.15s ease;
}


.export-dropdown--left {
  left: 0;
  right: auto;
}

.export-dropdown--right {
  left: auto;
  right: 0;
}

@keyframes exportDropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.export-option {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.export-option:hover {
  background: rgba(34, 197, 94, 0.1);
  color: rgba(255, 255, 255, 1);
  transform: translateX(2px);
}

.export-option:active {
  background: rgba(34, 197, 94, 0.15);
}

.export-option-icon {
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
  width: 16px;
  text-align: center;
}