/* Shared InteractiveChart host / zoom toolbar (engine-chart-*) */

.engine-chart-host {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 240px;
  height: 100%;
}

.engine-chart-plot {
  position: relative;
  width: 100%;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  background: #fff;
  overflow: hidden;
}

.engine-chart-plot canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.engine-chart-zoom-toolbar {
  display: flex;
  flex-wrap: wrap;
  flex: 0 0 auto;
  align-items: center;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
  user-select: none;
}

.engine-chart-zoom-group,
.engine-chart-action-group {
  display: inline-flex;
}

.engine-chart-action-group.d-none {
  display: none !important;
}

.engine-chart-tool-extras {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.engine-chart-zoom-toolbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 0.45rem;
  color: #334155;
  border-color: #cbd5e1;
  background: #fff;
}

.engine-chart-zoom-toolbar .btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.engine-chart-zoom-toolbar .btn.active,
.engine-chart-zoom-toolbar .btn[aria-pressed="true"] {
  background: #e2e8f0;
  border-color: #64748b;
  color: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.engine-chart-zoom-toolbar .btn:disabled {
  opacity: 0.45;
}

.engine-chart-zoom-toolbar .btn svg {
  display: block;
  pointer-events: none;
}

.engine-chart-action-detect {
  color: #0369a1 !important;
  border-color: #7dd3fc !important;
}

.engine-chart-action-cut {
  color: #b45309 !important;
  border-color: #fcd34d !important;
}

.engine-chart-action-save {
  color: #047857 !important;
  border-color: #6ee7b7 !important;
}

.engine-chart-ylog-btn.active {
  background: #dbeafe !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
}

.engine-chart-axis-unit-label {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  pointer-events: auto;
  line-height: 1.2;
}

.engine-chart-axis-unit-label.d-none {
  display: none !important;
}

.engine-chart-axis-unit-label--y,
.engine-chart-axis-unit-label--z {
  /* Position applied in InteractiveChart._layoutUnitLabel */
  left: 12px;
  right: auto;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center center;
}

.engine-chart-axis-unit-label--x {
  left: 50%;
  top: auto;
  bottom: auto;
  transform: translate(-50%, 0);
  transform-origin: center center;
}

.engine-chart-axis-unit-prefix {
  user-select: none;
}

.engine-chart-axis-unit-label--x .engine-chart-axis-unit-prefix {
  display: none;
}

.engine-chart-axis-unit-select {
  width: auto;
  min-width: 9.5rem;
  max-width: 14rem;
  height: 1.55rem;
  padding: 0 0.55rem;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-align-last: center;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #94a3b8;
  border-radius: 0.3rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
  cursor: pointer;
}

.engine-chart-axis-unit-label--y .engine-chart-axis-unit-select {
  min-width: 3.2rem;
  max-width: 4.5rem;
  text-align: center;
  text-align-last: center;
}

.engine-chart-axis-unit-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.lpe-results-chart.engine-chart-host {
  min-height: 320px !important;
  height: auto !important;
}

.lpe-results-chart .engine-chart-plot {
  min-height: 280px !important;
  height: 280px !important;
  max-height: 280px !important;
}

.lpe-results-chart .engine-chart-plot canvas {
  width: 100% !important;
  height: 100% !important;
}
