/* GHF Global: WhatsApp widget
   Floating button, chat card, timed message, Call / WhatsApp bar on phones, button after an enquiry.
   Own classes only: .ghf-wa*, .ghf-qbar*, .ghf-btn--wa-solid, .ghf-form__wa. */

.ghf-wa { --wa: #25D366; --wa-deep: #128C4B; --wa-ink: #06301A; position: fixed; right: 26px; bottom: 26px; z-index: 41; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; pointer-events: none; }
.ghf-wa--left { right: auto; left: 26px; align-items: flex-start; }
.ghf-wa > * { pointer-events: auto; }

/* Button */
.ghf-wa__btn { position: relative; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--wa); color: var(--ghf-white); box-shadow: 0 18px 40px -16px rgba(37, 211, 102, 0.9), 0 10px 30px -18px rgba(0, 0, 0, 0.7); transition: transform 0.4s var(--ghf-ease-out), background 0.3s var(--ghf-ease); }
.ghf-wa__btn::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--wa); opacity: 0; animation: ghfWaRing 3.2s var(--ghf-ease-out) infinite; pointer-events: none; }
.ghf-wa__btn:hover, .ghf-wa__btn:focus-visible { transform: translateY(-3px); }
.ghf-wa__icon, .ghf-wa__x { grid-area: 1 / 1; display: grid; place-items: center; transition: transform 0.45s var(--ghf-ease-out), opacity 0.25s var(--ghf-ease); }
.ghf-wa__icon svg { width: 31px; height: 31px; }
.ghf-wa__x { position: relative; width: 22px; height: 22px; opacity: 0; transform: rotate(-90deg) scale(0.6); }
.ghf-wa__x span, .ghf-wa__close span, .ghf-wa__nudge-close span { position: absolute; left: 50%; top: 50%; width: 100%; height: 2px; border-radius: 2px; background: currentColor; transform: translate(-50%, -50%) rotate(45deg); }
.ghf-wa__x span + span, .ghf-wa__close span + span, .ghf-wa__nudge-close span + span { transform: translate(-50%, -50%) rotate(-45deg); }
.ghf-wa.is-open .ghf-wa__btn { background: var(--ghf-navy); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 18px 40px -18px rgba(0, 0, 0, 0.8); }
.ghf-wa.is-open .ghf-wa__btn::before { animation: none; }
.ghf-wa.is-open .ghf-wa__icon { opacity: 0; transform: rotate(90deg) scale(0.6); }
.ghf-wa.is-open .ghf-wa__x { opacity: 1; transform: none; }
@keyframes ghfWaRing { 0% { transform: scale(1); opacity: 0.8; } 70%, 100% { transform: scale(1.7); opacity: 0; } }

