@import '../../sass/_custom-variables/libs';

/*-- Chart --*/
.c3 {
  svg {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  }

  text {
    user-select: none;
  }

  path,
  line {
    fill: none;
  }
}

.c3-legend-item-tile,
.c3-xgrid-focus,
.c3-ygrid,
.c3-event-rect,
.c3-bars path {
  shape-rendering: crispEdges;
}

.c3-chart-arc rect {
  stroke: white;
  stroke-width: 1;
}

.c3-xgrid,
.c3-ygrid {
  stroke-dasharray: 3 3;
}

.c3-line {
  stroke-width: 1px;
}

.c3-circle {
  fill: currentColor;
}

.c3-circle._expanded_ {
  stroke-width: 1px;
  stroke: white;
}

.c3-selected-circle {
  fill: white;
  stroke-width: 2px;
}

.c3-bar {
  stroke-width: 0;
}

.c3-bar._expanded_ {
  fill-opacity: 1;
  fill-opacity: 0.75;
}

.c3-target.c3-focused {
  opacity: 1;
}

.c3-target.c3-focused path.c3-line,
.c3-target.c3-focused path.c3-step {
  stroke-width: 2px;
}

.c3-target.c3-defocused {
  opacity: 0.3 !important;
}

/*-- Region --*/
.c3-region {
  fill: steelblue;
  fill-opacity: 0.1;
}

.c3-region text {
  fill-opacity: 1;
}

.c3-brush .extent {
  fill-opacity: 0.1;
}

.c3-legend-item-hidden {
  opacity: 0.15;
}

.c3-legend-background {
  opacity: 0.75;
  fill: white;
  stroke: lightgray;
  stroke-width: 1;
}

.c3-area {
  stroke-width: 0;
  opacity: 0.2;
}

.c3-chart-arcs-title {
  dominant-baseline: middle;
  font-size: 1.3em;
}

.c3-chart-arc.c3-target g path {
  opacity: 1;
}

.c3-chart-arc.c3-target.c3-focused g path {
  opacity: 1;
}

.c3-drag-zoom.enabled {
  pointer-events: all !important;
  visibility: visible;
}

.c3-drag-zoom.disabled {
  pointer-events: none !important;
  visibility: hidden;
}

.c3-drag-zoom .extent {
  fill-opacity: 0.1;
}

.c3-text.c3-empty {
  font-size: 2em;
}

.c3-chart-arcs .c3-chart-arcs-background {
  stroke: none;
}

.c3-tooltip-container {
  z-index: 10;
}

.c3-tooltip {
  border-spacing: 0;
  border-collapse: collapse;
  empty-cells: show;
}

.c3-tooltip,
.c3-tooltip tr,
.c3-tooltip th,
.c3-tooltip td {
  border: none;
  background: none !important;
}

.c3-tooltip td {
  &.value {
    text-align: right;
  }

  >span {
    display: inline-block;
    width: 10px;
    height: 10px;
  }
}

@if $enable-light-style {
  .light-style {
    @import "../../sass/_appwork/include";

    $c3-grid-color:      $gray-200 !default;
    $c3-guide-color:     $gray-200 !default;
    $c3-text-color:      $body-color !default;
    $c3-arcs-background: $gray-100 !default;
    $c3-arcs-stroke:     #fff !default;
    $c3-tooltip-padding: 6px !default;

    .c3 {
      svg {
        font: 11px $font-family-base;
      }

      path,
      line {
        stroke: $c3-grid-color;
      }

      text {
        fill: $body-color;
      }
    }

    .c3-chart-arc {
      path {
        stroke: $c3-arcs-stroke;
      }

      text {
        font-size: $font-size-sm;
        fill: $c3-arcs-stroke;
      }
    }

    .c3-grid {
      line {
        stroke: $c3-grid-color;
      }

      text {
        fill: $c3-grid-color;
      }
    }

    .c3-text.c3-empty {
      fill: $text-muted;
    }

    .c3-legend-item {
      font-size: $font-size-sm;
    }

    .c3-title {
      font: $font-size-base $font-family-base;
    }

    .c3-chart-arcs .c3-chart-arcs-background {
      fill: $c3-arcs-background;
      stroke: none;
    }

    .c3-chart-arcs .c3-chart-arcs-gauge-unit {
      font-size: $font-size-lg;
      fill: $body-color;
    }

    .c3-chart-arcs .c3-chart-arcs-gauge-max,
    .c3-chart-arcs .c3-chart-arcs-gauge-min {
      fill: $body-color;
    }

    .c3-chart-arc .c3-gauge-value {
      fill: $body-color;
    }

    .c3-tooltip-container {
      background-color: $tooltip-bg;
      padding: $c3-tooltip-padding;
      @include border-radius($border-radius);
    }

    .c3-tooltip,
    .c3-tooltip tr,
    .c3-tooltip th,
    .c3-tooltip td {
      color: $tooltip-color;
      font-size: $font-size-sm;
    }

    .c3-tooltip th {
      padding: 0 $c3-tooltip-padding;
    }

    .c3-tooltip td {
      padding: 0 $c3-tooltip-padding;

      > span {
        margin-right: $c3-tooltip-padding;
      }
    }
  }
}

