/**
 * Halo Contact Bar - giao diện người dùng
 * https://halomedia.com.vn/
 */

.hcb-bar {
	position: fixed;
	z-index: var(--hcb-z, 100);
	width: var(--hcb-w, 50px);
	display: flex;
	flex-direction: column;
	transition: opacity .3s ease-in-out;
	box-shadow: var(--hcb-shadow, none);
	border-radius: var(--hcb-radius, 8px);
}

.hcb-bar * {
	box-sizing: border-box;
}

/* --- Vị trí ngang --- */
.hcb-bar--right {
	right: 0;
	border-radius: var(--hcb-radius, 8px) 0 0 var(--hcb-radius, 8px);
}

.hcb-bar--left {
	left: 0;
	border-radius: 0 var(--hcb-radius, 8px) var(--hcb-radius, 8px) 0;
}

/* --- Vị trí dọc --- */
.hcb-bar--vtop {
	top: var(--hcb-offset, 35%);
}

.hcb-bar--vmiddle {
	bottom: var(--hcb-offset, 35%);
	transform: translateY(50%);
}

.hcb-bar--vbottom {
	bottom: var(--hcb-offset, 35%);
}

/* --- Nút gập/mở --- */
.hcb-bar__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 4px 12px;
	margin: 0;
	border: 0;
	cursor: pointer;
	background: var(--hcb-toggle-bg, #28ba59);
	color: var(--hcb-toggle-fg, #fff);
	line-height: 0;
	transition: filter .2s ease-in-out;
	-webkit-appearance: none;
	appearance: none;
}

.hcb-bar--right .hcb-bar__toggle {
	border-radius: var(--hcb-radius, 8px) 0 0 0;
}

.hcb-bar--left .hcb-bar__toggle {
	border-radius: 0 var(--hcb-radius, 8px) 0 0;
}

.hcb-bar__toggle:hover {
	filter: brightness(1.08);
}

.hcb-bar__toggle-icon {
	display: block;
	width: 24px;
	height: 24px;
	transition: transform .3s ease-in-out;
}

.hcb-bar__toggle-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.hcb-bar--left .hcb-bar__toggle-icon {
	transform: rotate(180deg);
}

.hcb-bar.is-collapsed .hcb-bar__toggle-icon {
	transform: rotate(180deg);
}

.hcb-bar--left.is-collapsed .hcb-bar__toggle-icon {
	transform: rotate(0deg);
}

/* --- Danh sách kênh --- */
.hcb-bar__list {
	display: flex;
	flex-direction: column;
	background: var(--hcb-bg, rgba(9, 16, 29, .8));
	transition: transform .3s ease-in-out, visibility 0s;
}

.hcb-bar--right .hcb-bar__list {
	border-radius: 0 0 0 var(--hcb-radius, 8px);
}

.hcb-bar--left .hcb-bar__list {
	border-radius: 0 0 var(--hcb-radius, 8px) 0;
}

/* Khi ẩn nút gập thì danh sách bo góc đầy đủ. */
.hcb-bar--right .hcb-bar__list:first-child {
	border-radius: var(--hcb-radius, 8px) 0 0 var(--hcb-radius, 8px);
}

.hcb-bar--left .hcb-bar__list:first-child {
	border-radius: 0 var(--hcb-radius, 8px) var(--hcb-radius, 8px) 0;
}

.hcb-bar.is-collapsed .hcb-bar__list {
	visibility: hidden;
	transition: transform .3s ease-in-out, visibility 0s .3s;
}

.hcb-bar--right.is-collapsed .hcb-bar__list {
	transform: translateX(100%);
}

.hcb-bar--left.is-collapsed .hcb-bar__list {
	transform: translateX(-100%);
}

/* --- Từng kênh --- */
.hcb-bar__item {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--hcb-pad, 9px);
	min-height: 44px;
	color: var(--hcb-icon-color, #fff);
	text-decoration: none;
	box-shadow: none;
	transition: background-color .2s ease-in-out;
}

.hcb-bar__item:hover,
.hcb-bar__item:focus {
	background-color: rgba(255, 255, 255, .08);
	text-decoration: none;
}

.hcb-bar__item:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -3px;
}

