/* Audimaans shared trend chart — soft tooltips, legend, segment controls */

.am-chart-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 280px;
}

.am-chart-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 260px;
  width: 100%;
}

.am-chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.am-chart-empty {
  text-align: center;
  color: #999;
  padding: 48px 16px;
  margin: 0;
  font-size: 14px;
}

.am-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.am-chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(40, 40, 40, 0.08);
  background: rgba(40, 40, 40, 0.03);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, color 0.15s;
}

.am-chart-legend__item:hover {
  background: rgba(40, 40, 40, 0.06);
}

.am-chart-legend__item.is-off {
  opacity: 0.45;
}

.am-chart-legend__swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.am-chart-legend__name {
  color: #282828;
}

.am-chart-legend__total {
  font-weight: 700;
  color: #282828;
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}

/* Floating HTML tooltip (replaces native black title block) */
.am-chart-tooltip {
  position: absolute;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.12s ease;
  min-width: 148px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--am-tip-bg, rgba(255, 255, 255, 0.98));
  border: 1px solid var(--am-tip-border, rgba(40, 40, 40, 0.08));
  box-shadow: var(--am-tip-shadow, 0 12px 32px rgba(40, 40, 40, 0.12));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: "Satoshi", -apple-system, BlinkMacSystemFont, sans-serif;
}

.am-chart-tooltip__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--am-tip-muted, #888);
  margin-bottom: 8px;
}

.am-chart-tooltip__total {
  font-size: 12px;
  color: var(--am-tip-muted, #888);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--am-tip-border, rgba(40, 40, 40, 0.08));
}

.am-chart-tooltip__total strong {
  color: var(--am-tip-title, #282828);
  font-weight: 700;
  margin-left: 4px;
}

.am-chart-tooltip__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
}

.am-chart-tooltip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.am-chart-tooltip__label {
  flex: 1;
  color: var(--am-tip-muted, #888);
}

.am-chart-tooltip__value {
  font-weight: 700;
  color: var(--am-tip-title, #282828);
  font-variant-numeric: tabular-nums;
}

/* Soft segment controls (replace harsh black pills) */
.am-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(40, 40, 40, 0.04);
  border: 1px solid rgba(40, 40, 40, 0.06);
  width: fit-content;
}

.am-seg__btn {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #888;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.am-seg__btn:hover:not(.is-active) {
  color: #282828;
  background: rgba(255, 255, 255, 0.55);
}

.am-seg__btn.is-active {
  background: #fff;
  color: #282828;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(40, 40, 40, 0.08);
}

/* Dark theme (Creators portal) */
[data-theme="dark"] .am-chart-legend__item {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #a1a1aa;
}

[data-theme="dark"] .am-chart-legend__item:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .am-chart-legend__name,
[data-theme="dark"] .am-chart-legend__total {
  color: #f5f5f5;
}

[data-theme="dark"] .am-chart-legend__swatch {
  box-shadow: 0 0 0 3px rgba(47, 47, 47, 0.9);
}

[data-theme="dark"] .am-seg {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .am-seg__btn {
  color: #9ca3af;
}

[data-theme="dark"] .am-seg__btn:hover:not(.is-active) {
  color: #f5f5f5;
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .am-seg__btn.is-active {
  background: #363636;
  color: #f5f5f5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .am-chart-empty {
  color: #9ca3af;
}
