/* Shop chat. Colors come from the settings screen as variables on the root. */

.osae-chat,
.osae-chat * {
	box-sizing: border-box;
}

.osae-chat {
	position: fixed;
	z-index: 99940;
	right: 20px;
	bottom: calc(20px + env(safe-area-inset-bottom, 0px));
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: inherit;
	line-height: 1.4;
	color: #282828;
}

.osae-chat button,
.osae-chat textarea,
.osae-chat input {
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	box-shadow: none;
	appearance: none;
	-webkit-appearance: none;
}

.osae-chat-panel {
	width: min(372px, calc(100vw - 32px));
	height: min(560px, calc(100vh - 120px));
	background: #fff;
	color: #282828;
	border-radius: 18px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.osae-chat-panel[hidden] {
	display: none;
}

.osae-chat-head {
	padding: 22px 22px 8px;
}

.osae-chat-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	color: #1a1a1a;
}

.osae-chat-sub {
	margin: 6px 0 0;
	font-size: 15px;
	line-height: 1.35;
	color: #6b7280;
}

.osae-chat-online {
	margin: 12px 0 0;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #374151;
}

.osae-chat-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #22c55e;
	display: inline-block;
	flex: 0 0 auto;
}

.osae-chat-name {
	margin: 8px 16px 0;
	width: calc(100% - 32px);
	border: 1px solid #e6e6e6;
	border-radius: 10px;
	background: #fff;
	color: #282828;
	padding: 10px 12px;
	font-size: 15px;
}

.osae-chat-body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	padding: 12px 16px 8px;
}

.osae-chat-starters {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.osae-chat-starter {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	text-align: left;
	background: #fff;
	color: #282828;
	border: 1px solid #ececec;
	border-radius: 12px;
	padding: 12px 14px;
	font-size: 15px;
	line-height: 1.3;
	cursor: pointer;
}

.osae-chat-starter:hover,
.osae-chat-starter:focus-visible {
	border-color: var(--osae-chat-accent, #0078e8);
}

.osae-chat-chevron {
	color: var(--osae-chat-accent, #0078e8);
	flex: 0 0 auto;
	font-size: 18px;
	line-height: 1;
}

.osae-chat-log {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-bottom: 8px;
}

.osae-chat-log[hidden],
.osae-chat-starters[hidden],
.osae-chat-form[hidden],
.osae-chat-error[hidden],
.osae-chat-name[hidden] {
	display: none;
}

.osae-chat-msg {
	max-width: 85%;
	padding: 10px 12px;
	border-radius: 14px;
	font-size: 15px;
	line-height: 1.4;
	white-space: pre-wrap;
	word-break: break-word;
}

.osae-chat-msg.is-visitor {
	align-self: flex-end;
	background: var(--osae-chat-launcher, #0078e8);
	color: var(--osae-chat-launcher-text, #fff);
	border-bottom-right-radius: 4px;
}

.osae-chat-msg.is-shop {
	align-self: flex-start;
	background: #f3f4f6;
	color: #282828;
	border-bottom-left-radius: 4px;
}

.osae-chat-error {
	margin: 0 16px 8px;
	color: #9f1239;
	font-size: 13px;
}

.osae-chat-form {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	padding: 12px;
	border-top: 1px solid #eee;
}

.osae-chat-input {
	flex: 1;
	resize: none;
	min-height: 44px;
	max-height: 120px;
	border: 1px solid #e6e6e6;
	border-radius: 12px;
	background: #fff;
	color: #282828;
	padding: 10px 12px;
	font-size: 15px;
	line-height: 1.35;
}

.osae-chat-send {
	background: var(--osae-chat-accent, #0078e8);
	color: var(--osae-chat-accent-text, #ffffff);
	border: 0;
	border-radius: 999px;
	padding: 10px 16px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.osae-chat-send:disabled {
	opacity: 0.6;
	cursor: default;
}

.osae-chat-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.osae-chat-launcher {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: var(--osae-chat-launcher, #0078e8);
	color: var(--osae-chat-launcher-text, #fff);
	border: 0;
	border-radius: 999px;
	padding: 12px 18px 12px 14px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.osae-chat.is-open .osae-chat-launcher {
	width: 56px;
	height: 56px;
	padding: 0;
	border-radius: 50%;
}

.osae-chat.is-open .osae-chat-launcher-label,
.osae-chat.is-open .osae-chat-bubble,
.osae-chat.is-closed .osae-chat-x {
	display: none;
}

.osae-chat-launcher svg {
	display: block;
}

.osae-chat button:focus-visible,
.osae-chat textarea:focus-visible,
.osae-chat input:focus-visible {
	outline: 2px solid var(--osae-chat-accent, #0078e8);
	outline-offset: 2px;
}

body.cart-panel-open .osae-chat,
body.woocommerce-cart .osae-chat,
body.woocommerce-checkout .osae-chat {
	display: none !important;
}

@media (max-width: 480px) {
	.osae-chat {
		right: 12px;
		left: 12px;
		align-items: stretch;
	}

	.osae-chat-panel {
		width: 100%;
		height: min(640px, calc(100vh - 108px));
	}

	.osae-chat-launcher {
		align-self: flex-end;
	}
}

@media (prefers-reduced-motion: reduce) {
	.osae-chat-panel,
	.osae-chat-launcher {
		transition: none;
	}
}
