/* Corelex Chat Widget — public styles */
:root {
	--corelex-color:        #2563eb;
	--corelex-button-color: var(--corelex-color);
	--corelex-header-color: var(--corelex-color);
	--corelex-chat-height:  520px;
	--corelex-chat-width:   340px;
	--corelex-bottom:       24px;
	--corelex-side:         24px;
}

.corelex-widget {
	position: fixed;
	z-index: 9999;
	font-family: inherit;
}
.corelex-widget--bottom-right { bottom: var(--corelex-bottom); right: var(--corelex-side); }
.corelex-widget--bottom-left  { bottom: var(--corelex-bottom); left:  var(--corelex-side); }

/* Toggle button */
.corelex-widget__toggle {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--corelex-button-color);
	border: none;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0,0,0,.2);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .2s;
}
.corelex-widget__toggle:hover { transform: scale(1.08); }

/* Panel */
.corelex-widget__panel {
	position: absolute;
	bottom: 68px;
	right: 0;
	width: var(--corelex-chat-width);
	max-height: var(--corelex-chat-height);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0,0,0,.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.corelex-widget--bottom-left .corelex-widget__panel {
	right: auto;
	left: 0;
}

/* Header */
.corelex-widget__header {
	background: var(--corelex-header-color);
	color: #fff;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-weight: 600;
	font-size: 14px;
}
.corelex-widget__header-title {
	display: flex;
	align-items: center;
	gap: 8px;
}
.corelex-widget__header-logo {
	height: 22px;
	width: auto;
	display: block;
	border-radius: 3px;
}
.corelex-widget__header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
}
.corelex-widget__new-chat {
	background: none;
	border: none;
	color: rgba(255,255,255,.75);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4px;
	border-radius: 4px;
	transition: color .15s, background .15s;
}
.corelex-widget__new-chat:hover {
	color: #fff;
	background: rgba(255,255,255,.15);
}
.corelex-widget__close {
	background: none;
	border: none;
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	line-height: 1;
}

