/* Global Custom Fields — frontend button styling */

.octgf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-decoration: none;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease, opacity 0.2s ease;
}
.octgf-btn:hover {
	opacity: 0.95;
}
.octgf-btn .octgf-btn-icon {
	display: inline-flex;
	align-items: center;
}
.octgf-btn .octgf-btn-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* Sensible defaults if the widget is used without style tweaks */
.octgf-call-btn {
	background: #2563eb;
	color: #fff;
	padding: 12px 24px;
	border-radius: 6px;
}
.octgf-whatsapp-btn {
	background: #25d366;
	color: #062e17;
	padding: 12px 24px;
	border-radius: 6px;
}

/* Inline text links from shortcodes */
.octgf-phone-link,
.octgf-whatsapp-link {
	text-decoration: none;
}

/* Widget looping animations (opt-in per device via the widget's Animation control).
   animation-name/duration/iteration are applied by Elementor; these define the frames. */
@keyframes octgf-pulse {
	0%, 100% { transform: scale( 1 ); }
	50%      { transform: scale( 1.06 ); }
}
@keyframes octgf-bounce {
	0%, 100%   { transform: translateY( 0 ); }
	50%        { transform: translateY( -6px ); }
}
@keyframes octgf-float {
	0%, 100% { transform: translateY( 0 ); }
	50%      { transform: translateY( -4px ); }
}
@keyframes octgf-grow {
	0%   { transform: scale( 1 ); }
	50%  { transform: scale( 1.04 ); }
	100% { transform: scale( 1 ); }
}
@media ( prefers-reduced-motion: reduce ) {
	.octgf-btn,
	.octgf-sb-btn { animation: none !important; }
}

/* Safety net: never leave our contact buttons stuck hidden. Elementor adds
   `elementor-invisible` (visibility:hidden; opacity:0) whenever a setting named
   `animation` is present and waits for its own entrance-animation JS to reveal
   the element. Our looping/hover animation controls are now `octgf_`-prefixed to
   avoid that collision, but this guarantees any legacy `animation` value lingering
   in saved element data can never hide the button on the front end. */
.elementor-widget-octgf-call-button.elementor-invisible,
.elementor-widget-octgf-whatsapp-button.elementor-invisible {
	visibility: visible !important;
	opacity: 1 !important;
	animation: none !important;
}