/* Chat card */
.ghf-wa__card { width: min(372px, calc(100vw - 32px)); max-height: min(620px, calc(100vh - 130px)); display: flex; flex-direction: column; overflow: hidden; border-radius: 26px; background: #07173F; color: var(--ghf-white); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 40px 90px -30px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(5, 10, 31, 0.4); opacity: 0; visibility: hidden; transform: translateY(18px) scale(0.96); transform-origin: 100% 100%; transition: opacity 0.3s var(--ghf-ease), transform 0.5s var(--ghf-ease-out), visibility 0s linear 0.5s; }
.ghf-wa--left .ghf-wa__card { transform-origin: 0 100%; }
html:not(.ghf-js) .ghf-wa__card { display: none; }
.ghf-wa:not(.is-open) .ghf-wa__card { position: absolute; bottom: 72px; pointer-events: none; }
.ghf-wa.is-open .ghf-wa__card { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.ghf-wa__head { position: relative; display: flex; align-items: center; gap: 14px; padding: 20px 22px; background: linear-gradient(120deg, #0B52DB 0%, #2A62FF 55%, #059EFC 130%); }
.ghf-wa__avatar { flex: 0 0 auto; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: #050A1F; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.ghf-wa__avatar svg { width: 26px; height: 26px; }
.ghf-wa__who { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin-right: auto; }
.ghf-wa__who strong { font: 500 1.0625rem/1.1 var(--ghf-font-head); letter-spacing: -0.01em; }
.ghf-wa__who > span { display: flex; align-items: center; gap: 9px; font: 500 0.6875rem/1.2 var(--ghf-font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.86); }
.ghf-wa__close { position: relative; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; color: var(--ghf-white); background: rgba(5, 10, 31, 0.22); transition: background 0.3s var(--ghf-ease), transform 0.4s var(--ghf-ease-out); }
.ghf-wa__close span { width: 14px; }
.ghf-wa__close:hover { background: rgba(5, 10, 31, 0.5); transform: rotate(90deg); }
.ghf-wa__body { padding: 22px; overflow-y: auto; overscroll-behavior: contain; }
.ghf-wa__bubble { position: relative; max-width: 92%; margin: 0 0 20px; padding: 14px 16px; border-radius: 4px 18px 18px 18px; background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); font-size: 0.9375rem; line-height: 1.5; color: rgba(255, 255, 255, 0.92); }
.ghf-wa__label { margin: 0 0 12px; font: 500 0.6875rem var(--ghf-font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ghf-dim); }
.ghf-wa__topics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.ghf-wa__topic { padding: 9px 14px; border-radius: 999px; font: 500 0.8125rem/1.2 var(--ghf-font-body, inherit); color: rgba(255, 255, 255, 0.9); background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); transition: background 0.3s var(--ghf-ease), color 0.3s var(--ghf-ease), box-shadow 0.3s var(--ghf-ease), transform 0.3s var(--ghf-ease-out); }
.ghf-wa__topic:hover { box-shadow: inset 0 0 0 1px var(--wa); transform: translateY(-1px); }
.ghf-wa__topic[aria-pressed="true"] { background: var(--wa); color: var(--wa-ink); box-shadow: none; }
.ghf-wa.is-open .ghf-wa__bubble, .ghf-wa.is-open .ghf-wa__label, .ghf-wa.is-open .ghf-wa__topic, .ghf-wa.is-open .ghf-wa__go, .ghf-wa.is-open .ghf-wa__number { animation: ghfWaRise 0.6s var(--ghf-ease-out) both; }
.ghf-wa.is-open .ghf-wa__bubble { animation-delay: 0.12s; }
.ghf-wa.is-open .ghf-wa__label { animation-delay: 0.2s; }
.ghf-wa.is-open .ghf-wa__topic { animation-delay: 0.26s; }
.ghf-wa.is-open .ghf-wa__topic:nth-child(2n) { animation-delay: 0.31s; }
.ghf-wa.is-open .ghf-wa__topic:nth-child(3n) { animation-delay: 0.36s; }
.ghf-wa.is-open .ghf-wa__go { animation-delay: 0.42s; }
.ghf-wa.is-open .ghf-wa__number { animation-delay: 0.48s; }
@keyframes ghfWaRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ghf-wa__go { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 52px; border-radius: 999px; background: var(--wa); color: var(--wa-ink); font: 600 0.9375rem/1 var(--ghf-font-head); transition: background 0.3s var(--ghf-ease), transform 0.4s var(--ghf-ease-out); }
.ghf-wa__go svg { width: 22px; height: 22px; }
.ghf-wa__go:hover { background: #3BE07A; transform: translateY(-2px); }
.ghf-wa__number { margin: 14px 0 0; text-align: center; font: 500 0.75rem var(--ghf-font-mono); letter-spacing: 0.1em; color: var(--ghf-dim); }

/* Timed message */
.ghf-wa__nudge { position: absolute; right: 72px; bottom: 7px; display: flex; align-items: center; gap: 4px; width: max-content; max-width: min(300px, calc(100vw - 110px)); padding: 6px 6px 6px 16px; border-radius: 18px 18px 4px 18px; background: var(--ghf-white); color: #07173F; box-shadow: 0 24px 50px -22px rgba(0, 0, 0, 0.7); opacity: 0; visibility: hidden; transform: translateX(12px) scale(0.94); transform-origin: 100% 100%; transition: opacity 0.3s var(--ghf-ease), transform 0.5s var(--ghf-ease-out), visibility 0s linear 0.5s; }
.ghf-wa--left .ghf-wa__nudge { right: auto; left: 72px; border-radius: 18px 18px 18px 4px; transform: translateX(-12px) scale(0.94); transform-origin: 0 100%; }
.ghf-wa__nudge.is-on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.ghf-wa.is-open .ghf-wa__nudge { opacity: 0; visibility: hidden; }
.ghf-wa__nudge-text { padding: 6px 0; text-align: left; font-size: 0.875rem; font-weight: 500; line-height: 1.35; color: inherit; }
.ghf-wa__nudge-close { position: relative; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; color: #5B6788; transition: background 0.3s var(--ghf-ease), color 0.3s var(--ghf-ease); }
.ghf-wa__nudge-close span { width: 11px; height: 1.5px; }
.ghf-wa__nudge-close:hover { background: rgba(7, 23, 63, 0.08); color: #07173F; }

/* Back to top keeps clear of the button */
.ghf-has-wa:not(.ghf-wa-left) .ghf-top { bottom: 98px; }

/* Call / WhatsApp bar on phones */
.ghf-qbar { display: none; }

/* Button after an enquiry is sent */
.ghf-btn--wa-solid { --btn-bg: #25D366; --btn-fg: #06301A; --btn-icon-bg: #06301A; --btn-icon-fg: #FFFFFF; --btn-hover: #128C4B; --btn-hover-fg: #FFFFFF; }
.ghf-btn--wa-solid .ghf-btn__icon svg { width: 21px; height: 21px; }
.ghf-form__wa { margin-top: 22px; opacity: 0; transform: translateY(10px); pointer-events: none; }
.ghf-form.is-sending .ghf-form__wa .ghf-btn__label, .ghf-form.is-sending .ghf-form__wa .ghf-btn__icon { opacity: 1; }
.ghf-form.is-sent .ghf-form__wa { opacity: 1; transform: none; pointer-events: auto; transition: opacity 0.5s var(--ghf-ease) 1.5s, transform 0.7s var(--ghf-ease-out) 1.5s; }

@media (max-width: 640px) {
	.ghf-wa { right: 16px; bottom: 16px; }
	.ghf-wa--left { left: 16px; }
	.ghf-wa__btn { width: 54px; height: 54px; }
	.ghf-wa__nudge { right: 66px; }
	.ghf-wa--left .ghf-wa__nudge { left: 66px; }
	.ghf-has-wa:not(.ghf-wa-left) .ghf-top { bottom: 82px; }

	.ghf-qbar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; padding: 8px; border-radius: 999px; background: rgba(7, 23, 63, 0.82); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 24px 50px -20px rgba(0, 0, 0, 0.8); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); transform: translateY(140%); transition: transform 0.7s var(--ghf-ease-out); }
	html:not(.ghf-js) .ghf-qbar, .ghf-qbar.is-on { transform: none; }
	.ghf-qbar__btn { display: flex; align-items: center; justify-content: center; gap: 9px; height: 46px; border-radius: 999px; font: 600 0.9375rem/1 var(--ghf-font-head); color: var(--ghf-white); background: rgba(255, 255, 255, 0.08); }
	.ghf-qbar__btn svg { width: 19px; height: 19px; }
	.ghf-qbar__btn--wa { background: #25D366; color: #06301A; }
	.ghf-qbar__btn--wa svg { width: 21px; height: 21px; }
	/* With the bar on, the bar is the button: the round one steps aside and the card opens above the bar */
	.ghf-has-qbar .ghf-wa__btn, .ghf-has-qbar .ghf-wa__nudge { display: none; }
	.ghf-has-qbar .ghf-wa { left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); align-items: stretch; }
	.ghf-has-qbar .ghf-wa__card { width: 100%; max-height: calc(100vh - 190px); transform-origin: 50% 100%; }
	.ghf-has-qbar .ghf-wa:not(.is-open) .ghf-wa__card { bottom: 0; left: 0; }
	.ghf-has-qbar .ghf-top, .ghf-has-qbar.ghf-has-wa:not(.ghf-wa-left) .ghf-top { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
	.ghf-has-qbar .ghf-footer { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
