/*
 * Phone quick actions (see inc/mobile-actions.php).
 * --fs-mbar-space: room the bottom bar takes on phones; 0 elsewhere.
 */
:root {
	--fs-mbar-space: 0px;
	--fs-float-size: 42px;
	--fs-float-gap: 10px;
	--fs-float-edge: 12px;
}

/* ---------- Broccoli chat launcher: theme red everywhere ---------- */
#broccoli-chat-widget-button {
	background-color: var(--color-accent, #e30b2e) !important;
	color: #fff !important;
}
#broccoli-chat-widget-button:hover,
#broccoli-chat-widget-button:focus-visible {
	filter: brightness(0.92);
}

/* ---------- OneTap button: no slide animation (drag sets its position) ---------- */
.onetap-container-toggle .onetap-toggle {
	touch-action: none !important;
	-webkit-user-select: none !important;
	user-select: none !important;
	-webkit-touch-callout: none !important;
	transition: none !important;
}
.onetap-container-toggle .onetap-toggle img { -webkit-user-drag: none; pointer-events: none; }
.onetap-container-toggle .onetap-toggle.fs-dragging { cursor: grabbing !important; }
.onetap-container-toggle .onetap-toggle.fs-dragging img { transform: scale(1.12) !important; }
html body .onetap-container-toggle .onetap-toggle.fs-snapping { transition: left .2s ease-out, top .2s ease-out !important; }

/* ---------- Header logo: undo the old WPCode "≤430px" logo clamp ----------
   A WPCode CSS snippet capped the phone logo (max-width clamp(96px, 32vw, 160px),
   height clamp(22px, 7vw, …)), overriding Theme Options → Logo (Mobile). Restore the
   parent's sizing so the theme settings apply; harmless once the snippet is gone. */
@media (max-width: 430px) {
	html body .fs-header__logo img {
		width: var(--logo-mobile-width, auto);
		max-width: 100%;
		height: var(--logo-mobile-height, 38px);
	}
}

/* ---------- Parent's scroll-up phone button: replaced by the bottom bar ---------- */
.fs-button-phone { display: none !important; }

/* ---------- Bottom bar (hidden above phone width) ---------- */
.fs-mbar { display: none; }