/* Messages */
.corelex-widget__messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.corelex-widget__message {
	max-width: 82%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.45;
	word-break: break-word;
}
.corelex-widget__message--user {
	align-self: flex-end;
	background: var(--corelex-color);
	color: #fff;
	border-bottom-right-radius: 3px;
}
.corelex-widget__message--assistant {
	align-self: flex-start;
	background: #f1f5f9;
	color: #1e293b;
	border-bottom-left-radius: 3px;
}
.corelex-widget__message--typing { color: #94a3b8; font-style: italic; }

/* Input form */
.corelex-widget__form {
	display: flex;
	border-top: 1px solid #e2e8f0;
	padding: 8px;
	gap: 6px;
}
.corelex-widget__input {
	flex: 1;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 14px;
	outline: none;
}
.corelex-widget__input:focus { border-color: var(--corelex-color); }
.corelex-widget__send {
	background: var(--corelex-color);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 8px 14px;
	font-size: 14px;
	cursor: pointer;
}
.corelex-widget__send:disabled { opacity: .6; cursor: default; }

/* ── Product cards ──────────────────────────────────────────────────────── */
.corelex-widget__products {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 4px 12px 8px;
	width: 100%;
}

.corelex-product-card {
	display: flex;
	gap: 10px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: box-shadow .15s, border-color .15s;
}
.corelex-product-card:hover {
	box-shadow: 0 2px 10px rgba(0,0,0,.1);
	border-color: var(--corelex-color);
}

.corelex-product-card__img-wrap {
	position: relative;
	flex-shrink: 0;
	width: 72px;
	height: 72px;
	background: #f8fafc;
}
.corelex-product-card__img-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.corelex-product-card__img-placeholder {
	width: 100%;
	height: 100%;
	background: #e2e8f0;
}

.corelex-product-card__badge {
	position: absolute;
	top: 4px;
	left: 4px;
	font-size: 10px;
	font-weight: 600;
	padding: 2px 5px;
	border-radius: 4px;
	line-height: 1.2;
}
.corelex-product-card__badge--backorder {
	background: #fef9c3;
	color: #854d0e;
}

.corelex-product-card__body {
	flex: 1;
	padding: 8px 10px 8px 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 3px;
	min-width: 0;
}

.corelex-product-card__name {
	margin: 0;
	font-size: 13px;
	font-weight: 600;
	color: #1e293b;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.corelex-product-card__pricing {
	margin: 0;
	font-size: 13px;
	display: flex;
	gap: 5px;
	align-items: baseline;
}
.corelex-product-card__price      { color: #1e293b; font-weight: 600; }
.corelex-product-card__sale-price  { color: #dc2626; font-weight: 700; }
.corelex-product-card__regular-price {
	color: #94a3b8;
	font-size: 11px;
	text-decoration: line-through;
}

/* Add-to-cart button — matches the Send button style */
.corelex-product-card__atc {
	flex-shrink: 0;
	align-self: center;
	margin-right: 10px;
	background: var(--corelex-color);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 8px 14px;
	font-size: 14px;
	cursor: pointer;
	transition: opacity .15s, background .15s;
}
.corelex-product-card__atc:hover:not(:disabled) { opacity: .85; }
.corelex-product-card__atc:disabled { opacity: .6; cursor: default; }
.corelex-product-card__atc--added   { background: #16a34a; }

/* Cart confirmation message */
.corelex-cart-confirmation {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.corelex-cart-actions {
	display: flex;
	gap: 6px;
}
.corelex-cart-btn {
	flex: 1;
	padding: 6px 10px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 500;
	text-align: center;
	text-decoration: none;
	border: 1px solid var(--corelex-color);
	color: var(--corelex-color);
	background: #fff;
	transition: background .15s, color .15s;
}
.corelex-cart-btn:hover { background: var(--corelex-color); color: #fff; }
.corelex-cart-btn--primary {
	background: var(--corelex-color);
	color: #fff;
}
.corelex-cart-btn--primary:hover { opacity: .85; }

/* Show more button */
.corelex-widget__show-more {
	width: 100%;
	margin-top: 4px;
	padding: 7px 12px;
	background: none;
	border: 1px solid var(--corelex-color);
	border-radius: 8px;
	color: var(--corelex-color);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.corelex-widget__show-more:hover {
	background: var(--corelex-color);
	color: #fff;
}

/* ── Backdrop (injected by JS on mobile) ─────────────────────────────────── */
.corelex-widget__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .4);
	z-index: 9998;
	animation: corelex-fade-in .2s ease;
}
@keyframes corelex-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* ── Mobile: bottom-sheet panel ─────────────────────────────────────────── */
@media (max-width: 480px) {
	/* Panel slides up from the bottom — leaves ~18 % of the page visible
	   so the user knows they are still on the webshop. */
	.corelex-widget__panel {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		top: auto;
		width: 100%;
		height: 82dvh;      /* dvh shrinks when the soft keyboard appears */
		max-height: 82dvh;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -4px 24px rgba(0, 0, 0, .18);
		animation: corelex-slide-up .28s cubic-bezier(.32, .72, 0, 1);
		z-index: 9999;
	}

	/* Drag-handle indicator at the top of the sheet */
	.corelex-widget__panel::before {
		content: '';
		display: block;
		align-self: center;
		flex-shrink: 0;
		width: 36px;
		height: 4px;
		background: rgba(0, 0, 0, .14);
		border-radius: 2px;
		margin: 10px auto 0;
	}

	@keyframes corelex-slide-up {
		from { transform: translateY(100%); }
		to   { transform: translateY(0); }
	}

	/* Keep the toggle in the corner */
	.corelex-widget--bottom-right,
	.corelex-widget--bottom-left {
		bottom: 16px;
	}
	.corelex-widget--bottom-right { right: 16px; }
	.corelex-widget--bottom-left  { left:  16px; }

	/* Give the product card image a touch more breathing room */
	.corelex-product-card__img-wrap {
		width: 64px;
		height: 64px;
	}

	/* Full-width add-to-cart button on narrow cards */
	.corelex-product-card__atc {
		margin-right: 8px;
		padding: 7px 10px;
		font-size: 13px;
	}
}
