/* ElectricMan Call SMS Widget */

.emcsw {
	--emcsw-green: #22c55e;
	--emcsw-bg: #ffffff;
	--emcsw-text: #1f2937;
	--emcsw-muted: #6b7280;
	--emcsw-soft: #eef2f5;
	--emcsw-accent: #3f9a2c;
	--emcsw-scale: 1.1; /* overall size of the pill and popup; 1 = original design size */
	zoom: var(--emcsw-scale);
	position: fixed;
	right: 14px;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 99990;
	display: none; /* revealed by widget.js */
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 16px;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
}
.emcsw.is-ready { display: flex; }
.emcsw *,
.emcsw *::before,
.emcsw *::after { box-sizing: border-box; }

/* Trigger: full pill, collapses to a small circle after scrolling */
.emcsw .emcsw-trigger {
	display: flex;
	align-items: center;
	gap: 9px;
	height: 46px;
	min-width: 0;
	margin: 0;
	padding: 0 6px 0 16px;
	border: 0;
	border-radius: 23px;
	background: var(--emcsw-bg);
	color: var(--emcsw-text);
	box-shadow: 0 2px 12px rgba(15, 23, 42, .12), 0 0 0 1px rgba(15, 23, 42, .05);
	cursor: pointer;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	-webkit-tap-highlight-color: transparent;
	transition: padding .3s ease, gap .3s ease, opacity .2s ease;
}
.emcsw .emcsw-trigger:hover,
.emcsw .emcsw-trigger:focus {
	background: var(--emcsw-bg);
	color: var(--emcsw-text);
}
.emcsw .emcsw-trigger:focus-visible { outline: 3px solid var(--emcsw-accent); outline-offset: 3px; }

.emcsw .emcsw-dot {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--emcsw-green);
	transition: opacity .2s ease, width .3s ease;
}
.emcsw .emcsw-label {
	display: flex;
	flex-direction: column;
	max-width: 220px;
	overflow: hidden;
	line-height: 1.25;
	text-align: left;
	white-space: nowrap;
	transition: max-width .3s ease, opacity .2s ease;
}
.emcsw .emcsw-label b { font-size: 14px; font-weight: 600; color: var(--emcsw-text); }
.emcsw .emcsw-label small { font-size: 12px; font-weight: 400; color: var(--emcsw-muted); }

.emcsw .emcsw-face { position: relative; flex: none; width: 34px; height: 34px; }
.emcsw .emcsw-avatar,
.emcsw .emcsw-phone {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	transition: opacity .25s ease, transform .3s ease;
}
.emcsw .emcsw-avatar {
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	object-fit: cover;
	background: #dbe3ea;
}
.emcsw .emcsw-phone {
	display: grid;
	place-items: center;
	background: var(--emcsw-accent);
	color: #fff;
	opacity: 0;
	transform: scale(.7);
}
.emcsw .emcsw-phone svg { width: 17px; height: 17px; }
.emcsw .emcsw-badge {
	position: absolute;
	right: -1px;
	bottom: -1px;
	width: 10px;
	height: 10px;
	border: 2px solid var(--emcsw-bg);
	border-radius: 50%;
	background: var(--emcsw-green);
	opacity: 0;
	transition: opacity .25s ease;
}

/* Collapsed trigger */
.emcsw.is-min .emcsw-trigger { padding: 0 6px; gap: 0; }
.emcsw.is-min .emcsw-dot { opacity: 0; width: 0; }
.emcsw.is-min .emcsw-label { max-width: 0; opacity: 0; }
.emcsw.is-min .emcsw-trigger .emcsw-avatar { opacity: 0; transform: scale(.7); }
.emcsw.is-min .emcsw-phone { opacity: 1; transform: none; }
.emcsw.is-min .emcsw-trigger .emcsw-badge { opacity: 1; }

/* Avatar turned off: the pill shows the green phone icon instead */
.emcsw.emcsw--no-avatar .emcsw-phone { opacity: 1; transform: none; }

