/*============================================*/
/*       SDGI BAR CHART WIDGET                */
/*       Created: 2026/01/15                  */
/*       Version: 1.0.0                       */
/*============================================*/

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");

/* RESET */
#tbc-horizontal-fix,
#tbc-horizontal-fix * {
	box-sizing: border-box;
}

#tbc-horizontal-fix {
	font-family: "Inter", sans-serif;
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 40px 20px;
	overflow-x: hidden;
	position: relative;
}

/* --- DESKTOP LAYOUT (> 1200px) --- */
.tbc-chart-area {
	display: flex;
	justify-content: center;
	align-items: stretch;
	gap: 50px;
	height: 450px;
	padding-bottom: 0px;
	margin-bottom: 0px;
	width: 100%;
}

.tbc-bar-group {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: center;
	position: relative;
	width: auto;
	min-width: 0;
}

.tbc-bars-wrapper {
	display: flex;
	justify-content: center;
	align-items: flex-end;
	/* Zero gap so bars touch */
	gap: 0px;
	height: 100%;
}

.tbc-bar {
	width: 65px;
	border-top-left-radius: 8px;
	border-top-right-radius: 8px;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding-top: 5px;
	height: 0%;
	opacity: 0;
	transition: height 1s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease;
	position: relative;
	overflow: visible;
}
.tbc-bar.mill {
	background-color: #9d1b1e;
}
.tbc-bar.plantation {
	background-color: #ef4b3b;
}

.tbc-bar-label {
	color: white;
	font-weight: 700;
	font-size: 0.9rem;
	opacity: 0;
	transition: opacity 0.5s ease 0.8s;
	z-index: 2;
	white-space: nowrap;
}

.tbc-group-label {
	font-weight: 700;
	color: #000;
	font-size: 1rem;
	text-align: center;
	margin-top: 15px;
	line-height: 1.2;
	width: 100%;
	white-space: normal;
	/* height: 48px; */
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

.tbc-legend {
	display: flex;
	justify-content: center;
	gap: 40px;
	margin-top: 20px;
	width: 100%;
	flex-wrap: wrap;
}

.tbc-legend-item {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.95rem;
	color: #333;
	font-weight: 500;
}

.tbc-legend-dot {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	flex-shrink: 0;
}
.tbc-legend-dot.mill {
	background-color: #9d1b1e;
}
.tbc-legend-dot.plantation {
	background-color: #ef4b3b;
}

/* --- TABLET / SMALL LAPTOP (1200px -> 769px) --- */
/* Shrinks bars but KEEPS TEXT HORIZONTAL */
@media (max-width: 1200px) {
	.tbc-chart-area {
		/* Keep centered, just reduce gap */
		justify-content: center;
		gap: 20px;
	}

	.tbc-bar {
		/* Reduce width to 50px so it fits on Tablet without wrapping */
		width: 50px;
	}

	.tbc-bar-label {
		/* Slightly smaller font to fit horizontal text in 50px bar */
		font-size: 0.8rem;
	}
}

/* --- MOBILE LAYOUT (<= 768px) --- */
/* Only switches to Vertical Text here */
@media (max-width: 768px) {
	#tbc-horizontal-fix {
		padding: 20px 0;
	}

	.tbc-chart-area {
		height: 280px;
		justify-content: space-between;
		gap: 0;
		padding: 0;
	}

	.tbc-bar-group {
		width: 16%;
	}

	.tbc-bars-wrapper {
		gap: 0px;
		width: 100%;
	}

	.tbc-bar {
		width: 50%;
		max-width: none;
		min-height: 40px;
		padding-top: 0;
		align-items: center;
		/* Visible 6px rounding */
		border-radius: 6px 6px 0 0;
	}

	.tbc-bar-label {
		/* Vertical Text kicks in here */
		writing-mode: vertical-rl;
		transform: rotate(180deg);
		font-size: 8px;
		font-weight: 600;
		margin-bottom: 0px;
	}

	.tbc-group-label {
		font-size: 0.6rem;
		margin-top: 6px;
		line-height: 1.1;
		padding: 0;
		height: 30px;
	}

	.tbc-legend {
		gap: 10px;
		margin-top: 15px;
	}
	.tbc-legend-item {
		font-size: 0.75rem;
	}
	.tbc-legend-dot {
		width: 14px;
		height: 14px;
	}
}
