/* Recipe chatbot widget */
.ws-chatbot {
	position: fixed;
	inset-inline-end: 18px;
	bottom: 18px;
	z-index: 99999;
	font-family: "iran-sans", "IRANSans", Tahoma, Arial, sans-serif;
}

.ws-chatbot[hidden] {
	display: block !important;
}

.ws-chatbot__fab {
	width: 58px;
	height: 58px;
	border: 0;
	border-radius: 50%;
	background: #d62828;
	color: #fff;
	box-shadow: 0 10px 28px rgba(214, 40, 40, 0.35);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, background 0.2s ease;
}

.ws-chatbot__fab:hover,
.ws-chatbot__fab:focus-visible {
	background: #b51f1f;
	transform: translateY(-2px);
	outline: none;
}

.ws-chatbot__fab-icon {
	display: flex;
	line-height: 0;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.ws-chatbot__fab--custom {
	padding: 0;
	overflow: hidden;
	background: #fff;
}

.ws-chatbot__fab-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 50%;
}

.ws-chatbot__panel {
	position: absolute;
	inset-inline-end: 0;
	bottom: 72px;
	width: min(380px, calc(100vw - 24px));
	height: min(560px, calc(100vh - 110px));
	background: #fff;
	border: 1px solid #e6e6e6;
	border-radius: 16px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
	display: none;
	flex-direction: column;
	overflow: hidden;
}

.ws-chatbot.is-open .ws-chatbot__panel {
	display: flex;
}

.ws-chatbot__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(135deg, #d62828, #b51f1f);
	color: #fff;
}

.ws-chatbot__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.ws-chatbot__sub {
	margin: 4px 0 0;
	font-size: 12px;
	opacity: 0.9;
	line-height: 1.4;
}

.ws-chatbot__close {
	border: 0;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.ws-chatbot__messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #f7f7f7;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ws-chatbot__bubble {
	max-width: 92%;
	padding: 10px 12px;
	border-radius: 12px;
	font-size: 13.5px;
	line-height: 1.7;
	white-space: pre-wrap;
	word-break: break-word;
}

.ws-chatbot__bubble--bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #eaeaea;
	color: #222;
	border-start-start-radius: 4px;
}

.ws-chatbot__bubble--user {
	align-self: flex-end;
	background: #d62828;
	color: #fff;
	border-start-end-radius: 4px;
}

.ws-chatbot__bubble--thinking {
	opacity: 0.85;
	font-style: italic;
	animation: ws-chatbot-pulse 1.2s ease-in-out infinite;
}

.ws-chatbot__inline-link {
	color: #9b1c1c;
	text-decoration: underline;
	word-break: break-all;
}

.ws-chatbot__bubble--bot .ws-chatbot__inline-link:hover {
	color: #d62828;
}

@keyframes ws-chatbot-pulse {
	0%,
	100% {
		opacity: 0.55;
	}
	50% {
		opacity: 1;
	}
}

.ws-chatbot__cards {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 2px;
}

.ws-chatbot__card {
	display: grid;
	grid-template-columns: 64px 1fr;
	gap: 10px;
	align-items: center;
	padding: 8px;
	background: #fff;
	border: 1px solid #eaeaea;
	border-radius: 12px;
	text-decoration: none !important;
	color: #222 !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ws-chatbot__card:hover {
	border-color: #d62828;
	box-shadow: 0 4px 14px rgba(214, 40, 40, 0.12);
}

.ws-chatbot__card-thumb {
	width: 64px;
	height: 64px;
	border-radius: 10px;
	object-fit: cover;
	background: #eee;
}

.ws-chatbot__card-thumb--empty {
	display: block;
}

.ws-chatbot__card-body {
	min-width: 0;
}

.ws-chatbot__card-title {
	display: block;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.4;
	margin-bottom: 4px;
}

.ws-chatbot__card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	font-size: 11.5px;
	color: #6b6b6b;
}

.ws-chatbot__quick {
	display: flex;
	flex-wrap: nowrap;
	gap: 6px;
	padding: 8px 12px;
	border-top: 1px solid #eee;
	background: #fff;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.ws-chatbot__chip {
	border: 1px solid #e6e6e6;
	background: #fafafa;
	color: #333;
	border-radius: 999px;
	padding: 6px 10px;
	font-size: 12px;
	cursor: pointer;
	line-height: 1.3;
	flex: 0 0 auto;
	white-space: nowrap;
}

.ws-chatbot__chip:hover {
	border-color: #d62828;
	color: #d62828;
	background: #ffe8e8;
}

.ws-chatbot__form {
	display: flex;
	align-items: stretch;
	gap: 8px;
	padding: 10px 12px 12px;
	border-top: 1px solid #eee;
	background: #fff;
}

.ws-chatbot__input {
	flex: 1 1 auto;
	width: 100%;
	resize: none;
	min-height: 44px;
	height: 44px;
	max-height: 96px;
	border: 1px solid #e0e0e0;
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
	font-size: 13.5px;
	line-height: 1.4;
	outline: none;
	background: #fff;
	color: #222;
	box-sizing: border-box;
}

.ws-chatbot__input:focus {
	border-color: #d62828;
	box-shadow: 0 0 0 3px rgba(214, 40, 40, 0.12);
}

.ws-chatbot__send {
	flex: 0 0 auto;
	align-self: stretch;
	min-height: 44px;
	border: 0;
	border-radius: 10px;
	background: #d62828;
	color: #fff;
	padding: 0 16px;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}

.ws-chatbot__send:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

@media (max-width: 480px) {
	.ws-chatbot {
		inset-inline-end: 12px;
		bottom: 12px;
	}

	.ws-chatbot__panel {
		width: calc(100vw - 16px);
		height: min(70vh, 560px);
		inset-inline-end: -4px;
	}
}

/* Keep above floating ingredients FAB on recipe pages */
.recipe-page .ws-chatbot {
	bottom: 78px;
}

@media (min-width: 992px) {
	.recipe-page .ws-chatbot {
		bottom: 18px;
	}
}
