/**
 * Frontend CSS for Floating Contact Module
 * All styles scoped to .onmate-floating-contact
 */

.onmate-floating-contact {
	--omfc-primary: var(--theme-palette-color-1, #224035);
	--omfc-accent: var(--theme-palette-color-2, #fa9c10);
	--omfc-danger: #e53935;
	--omfc-white: #ffffff;
	--omfc-text: #224035;

	position: fixed;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	z-index: 900;
	box-sizing: border-box;
}

/* Base resets within scope */
.onmate-floating-contact *,
.onmate-floating-contact *::before,
.onmate-floating-contact *::after {
	box-sizing: border-box;
}

/* Hidden toggle button on desktop */
.onmate-floating-contact__toggle {
	display: none;
}

/* Panel vertical rail on desktop */
.onmate-floating-contact__panel {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 10px 8px;
	margin: 0;
	background: #ffffff;
	border-radius: 10px 0 0 10px;
	border: 1px solid rgba(15, 23, 42, 0.08);
	border-right: 0;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

/* Link items styling */
.onmate-floating-contact__item {
	position: relative;
	display: flex;
	align-items: center;
	text-decoration: none !important;
	outline: none;
	border: none;
	background: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
}

/* Icon badge wrapper */
.onmate-floating-contact__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 999px;
	background: transparent;
	color: var(--omfc-primary);
	box-shadow: none;
	transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.3s ease;
	position: relative;
	z-index: 2;
}

.onmate-floating-contact__icon img {
	width: 36px;
	height: 36px;
	object-fit: contain;
	display: block;
}

.onmate-floating-contact__fallback {
	font-size: 18px;
	font-weight: 700;
	text-transform: uppercase;
	line-height: 1;
	user-select: none;
	color: var(--omfc-text);
}

/* Slide-out text label on desktop */
.onmate-floating-contact__label {
	position: absolute;
	right: 100%;
	top: 50%;
	transform: translateY(-50%) translateX(10px);
	background-color: var(--omfc-primary);
	color: var(--omfc-white);
	padding: 6px 12px;
	border-radius: 4px;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
	margin-right: 10px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
	font-size: 13px;
	font-weight: 500;
	z-index: 1;
}

/* Desktop hover interactions */
.onmate-floating-contact__item:hover .onmate-floating-contact__icon {
	transform: scale(1.1);
	filter: brightness(1.05) saturate(1.05);
}

.onmate-floating-contact__item:hover .onmate-floating-contact__label {
	opacity: 1;
	visibility: visible;
	transform: translateY(-50%) translateX(0);
}

/* Mobile Breakpoint (< 768px) */
@media (max-width: 767px) {
	.onmate-floating-contact {
		right: 20px;
		bottom: 20px;
		top: auto;
		transform: none;
	}

	/* Toggle Button on Mobile */
	.onmate-floating-contact__toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 48px;
		height: 48px;
		border-radius: 50%;
		background-color: var(--omfc-accent);
		color: var(--omfc-white);
		border: none;
		outline: none;
		cursor: pointer;
		box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
		position: relative;
		z-index: 10;
		transition: background-color 0.3s, transform 0.3s;
	}

	.onmate-floating-contact__toggle:active {
		transform: scale(0.95);
	}

	/* Chat and X toggle states */
	.onmate-floating-contact__toggle-chat {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 24px;
		height: 24px;
		transition: opacity 0.3s, transform 0.3s;
	}

	.onmate-floating-contact__toggle-close {
		position: absolute;
		width: 20px;
		height: 20px;
		opacity: 0;
		transform: rotate(-45deg) scale(0.5);
		transition: opacity 0.3s, transform 0.3s;
		pointer-events: none;
	}

	.onmate-floating-contact__toggle-close::before,
	.onmate-floating-contact__toggle-close::after {
		content: '';
		position: absolute;
		background-color: var(--omfc-white);
		top: 50%;
		left: 50%;
	}

	.onmate-floating-contact__toggle-close::before {
		width: 16px;
		height: 2px;
		margin-left: -8px;
		margin-top: -1px;
	}

	.onmate-floating-contact__toggle-close::after {
		width: 2px;
		height: 16px;
		margin-left: -1px;
		margin-top: -8px;
	}

	/* Toggle active state (X close icon) */
	.onmate-floating-contact.is-open .onmate-floating-contact__toggle {
		background-color: var(--omfc-danger);
	}

	.onmate-floating-contact.is-open .onmate-floating-contact__toggle-chat {
		opacity: 0;
		transform: scale(0.5) rotate(45deg);
	}

	.onmate-floating-contact.is-open .onmate-floating-contact__toggle-close {
		opacity: 1;
		transform: rotate(45deg) scale(1);
	}

	/* Panel container in popup form */
	.onmate-floating-contact__panel {
		position: absolute;
		bottom: 60px;
		right: 0;
		background-color: var(--omfc-white);
		border-radius: 12px;
		box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
		padding: 16px;
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 16px;
		width: max-content;
		max-width: calc(100vw - 40px);
		min-width: 220px;
		opacity: 0;
		visibility: hidden;
		transform: translateY(15px) scale(0.95);
		transform-origin: bottom right;
		transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0.3s;
		z-index: 9;
	}

	.onmate-floating-contact.is-open .onmate-floating-contact__panel {
		opacity: 1;
		visibility: visible;
		transform: translateY(0) scale(1);
	}

	/* Item alignment inside grid */
	.onmate-floating-contact__item {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	/* Reset label for grid display */
	.onmate-floating-contact__label {
		position: static;
		transform: none;
		background-color: transparent;
		color: var(--omfc-text);
		padding: 0;
		border-radius: 0;
		opacity: 1;
		visibility: visible;
		margin-right: 0;
		margin-top: 6px;
		font-size: 11px;
		box-shadow: none;
		font-weight: 500;
		max-width: 64px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.onmate-floating-contact__item:hover .onmate-floating-contact__icon {
		transform: none;
	}

	.onmate-floating-contact__item:hover .onmate-floating-contact__label {
		transform: none;
		color: var(--omfc-accent);
	}

}

.onmate-floating-contact__icon-visual {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.onmate-floating-contact__icon-visual--attention {
	animation: onmateFloatingIconShake 5s ease-in-out infinite;
	transform-origin: center center;
}

@keyframes onmateFloatingIconShake {
	0%, 88%, 100% {
		transform: translateX(0) rotate(0deg);
	}

	90% {
		transform: translateX(-2px) rotate(-4deg);
	}

	92% {
		transform: translateX(2px) rotate(4deg);
	}

	94% {
		transform: translateX(-2px) rotate(-3deg);
	}

	96% {
		transform: translateX(2px) rotate(3deg);
	}

	98% {
		transform: translateX(0) rotate(0deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.onmate-floating-contact__icon-visual--attention {
		animation: none !important;
	}
}
