/* MadBoost Contact Card — frontend widget
   Compact, white, iOS-style (Apple Music-ish) modal.

   Every selector is scoped under #mbcc-widget: themes and page builders
   style bare `a` / `button` / `button:focus` aggressively, and ID
   specificity is what keeps the widget looking the same on every site. */

#mbcc-widget {
	--mbcc-right: 20px;
	--mbcc-bottom: 20px;
	--mbcc-size: 56px;
	--mbcc-accent: #fa2d48;
	--mbcc-min-scale: 0.7;
	--mbcc-text: #1c1c1e;
	--mbcc-muted: #6e6e73;
	--mbcc-fill: rgba(120, 120, 128, 0.08);
	--mbcc-fill-strong: rgba(120, 120, 128, 0.16);
	--mbcc-hairline: rgba(60, 60, 67, 0.1);
	--mbcc-safe-bottom: env(safe-area-inset-bottom, 0px);
	--mbcc-ease: cubic-bezier(0.32, 0.72, 0, 1);
	position: fixed;
	right: var(--mbcc-right);
	bottom: calc(var(--mbcc-bottom) + var(--mbcc-safe-bottom));
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.35;
	-webkit-tap-highlight-color: transparent;
}

@media (max-width: 782px) {
	#mbcc-widget.mbcc-hide-mobile {
		display: none;
	}
}

@media (min-width: 783px) {
	#mbcc-widget.mbcc-hide-desktop {
		display: none;
	}
}

/* ---------- Reset (beats theme a/button/focus styles) ---------- */

#mbcc-widget *,
#mbcc-widget *::before,
#mbcc-widget *::after {
	box-sizing: border-box;
}

#mbcc-widget button,
#mbcc-widget a {
	margin: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-align: inherit;
	white-space: normal;
	min-height: 0;
	width: auto;
	transition: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

#mbcc-widget button:hover,
#mbcc-widget button:focus,
#mbcc-widget a:hover,
#mbcc-widget a:focus {
	color: inherit;
	text-decoration: none;
	outline: none;
}

#mbcc-widget button:focus-visible,
#mbcc-widget a:focus-visible {
	outline: 2px solid var(--mbcc-accent);
	outline-offset: 2px;
}

#mbcc-widget svg {
	display: block;
	flex-shrink: 0;
}

#mbcc-widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

#mbcc-widget li {
	margin: 0;
	padding: 0;
}

#mbcc-widget li::before,
#mbcc-widget li::marker {
	content: none;
}

/* ---------- Trigger button ---------- */

#mbcc-widget .mbcc-trigger {
	--mbcc-state-scale: 1;
	--mbcc-press-scale: 1;
	position: relative;
	width: var(--mbcc-size);
	height: var(--mbcc-size);
	padding: 0;
	border-radius: 999px;
	background: var(--mbcc-button-bg, #ffffff);
	color: var(--mbcc-button-fg, var(--mbcc-accent));
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
	display: flex;
	align-items: center;
	justify-content: center;
	transform: scale(calc(var(--mbcc-state-scale) * var(--mbcc-press-scale)));
	transform-origin: bottom right;
	transition: transform 0.28s var(--mbcc-ease), opacity 0.28s ease;
}

#mbcc-widget .mbcc-trigger:hover,
#mbcc-widget .mbcc-trigger:focus {
	background: var(--mbcc-button-bg, #ffffff);
	color: var(--mbcc-button-fg, var(--mbcc-accent));
}

@media (hover: hover) {
	#mbcc-widget .mbcc-trigger:hover {
		--mbcc-press-scale: 1.05;
	}
}

#mbcc-widget .mbcc-trigger:active {
	--mbcc-press-scale: 0.94;
}

#mbcc-widget .mbcc-trigger-icon {
	display: flex;
	width: 46%;
	height: 46%;
}

#mbcc-widget .mbcc-trigger-icon svg {
	width: 100%;
	height: 100%;
}

#mbcc-widget .mbcc-trigger-icon--minimized {
	display: none;
}

/* Scroll states, set by frontend.js */

#mbcc-widget.mbcc-is-hidden .mbcc-trigger {
	--mbcc-state-scale: 0.6;
	opacity: 0;
	pointer-events: none;
}

#mbcc-widget[data-minimized-mode="scale"].mbcc-is-minimized .mbcc-trigger {
	--mbcc-state-scale: var(--mbcc-min-scale);
}

#mbcc-widget[data-minimized-mode="icon"].mbcc-is-minimized .mbcc-trigger-icon--active {
	display: none;
}

