/* ==========================================================================
   Wepsol Weekly Report Canvas - Chart & Channel Distribution
   Trend Graph, Metric Tabs, Spline Curves, Interactive Tooltip, Stacked Bar
   ========================================================================== */

.chart-container-card {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chart-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.chart-title-area h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.chart-title-area p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.chart-controls-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-metric-tabs {
  display: inline-flex;
  background: rgba(20, 22, 31, .04);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.metric-tab {
  border: none;
  background: transparent;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink2);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}

.metric-tab:hover {
  color: var(--ink);
}

.metric-tab.active {
  background: #ffffff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ink2);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.legend-line.current {
  background: var(--brand);
}

.legend-line.previous {
  background: none;
  border-top: 2px dashed #94a3b8;
}

/* SVG Chart Container */
.chart-svg-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: visible;
}

.chart-svg-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* Interactive Floating Tooltip */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(20, 22, 31, .94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 12px 28px -4px rgba(20, 22, 31, .35), 0 0 0 1px rgba(255, 255, 255, .12);
  display: none;
  z-index: 100;
  white-space: nowrap;
  transform: translate(-50%, -115%);
  transition: transform .06s ease, left .04s ease, top .04s ease;
  border: 1px solid rgba(255, 255, 255, .1);
}

.chart-tooltip .tt-date {
  font-weight: 600;
  margin-bottom: 6px;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
  padding-bottom: 4px;
  font-size: 12px;
}

.chart-tooltip .tt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 11.5px;
  margin-top: 2px;
}

/* Traffic Channel Breakdown Stack Bar */
.channel-breakdown-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink2);
}

.stack-bar {
  width: 100%;
  height: 10px;
  border-radius: 9999px;
  background: rgba(20, 22, 31, .08);
  overflow: hidden;
  display: flex;
}

.stack-segment {
  height: 100%;
  transition: width .3s ease;
}

.breakdown-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.breakdown-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.breakdown-legend-item strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

@media(max-width: 768px) {
  .chart-svg-wrap { height: 190px; }
}

.chart-tooltip.visible{display:block}
