.ppfc-panel[data-position="left"] {
    right: auto;
    left: var(--pp-bubble-margin, 20px);
}

.ppfc-panel button:focus-visible,
.ppfc-panel input:focus-visible,
.ppfc-panel textarea:focus-visible {
    outline: 3px solid rgba(54, 91, 178, 0.3);
    outline: 3px solid color-mix(in srgb, var(--pp-bg-color, #365bb2) 30%, transparent);
    outline-offset: 2px;
}

.ppfc-panel {
    position: fixed;
    z-index: var(--prayerpop-z-modal, 1100000);
    right: var(--pp-bubble-margin, 20px);
    bottom: calc(var(--pp-bubble-margin, 20px) + var(--pp-bubble-offset-y, 0px) + var(--pp-bubble-height, 60px) + 12px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(var(--pp-popup-width), calc(100vw - 32px));
    height: min(520px, calc(100vh - var(--pp-bubble-height, 60px) - var(--pp-bubble-margin, 20px) - var(--pp-bubble-offset-y, 0px) - 28px));
    overflow: hidden;
    border: 0;
    border-radius: var(--pp-panel-border-radius, 20px);
    background: #fff;
    color: #172033;
    font: 16px/1.45 var(--pp-font-family, system-ui);
    box-shadow: 0 20px 55px rgba(23, 32, 51, 0.2);
}

.ppfc-panel:not(.ppfc-with-bubble) {
    bottom: calc(var(--pp-bubble-margin, 20px) + 52px);
}

.ppfc-panel[hidden],
.ppfc-start[hidden],
.ppfc-conversation[hidden] {
    display: none !important;
}

.ppfc-panel.ppfc-route-transition:not([hidden]) {
	transition: height 180ms cubic-bezier(.2, .8, .2, 1);
}

/* Classic Popup swaps Chat into the existing popup host so the visitor sees
 * one continuous surface rather than a second panel opening on top of it. */
#prayer-pop-form-container.ppfc-classic-chat-host {
	transition: transform 0.3s ease, opacity 0.3s ease, height 220ms cubic-bezier(.2, .8, .2, 1);
}

#prayer-pop-form-container.ppfc-classic-chat-host.ppfc-classic-chat-active {
	height: min(520px, calc(100vh - var(--pp-bubble-height, 60px) - var(--pp-bubble-margin, 20px) - var(--pp-bubble-offset-y, 0px) - 28px));
	max-height: min(520px, calc(100vh - var(--pp-bubble-height, 60px) - var(--pp-bubble-margin, 20px) - var(--pp-bubble-offset-y, 0px) - 28px));
	padding: 0;
	overflow: hidden;
}

#prayer-pop-form-container.ppfc-classic-chat-host.ppfc-classic-chat-active > :not(.ppfc-panel) {
	visibility: hidden;
}

#prayer-pop-form-container .ppfc-panel.ppfc-classic-chat-embedded {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	max-height: none;
	border: 0;
	border-radius: inherit;
	box-shadow: none;
}