#mbcc-widget[data-minimized-mode="icon"].mbcc-is-minimized .mbcc-trigger-icon--minimized {
	display: flex;
}

/* ---------- Backdrop (below the modal, above the trigger) ---------- */

#mbcc-widget .mbcc-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1;
	background: rgba(0, 0, 0, 0.32);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

#mbcc-widget .mbcc-backdrop[hidden] {
	display: none;
}

#mbcc-widget.mbcc-is-open .mbcc-backdrop {
	opacity: 1;
}

/* ---------- Modal ---------- */

#mbcc-widget .mbcc-modal {
	position: fixed;
	z-index: 2;
	right: var(--mbcc-right);
	bottom: calc(var(--mbcc-bottom) + var(--mbcc-safe-bottom) + var(--mbcc-size) + 14px);
	width: min(340px, calc(100vw - 32px));
	max-height: min(560px, calc(100vh - var(--mbcc-bottom) - var(--mbcc-size) - 44px));
	max-height: min(560px, calc(100dvh - var(--mbcc-bottom) - var(--mbcc-safe-bottom) - var(--mbcc-size) - 44px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--mbcc-modal-bg, #ffffff);
	color: var(--mbcc-text);
	border-radius: 22px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24), 0 6px 16px rgba(0, 0, 0, 0.1);
	transform-origin: bottom right;
	transform: translateY(12px) scale(0.6);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.42s var(--mbcc-ease), opacity 0.24s ease;
}

#mbcc-widget .mbcc-modal[hidden] {
	display: none;
}

#mbcc-widget.mbcc-is-open .mbcc-modal {
	transform: translateY(0) scale(1);
	opacity: 1;
	pointer-events: auto;
}

/* Phones: a bottom sheet that slides up, clear of the home indicator. */
@media (max-width: 480px) {
	#mbcc-widget .mbcc-modal {
		left: 10px;
		right: 10px;
		bottom: calc(10px + var(--mbcc-safe-bottom));
		width: auto;
		max-height: calc(100vh - 40px);
		max-height: calc(100dvh - 40px - var(--mbcc-safe-bottom));
		border-radius: 24px;
		transform-origin: bottom center;
		transform: translateY(40px) scale(0.96);
	}
}

@media (prefers-reduced-motion: reduce) {
	#mbcc-widget .mbcc-modal,
	#mbcc-widget .mbcc-trigger,
	#mbcc-widget .mbcc-backdrop {
		transition-duration: 0.01ms;
	}
}

/* X: a 30px visual pill inside a 44px hit area. */
#mbcc-widget .mbcc-modal-close {
	position: absolute;
	top: 4px;
	right: 4px;
	z-index: 3;
	width: 44px;
	height: 44px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--mbcc-muted);
}

#mbcc-widget .mbcc-modal-close::before {
	content: "";
	position: absolute;
	inset: 7px;
	border-radius: 999px;
	background: rgba(120, 120, 128, 0.12);
	transition: background 0.15s ease;
}

#mbcc-widget .mbcc-modal-close:hover::before {
	background: rgba(120, 120, 128, 0.22);
}

#mbcc-widget .mbcc-modal-close svg {
	position: relative;
	width: 16px;
	height: 16px;
	stroke-width: 2.5;
}

/* ---------- Views ---------- */

/* min-height:0 lets the view shrink inside the flex column so it scrolls,
   instead of pushing the Close button out of the modal. */
#mbcc-widget .mbcc-view {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: rgba(120, 120, 128, 0.35) transparent;
	padding: 22px 16px 14px;
}

#mbcc-widget .mbcc-view[hidden] {
	display: none;
}

/* Contact list (multiple contacts) */

#mbcc-widget .mbcc-view--list {
	padding-top: 48px;
}

#mbcc-widget .mbcc-contact-list {
	background: var(--mbcc-fill);
	border-radius: 14px;
	overflow: hidden;
}

#mbcc-widget .mbcc-contact-list li + li .mbcc-contact-list-item {
	box-shadow: inset 0 1px 0 var(--mbcc-hairline);
}

#mbcc-widget .mbcc-contact-list-item {
	width: 100%;
	min-height: 56px;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 12px;
	text-align: left;
}

#mbcc-widget .mbcc-contact-list-item:hover {
	background: var(--mbcc-fill);
}

#mbcc-widget .mbcc-contact-list-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

#mbcc-widget .mbcc-contact-list-name {
	font-weight: 600;
	font-size: 15px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#mbcc-widget .mbcc-contact-list-label {
	font-size: 13px;
	color: var(--mbcc-muted);
}

/* Avatars */