/* Floating contact buttons */
.octgf-fab {
	position: fixed;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.octgf-fab-left {
	align-items: flex-start;
}
.octgf-fab-right {
	align-items: flex-end;
}

/* The button is a fixed-size circle; it never changes size on hover, so
   hovering one button can never shift the others. */
.octgf-fab-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var( --octgf-fab-size, 56px );
	height: var( --octgf-fab-size, 56px );
	padding: 0;
	background: var( --octgf-fab-color, #25d366 );
	color: #fff;
	border-radius: var( --octgf-fab-radius, 50% );
	box-shadow: 0 6px 18px rgba( 0, 0, 0, 0.25 );
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.octgf-fab-btn:hover {
	transform: scale( 1.06 );
	color: #fff;
	box-shadow: 0 10px 24px rgba( 0, 0, 0, 0.3 );
}
.octgf-fab-icon {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}
.octgf-fab-icon svg {
	display: block;
	width: 52%;
	height: 52%;
	fill: currentColor;
}

/* Label is absolutely positioned → it floats out on hover without affecting
   layout, so sibling buttons stay put. */
.octgf-fab-label {
	position: absolute;
	top: 50%;
	transform: translateY( -50% ) translateX( 8px );
	background: var( --octgf-fab-color, #25d366 );
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	padding: 10px 16px;
	border-radius: 30px;
	box-shadow: 0 6px 18px rgba( 0, 0, 0, 0.2 );
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
/* Right side: label appears to the LEFT of the icon. */
.octgf-fab-right .octgf-fab-label {
	right: calc( 100% + 12px );
}
.octgf-fab-right .octgf-fab-btn:hover .octgf-fab-label {
	opacity: 1;
	transform: translateY( -50% ) translateX( 0 );
}
/* Left side: label appears to the RIGHT of the icon. */
.octgf-fab-left .octgf-fab-label {
	left: calc( 100% + 12px );
	transform: translateY( -50% ) translateX( -8px );
}
.octgf-fab-left .octgf-fab-btn:hover .octgf-fab-label {
	opacity: 1;
	transform: translateY( -50% ) translateX( 0 );
}

/* RTL sites: keep the label text direction correct. */
.rtl .octgf-fab-label,
[dir="rtl"] .octgf-fab-label {
	direction: rtl;
	text-align: center;
}

/* =========================================================================
   Sticky Buttons — vertical bar stuck to the middle of the screen edge
   ========================================================================= */
.octgf-sb {
	position: fixed;
	top: 50%;
	transform: translateY( calc( -50% + var( --octgf-sb-offset, 0px ) ) );
	z-index: 99990;
	display: flex;
	flex-direction: column;
	gap: var( --octgf-sb-gap, 10px );
}
.octgf-sb-left {
	left: 0;
	align-items: flex-start;
}
.octgf-sb-right {
	right: 0;
	align-items: flex-end;
}

.octgf-sb-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: var( --octgf-sb-size, 52px );
	height: var( --octgf-sb-size, 52px );
	padding: 0;
	background: var( --octgf-sb-bg, #2563eb );
	color: #fff;
	text-decoration: none;
	font-size: calc( var( --octgf-sb-size, 52px ) * 0.42 );
	line-height: 1;
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.22 );
	transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.octgf-sb-btn:hover {
	color: #fff;
	filter: brightness( 1.08 );
	box-shadow: 0 8px 20px rgba( 0, 0, 0, 0.28 );
}

.octgf-sb-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1em;
	height: 1em;
}
.octgf-sb-icon svg {
	display: block;
	width: 1em;
	height: 1em;
	fill: currentColor;
}
.octgf-sb-icon img {
	display: block;
	width: 1em;
	height: 1em;
	object-fit: contain;
}
.octgf-sb-icon .dashicons {
	width: 1em;
	height: 1em;
	font-size: 1em;
}
.octgf-sb-label {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

/* --- Shapes ------------------------------------------------------------ */
/* Bar shapes (tab / square): stretch every button to the width of the widest
   one so mixed label lengths still form one clean, even column. Circles keep
   their natural size (stretching would distort them). */
.octgf-sb-shape-tab,
.octgf-sb-shape-square {
	align-items: stretch;
}
.octgf-sb-shape-tab .octgf-sb-btn,
.octgf-sb-shape-square .octgf-sb-btn {
	width: auto;
}
.octgf-sb-shape-circle .octgf-sb-btn {
	border-radius: 50%;
}
.octgf-sb-shape-circle.octgf-sb-left .octgf-sb-btn   { margin-left: 12px; }
.octgf-sb-shape-circle.octgf-sb-right .octgf-sb-btn  { margin-right: 12px; }
.octgf-sb-shape-square .octgf-sb-btn {
	border-radius: 10px;
}
.octgf-sb-shape-square.octgf-sb-left .octgf-sb-btn   { margin-left: 12px; }
.octgf-sb-shape-square.octgf-sb-right .octgf-sb-btn  { margin-right: 12px; }
/* Edge tab: flush to the screen edge, rounded on the inner side only. */
.octgf-sb-right.octgf-sb-shape-tab .octgf-sb-btn { border-radius: 10px 0 0 10px; }
.octgf-sb-left.octgf-sb-shape-tab .octgf-sb-btn  { border-radius: 0 10px 10px 0; }

/* --- Display modes ------------------------------------------------------
   Desktop and mobile modes live in mutually exclusive media queries so they
   can never fight each other across the breakpoint. */
@media ( min-width: 783px ) {
	/* Icon only: the label becomes a slide-out hover tooltip (absolute →
	   never shifts siblings; pure CSS). */
	.octgf-sb-desk-icon .octgf-sb-label {
		position: absolute;
		top: 50%;
		background: #fff;
		color: var( --octgf-sb-bg, #2563eb );
		padding: 9px 14px;
		border-radius: 8px;
		box-shadow: 0 6px 18px rgba( 0, 0, 0, 0.2 );
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease, transform 0.2s ease;
	}
	.octgf-sb-right.octgf-sb-desk-icon .octgf-sb-label {
		right: calc( 100% + 10px );
		transform: translateY( -50% ) translateX( 8px );
	}
	.octgf-sb-right.octgf-sb-desk-icon .octgf-sb-btn:hover .octgf-sb-label {
		opacity: 1;
		transform: translateY( -50% ) translateX( 0 );
	}
	.octgf-sb-left.octgf-sb-desk-icon .octgf-sb-label {
		left: calc( 100% + 10px );
		transform: translateY( -50% ) translateX( -8px );
	}
	.octgf-sb-left.octgf-sb-desk-icon .octgf-sb-btn:hover .octgf-sb-label {
		opacity: 1;
		transform: translateY( -50% ) translateX( 0 );
	}
	/* Text only. */
	.octgf-sb-desk-text .octgf-sb-icon {
		display: none;
	}
	.octgf-sb-desk-text .octgf-sb-btn {
		width: auto;
		padding: 0 16px;
	}
	/* Icon + text. */
	.octgf-sb-desk-both .octgf-sb-btn {
		width: auto;
		padding: 0 16px 0 12px;
	}
}

/* --- Icon position relative to the label (Icon + Text mode) -------------
   Physical left/right regardless of site direction; harmless in icon-only /
   text-only modes because only one of the two elements renders. */
.octgf-sb-icon-right .octgf-sb-btn { flex-direction: row-reverse; }
[dir="rtl"] .octgf-sb-icon-left .octgf-sb-btn,
.rtl .octgf-sb-icon-left .octgf-sb-btn { flex-direction: row-reverse; }
[dir="rtl"] .octgf-sb-icon-right .octgf-sb-btn,
.rtl .octgf-sb-icon-right .octgf-sb-btn { flex-direction: row; }
.octgf-sb-icon-top .octgf-sb-btn { flex-direction: column; }
.octgf-sb-icon-bottom .octgf-sb-btn { flex-direction: column-reverse; }

/* Stacked (above/below) needs room to grow past the fixed button height. */
@media ( min-width: 783px ) {
	.octgf-sb-icon-top.octgf-sb-desk-both .octgf-sb-btn,
	.octgf-sb-icon-bottom.octgf-sb-desk-both .octgf-sb-btn {
		height: auto;
		min-height: var( --octgf-sb-size, 52px );
		padding: 10px 14px;
		gap: 6px;
	}
}
/* --- Animations (reuse the shared keyframes above) ---------------------- */
.octgf-sb-anim-pulse .octgf-sb-btn  { animation: octgf-pulse 2s ease-in-out infinite; }
.octgf-sb-anim-bounce .octgf-sb-btn { animation: octgf-bounce 1.6s ease-in-out infinite; }
.octgf-sb-anim-float .octgf-sb-btn  { animation: octgf-float 2.4s ease-in-out infinite; }
.octgf-sb-anim-grow .octgf-sb-btn   { animation: octgf-grow 2s ease-in-out infinite; }
.octgf-sb-anim-hover .octgf-sb-btn:hover { transform: scale( 1.08 ); }

/* RTL sites: keep label text direction correct. */
.rtl .octgf-sb-label,
[dir="rtl"] .octgf-sb-label {
	direction: rtl;
}

/* --- Mobile overrides (WP admin breakpoint, matches admin.css) ----------
   Each mobile mode explicitly resets what the desktop modes set; these rules
   sit later in the file with matching-or-higher specificity, so they win. */
@media ( max-width: 782px ) {
	/* Icon only. */
	.octgf-sb.octgf-sb-mob-icon .octgf-sb-icon {
		display: flex;
	}
	.octgf-sb.octgf-sb-mob-icon .octgf-sb-btn {
		width: var( --octgf-sb-size, 52px );
		min-width: var( --octgf-sb-size, 52px );
		padding: 0;
	}
	.octgf-sb.octgf-sb-mob-icon .octgf-sb-label {
		position: absolute;
		top: 50%;
		background: #fff;
		color: var( --octgf-sb-bg, #2563eb );
		font-size: 13px;
		padding: 8px 12px;
		border-radius: 8px;
		box-shadow: 0 6px 18px rgba( 0, 0, 0, 0.2 );
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease, transform 0.2s ease;
	}
	.octgf-sb-right.octgf-sb-mob-icon .octgf-sb-label {
		right: calc( 100% + 10px );
		left: auto;
		transform: translateY( -50% ) translateX( 8px );
	}
	.octgf-sb-right.octgf-sb-mob-icon .octgf-sb-btn:hover .octgf-sb-label,
	.octgf-sb-right.octgf-sb-mob-icon .octgf-sb-btn:focus .octgf-sb-label {
		opacity: 1;
		transform: translateY( -50% ) translateX( 0 );
	}
	.octgf-sb-left.octgf-sb-mob-icon .octgf-sb-label {
		left: calc( 100% + 10px );
		right: auto;
		transform: translateY( -50% ) translateX( -8px );
	}
	.octgf-sb-left.octgf-sb-mob-icon .octgf-sb-btn:hover .octgf-sb-label,
	.octgf-sb-left.octgf-sb-mob-icon .octgf-sb-btn:focus .octgf-sb-label {
		opacity: 1;
		transform: translateY( -50% ) translateX( 0 );
	}

	/* Text only. */
	.octgf-sb.octgf-sb-mob-text .octgf-sb-icon {
		display: none;
	}
	.octgf-sb.octgf-sb-mob-text .octgf-sb-btn {
		width: auto;
		padding: 0 14px;
	}
	.octgf-sb.octgf-sb-mob-text .octgf-sb-label,
	.octgf-sb.octgf-sb-mob-both .octgf-sb-label {
		position: static;
		background: transparent;
		color: inherit;
		font-size: 13px;
		padding: 0;
		border-radius: 0;
		box-shadow: none;
		opacity: 1;
		pointer-events: auto;
		transform: none;
		transition: none;
	}

	/* Icon + text. */
	.octgf-sb.octgf-sb-mob-both .octgf-sb-icon {
		display: flex;
	}
	.octgf-sb.octgf-sb-mob-both .octgf-sb-btn {
		width: auto;
		padding: 0 14px 0 10px;
	}
	/* Stacked icon (above/below) needs room to grow past the fixed height. */
	.octgf-sb-icon-top.octgf-sb-mob-both .octgf-sb-btn,
	.octgf-sb-icon-bottom.octgf-sb-mob-both .octgf-sb-btn {
		height: auto;
		min-height: var( --octgf-sb-size, 52px );
		padding: 8px 12px;
		gap: 5px;
	}
}

/* --- Per-device visibility (keep last so it always wins) ---------------- */
@media ( min-width: 783px ) {
	.octgf-sb-hide-desktop { display: none !important; }
}
@media ( max-width: 782px ) {
	.octgf-sb-hide-mobile { display: none !important; }
}
