/*
 * Floating Calendly Widget — frontend styles
 * Values driven by CSS custom properties set inline from PHP settings.
 */

/*
 * Default values live on :root (not #fcw-widget) so the admin-configured
 * overrides — which the plugin prints inline on :root AFTER this file —
 * win by source order. If they were on #fcw-widget (ID specificity), those
 * defaults would shadow the :root admin values and settings would silently
 * do nothing. Keep these on :root.
 */
:root {
	--fcw-bottom: 24px;
	--fcw-right: 24px;
	--fcw-left: auto;
	--fcw-width: 300px;
	--fcw-radius: 24px;
	--fcw-shadow: 0 20px 50px rgba(0, 0, 0, .12);
	--fcw-bg: #ffffff;
	--fcw-text: #0a0a0a;
	--fcw-indicator: #34c759;
	--fcw-heading-size: 18px;
	--fcw-avatar-size: 58px;
}

#fcw-widget {
	position: fixed !important;
	bottom: var(--fcw-bottom) !important;
	right: var(--fcw-right) !important;
	left: var(--fcw-left) !important;
	top: auto !important;
	width: var(--fcw-width) !important;
	max-width: calc(100vw - 24px) !important;
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--fcw-text);
	cursor: pointer;
	z-index: 2147483647 !important;
	margin: 0 !important;
	transform: none !important;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	-webkit-tap-highlight-color: transparent;
	box-sizing: border-box;
	/* No overflow:hidden here — the close button sits outside the card. */
}

#fcw-widget[hidden] {
	display: none !important;
}

/*
 * The visible card. It carries the background, rounded corners, shadow, and
 * the height animation. overflow:hidden lives here (not on #fcw-widget) so
 * the rounded corners clip content while the close button, which is a
 * sibling at the #fcw-widget level, can sit outside the card unclipped.
 *
 * Heights scale with the avatar so a large configured avatar size never
 * gets clipped: collapsed is at least 100px or avatar + 24px; expanded
 * adds the bottom row on top.
 */
.fcw-card {
	position: relative;
	background: var(--fcw-bg);
	border-radius: var(--fcw-radius);
	box-shadow: var(--fcw-shadow);
	overflow: hidden;
	box-sizing: border-box;
	height: max(88px, calc(var(--fcw-avatar-size) + 24px));
	transition: height 300ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 300ms ease;
}

#fcw-widget:hover .fcw-card,
#fcw-widget.fcw-expanded .fcw-card {
	/* Collapsed top row + 60px bottom row, with no gap between them. */
	height: max(148px, calc(var(--fcw-avatar-size) + 84px));
}

.fcw-row-top {
	height: max(88px, calc(var(--fcw-avatar-size) + 24px)) !important;
}

#fcw-widget:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 3px;
	border-radius: var(--fcw-radius);
}

/* Top row: avatar + heading */
.fcw-row-top {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 16px;
	box-sizing: border-box;
}

.fcw-avatar-wrap {
	position: relative;
	flex: 0 0 auto;
	width: var(--fcw-avatar-size);
	height: var(--fcw-avatar-size);
}

.fcw-avatar {
	width: var(--fcw-avatar-size);
	height: var(--fcw-avatar-size);
	border-radius: 50%;
	object-fit: cover;
	border: 3px solid #d7f3df;
	display: block;
	background: #f0f5ff;
}

.fcw-avatar-placeholder {
	background: linear-gradient(135deg, #309bfd, #4057ef);
}

.fcw-indicator {
	position: absolute;
	bottom: 1px;
	right: 1px;
	/* Scales with the avatar so it stays proportional at any configured size. */
	width: calc(var(--fcw-avatar-size) * 0.22);
	height: calc(var(--fcw-avatar-size) * 0.22);
	border-radius: 50%;
	background: var(--fcw-indicator);
	border: calc(var(--fcw-avatar-size) * 0.045) solid var(--fcw-bg);
	box-sizing: content-box;
}

.fcw-heading {
	font-size: var(--fcw-heading-size);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

/* Close button — sits just outside the card at the top-right corner. */
.fcw-close-btn {
	position: absolute;
	top: -16px;
	right: 10px;
	width: 20px;
	height: 20px;
	padding: 4px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 50%;
	color: #6b7280;
	cursor: pointer;
	z-index: 3;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
	transition: background-color 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.fcw-close-btn:hover {
	background-color: #ffffff;
	color: #111827;
	transform: scale(1.08);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

.fcw-close-btn:active {
	transform: scale(0.96);
}

.fcw-close-btn:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
}

/* Bottom row: CTA + Calendly logo — sits flush under the top row, no gap. */
.fcw-row-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 60px;
	padding: 0 16px;
	box-sizing: border-box;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 250ms ease 60ms, transform 250ms ease 60ms;
}

#fcw-widget:hover .fcw-row-bottom,
#fcw-widget.fcw-expanded .fcw-row-bottom {
	opacity: 1;
	transform: translateY(0);
}

.fcw-cta-text {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: 600;
	color: #4057ef;
}

.fcw-cta-arrow {
	transition: transform 200ms ease;
}

#fcw-widget:hover .fcw-cta-arrow,
#fcw-widget.fcw-expanded .fcw-cta-arrow {
	transform: translateX(3px);
}

.fcw-calendly-logo {
	height: 24px;
	width: auto;
	display: block;
}

/*
 * Mobile layout (width, alignment, padding, mobile-disable) is generated
 * dynamically in PHP at the admin-configured breakpoint — see
 * FCW_Frontend::generate_inline_css(). It is intentionally NOT hard-coded
 * here, so changing the "Mobile Breakpoint" setting actually takes effect.
 */

@media (prefers-reduced-motion: reduce) {
	#fcw-widget,
	.fcw-row-bottom,
	.fcw-cta-arrow {
		transition: none;
	}
}