@media (max-width: 767px) {
	:root {
		/* 8 + 48 + 8 card height, plus the 10px gap under it. */
		--fs-mbar-space: calc(74px + env(safe-area-inset-bottom, 0px));
	}

	body { padding-bottom: var(--fs-mbar-space) !important; }

	/* Floating rounded card. */
	.fs-mbar {
		position: fixed;
		left: 10px;
		right: 10px;
		bottom: calc(10px + env(safe-area-inset-bottom, 0px));
		z-index: 90;
		display: flex;
		gap: 8px;
		padding: 8px;
		background: #fff;
		border-radius: 14px;
		box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .16);
	}
	/* The open mobile menu and popouts own the screen. */
	body:has(.fs-header__content_show) .fs-mbar { display: none; }
	body:has(.fs-header__content_show) { --fs-mbar-space: 0px; }

	/* Fuse Addons footer "Hide Floating Contact Buttons": no bar (not printed) and no room kept for it. */
	body.fuse-hide-mobile-actions { --fs-mbar-space: 0px; }

	.fs-mbar__btn {
		flex: 1 1 0;
		min-width: 0;
		height: 48px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		border-radius: 10px;
		font-size: 16px;
		font-weight: 600;
		line-height: 1;
		text-decoration: none !important;
		white-space: nowrap;
		-webkit-tap-highlight-color: transparent;
		transition: background-color .15s, filter .15s;
	}
	.fs-mbar__btn--call {
		color: var(--color-main, #000) !important;
		background: var(--color-gray-light, #f7f7f7);
		border: 1px solid var(--color-stroke, #cfcfcf);
	}
	.fs-mbar__btn--call svg { color: var(--color-accent, #e30b2e); flex: none; }
	.fs-mbar__btn--book {
		color: #fff !important;
		background: var(--color-accent, #e30b2e);
		border: 1px solid var(--color-accent, #e30b2e);
	}
	.fs-mbar__btn:active { filter: brightness(0.92); }

	/* Layout 2: Call Us + Chat + Book Now. Book Now stays the widest. */
	button.fs-mbar__btn {
		font-family: inherit;
		cursor: pointer;
		appearance: none;
		-webkit-appearance: none;
	}
	.fs-mbar__btn--chat {
		color: var(--color-main, #000) !important;
		background: var(--color-gray-light, #f7f7f7);
		border: 1px solid var(--color-stroke, #cfcfcf);
	}
	.fs-mbar__btn--chat svg { color: var(--color-accent, #e30b2e); flex: none; }
	.fs-mbar--3 { gap: 6px; }
	.fs-mbar--3 .fs-mbar__btn {
		gap: 6px;
		padding: 0 6px;
		font-size: 15px;
	}
	.fs-mbar--3 .fs-mbar__btn--book { flex-grow: 1.3; }
	@media (max-width: 359px) {
		.fs-mbar--3 .fs-mbar__btn { font-size: 14px; }
		.fs-mbar--3 .fs-mbar__btn svg { display: none; }
	}

	/* ---------- Chat: icon-only circle above the bar ---------- */
	html body #broccoli-chat-widget-container {
		right: var(--fs-float-edge) !important;
		bottom: calc(var(--fs-mbar-space) + var(--fs-float-edge)) !important;
	}
	#broccoli-chat-widget-button {
		width: var(--fs-float-size) !important;
		height: var(--fs-float-size) !important;
		padding: 0 !important;
		border-radius: 50% !important;
		gap: 0 !important;
	}
	#broccoli-chat-widget-button > span,
	#broccoli-message-popup { display: none !important; }
	#broccoli-chat-widget-button > svg { margin: 0 !important; }

	/* ---------- Accessibility: same size, stacked above chat by default ---------- */
	/* Same visible circle as the chat button: no transparent border around it. */
	html body .onetap-container-toggle .onetap-toggle img.design-size1,
	html body .onetap-container-toggle .onetap-toggle img.design-size2,
	html body .onetap-container-toggle .onetap-toggle img.design-size3 {
		width: var(--fs-float-size) !important;
		height: var(--fs-float-size) !important;
		padding: 8px !important;
	}
	html body .onetap-container-toggle .onetap-toggle,
	html body .onetap-container-toggle .onetap-toggle:hover,
	html body .onetap-container-toggle .onetap-toggle:focus {
		border: 0 !important;
		padding: 0 !important;
		width: var(--fs-float-size) !important;
		height: var(--fs-float-size) !important;
	}
	html body .onetap-container-toggle .onetap-toggle:focus-visible {
		outline: 2px solid var(--color-main, #000) !important;
		outline-offset: 2px !important;
		border-radius: 50%;
	}
	html body .onetap-container-toggle .onetap-toggle {
		left: auto !important;
		right: var(--fs-float-edge) !important;
		top: auto !important;
		bottom: calc(var(--fs-mbar-space) + var(--fs-float-edge) + var(--fs-float-size) + var(--fs-float-gap)) !important;
		margin: 0 !important;
	}

	/* Layout 2: no floating chat; accessibility bottom-left, where the chat circle sat. */
	body.fs-mbar-layout-chat #broccoli-chat-widget-container { display: none !important; }
	html body.fs-mbar-layout-chat .onetap-container-toggle .onetap-toggle {
		left: var(--fs-float-edge) !important;
		right: auto !important;
		bottom: calc(var(--fs-mbar-space) + var(--fs-float-edge)) !important;
	}
	/* Homepage with the phone photo hero (general.css): accessibility on the right, clear of
	   the hero's Get a Quote link. Same specificity as the rule above (:where adds none), so
	   a spot the visitor dragged it to (onetap-drag.js, more specific) still wins. */
	html body.fs-mbar-layout-chat:where(.home:has(.fs-hero-block--has-bg-mobile)) .onetap-container-toggle .onetap-toggle {
		left: auto !important;
		right: var(--fs-float-edge) !important;
	}

	/* The chat panel is full-screen on phones: step aside while it is open. */
	html.fs-chat-open .onetap-container-toggle,
	html.fs-chat-open .fs-mbar { display: none !important; }
}