.ppfc-panel > .ppfc-chat-header {
    display: grid;
    grid-template-columns: var(--pp-control-size, 28px) minmax(0, 1fr) var(--pp-control-size, 28px);
    align-items: center;
    gap: 0;
    box-sizing: border-box;
    min-height: var(--pp-header-height, 56px);
    padding: 8px var(--pp-control-inset, 12px);
    border: 0;
    border-bottom: 1px solid var(--pp-border-color, #dfe2e7);
    background: #fff;
    color: #172033;
}

.ppfc-team {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-self: center;
    min-width: 0;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.ppfc-message time {
    color: #6b7280;
}

.ppfc-back {
    grid-column: 1;
    display: grid;
    place-items: center;
    width: var(--pp-control-size, 28px);
    height: var(--pp-control-size, 28px);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.ppfc-back:hover {
    background: rgba(23, 32, 51, 0.06);
    color: inherit;
}

.ppfc-back .dashicons {
    width: 22px;
    height: 22px;
    font-size: 22px;
    line-height: 22px;
}

.ppfc-team-icon {
    display: grid;
    place-items: center;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--pp-bubble-bg-color, var(--pp-bg-color, #365bb2)) 15%, #fff);
	color: var(--pp-bubble-bg-color, var(--pp-bg-color, #365bb2));
    font-size: 15px;
    line-height: 26px;
}

.ppfc-close {
    grid-column: 3;
    display: grid;
    place-items: center;
    justify-self: end;
    width: var(--pp-control-size, 28px);
    height: var(--pp-control-size, 28px);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}

.ppfc-close:hover {
    background: rgba(23, 32, 51, 0.06);
}

.ppfc-start,
.ppfc-conversation {
    flex: 1;
    min-height: 0;
    padding: 18px;
    overflow: auto;
    background: #f5f6f8;
}

.ppfc-start {
	display: grid;
	grid-template-rows: auto auto;
	padding: 18px 16px 14px;
	overflow: hidden;
}

.ppfc-agent-welcome,
.ppfc-thread-welcome {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	justify-self: start;
	max-width: none;
	margin: 0 0 6px;
}

.ppfc-agent-welcome-content {
	display: grid;
	gap: 4px;
	min-width: 0;
	max-width: 82%;
}

.ppfc-agent-welcome-bubble {
	display: block;
	padding: 12px 14px;
	border-radius: 18px 18px 18px 6px;
	background: #e9ebef;
	font-size: 14px;
	line-height: 1.45;
}

.ppfc-agent-welcome-bubble strong {
	display: block;
	margin-bottom: 4px;
	font-size: 14px;
}

.ppfc-agent-welcome-bubble > span {
	display: block;
	margin: 0;
	font-size: 14px;
	line-height: 1.45;
}

.ppfc-agent-welcome-content small {
	display: block;
	margin: 0;
	padding: 0 5px;
	color: #747b88;
	font-size: 11px;
}

.ppfc-agent-avatar {
	display: grid;
	place-items: center;
	flex: 0 0 28px;
	width: 28px;
	height: 28px;
	margin-top: 10px;
	border: 0;
	border-radius: 50%;
	background: var(--pp-bubble-bg-color, var(--pp-bg-color, #0048a6));
	color: var(--pp-font-color, #fff);
	font-size: 15px;
	line-height: 28px;
	object-fit: cover;
}

.ppfc-start-form {
	grid-row: 2;
	min-height: 0;
}

.ppfc-onboarding-step[hidden] {
	display: none !important;
}

.ppfc-onboarding-step:not([hidden]) {
	display: grid;
	align-content: start;
	height: auto;
	min-height: 0;
	padding-bottom: 2px;
	animation: ppfc-step-in 0.18s ease-out;
}

.ppfc-step-toolbar {
	display: grid;
	grid-template-columns: 32px max-content 1fr max-content;
	align-items: center;
	margin-bottom: 8px;
}

.ppfc-step-toolbar .ppfc-step-count {
	grid-column: 2;
}

.ppfc-step-skip {
	grid-column: 4;
}

.ppfc-step-count {
	margin-bottom: 8px;
	color: #7d8490;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ppfc-step-prompt {
	padding: 0 0 10px;
	color: #172033;
	font-size: 14px;
	line-height: 1.45;
}

.ppfc-panel .ppm-composer-field {
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
	padding: 5px 5px 5px 12px;
	border: 1px solid var(--pp-border-color, #d8dde5);
	border-radius: 15px;
	background: #fff;
	box-sizing: border-box;
}

.ppfc-panel .ppm-composer-input-row {
	display: flex;
	align-items: center;
	gap: 4px;
	width: 100%;
}

.ppfc-panel .ppm-composer-field :is(input, textarea) {
	box-sizing: border-box;
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	margin: 0;
	padding: 6px 0;
	border: 0;
	background: transparent;
	color: #172033;
	font: inherit;
	font-size: 14px;
	line-height: 20px;
	resize: none;
	box-shadow: none;
	outline: none;
}

.ppfc-panel .ppm-composer-field input {
	height: 32px;
}

.ppfc-panel .ppm-composer-field textarea {
	height: 32px;
	min-height: 32px;
	max-height: 100px;
}

.ppfc-panel .ppfc-first-composer textarea {
	height: 66px;
	min-height: 66px;
	line-height: 1.45;
}

.ppfc-panel .ppfc-step-control input[aria-invalid="true"] {
	background: #fff3f3;
}


.ppfc-panel .ppm-composer-ctas {
	display: flex;
	align-items: center;
	gap: 2px;
	flex: 0 0 auto;
}

.ppfc-panel .ppm-send-button {
	display: grid;
	place-items: center;
	flex: 0 0 30px;
	width: 30px;
	height: 30px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--pp-bubble-bg-color, var(--pp-bg-color, #365bb2));
	color: var(--pp-font-color, #fff);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.ppfc-panel .ppm-send-icon {
	display: block;
	line-height: 1;
	transform: translateY(-1px);
}

.ppfc-panel .ppm-send-button:disabled {
	opacity: 0.45;
	cursor: default;
}

.ppfc-panel .ppm-composer-field:focus-within {
	border-color: var(--pp-bubble-bg-color, var(--pp-bg-color, #365bb2));
}

.ppfc-step-back,
.ppfc-step-skip {
	margin: 0;
	padding: 4px 0;
	border: 0;
	background: transparent;
	color: #687181;
	font: inherit;
	font-size: 11px;
	cursor: pointer;
}

.ppfc-step-back {
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
}

.ppfc-step-back .dashicons {
	width: 22px;
	height: 22px;
	font-size: 22px;
}

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

@keyframes ppfc-step-in {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.ppfc-onboarding-step:not([hidden]) {
		animation: none;
	}

	.ppfc-panel.ppfc-route-transition:not([hidden]) {
		transition: none;
	}
}

.ppfc-website {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
}

.ppfc-conversation {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: #f7f8fa;
	--ppfc-composer-overlap: 20px;
}

.ppfc-messages {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: auto;
    padding: 20px 16px calc(14px + var(--ppfc-composer-overlap));
}

.ppfc-thread-welcome {
	margin-bottom: 14px;
}

.ppfc-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: fit-content;
    max-width: min(78%, 290px);
    gap: 4px;
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.45;
}

.ppfc-message > div {
    max-width: 100%;
    padding: 10px 13px;
    border-radius: 18px 18px 18px 6px;
    background: #e9ebef;
    overflow-wrap: anywhere;
}

.ppfc-message-visitor {
    align-self: flex-end;
    align-items: flex-end;
}

.ppfc-message-visitor > div {
    border-radius: 18px 18px 6px 18px;
    background: var(--pp-bg-color, #365bb2);
    color: var(--pp-font-color, #fff);
}

.ppfc-message time {
    margin: 0;
    padding: 0 4px;
    font-size: 10px;
    line-height: 1.2;
}

.ppfc-composer {
	position: relative;
	z-index: 2;
	padding: 0 12px 12px;
	margin-top: calc(var(--ppfc-composer-overlap) * -1);
	border: 0;
	background: transparent;
}

.ppfc-panel :where(.ppfc-back, .ppfc-close, .ppfc-composer button):focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.ppfc-closed {
    padding: 12px;
    border-radius: 10px;
    background: #f5f6f8;
}

.ppfc-closed button {
    display: block;
    margin-top: 8px;
    border: 0;
    background: transparent;
    color: var(--pp-bg-color, #365bb2);
    font-weight: 600;
    cursor: pointer;
}

.ppfc-error {
    margin: 0;
    padding: 10px 20px;
    color: #b42318;
    background: #fff3f2;
}

@media (max-width: 600px) {
    .ppfc-panel,
    .ppfc-panel[data-position="left"] {
        inset: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

	.ppfc-start,
	.ppfc-conversation {
		padding: 18px;
	}

	.ppfc-conversation {
		padding: 0;
	}
}

@media (max-width: 600px) {
	#prayer-pop-form-container .ppfc-panel.ppfc-classic-chat-embedded {
		inset: 0;
		width: 100%;
		height: 100%;
		border-radius: inherit;
	}
}

/* Match the team-message treatment: avatar, incoming bubble, and one metadata row. */
.ppfc-message.ppfc-message-admin {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	align-self: flex-start;
	gap: 8px;
	width: auto;
	max-width: 100%;
	text-align: left;
}

.ppfc-message-admin .ppfc-message-team-avatar {
	margin-top: 10px;
}

.ppfc-message-admin .ppfc-message-team-content {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	column-gap: 8px;
	row-gap: 4px;
	min-width: 0;
	max-width: 82%;
}

.ppfc-message-admin .ppfc-message-team-content .ppfc-agent-welcome-bubble {
	grid-column: 1 / -1;
	width: fit-content;
	max-width: 250px;
	box-sizing: border-box;
	font-size: inherit;
	overflow-wrap: anywhere;
}

.ppfc-message-admin .ppfc-message-team-content small,
.ppfc-message-admin .ppfc-message-team-content time {
	display: block;
	margin: 0;
	padding: 0 5px;
	color: #747b88;
	font-size: 11px;
	line-height: 1.2;
}

.ppfc-message-admin .ppfc-message-team-content small {
	grid-column: 1;
}

.ppfc-message-admin .ppfc-message-team-content time {
	grid-column: 2;
	align-self: center;
	padding-left: 0;
	white-space: nowrap;
}

/* Consecutive messages from the same sender in one minute form one group. */
.ppfc-message.ppfc-message-grouped {
	margin-top: -10px;
}

.ppfc-message-admin.ppfc-message-grouped .ppfc-message-team-avatar {
	visibility: hidden;
}
