/* ---- Chat popover — bottom-right floating single-thread panel ---- */

.mgl-chat-popover {
	position: fixed;
	right: 20px;
	bottom: 20px;
	width: 360px;
	height: 480px;
	max-height: calc(100vh - 40px);
	background: var(--mgl-card);
	border: 1px solid var(--mgl-border);
	border-radius: var(--mgl-radius-lg);
	box-shadow: var(--mgl-shadow-modal);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	/* Elementor's own image lightbox (.dialog-type-lightbox, opened via
	   data-elementor-open-lightbox on message image links below) sits at
	   z-index:9999 — stay below it so the lightbox isn't hidden behind
	   this popover when a message image is opened. */
	z-index: 9000;
}

/* header layout (flex row, space-between, border-bottom) shared via
   base.css's .mgl-drawer-head — this popover is much smaller than a
   side-drawer, so it keeps its own tighter gap/padding, plus flex:none
   since it sits above a flex:1 scrolling body in a fixed-height panel. */
.mgl-chat-popover-head {
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	flex: none;
}

.mgl-chat-popover-identity {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.mgl-chat-popover-avatar {
	width: 32px;
	height: 32px;
	border-radius: var(--mgl-radius-full);
	background: var(--mgl-neutral-bg);
	background-size: cover;
	background-position: center;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 13px;
	color: var(--mgl-text-secondary);
	flex: none;
}

.mgl-chat-popover-name {
	font-weight: 600;
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* .mgl-chat-popover-close removed 2026-07 — was its own 28px transparent
   circle; now uses the shared .mgl-icon-btn directly. */

/* "Sending as [event/listing]" strip — a smaller, muted echo of the header
   identity above it, since it's context (which of the viewer's own posts
   this thread is attached to) rather than the primary "who am I talking to"
   identity the header already owns. */
.mgl-chat-popover-sender {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	background: var(--mgl-neutral-bg);
	border-bottom: 1px solid var(--mgl-border);
	flex: none;
}

.mgl-chat-popover-sender-avatar {
	width: 20px;
	height: 20px;
	border-radius: var(--mgl-radius-full);
	background: var(--mgl-neutral-bg-alt);
	background-size: cover;
	background-position: center;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 10px;
	color: var(--mgl-text-secondary);
	flex: none;
}

.mgl-chat-popover-sender-label {
	min-width: 0;
	font-size: 12px;
	color: var(--mgl-text-tertiary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mgl-chat-popover-sender-label span {
	margin-right: 4px;
}

.mgl-chat-popover-sender-label strong {
	color: var(--mgl-text-secondary);
	font-weight: 600;
}

/* scroll behavior (flex:1, overflow-y:auto) shared via base.css's
   .mgl-drawer-body — this popover additionally stacks message bubbles in a
   column, which a plain form-field drawer body never needs. */
.mgl-chat-popover-body {
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mgl-chat-msg {
	display: flex;
	max-width: 82%;
}

.mgl-chat-msg--mine {
	align-self: flex-end;
	justify-content: flex-end;
}

.mgl-chat-msg--theirs {
	align-self: flex-start;
}

.mgl-chat-msg-bubble {
	background: var(--mgl-neutral-bg);
	border-radius: var(--mgl-radius-md);
	padding: 8px 12px;
	font-size: 13.5px;
	line-height: 1.4;
	word-break: break-word;
}

.mgl-chat-msg--mine .mgl-chat-msg-bubble {
	background: var(--mgl-dark-bg);
	color: var(--mgl-dark-text);
}

.mgl-chat-msg-content p {
	margin: 0;
}

.mgl-chat-msg-content p + p {
	margin-top: 6px;
}

/* "Request a quote" system card — the host's initial vendor-inquiry message
   (see event_contact_prefill_message()/renderMessage()'s extractEventPageLink())
   rendered as a centered callout instead of a left/right bubble, since it
   reads as a notice both sides share rather than one side "saying" it. */
.mgl-chat-msg--system {
	align-self: center;
	max-width: 100%;
	width: 100%;
	justify-content: center;
}

.mgl-chat-msg-system-card {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	text-align: center;
	background: var(--mgl-card);
	border: 1px solid var(--mgl-border);
	border-radius: var(--mgl-radius-md);
	box-shadow: var(--mgl-shadow-row);
	padding: 14px 16px;
}

.mgl-chat-msg-system-head {
	display: flex;
	align-items: center;
	gap: 8px;
}

.mgl-chat-msg-system-icon {
	width: 26px;
	height: 26px;
	border-radius: var(--mgl-radius-full);
	background: var(--mgl-neutral-bg);
	color: var(--mgl-text-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}

.mgl-chat-msg-system-title {
	font-weight: 700;
	font-size: 13.5px;
	color: var(--mgl-text);
}

.mgl-chat-msg-system-card .mgl-chat-msg-system-body {
	background: none;
	padding: 0;
	color: var(--mgl-text-secondary);
}

.mgl-chat-msg-system-cta {
	margin-top: 4px;
	padding: 8px 16px;
	font-size: 13px;
}

.mgl-chat-msg-file {
	display: block;
	margin-top: 6px;
}

.mgl-chat-msg-file img {
	max-width: 100%;
	border-radius: var(--mgl-radius-sm);
	display: block;
}

.mgl-chat-composer-wrap {
	border-top: 1px solid var(--mgl-border);
	flex: none;
}

.mgl-chat-popover-attachments {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 10px 16px 0;
	flex: none;
}

.mgl-chat-attachment-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--mgl-neutral-bg);
	border-radius: var(--mgl-radius-full);
	padding: 4px 10px;
	font-size: 12px;
	color: var(--mgl-text-secondary);
	max-width: 160px;
}

.mgl-chat-attachment-chip-name {
	overflow: hidden;
	white-space: nowrap;
	min-width: 0;
}

.mgl-chat-attachment-chip button {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	color: var(--mgl-text-secondary);
	flex: none;
}

.mgl-chat-popover-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 16px;
	flex: none;
}

/* .mgl-chat-plus-btn/.mgl-chat-emoji-btn/.mgl-chat-send-btn removed
   2026-07 — were their own 34px neutral-fill circles; now use the shared
   .mgl-icon-btn (send additionally gets .mgl-icon-btn--dark, see base.css,
   so the primary "submit" action still stands out from attach/emoji). */

.mgl-chat-popover-textarea {
	flex: 1;
	resize: none;
	border: 1px solid var(--mgl-border-strong);
	border-radius: var(--mgl-radius-sm);
	padding: 8px 10px;
	font: inherit;
	font-size: 13.5px;
	max-height: 90px;
	color: var(--mgl-text);
}

/* ---- popup panel (shared box shell behind the composer's emoji picker,
   plus-menu, and gallery picker — three near-identical floating panels that
   only differed in anchor side, width, and whether they need an internal
   flex-column/overflow-hidden treatment). ---- */
.mgl-chat-popup-panel {
	position: absolute;
	bottom: 68px;
	background: var(--mgl-card);
	border: 1px solid var(--mgl-border);
	border-radius: var(--mgl-radius-md);
	box-shadow: var(--mgl-shadow-modal);
	z-index: 1;
}

.mgl-chat-emoji-popup {
	right: 16px;
	width: 260px;
	height: 220px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.mgl-chat-emoji-search {
	flex: none;
	margin: 8px;
	border: 1px solid var(--mgl-border-strong);
	border-radius: var(--mgl-radius-sm);
	padding: 6px 10px;
	font: inherit;
	font-size: 13px;
	color: var(--mgl-text);
}

.mgl-chat-emoji-grid {
	flex: 1;
	overflow-y: auto;
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 2px;
	padding: 0 6px 8px;
	align-content: start;
}

.mgl-chat-emoji-option {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 19px;
	line-height: 1;
	padding: 6px 0;
	border-radius: var(--mgl-radius-sm);
}

.mgl-chat-emoji-option:hover {
	background: var(--mgl-neutral-bg);
}

.mgl-chat-emoji-empty {
	grid-column: 1 / -1;
	text-align: center;
	font-size: 12.5px;
	color: var(--mgl-text-tertiary);
	padding: 20px 0;
}

.mgl-chat-plus-menu {
	left: 16px;
	width: 240px;
	display: flex;
	flex-direction: column;
	padding: 6px;
}

.mgl-chat-plus-menu-item {
	display: flex;
	align-items: center;
	gap: 10px;
	background: none;
	border: none;
	text-align: left;
	padding: 9px 10px;
	color: var(--mgl-text);
	cursor: pointer;
	border-radius: var(--mgl-radius-sm);
}

.mgl-chat-plus-menu-item svg {
	flex: none;
	color: var(--mgl-text-secondary);
}

.mgl-chat-plus-menu-text {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
	line-height: 1.5;
}

.mgl-chat-plus-menu-text strong {
	font-size: 13px;
	font-weight: 400;
}

.mgl-chat-plus-menu-text small {
	font-size: 11.5px;
	font-weight: 400;
	color: var(--mgl-text-tertiary);
}

.mgl-chat-plus-menu-item:hover {
	background: var(--mgl-neutral-bg);
}

.mgl-chat-plus-menu-divider {
	height: 1px;
	background: var(--mgl-border);
	margin: 4px 6px;
}

.mgl-chat-gallery-popup {
	left: 16px;
	width: 280px;
	height: 220px;
	overflow: hidden;
}

.mgl-chat-gallery-grid {
	height: 100%;
	overflow-y: auto;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px;
	padding: 8px;
	align-content: start;
}

.mgl-chat-gallery-option {
	width: 100%;
	aspect-ratio: 1;
	border: none;
	border-radius: var(--mgl-radius-sm);
	background-color: var(--mgl-neutral-bg);
	background-size: cover;
	background-position: center;
	cursor: pointer;
	padding: 0;
}

.mgl-chat-gallery-empty {
	grid-column: 1 / -1;
	text-align: center;
	font-size: 12.5px;
	color: var(--mgl-text-tertiary);
	padding: 20px 10px;
}

.mgl-event-header-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	flex: none;
}

@media (max-width: 640px) {
	/* .mgl-event-header-propose-btn's own full-width mobile rule (in
	   event-page.css) now lives one level inside this wrapper — force the
	   wrapper itself onto its own row instead. */
	.mgl-event-header-actions {
		flex-basis: 100%;
		width: 100%;
		margin-top: 14px;
	}

	.mgl-chat-popover {
		right: 0;
		bottom: 0;
		left: 0;
		width: auto;
		height: 70vh;
		max-height: 70vh;
		border-radius: var(--mgl-radius-lg) var(--mgl-radius-lg) 0 0;
	}

	.mgl-chat-emoji-popup,
	.mgl-chat-gallery-popup {
		left: 8px;
		right: 8px;
		width: auto;
	}

	.mgl-chat-plus-menu {
		left: 8px;
		width: auto;
		right: 8px;
	}
}