@if $enable-material-style {
  .material-style {
    @import "../../sass/_appwork/include-material";

    $c3-grid-color:      $gray-200 !default;
    $c3-guide-color:     $gray-200 !default;
    $c3-text-color:      $body-color !default;
    $c3-arcs-background: $gray-100 !default;
    $c3-arcs-stroke:     #fff !default;
    $c3-tooltip-padding: 6px !default;

    .c3 {
      svg {
        font: 11px $font-family-base;
      }

      path,
      line {
        stroke: $c3-grid-color;
      }

      text {
        fill: $body-color;
      }
    }

    .c3-chart-arc {
      path {
        stroke: $c3-arcs-stroke;
      }

      text {
        font-size: $font-size-sm;
        fill: $c3-arcs-stroke;
      }
    }

    .c3-grid {
      line {
        stroke: $c3-grid-color;
      }

      text {
        fill: $c3-grid-color;
      }
    }

    .c3-text.c3-empty {
      fill: $text-muted;
    }

    .c3-legend-item {
      font-size: $font-size-sm;
    }

    .c3-title {
      font: $font-size-base $font-family-base;
    }

    .c3-chart-arcs .c3-chart-arcs-background {
      fill: $c3-arcs-background;
      stroke: none;
    }

    .c3-chart-arcs .c3-chart-arcs-gauge-unit {
      font-size: $font-size-lg;
      fill: $body-color;
    }

    .c3-chart-arcs .c3-chart-arcs-gauge-max,
    .c3-chart-arcs .c3-chart-arcs-gauge-min {
      fill: $body-color;
    }

    .c3-chart-arc .c3-gauge-value {
      fill: $body-color;
    }

    .c3-tooltip-container {
      background-color: $tooltip-bg;
      padding: $c3-tooltip-padding;
      @include border-radius($border-radius);
    }

    .c3-tooltip,
    .c3-tooltip tr,
    .c3-tooltip th,
    .c3-tooltip td {
      color: $tooltip-color;
      font-size: $font-size-sm;
    }

    .c3-tooltip th {
      padding: 0 $c3-tooltip-padding;
    }

    .c3-tooltip td {
      padding: 0 $c3-tooltip-padding;

      > span {
        margin-right: $c3-tooltip-padding;
      }
    }
  }
}

@if $enable-dark-style {
  .dark-style {
    @import "../../sass/_appwork/include-dark";

    $c3-grid-color:      $gray-200 !default;
    $c3-guide-color:     $gray-200 !default;
    $c3-text-color:      $body-color !default;
    $c3-arcs-background: $gray-100 !default;
    $c3-arcs-stroke:     #fff !default;
    $c3-tooltip-padding: 6px !default;

    .c3 {
      svg {
        font: 11px $font-family-base;
      }

      path,
      line {
        stroke: $c3-grid-color;
      }

      text {
        fill: $body-color;
      }
    }

    .c3-chart-arc {
      path {
        stroke: $c3-arcs-stroke;
      }

      text {
        font-size: $font-size-sm;
        fill: $c3-arcs-stroke;
      }
    }

    .c3-grid {
      line {
        stroke: $c3-grid-color;
      }

      text {
        fill: $c3-grid-color;
      }
    }

    .c3-text.c3-empty {
      fill: $text-muted;
    }

    .c3-legend-item {
      font-size: $font-size-sm;
    }

    .c3-title {
      font: $font-size-base $font-family-base;
    }

    .c3-chart-arcs .c3-chart-arcs-background {
      fill: $c3-arcs-background;
      stroke: none;
    }

    .c3-chart-arcs .c3-chart-arcs-gauge-unit {
      font-size: $font-size-lg;
      fill: $body-color;
    }

    .c3-chart-arcs .c3-chart-arcs-gauge-max,
    .c3-chart-arcs .c3-chart-arcs-gauge-min {
      fill: $body-color;
    }

    .c3-chart-arc .c3-gauge-value {
      fill: $body-color;
    }

    .c3-tooltip-container {
      background-color: $tooltip-bg;
      padding: $c3-tooltip-padding;
      @include border-radius($border-radius);
    }

    .c3-tooltip,
    .c3-tooltip tr,
    .c3-tooltip th,
    .c3-tooltip td {
      color: $tooltip-color;
      font-size: $font-size-sm;
    }

    .c3-tooltip th {
      padding: 0 $c3-tooltip-padding;
    }

    .c3-tooltip td {
      padding: 0 $c3-tooltip-padding;

      > span {
        margin-right: $c3-tooltip-padding;
      }
    }
  }
}
