/**
 * Finance Help Floating Button — frontend styles.
 * Only transform / opacity / transition are used for motion (GPU-friendly).
 * All theming comes from CSS custom properties set inline on .fhfb-root.
 * Every selector is namespaced with .fhfb- to avoid clashing with Enfold.
 */

.fhfb-root {
	--fhfb-size: 60px;
	--fhfb-right: 24px;
	--fhfb-bottom: 24px;
	--fhfb-speed: 320ms;
	--fhfb-main: #2a9d8f;
	--fhfb-menu: #ffffff;
	--fhfb-text: #1d2433;
	--fhfb-icon: #ffffff;
	--fhfb-item: 48px;

	position: fixed;
	right: var(--fhfb-right);
	bottom: var(--fhfb-bottom);
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: inherit;
	line-height: 1;
	box-sizing: border-box;
}

.fhfb-root *,
.fhfb-root *::before,
.fhfb-root *::after {
	box-sizing: border-box;
}

/* ---- Menu list ---- */
.fhfb-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
}

.fhfb-item {
	opacity: 0;
	transform: translateY(12px) scale(0.6);
	transform-origin: center right;
	pointer-events: none;
	transition:
		opacity var(--fhfb-speed) ease,
		transform var(--fhfb-speed) cubic-bezier(0.22, 1, 0.36, 1);
	/* Closing: items collapse quickly, last-added first. */
	transition-delay: calc((var(--fhfb-i) - 1) * 20ms);
}

/* ---- Open state (staggered reveal, bottom-up) ---- */
.fhfb-root.is-open .fhfb-item {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
	transition-delay: calc((var(--fhfb-i) - 1) * 45ms);
}

/* ---- Action buttons ---- */
.fhfb-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: var(--fhfb-item);
	padding: 0 6px 0 16px;
	border-radius: calc(var(--fhfb-item) / 2);
	background: var(--fhfb-menu);
	color: var(--fhfb-text);
	text-decoration: none;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
	transition:
		transform var(--fhfb-speed) cubic-bezier(0.22, 1, 0.36, 1),
		box-shadow var(--fhfb-speed) ease,
		background-color var(--fhfb-speed) ease,
		color var(--fhfb-speed) ease;
}

.fhfb-label {
	order: 1;
}

.fhfb-ico {
	order: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--fhfb-item) - 12px);
	height: calc(var(--fhfb-item) - 12px);
	border-radius: 50%;
	color: var(--fhfb-icon);
	flex: 0 0 auto;
	transition: transform var(--fhfb-speed) ease;
}

.fhfb-ico svg {
	width: 22px;
	height: 22px;
	display: block;
}