#mbcc-widget .mbcc-avatar {
	width: 40px;
	height: 40px;
	border-radius: 999px;
	overflow: hidden;
	background: rgba(120, 120, 128, 0.12);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-weight: 600;
	color: var(--mbcc-muted);
}

#mbcc-widget .mbcc-avatar img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border-radius: 0;
	margin: 0;
}

#mbcc-widget .mbcc-avatar--large {
	width: 68px;
	height: 68px;
	font-size: 24px;
	margin: 0 auto 10px;
	box-shadow: 0 0 0 1px var(--mbcc-hairline);
}

#mbcc-widget .mbcc-chevron {
	width: 16px;
	height: 16px;
	color: #c7c7cc;
}

/* Detail view */

#mbcc-widget .mbcc-back {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	min-height: 44px;
	margin: -14px 0 0 -8px;
	padding: 0 8px;
	color: var(--mbcc-accent);
	font-size: 15px;
	font-weight: 500;
}

#mbcc-widget .mbcc-back:hover,
#mbcc-widget .mbcc-back:focus {
	color: var(--mbcc-accent);
}

#mbcc-widget .mbcc-back svg {
	width: 20px;
	height: 20px;
}

#mbcc-widget .mbcc-detail-header {
	text-align: center;
	margin-bottom: 16px;
	padding: 0 28px;
}

#mbcc-widget .mbcc-detail-name {
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -0.01em;
	overflow-wrap: anywhere;
}

#mbcc-widget .mbcc-detail-label,
#mbcc-widget .mbcc-detail-email {
	font-size: 13px;
	color: var(--mbcc-muted);
	margin-top: 2px;
	overflow-wrap: anywhere;
}

/* Email: a mailto link (accent = tappable) with a small copy button. */
#mbcc-widget .mbcc-detail-email {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2px;
}

#mbcc-widget .mbcc-detail-email a {
	color: var(--mbcc-accent);
	min-width: 0;
	overflow-wrap: anywhere;
}

#mbcc-widget .mbcc-detail-email a:hover,
#mbcc-widget .mbcc-detail-email a:focus-visible {
	color: var(--mbcc-accent);
	text-decoration: underline;
}

/* Number row: the pill keeps the number centred; the copy button sits
   inside its right end (a sibling, since a button can't nest in <a>). */
#mbcc-widget .mbcc-main-number-row {
	position: relative;
	margin-bottom: 12px;
}

#mbcc-widget .mbcc-copy {
	position: absolute;
	top: 50%;
	right: 3px;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 11px;
	color: var(--mbcc-muted);
}

#mbcc-widget .mbcc-copy:hover,
#mbcc-widget .mbcc-copy:focus-visible {
	background: rgba(120, 120, 128, 0.14);
	color: var(--mbcc-text);
}

#mbcc-widget .mbcc-copy svg {
	width: 18px;
	height: 18px;
}

#mbcc-widget .mbcc-copy .mbcc-copied-icon,
#mbcc-widget .mbcc-copy.is-copied .mbcc-copy-icon {
	display: none;
}

#mbcc-widget .mbcc-copy.is-copied .mbcc-copied-icon {
	display: block;
}

#mbcc-widget .mbcc-copy.is-copied {
	color: var(--mbcc-accent);
}

/* Small inline variant next to the email: 32px target, pulled in with
   negative margins so it doesn't push the header text around. */
#mbcc-widget .mbcc-copy--small {
	position: static;
	transform: none;
	width: 32px;
	height: 32px;
	margin: -8px -8px -8px 0;
	flex-shrink: 0;
	border-radius: 8px;
}

#mbcc-widget .mbcc-copy--small svg {
	width: 14px;
	height: 14px;
}

/* "Copied" bubble. frontend.js positions it (top/left, in px relative to
   the modal) just above the copy button that was tapped. */
#mbcc-widget .mbcc-toast {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 4;
	transform: translateY(4px);
	padding: 6px 12px;
	border-radius: 999px;
	background: #1c1c1e;
	color: #ffffff;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s var(--mbcc-ease);
}

#mbcc-widget .mbcc-toast.is-visible {
	opacity: 1;
	transform: translateY(0);
}

#mbcc-widget .mbcc-main-number {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 50px;
	padding: 12px 52px;
	border-radius: 14px;
	background: var(--mbcc-fill);
	color: var(--mbcc-text);
	font-size: 18px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

#mbcc-widget .mbcc-main-number:hover,
#mbcc-widget .mbcc-main-number:focus {
	background: var(--mbcc-fill-strong);
	color: var(--mbcc-text);
}

