[data-chart-type-value="bar"] .c3-chart .c3-chart-texts .c3-chart-text .c3-text {
  fill: black !important;
}

.c3-legend-item-hidden {
  opacity: 0.5 !important;
}

/* Y-axis labels - adapt to theme */
.c3-axis-y .tick text {
  fill: black !important;
  color: black !important;
}

/* X-axis labels - adapt to theme */
.c3-axis-x .tick text {
  fill: black !important;
  color: black !important;
}

/* Legend text - adapt to theme */
.c3-legend-item text {
  fill: black !important;
  color: black !important;
}

/* Ensure spline charts also have visible text */
[data-chart-type-value="spline"] .c3-axis-y .tick text,
[data-chart-type-value="spline"] .c3-axis-x .tick text,
[data-chart-type-value="spline"] .c3-legend-item text {
  fill: black !important;
  color: black !important;
}

.c3-grid .c3-ygrid,
.c3-grid .c3-xgrid {
  stroke: #e0e0e0 !important;
}

.c3-axis-x path,
.c3-axis-x line,
.c3-axis-y path,
.c3-axis-y line {
  stroke: #bdbdbd !important;
  fill: none !important;
}

.c3-axis-x path {
  stroke: none !important;
}

/* Restore X-axis line for specific charts */
.show-x-axis .c3-axis-x path {
  stroke: #bdbdbd !important;
}

/* Dark mode overrides - check data-theme attribute instead of system preference */
[data-theme="dark"],
[data-theme="forest"],
[data-theme="synthwave"],
[data-theme="retro"],
[data-theme="cyberpunk"],
[data-theme="halloween"],
[data-theme="aqua"],
[data-theme="fantasy"],
[data-theme="black"],
[data-theme="luxury"],
[data-theme="dracula"],
[data-theme="night"],
[data-theme="coffee"],
[data-theme="dim"],
[data-theme="nord"],
[data-theme="sunset"],
[data-theme="abyss"] {
  [data-chart-type-value="bar"] .c3-chart .c3-chart-texts .c3-chart-text .c3-text {
    fill: white !important;
  }

  .c3-axis-y .tick text {
    fill: white !important;
    color: white !important;
  }

  .c3-axis-x .tick text {
    fill: white !important;
    color: white !important;
  }

  .c3-legend-item text {
    fill: white !important;
    color: white !important;
  }

  /* Ensure spline charts also have visible text in dark mode */
  [data-chart-type-value="spline"] .c3-axis-y .tick text,
  [data-chart-type-value="spline"] .c3-axis-x .tick text,
  [data-chart-type-value="spline"] .c3-legend-item text {
    fill: white !important;
    color: white !important;
  }

  .c3-grid .c3-ygrid,
  .c3-grid .c3-xgrid {
    stroke: rgba(255, 255, 255, 0.2) !important;
  }

  .c3-axis-x path,
  .c3-axis-x line,
  .c3-axis-y path,
  .c3-axis-y line {
    stroke: rgba(255, 255, 255, 0.4) !important;
  }

  .show-x-axis .c3-axis-x path {
    stroke: rgba(255, 255, 255, 0.4) !important;
  }

  /* Force text visibility in dark mode - high specificity */
  .c3 svg .c3-axis-y .tick text,
  .c3 svg .c3-axis-x .tick text,
  .c3 svg .c3-legend-item text {
    fill: #f3f4f6 !important;
    opacity: 1 !important;
  }
}

.spline-chart-present .c3-line {
  stroke-width: 3px;
  fill: none !important;
}

/* Force text visibility for all chart types - high specificity */
.c3 svg .c3-axis-y .tick text,
.c3 svg .c3-axis-x .tick text,
.c3 svg .c3-legend-item text {
  fill: #1f2937 !important;
  opacity: 1 !important;
}

/* Force text visibility for all chart types */
.c3 svg .c3-axis-y .tick text,
.c3 svg .c3-axis-x .tick text,
.c3 svg .c3-legend-item text {
  fill: #1f2937 !important;
  opacity: 1 !important;
}

.c3-legend-item-tile {
  stroke-width: 10;
  shape-rendering: auto;
  stroke-linecap: round;
  stroke-dasharray: .1 10;
  transform: translate(6px);
}

.c3-tooltip-container {
  background: #333 !important;
  border: 1px solid #333 !important;
  border-radius: 5px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
  color: white !important;
}

.c3-tooltip th {
  background-color: #333 !important;
  font-size: 14px;
  padding: 5px 10px;
  text-align: left !important;
  color: #fff;
}

.c3-tooltip td {
  font-size: 13px;
  padding: 5px 10px;
  color: #fff;
  border-left: none !important;
}