/* Per-channel accent colors (icon circle). */
.fhfb-btn--viber .fhfb-ico { background: #7360f2; }
.fhfb-btn--telegram .fhfb-ico { background: #29a9eb; }
.fhfb-btn--whatsapp .fhfb-ico { background: #25d366; }
.fhfb-btn--request .fhfb-ico { background: var(--fhfb-main); }

/* Hover / focus feedback. */
.fhfb-btn:hover,
.fhfb-btn:focus-visible {
	transform: translateX(-4px);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
	color: #fff;
}

.fhfb-btn--viber:hover, .fhfb-btn--viber:focus-visible { background: #7360f2; }
.fhfb-btn--telegram:hover, .fhfb-btn--telegram:focus-visible { background: #29a9eb; }
.fhfb-btn--whatsapp:hover, .fhfb-btn--whatsapp:focus-visible { background: #25d366; }
.fhfb-btn--request:hover, .fhfb-btn--request:focus-visible { background: var(--fhfb-main); }

.fhfb-btn:hover .fhfb-ico,
.fhfb-btn:focus-visible .fhfb-ico {
	transform: scale(1.08);
}

.fhfb-btn:focus-visible {
	outline: 2px solid var(--fhfb-main);
	outline-offset: 2px;
}

/* ---- Main toggle button ---- */
.fhfb-toggle {
	position: relative;
	width: var(--fhfb-size);
	height: var(--fhfb-size);
	border: 0;
	margin: 0;
	padding: 0;
	border-radius: 50%;
	background: var(--fhfb-main);
	color: var(--fhfb-icon);
	cursor: pointer;
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
	-webkit-appearance: none;
	appearance: none;
	transition:
		transform var(--fhfb-speed) cubic-bezier(0.34, 1.56, 0.64, 1),
		box-shadow var(--fhfb-speed) ease;
}

.fhfb-toggle:hover {
	transform: scale(1.06);
	box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}

.fhfb-toggle:active {
	transform: scale(0.96);
}

.fhfb-toggle:focus-visible {
	outline: 2px solid var(--fhfb-main);
	outline-offset: 3px;
}

/* Icon crossfade + rotate between chat and close marks. */
.fhfb-toggle-ico {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition:
		opacity var(--fhfb-speed) ease,
		transform var(--fhfb-speed) cubic-bezier(0.22, 1, 0.36, 1);
}

.fhfb-toggle-ico--open {
	opacity: 1;
	transform: rotate(0deg) scale(1);
}

.fhfb-toggle-ico--close {
	opacity: 0;
	transform: rotate(-90deg) scale(0.6);
}

.fhfb-root.is-open .fhfb-toggle-ico--open {
	opacity: 0;
	transform: rotate(90deg) scale(0.6);
}

.fhfb-root.is-open .fhfb-toggle-ico--close {
	opacity: 1;
	transform: rotate(0deg) scale(1);
}

.fhfb-root.is-open .fhfb-toggle {
	transform: rotate(0deg);
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
	.fhfb-root {
		--fhfb-item: 44px;
	}
	.fhfb-btn {
		font-size: 14px;
		padding: 0 5px 0 14px;
	}
}

/* =====================================================================
   Popup request form  (design matched to the FinHelp landing)
   ===================================================================== */
.fhfb-lock {
	overflow: hidden;
}

.fhfb-modal {
	/* Form palette — accent follows the configured main colour; the rest are
	   the landing's neutral tokens. */
	--fhfb-line: #e2ece8;
	--fhfb-muted: #5c6b66;
	--fhfb-soft: #f4faf7;
	--fhfb-accent-soft: color-mix(in srgb, var(--fhfb-main, #2a9d8f) 12%, #fff);

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	transition: opacity var(--fhfb-speed, 320ms) ease;
	box-sizing: border-box;
	font-family: inherit;
}

.fhfb-modal[hidden] {
	display: none;
}

.fhfb-modal.is-visible {
	opacity: 1;
}

.fhfb-modal *,
.fhfb-modal *::before,
.fhfb-modal *::after {
	box-sizing: border-box;
}

.fhfb-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 40, 33, 0.5);
	backdrop-filter: blur(2px);
}

.fhfb-modal__card {
	position: relative;
	width: 100%;
	max-width: 420px;
	background: #fff;
	color: var(--fhfb-text, #1c2b26);
	border-radius: 20px;
	padding: 30px 28px;
	box-shadow: 0 30px 60px rgba(20, 40, 33, 0.32);
	transform: translateY(16px) scale(0.97);
	opacity: 0;
	transition:
		transform var(--fhfb-speed, 320ms) cubic-bezier(0.2, 0.9, 0.3, 1.2),
		opacity var(--fhfb-speed, 320ms) ease;
}

.fhfb-modal.is-visible .fhfb-modal__card {
	transform: translateY(0) scale(1);
	opacity: 1;
}

.fhfb-modal__x {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	padding: 0;
	border-radius: 50%;
	background: var(--fhfb-soft);
	color: var(--fhfb-muted);
	cursor: pointer;
	transition: background-color var(--fhfb-speed, 320ms) ease, color var(--fhfb-speed, 320ms) ease;
}

.fhfb-modal__x:hover {
	background: var(--fhfb-accent-soft);
	color: var(--fhfb-main, #2a9d8f);
}

.fhfb-modal__x svg {
	width: 18px;
	height: 18px;
}

.fhfb-modal__title {
	margin: 0 24px 6px 0;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.2;
}

.fhfb-modal__sub {
	margin: 0 0 18px;
	font-size: 14px;
	line-height: 1.45;
	color: var(--fhfb-muted);
}

.fhfb-field {
	display: block;
	margin-bottom: 14px;
}

.fhfb-modal .fhfb-field input,
.fhfb-modal .fhfb-field textarea {
	width: 100%;
	font-family: inherit;
	font-weight: 400;
	/* 16px minimum stops iOS Safari from auto-zooming the page on focus.
	   !important + the .fhfb-modal prefix keep the theme (Enfold) from
	   lowering it below 16px via more specific rules. */
	font-size: 16px !important;
	line-height: 1.4;
	color: inherit;
	padding: 13px 14px;
	border: 1.5px solid var(--fhfb-line);
	border-radius: 10px;
	background: #fff;
	transition: border-color var(--fhfb-speed, 320ms) ease;
	-webkit-appearance: none;
	appearance: none;
	resize: vertical;
	touch-action: manipulation;
}

.fhfb-field textarea {
	min-height: 92px;
}

.fhfb-field input::placeholder,
.fhfb-field textarea::placeholder {
	color: #9aa8a3;
}

.fhfb-field input:focus,
.fhfb-field textarea:focus {
	outline: none;
	border-color: var(--fhfb-main, #2a9d8f);
}

.fhfb-field input:invalid:not(:placeholder-shown) {
	border-color: #e08a8a;
}

.fhfb-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	width: 100%;
	margin-top: 6px;
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	color: #fff;
	background: var(--fhfb-main, #2a9d8f);
	border: 2px solid transparent;
	border-radius: 12px;
	padding: 15px 24px;
	cursor: pointer;
	box-shadow: 0 8px 20px color-mix(in srgb, var(--fhfb-main, #2a9d8f) 28%, transparent);
	transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.fhfb-form__submit:hover {
	background: color-mix(in srgb, var(--fhfb-main, #2a9d8f) 82%, #000);
	transform: translateY(-2px);
}

.fhfb-form__submit:disabled {
	opacity: 0.65;
	cursor: default;
	transform: none;
}

/* Privacy note (implicit consent, as on the landing) */
.fhfb-privacy {
	font-size: 12px;
	color: var(--fhfb-muted);
	text-align: center;
	margin-top: 12px;
	line-height: 1.45;
}

.fhfb-privacy a {
	color: var(--fhfb-main, #2a9d8f);
	text-decoration: underline;
}

/* Success / error messages */
.fhfb-okmsg,
.fhfb-errmsg {
	display: none;
	border-radius: 10px;
	padding: 16px;
	text-align: center;
	font-weight: 700;
	margin-top: 12px;
	font-size: 14px;
	line-height: 1.45;
}

.fhfb-okmsg {
	background: var(--fhfb-accent-soft);
	color: color-mix(in srgb, var(--fhfb-main, #2a9d8f) 75%, #000);
}

.fhfb-okmsg small {
	display: block;
	margin-top: 8px;
	font-weight: 500;
	font-size: 12.5px;
	opacity: 0.85;
}

.fhfb-errmsg {
	background: #fdeaea;
	color: #b02a2a;
	padding: 14px;
}

.fhfb-okmsg.is-shown,
.fhfb-errmsg.is-shown {
	display: block;
}

/* Friendly "is this number correct?" warning (non-blocking) */
.fhfb-phonewarn {
	display: none;
	background: #fff8e6;
	border: 1px solid #f0d98a;
	color: #8a6d1a;
	border-radius: 12px;
	padding: 14px 16px;
	margin-top: 12px;
	font-size: 14px;
	text-align: left;
}

.fhfb-phonewarn.is-shown {
	display: block;
}

.fhfb-phonewarn p {
	margin: 0 0 12px;
	line-height: 1.45;
}

.fhfb-phonewarn__actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.fhfb-phonewarn button {
	font-family: inherit;
	font-weight: 700;
	font-size: 14px;
	border-radius: 9px;
	padding: 9px 16px;
	cursor: pointer;
	border: 1.5px solid transparent;
	transition: background-color 0.15s ease;
}

.fhfb-phonewarn__edit {
	background: #fff;
	border-color: #e6d38f;
	color: #8a6d1a;
}

.fhfb-phonewarn__edit:hover {
	background: #fdf5dd;
}

.fhfb-phonewarn__send {
	background: var(--fhfb-main, #2a9d8f);
	color: #fff;
}

.fhfb-phonewarn__send:hover {
	background: color-mix(in srgb, var(--fhfb-main, #2a9d8f) 82%, #000);
}

/* Honeypot: present in layout but invisible / unreachable for humans. */
.fhfb-hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (max-width: 560px) {
	.fhfb-modal__card {
		border-radius: 16px;
		padding: 26px 20px;
	}
}


/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
	.fhfb-root *,
	.fhfb-root,
	.fhfb-modal,
	.fhfb-modal * {
		transition-duration: 1ms !important;
		transition-delay: 0ms !important;
	}
}
