/* Store Chatbot widget — floating launcher + WhatsApp-style panel. */

:root {
	/* Veduka brand purple — same values the kava-child theme uses. */
	--sc-brand: #9367a2;
	--sc-brand-dark: #7d5590;
	--sc-bubble-user: #f0e6f7;
	--sc-bubble-bot: #ffffff;
	--sc-bg: #f9f4fb;
	--sc-text: #111b21;
	--sc-radius: 14px;
	--sc-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
	--sc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------------------------------------------------------------- */
/* Shared chat UI                                                    */
/* ---------------------------------------------------------------- */

.sc-chat {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--sc-bg);
	font-family: var(--sc-font);
	color: var(--sc-text);
}

.sc-chat__header {
	background: var(--sc-brand-dark);
	color: #fff;
	padding: 14px 18px;
	position: relative;
	flex-shrink: 0;
}

.sc-chat__title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
}

.sc-chat__subtitle {
	font-size: 13px;
	opacity: 0.85;
	margin-top: 2px;
}

.sc-chat__close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: 0;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
}

.sc-chat__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.sc-chat__messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	scroll-behavior: smooth;
}

.sc-bubble {
	max-width: 82%;
	padding: 9px 13px;
	border-radius: var(--sc-radius);
	font-size: 14.5px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.sc-bubble--bot {
	background: var(--sc-bubble-bot);
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

.sc-bubble--user {
	background: var(--sc-bubble-user);
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

/* Typing indicator */
.sc-chat__typing {
	display: flex;
	gap: 5px;
	padding: 6px 18px 10px;
	flex-shrink: 0;
}

.sc-chat__typing span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #8a9aa2;
	animation: sc-bounce 1.2s infinite ease-in-out;
}

.sc-chat__typing span:nth-child(2) { animation-delay: 0.15s; }
.sc-chat__typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes sc-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-5px); opacity: 1; }
}

/* Input row */
.sc-chat__form {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	background: #f0f2f5;
	flex-shrink: 0;
}

.sc-chat__input {
	flex: 1;
	border: 1px solid #d1d7db;
	border-radius: 22px;
	padding: 10px 16px;
	font-size: 15px;
	font-family: var(--sc-font);
	background: #fff;
	color: var(--sc-text);
	min-width: 0;
}

.sc-chat__input:focus {
	outline: 2px solid var(--sc-brand);
	border-color: transparent;
}

.sc-chat__send {
	background: var(--sc-brand);
	color: #fff;
	border: 0;
	border-radius: 22px;
	padding: 0 18px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	font-family: var(--sc-font);
}

.sc-chat__send:hover { background: var(--sc-brand-dark); }
.sc-chat__send:disabled { opacity: 0.55; cursor: default; }
.sc-chat__send:focus-visible { outline: 2px solid var(--sc-brand-dark); outline-offset: 2px; }

.sc-chat__footer {
	font-size: 11px;
	color: #667781;
	text-align: center;
	padding: 6px 12px 9px;
	background: #f0f2f5;
	flex-shrink: 0;
}

/* Product cards */
.sc-cards {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: flex-start;
	max-width: 88%;
}

.sc-card {
	background: #fff;
	border-radius: var(--sc-radius);
	padding: 12px 14px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sc-card__name {
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 2px;
}

.sc-card__price {
	font-size: 13.5px;
	color: #667781;
	margin-bottom: 8px;
}

.sc-card__link {
	display: inline-block;
	background: var(--sc-brand);
	color: #fff !important;
	text-decoration: none !important;
	font-size: 13px;
	font-weight: 600;
	padding: 7px 14px;
	border-radius: 18px;
}

.sc-card__link:hover { background: var(--sc-brand-dark); color: #fff; }
.sc-card__link:focus-visible { outline: 2px solid var(--sc-brand-dark); outline-offset: 2px; }

/* ---------------------------------------------------------------- */
/* Floating mode                                                     */
/* ---------------------------------------------------------------- */

.sc-launcher {
	position: fixed;
	bottom: 22px;
	right: 90px; /* overridden inline; clears the WhatsApp widget */
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--sc-brand);
	color: #fff;
	border: 0;
	cursor: pointer;
	box-shadow: var(--sc-shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99998;
	transition: transform 0.15s ease;
}

.sc-launcher:hover { transform: scale(1.07); background: var(--sc-brand-dark); }
.sc-launcher:focus-visible { outline: 3px solid var(--sc-brand-dark); outline-offset: 2px; }
.sc-launcher--hidden { display: none; }

.sc-panel {
	position: fixed;
	bottom: 22px;
	right: 22px;
	width: 360px;
	max-width: calc(100vw - 44px);
	height: 540px;
	max-height: calc(100vh - 44px);
	max-height: calc(100dvh - 44px);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: var(--sc-shadow);
	z-index: 99999;
	background: var(--sc-bg);
}

.sc-panel[hidden] { display: none; }

/* Mobile: compact bottom sheet instead of a confusing full-screen takeover —
   the close button stays visible at the top of the panel. */
@media (max-width: 480px) {
	.sc-panel {
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
		max-width: none;
		height: 70vh;
		height: 70dvh;
		max-height: 520px;
		border-radius: 16px;
	}
}