/* Call toggle off: number is shown for reading/copying, not dialled. */
#mbcc-widget .mbcc-main-number--static,
#mbcc-widget .mbcc-main-number--static:hover {
	background: var(--mbcc-fill);
	cursor: text;
	user-select: all;
}

/* Mouse + keyboard devices have no handler for these schemes (SMS). */
@media (hover: hover) and (pointer: fine) {
	#mbcc-widget .mbcc-mobile-only {
		display: none;
	}

	/* A hidden first row would leave the next row's divider on top. */
	#mbcc-widget .mbcc-mobile-only:first-child + li .mbcc-channel-item::before {
		display: none;
	}
}

#mbcc-widget .mbcc-main-number svg {
	width: 18px;
	height: 18px;
	color: var(--mbcc-accent);
}

#mbcc-widget .mbcc-channel-list {
	margin-bottom: 12px;
	background: var(--mbcc-fill);
	border-radius: 14px;
	overflow: hidden;
}

/* No channels switched on: drop the empty grouped box (the <ul> always
   contains template whitespace, so :empty would never match). */
#mbcc-widget .mbcc-channel-list:not(:has(li)) {
	display: none;
}

/* Inset hairline between rows, starting after the icon — iOS grouped list. */
#mbcc-widget .mbcc-channel-list li + li .mbcc-channel-item::before {
	content: "";
	position: absolute;
	top: 0;
	left: 52px;
	right: 0;
	height: 1px;
	background: var(--mbcc-hairline);
}

#mbcc-widget .mbcc-channel-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 48px;
	padding: 10px 12px;
	color: var(--mbcc-text);
}

#mbcc-widget .mbcc-channel-item:hover,
#mbcc-widget .mbcc-channel-item:focus {
	background: var(--mbcc-fill);
	color: var(--mbcc-text);
}

/* Channel icon tile. data-icon-style on #mbcc-widget picks the tile color:
   accent (default) | brand (per-row --mbcc-brand) | custom | none. */
#mbcc-widget .mbcc-channel-icon {
	width: 28px;
	height: 28px;
	border-radius: 8px;
	background: var(--mbcc-accent);
	color: var(--mbcc-tile-fg, #ffffff);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
}

#mbcc-widget[data-icon-style="brand"] .mbcc-channel-icon {
	background: var(--mbcc-brand, var(--mbcc-accent));
}

#mbcc-widget[data-icon-style="custom"] .mbcc-channel-icon {
	background: var(--mbcc-tile-custom, var(--mbcc-accent));
}

#mbcc-widget[data-icon-style="none"] .mbcc-channel-icon {
	background: none;
	color: var(--mbcc-brand, var(--mbcc-accent));
}

#mbcc-widget .mbcc-channel-icon svg {
	width: 16px;
	height: 16px;
}

#mbcc-widget[data-icon-style="none"] .mbcc-channel-icon svg {
	width: 24px;
	height: 24px;
}

/* A full-color logo SVG already includes its own tile: show it as the tile,
   whatever the icon style. */
#mbcc-widget .mbcc-channel-icon.mbcc-channel-icon--logo {
	background: none;
}

#mbcc-widget .mbcc-channel-icon.mbcc-channel-icon--logo svg {
	width: 100%;
	height: 100%;
}

#mbcc-widget .mbcc-channel-label {
	flex: 1;
	min-width: 0;
	font-size: 15px;
	font-weight: 500;
}

#mbcc-widget .mbcc-vcard-button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 46px;
	padding: 11px;
	border-radius: 14px;
	box-shadow: inset 0 0 0 1px rgba(60, 60, 67, 0.16);
	color: var(--mbcc-accent);
	font-size: 15px;
	font-weight: 600;
}

#mbcc-widget .mbcc-vcard-button:hover,
#mbcc-widget .mbcc-vcard-button:focus {
	background: var(--mbcc-fill);
	color: var(--mbcc-accent);
}

#mbcc-widget .mbcc-vcard-button svg {
	width: 18px;
	height: 18px;
}

#mbcc-widget .mbcc-close-button {
	flex-shrink: 0;
	display: block;
	width: auto;
	min-height: 48px;
	margin: 0 16px 16px;
	padding: 12px;
	border-radius: 14px;
	background: var(--mbcc-fill-strong);
	color: var(--mbcc-text);
	font-size: 16px;
	font-weight: 600;
	text-align: center;
}

#mbcc-widget .mbcc-close-button:hover,
#mbcc-widget .mbcc-close-button:focus {
	background: rgba(120, 120, 128, 0.24);
	color: var(--mbcc-text);
}

#mbcc-widget .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