/* Đường kẻ mảnh ngăn cách giữa các kênh (clone theo giao diện gốc). */
.hcb-bar__item:not(:first-child)::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	z-index: 0;
	width: 16px;
	height: 1px;
	background: var(--hcb-divider, rgba(255, 255, 255, .4));
	transform: translateX(-50%);
}

.hcb-bar--right .hcb-bar__list > .hcb-bar__item:last-child {
	border-radius: 0 0 0 var(--hcb-radius, 8px);
}

.hcb-bar--left .hcb-bar__list > .hcb-bar__item:last-child {
	border-radius: 0 0 var(--hcb-radius, 8px) 0;
}

.hcb-bar__icon {
	display: block;
	width: var(--hcb-icon, 32px);
	height: var(--hcb-icon, 32px);
	line-height: 0;
	transition: transform .3s ease-in-out;
}

.hcb-bar__icon svg,
.hcb-bar__icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* --- Kiểu tách rời (khoảng cách > 0) --- */
.hcb-bar--separated .hcb-bar__list {
	background: transparent;
	gap: var(--hcb-gap, 8px);
}

.hcb-bar--separated .hcb-bar__item {
	background: var(--hcb-bg, rgba(9, 16, 29, .8));
	border-radius: var(--hcb-radius, 8px);
}

.hcb-bar--separated .hcb-bar__item::before {
	display: none;
}

/* --- Hiệu ứng hover --- */
.hcb-bar--hover-scale .hcb-bar__item:hover .hcb-bar__icon {
	transform: scale(1.14);
}

.hcb-bar--hover-shine .hcb-bar__item:hover {
	background-color: rgba(255, 255, 255, .16);
}

.hcb-bar--hover-pulse .hcb-bar__item::after {
	content: "";
	position: absolute;
	inset: 4px;
	border-radius: 50%;
	border: 2px solid currentColor;
	opacity: 0;
	pointer-events: none;
}

.hcb-bar--hover-pulse .hcb-bar__item:hover::after {
	animation: hcb-pulse 1.2s ease-out infinite;
}

@keyframes hcb-pulse {
	0% {
		opacity: .55;
		transform: scale(.75);
	}

	100% {
		opacity: 0;
		transform: scale(1.35);
	}
}

/* --- Tooltip nhãn --- */
.hcb-bar__tip {
	position: absolute;
	top: 50%;
	z-index: 1;
	padding: 6px 12px;
	border-radius: 6px;
	background: var(--hcb-tip-bg, #111827);
	color: var(--hcb-tip-fg, #fff);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%);
	transition: opacity .2s ease-in-out, transform .2s ease-in-out;
}

.hcb-bar--right .hcb-bar__tip {
	right: calc(100% + 10px);
}

.hcb-bar--left .hcb-bar__tip {
	left: calc(100% + 10px);
}

.hcb-bar__tip::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 8px;
	height: 8px;
	background: inherit;
	transform: translateY(-50%) rotate(45deg);
}

.hcb-bar--right .hcb-bar__tip::after {
	left: 100%;
	margin-left: -4px;
}

.hcb-bar--left .hcb-bar__tip::after {
	right: 100%;
	margin-right: -4px;
}

.hcb-bar__item:hover .hcb-bar__tip,
.hcb-bar__item:focus-visible .hcb-bar__tip {
	opacity: 1;
}

.hcb-bar--right .hcb-bar__item:hover .hcb-bar__tip,
.hcb-bar--right .hcb-bar__item:focus-visible .hcb-bar__tip {
	transform: translateY(-50%) translateX(-4px);
}

.hcb-bar--left .hcb-bar__item:hover .hcb-bar__tip,
.hcb-bar--left .hcb-bar__item:focus-visible .hcb-bar__tip {
	transform: translateY(-50%) translateX(4px);
}

/* --- Tôn trọng thiết lập giảm chuyển động --- */
@media (prefers-reduced-motion: reduce) {

	.hcb-bar,
	.hcb-bar *,
	.hcb-bar *::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
	}
}
