/*
*
* D3 Charts
*/

.c3 svg {
	padding-left: 4px;
	width: 100%;
	-webkit-tap-highlight-color: transparent;
}

.c3 path,
.c3 line {
	fill: none;
	stroke: #9f9f9f;
}

.c3 text {
	font-family: $font-family-base;
	font-size: 16px;
	fill: #9b9b9b;
	user-select: none;
}

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

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

.c3-chart-arc text {
	fill: $white;
	font-size: 14px;
}

/*-- Axis --*/
/*-- Grid --*/
.c3-grid line {
	stroke: #eaebee;
}

.c3-grid text {
	fill: #aaa;
}

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

/*-- Text on Chart --*/
.c3-text.c3-empty {
	fill: #808080;
	font-size: 2em;
}

/*-- Line --*/
.c3-line {
	stroke-width: 3px;
}

/*-- Point --*/
.c3-circle._expanded_ {
	stroke-width: 2px;
	stroke: white;
}

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

/*-- Bar --*/
.c3-bar {
	stroke-width: 0;
}

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

/*-- Focus --*/
.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: .1;
}

/*-- Brush --*/
.c3-brush .extent {
	fill-opacity: .1;
	fill: #000;
}

/*-- Select - Drag --*/
/*-- Legend --*/
.c3-legend-item {
	font-size: 12px;
}

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

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

/*-- Title --*/
.c3-title {
	font: 14px sans-serif;
}

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

.c3-tooltip {
	border-collapse: collapse;
	border-spacing: 0;
	background-color: $white;
	empty-cells: show;
	opacity: 0.9;
	border: 1px solid #ccc;

	tr {
		border: 1px solid #ccc;
	}

	th {
		background-color: #aaa;
		font-size: 14px;
		line-height: 1.2;
		padding: 2px 5px;
		text-align: left;
		color: $white;
	}

	td {
		font-size: 13px;
		padding: 3px 6px;
		background-color: $white;
		color: $black;
		border-left: 1px dotted #999;

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

	td.value {
		text-align: right;
	}
}

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

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

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

.c3-chart-arcs .c3-chart-arcs-gauge-unit {
	fill: #000;
	font-size: 16px;
}

.c3-chart-arcs .c3-chart-arcs-gauge-max {
	fill: #777;
}

.c3-chart-arcs .c3-chart-arcs-gauge-min {
	fill: #777;
}

.c3-chart-arc .c3-gauge-value {
	fill: #000;
}

.c3 .domain {
	stroke: #c8c8c8;
}

.d3-chart .tick line {
	display: none;
}

.d3-chart .c3-tooltip {
	opacity: 1;
	color: $white;
	background: $primary;
	border: 1px solid $gray-300;

	tr th {
		padding: 8px 10px;
		color: $white;
		background: $gray-700;
	}

	tr td {
		padding: 5px 10px;
		color: #838386;
		background: $white;
	}

	.value {
		border-left: 1px solid #f2f3f9;
	}
}

#line-chart {
	.c3-tooltip-container {
		border-radius: $border-radius-lg;
		overflow: hidden;
		box-shadow: 0 0 10px 0 rgba($black, .05);

		tr {
			border: 0;
		}

		.name {
			border-left: 0;
		}

		table {
			border: 0 solid transparent;
			border-radius: $border-radius-lg;
		}
	}

	.c3-axis-y-label {
		transform: translateY(-10px);
	}

	.c3-axis-y .tick text {
		transform: translateX(1px);
	}

	.c3-axis-x {
		text-align: left;

		text {
			transform: translateX(-1px);
			text-anchor: start !important;
		}
	}

	.c3-legend-item {
		display: none !important;
		transform: translateY(15px);

		text {
			font-size: 16px;
			color: #29293a;
		}
	}
}

.d3-chart-wrap {
	width: 100%;
	max-width: 100%;
	overflow-y: hidden;
	overflow-x: auto;
	padding-bottom: 30px;
}

.d3-chart-wrap > .d3-chart {
	min-width: 520px;
}

.d3-chart-legend {
	transform: translateY(-5px);
	margin-bottom: -5px;
	margin-left: -30px;
	text-align: center;
}

.d3-chart-legend {
	> * {
		display: inline-block;
		margin-top: 5px;
		margin-left: 30px;
	}

	span {
		position: relative;
		display: inline-block;
		font-size: 16px;
		color: $gray-400;
		cursor: pointer;

		&::before {
			content: '';
			display: inline-block;
			height: 3px;
			width: 30px;
			margin-right: 12px;
			vertical-align: middle;
		}

		&:nth-child(1) {
			&::before {
				background: $primary;
			}
		}

		&:nth-child(2) {
			&::before {
				background: $gray-300;
			}
		}
	}
}

* + .d3-chart-legend { margin-top: 20px; }

@include media-breakpoint-up(xxl) {
	.d3-chart-legend span {
		font-size: 18px;
	}
}