/**
 * Casa Noce floating customer-service widget.
 * Walnut bubble, Oat panel, Honey Brass accents.
 */

.cn-chat {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 300;
	font-family: var(--wp--preset--font-family--body);
}

/* --------------------------------------------------------------- toggle */

.cn-chat__toggle {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	margin-left: auto;
	border: none;
	border-radius: 50%;
	background: var(--wp--preset--color--walnut);
	color: var(--wp--preset--color--oat);
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(41, 36, 32, 0.28);
	transition: background var(--cn-ease), transform var(--cn-ease);
}

.cn-chat__toggle:hover {
	background: var(--wp--preset--color--walnut-light);
	transform: translateY(-2px);
}

.cn-chat__toggle svg {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.cn-chat__icon-close {
	display: none;
}

.cn-chat[data-open="true"] .cn-chat__icon-open {
	display: none;
}

.cn-chat[data-open="true"] .cn-chat__icon-close {
	display: block;
}

/* ---------------------------------------------------------------- panel */

.cn-chat__panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: var(--wp--preset--color--oat);
	border: 1px solid var(--wp--preset--color--greige);
	box-shadow: 0 24px 60px rgba(41, 36, 32, 0.24);
	overflow: hidden;
	transform-origin: bottom right;
	animation: cn-chat-in 0.22s ease both;
}

.cn-chat__panel[hidden] {
	display: none;
}

@keyframes cn-chat-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cn-chat__panel {
		animation: none;
	}
}

/* --------------------------------------------------------------- header */

.cn-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	background: var(--wp--preset--color--walnut);
	color: var(--wp--preset--color--oat);
}

.cn-chat__title {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.cn-chat__wordmark {
	font-family: var(--wp--preset--font-family--display);
	font-size: 18px;
	letter-spacing: 0.02em;
}

.cn-chat__status {
	font-size: 11.5px;
	letter-spacing: 0.04em;
	color: var(--wp--preset--color--linen);
}

.cn-chat__min {
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--wp--preset--color--oat);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

/* ------------------------------------------------------------------ log */

.cn-chat__log {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
	overflow-y: auto;
}

.cn-chat__msg {
	max-width: 84%;
	padding: 12px 14px;
	font-size: 14px;
	line-height: 1.5;
}

.cn-chat__msg p {
	margin: 0;
}

.cn-chat__msg p + p {
	margin-top: 8px;
}

.cn-chat__msg a {
	border-bottom: 1px solid currentColor;
}

.cn-chat__msg--bot {
	align-self: flex-start;
	background: var(--wp--preset--color--oat-deep);
	color: var(--wp--preset--color--warm-ink);
	border-top-left-radius: 2px;
}

.cn-chat__msg--user {
	align-self: flex-end;
	background: var(--wp--preset--color--honey-brass);
	color: var(--wp--preset--color--ivory);
	border-top-right-radius: 2px;
}

.cn-chat__msg--typing {
	color: var(--wp--preset--color--ink-muted);
	font-style: italic;
}

/* ---------------------------------------------------------------- chips */

.cn-chat__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 20px 12px;
}

.cn-chat__chip {
	padding: 7px 12px;
	border: 1px solid var(--wp--preset--color--greige);
	background: transparent;
	color: var(--wp--preset--color--warm-ink);
	font-family: var(--wp--preset--font-family--body);
	font-size: 12.5px;
	cursor: pointer;
	transition: background var(--cn-ease), border-color var(--cn-ease);
}

.cn-chat__chip:hover {
	border-color: var(--wp--preset--color--honey-brass);
	background: var(--wp--preset--color--oat-deep);
}

/* ----------------------------------------------------------------- form */

.cn-chat__form {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid var(--wp--preset--color--greige);
	background: var(--wp--preset--color--oat);
}

.cn-chat__input {
	flex: 1;
	height: 44px;
	min-width: 0;
	padding: 0 14px;
	border: 1px solid var(--wp--preset--color--greige);
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--warm-ink);
	font-family: var(--wp--preset--font-family--body);
	font-size: 14px;
}

.cn-chat__input:focus {
	outline: var(--cn-focus);
	outline-offset: 1px;
	border-color: var(--wp--preset--color--warm-ink);
}

.cn-chat__send {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex: 0 0 44px;
	border: none;
	background: var(--wp--preset--color--honey-brass);
	color: var(--wp--preset--color--ivory);
	cursor: pointer;
	transition: background var(--cn-ease);
}

.cn-chat__send:hover {
	background: var(--wp--preset--color--brass-deep);
}

.cn-chat__send svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.cn-chat__foot {
	padding: 10px 20px 14px;
	background: var(--wp--preset--color--oat);
	color: var(--wp--preset--color--ink-muted);
	font-size: 12px;
	text-align: center;
}

.cn-chat__foot a {
	color: var(--wp--preset--color--honey-brass);
	border-bottom: 1px solid currentColor;
}

@media (max-width: 480px) {
	.cn-chat {
		right: 16px;
		bottom: 16px;
	}

	.cn-chat__panel {
		width: calc(100vw - 32px);
		height: calc(100vh - 110px);
	}
}
