/* Page Loading Spinner */

.bh-page-loader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bh-page-loader.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.bh-page-loader__spinner {
	position: relative;
	width: 48px;
	height: 48px;
}

.bh-page-loader__spinner::before,
.bh-page-loader__spinner::after {
	content: '';
	position: absolute;
	border-radius: 50%;
}

.bh-page-loader__spinner::before {
	width: 48px;
	height: 48px;
	border: 3px solid #f2f2f2;
}

.bh-page-loader__spinner::after {
	width: 48px;
	height: 48px;
	border: 3px solid transparent;
	border-top-color: #f0af24;
	animation: bh-spin 0.8s linear infinite;
}

@keyframes bh-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Honeycomb Loader (Alternative) */
.bh-honeycomb-loader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: #1d2229;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 24px;
	z-index: 999999;
	transition: opacity 0.4s ease, visibility 0.4s ease;
}

.bh-honeycomb-loader.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.bh-honeycomb-loader__logo {
	width: clamp(140px, 28vw, 220px);
	height: auto;
	display: block;
}

.bh-honeycomb-loader__hexagons {
	display: flex;
	gap: 4px;
}

.bh-honeycomb-loader__hex {
	width: 12px;
	height: 14px;
	background-color: #f0af24;
	clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
	animation: bh-pulse 1.2s ease-in-out infinite;
}

.bh-honeycomb-loader__hex:nth-child(1) {
	animation-delay: 0s;
}

.bh-honeycomb-loader__hex:nth-child(2) {
	animation-delay: 0.15s;
}

.bh-honeycomb-loader__hex:nth-child(3) {
	animation-delay: 0.3s;
}

.bh-honeycomb-loader__hex:nth-child(4) {
	animation-delay: 0.45s;
}

.bh-honeycomb-loader__hex:nth-child(5) {
	animation-delay: 0.6s;
}

@keyframes bh-pulse {
	0%, 100% {
		opacity: 0.3;
		transform: scale(0.8);
	}
	50% {
		opacity: 1;
		transform: scale(1);
	}
}

.bh-honeycomb-loader__text {
	font-family: 'PT Sans', sans-serif;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #f0af24;
}

/* Button Loading State */
.btn--loading {
	position: relative;
	pointer-events: none;
}

.btn--loading > * {
	visibility: hidden;
}

.btn--loading::after {
	content: '';
	position: absolute;
	width: 20px;
	height: 20px;
	top: 50%;
	left: 50%;
	margin-top: -10px;
	margin-left: -10px;
	border: 2px solid #ffffff;
	border-radius: 50%;
	border-right-color: transparent;
	animation: bh-spin 0.6s linear infinite;
}

/* Skeleton Loader */
.bh-skeleton {
	background: linear-gradient(90deg, #f2f2f2 25%, #e8e8e9 50%, #f2f2f2 75%);
	background-size: 200% 100%;
	animation: bh-skeleton-loading 1.5s ease-in-out infinite;
	border-radius: 4px;
}

.bh-skeleton--text {
	height: 16px;
	margin-bottom: 8px;
}

.bh-skeleton--title {
	height: 32px;
	width: 60%;
	margin-bottom: 16px;
}

.bh-skeleton--image {
	width: 100%;
	padding-bottom: 56.25%;
}

.bh-skeleton--avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
}

.bh-skeleton--button {
	width: 120px;
	height: 44px;
	border-radius: 8px;
}

@keyframes bh-skeleton-loading {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* Content Loading Spinner (inline) */
.bh-spinner {
	display: inline-block;
	width: 24px;
	height: 24px;
	border: 2px solid #f2f2f2;
	border-top-color: #f0af24;
	border-radius: 50%;
	animation: bh-spin 0.8s linear infinite;
}

.bh-spinner--sm {
	width: 16px;
	height: 16px;
	border-width: 2px;
}

.bh-spinner--lg {
	width: 40px;
	height: 40px;
	border-width: 3px;
}

.bh-spinner--dark {
	border-color: #606469;
	border-top-color: #1d2229;
}

/* Progress Bar */
.bh-progress {
	width: 100%;
	height: 4px;
	background-color: #f2f2f2;
	border-radius: 2px;
	overflow: hidden;
}

.bh-progress__bar {
	height: 100%;
	background-color: #f0af24;
	border-radius: 2px;
	transition: width 0.3s ease;
}

.bh-progress--indeterminate .bh-progress__bar {
	width: 30%;
	animation: bh-progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes bh-progress-indeterminate {
	0% {
		transform: translateX(-100%);
	}
	100% {
		transform: translateX(400%);
	}
}

/* No JS fallback - hide loader immediately */
.no-js .bh-page-loader,
.no-js .bh-honeycomb-loader {
	display: none;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
	.bh-page-loader__spinner::after,
	.bh-honeycomb-loader__hex,
	.btn--loading::after,
	.bh-skeleton,
	.bh-spinner,
	.bh-progress--indeterminate .bh-progress__bar {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}

	.bh-page-loader,
	.bh-honeycomb-loader {
		transition-duration: 0.01ms !important;
	}
}