/* Popup: dimmed backdrop + card that drops in from the top */
.emcsw .emcsw-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, .5);
	opacity: 0;
	visibility: hidden;
	touch-action: none;
	transition: opacity .2s ease, visibility 0s linear .2s;
}
.emcsw.is-open .emcsw-backdrop { opacity: 1; visibility: visible; transition: opacity .2s ease; }

.emcsw .emcsw-panel {
	position: fixed;
	top: calc(14px + env(safe-area-inset-top, 0px));
	left: 10px;
	right: 10px;
	max-width: 380px;
	margin: 0 auto;
	padding: 16px;
	border-radius: 20px;
	background: var(--emcsw-bg);
	box-shadow: 0 16px 48px rgba(15, 23, 42, .35);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-24px);
	transition: opacity .2s ease, transform .25s ease, visibility 0s linear .25s;
}
.emcsw.is-open .emcsw-panel {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity .2s ease, transform .25s ease;
}
/* WordPress admin bar (logged-in users only) */
.admin-bar .emcsw .emcsw-panel { top: calc(60px + env(safe-area-inset-top, 0px)); }

.emcsw .emcsw-who { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.emcsw .emcsw-who .emcsw-face { width: 48px; height: 48px; }
.emcsw .emcsw-who .emcsw-badge { width: 13px; height: 13px; opacity: 1; }
.emcsw .emcsw-who-text { flex: 1; min-width: 0; line-height: 1.25; text-align: left; }
.emcsw .emcsw-who-text b { display: block; font-size: 17px; font-weight: 700; color: var(--emcsw-text); }
.emcsw .emcsw-who-text span { font-size: 14px; color: var(--emcsw-muted); }

.emcsw .emcsw-close {
	display: grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--emcsw-soft);
	color: var(--emcsw-text);
	cursor: pointer;
}
.emcsw .emcsw-close:hover,
.emcsw .emcsw-close:focus { background: #e2e8ee; color: var(--emcsw-text); }
.emcsw .emcsw-close svg { width: 16px; height: 16px; }
.emcsw .emcsw-close:focus-visible { outline: 3px solid var(--emcsw-accent); outline-offset: 2px; }

.emcsw .emcsw-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.emcsw .emcsw-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 54px;
	padding: 0 12px;
	border-radius: 12px;
	font-size: 17px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	-webkit-tap-highlight-color: transparent;
	transition: filter .15s ease;
}
.emcsw .emcsw-btn svg { flex: none; width: 20px; height: 20px; }
.emcsw .emcsw-btn--sms,
.emcsw .emcsw-btn--sms:hover,
.emcsw .emcsw-btn--sms:focus { background: var(--emcsw-soft); color: var(--emcsw-text); }
.emcsw .emcsw-btn--call,
.emcsw .emcsw-btn--call:hover,
.emcsw .emcsw-btn--call:focus { background: var(--emcsw-accent); color: #fff; }
.emcsw .emcsw-btn:hover { filter: brightness(.95); text-decoration: none; }
.emcsw .emcsw-btn:focus-visible { outline: 3px solid var(--emcsw-accent); outline-offset: 2px; }

/* The number is in the markup on every screen; it is only shown on desktop */
.emcsw .emcsw-btn-number { display: none; }

/* The pill hides while the popup is open */
.emcsw.is-open .emcsw-trigger { opacity: 0; visibility: hidden; }

/* Desktop: wider popup that shows the full number */
@media (min-width: 768px) {
	.emcsw { right: 24px; bottom: 24px; }
	.emcsw .emcsw-panel { top: 24px; max-width: 520px; padding: 20px; }
	.admin-bar .emcsw .emcsw-panel { top: 56px; }
	.emcsw .emcsw-actions { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
	.emcsw .emcsw-btn-number { display: inline; font-variant-numeric: tabular-nums; }
}

@media print {
	.emcsw { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
	.emcsw *,
	.emcsw *::after { transition: none !important; animation: none !important; }
}
