/* ── CritterChatbot Frontend Styles ──────────────────────────────── */

:root {
	--ccb-primary: #2563eb;
	--ccb-primary-text: #ffffff;
	--ccb-bg: #ffffff;
	--ccb-text: #1f2937;
	--ccb-text-light: #6b7280;
	--ccb-border: #e5e7eb;
	--ccb-radius: 12px;
	--ccb-msg-bot-bg: #f3f4f6;
	--ccb-msg-user-bg: var(--ccb-primary);
	--ccb-msg-user-text: var(--ccb-primary-text);
	--ccb-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* ── Container ──────────────────────────────────────────────────── */

.ccb-chat {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--ccb-text);
	-webkit-font-smoothing: antialiased;
}

.ccb-chat button:not(.ccb-chat__bubble),
.ccb-chat .button {
	height: auto !important;
	line-height: 1.4 !important;
}

.ccb-chat input {
	height: auto !important;
	line-height: 1.5 !important;
	padding: 8px 12px !important;
}

.ccb-chat--right,
.ccb-chat--left {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
}

.ccb-chat--right {
	right: 20px;
}

.ccb-chat--left {
	left: 20px;
}

/* ── Bubble ─────────────────────────────────────────────────────── */

.ccb-chat__bubble {
	width: 56px !important;
	height: 56px !important;
	min-width: 56px;
	min-height: 56px;
	border-radius: 50%;
	border: none;
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	position: relative;
	animation: ccb-pulse 2s ease-in-out infinite;
}

.ccb-chat__bubble:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.ccb-chat--open .ccb-chat__bubble {
	display: none;
}

.ccb-chat__bubble-icon {
	width: 24px;
	height: 24px;
}

.ccb-chat__bubble-img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
}

.ccb-chat__bubble-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

/* ── CTA Bubble ────────────────────────────────────────────────── */

.ccb-chat__cta {
	position: absolute;
	bottom: 68px;
	right: 0;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	padding: 10px 32px 10px 14px;
	max-width: 260px;
	cursor: pointer;
	animation: ccb-cta-in 0.35s ease;
	white-space: normal;
}

.ccb-chat--left .ccb-chat__cta {
	right: auto;
	left: 0;
}

/* Speech tail */
.ccb-chat__cta::after {
	content: "";
	position: absolute;
	bottom: -8px;
	right: 22px;
	width: 0;
	height: 0;
	border-left: 8px solid transparent;
	border-right: 8px solid transparent;
	border-top: 8px solid #fff;
}

.ccb-chat--left .ccb-chat__cta::after {
	right: auto;
	left: 22px;
}

.ccb-chat__cta-text {
	font-size: 13px;
	line-height: 1.4;
	color: #1f2937;
}

.ccb-chat__cta-close {
	position: absolute;
	top: 4px;
	right: 6px;
	background: none;
	border: none;
	font-size: 16px;
	color: #9ca3af;
	cursor: pointer;
	padding: 0;
	line-height: 1;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
}

.ccb-chat__cta-close:hover {
	color: #6b7280;
	background: #f3f4f6;
}

.ccb-chat--open .ccb-chat__cta {
	display: none !important;
}

@keyframes ccb-cta-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ── Chat Window ────────────────────────────────────────────────── */

.ccb-chat__window {
	display: none;
	flex-direction: column;
	width: 380px;
	max-height: 520px;
	background: var(--ccb-bg);
	border-radius: var(--ccb-radius);
	box-shadow: var(--ccb-shadow);
	overflow: hidden;
	border: 1px solid var(--ccb-border);
}

.ccb-chat--open .ccb-chat__window {
	display: flex;
}

/* ── Header ─────────────────────────────────────────────────────── */

.ccb-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
	flex-shrink: 0;
}

.ccb-chat__header-title {
	font-weight: 600;
	font-size: 15px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ccb-chat__close {
	background: none;
	border: none;
	color: var(--ccb-primary-text);
	font-size: 22px;
	cursor: pointer;
	padding: 0 4px;
	line-height: 1;
	opacity: 0.8;
	transition: opacity 0.2s;
}

.ccb-chat__close:hover {
	opacity: 1;
}

/* ── Messages ───────────────────────────────────────────────────── */

.ccb-chat__messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-height: 200px;
	max-height: 360px;
}

/* Scrollbar styling */
.ccb-chat__messages::-webkit-scrollbar {
	width: 6px;
}

.ccb-chat__messages::-webkit-scrollbar-track {
	background: transparent;
}

.ccb-chat__messages::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 3px;
}

/* ── Message Bubbles ────────────────────────────────────────────── */

.ccb-chat__msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: var(--ccb-radius);
	word-wrap: break-word;
	animation: ccb-fade-in 0.3s ease;
}

.ccb-chat__msg--user {
	align-self: flex-end;
	background: var(--ccb-msg-user-bg);
	color: var(--ccb-msg-user-text);
	border-bottom-right-radius: 4px;
}

.ccb-chat__msg--bot {
	align-self: flex-start;
	background: var(--ccb-msg-bot-bg);
	color: var(--ccb-text);
	border-bottom-left-radius: 4px;
}

/* ── Typing Indicator ───────────────────────────────────────────── */

.ccb-chat__typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 12px 16px;
	background: var(--ccb-msg-bot-bg);
	border-radius: var(--ccb-radius);
	border-bottom-left-radius: 4px;
}

.ccb-chat__typing-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #9ca3af;
	animation: ccb-bounce 1.4s ease-in-out infinite;
}

.ccb-chat__typing-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.ccb-chat__typing-dot:nth-child(3) {
	animation-delay: 0.4s;
}

/* ── Input Row ──────────────────────────────────────────────────── */

.ccb-chat__input-row {
	display: flex;
	align-items: center;
	border-top: 1px solid var(--ccb-border);
	padding: 8px;
	gap: 8px;
	flex-shrink: 0;
	background: var(--ccb-bg);
}

.ccb-chat__input {
	flex: 1;
	border: 1px solid var(--ccb-border);
	border-radius: 8px;
	padding: 8px 12px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
	font-family: inherit;
	color: var(--ccb-text);
	background: var(--ccb-bg);
}

.ccb-chat__input:focus {
	border-color: var(--ccb-primary);
}

.ccb-chat__input::placeholder {
	color: var(--ccb-text-light);
}

.ccb-chat__send {
	padding: 8px 16px;
	border-radius: 8px;
	border: none;
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
	cursor: pointer;
	flex-shrink: 0;
	font-size: 13px;
	font-weight: 600;
	font-family: inherit;
	transition: opacity 0.2s;
}

.ccb-chat__send:hover {
	opacity: 0.9;
}

.ccb-chat__send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Product Cards ──────────────────────────────────────────────── */

.ccb-products {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
}

.ccb-product {
	border: 1px solid var(--ccb-border);
	border-radius: 8px;
	overflow: hidden;
	background: var(--ccb-bg);
	display: flex;
	gap: 10px;
	animation: ccb-fade-in 0.3s ease;
}

.ccb-product__image {
	width: 80px;
	height: 80px;
	object-fit: cover;
	flex-shrink: 0;
	background: #f9fafb;
}

.ccb-product__info {
	flex: 1;
	padding: 8px 8px 8px 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.ccb-product__name {
	font-weight: 600;
	font-size: 13px;
	color: var(--ccb-text);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ccb-product__name:hover {
	color: var(--ccb-primary);
}

.ccb-product__price {
	font-size: 13px;
	font-weight: 600;
	color: var(--ccb-text);
}

.ccb-product__price del {
	color: var(--ccb-text-light);
	font-weight: 400;
}

.ccb-product__price ins {
	text-decoration: none;
	color: #dc2626;
}

.ccb-product__meta {
	display: flex;
	gap: 6px;
	align-items: center;
	flex-wrap: wrap;
}

.ccb-product__badge {
	font-size: 11px;
	padding: 1px 6px;
	border-radius: 4px;
	font-weight: 500;
}

.ccb-product__badge--in-stock {
	background: #dcfce7;
	color: #166534;
}

.ccb-product__badge--out-of-stock {
	background: #fef2f2;
	color: #991b1b;
}

.ccb-product__badge--on-sale {
	background: #fef3c7;
	color: #92400e;
}

.ccb-product__actions {
	display: flex;
	gap: 6px;
	margin-top: 4px;
}

.ccb-product__add-btn,
.ccb-product__view-btn {
	font-size: 12px;
	padding: 4px 10px;
	border-radius: 6px;
	border: none;
	cursor: pointer;
	font-weight: 500;
	transition: opacity 0.2s;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1.4 !important;
	height: auto !important;
	text-align: center;
}

.ccb-product__add-btn {
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
}

.ccb-product__add-btn:hover {
	opacity: 0.9;
}

.ccb-product__add-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.ccb-product__add-btn--added {
	background: #16a34a;
}

.ccb-product__view-btn {
	background: transparent;
	color: var(--ccb-primary);
	border: 1px solid var(--ccb-primary);
}

.ccb-product__view-btn:hover {
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
}

/* ── Lead Form ──────────────────────────────────────────────────── */

.ccb-lead {
	background: var(--ccb-bg);
	border: 1px solid var(--ccb-border);
	border-radius: 8px;
	padding: 14px;
	width: 100%;
	animation: ccb-fade-in 0.3s ease;
}

.ccb-lead__title {
	font-weight: 600;
	font-size: 14px;
	margin: 0 0 10px;
}

.ccb-lead__field {
	margin-bottom: 10px;
}

.ccb-lead__label {
	display: block;
	font-size: 12px;
	font-weight: 500;
	color: var(--ccb-text-light);
	margin-bottom: 3px;
}

.ccb-lead__input,
.ccb-lead__textarea {
	width: 100%;
	border: 1px solid var(--ccb-border);
	border-radius: 6px;
	padding: 7px 10px;
	font-size: 13px;
	font-family: inherit;
	color: var(--ccb-text);
	outline: none;
	transition: border-color 0.2s;
	box-sizing: border-box;
}

.ccb-lead__input:focus,
.ccb-lead__textarea:focus {
	border-color: var(--ccb-primary);
}

.ccb-lead__textarea {
	resize: vertical;
	min-height: 60px;
}

.ccb-lead__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: 10px;
	font-size: 12px;
	color: var(--ccb-text-light);
}

.ccb-lead__consent input[type="checkbox"] {
	margin-top: 2px;
	flex-shrink: 0;
}

.ccb-lead__submit {
	width: 100%;
	padding: 8px 16px;
	border: none;
	border-radius: 6px;
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	transition: opacity 0.2s;
}

.ccb-lead__submit:hover {
	opacity: 0.9;
}

.ccb-lead__submit:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.ccb-lead__error {
	color: #dc2626;
	font-size: 12px;
	margin-top: 4px;
}

.ccb-lead__success {
	text-align: center;
	padding: 16px;
	color: #16a34a;
	font-weight: 500;
}

/* ── Notice (subtle inline confirmation) ────────────────────────── */

.ccb-chat__notice {
	text-align: center;
	font-size: 12px;
	color: #16a34a;
	font-weight: 500;
	padding: 8px 12px;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 8px;
	animation: ccb-fade-in 0.3s ease;
}

/* ── Suggested Questions ────────────────────────────────────────── */

.ccb-questions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	animation: ccb-fade-in 0.3s ease;
}

.ccb-questions__btn {
	font-size: 12px;
	padding: 6px 12px;
	border-radius: 16px;
	border: 1px solid var(--ccb-primary);
	background: transparent;
	color: var(--ccb-primary);
	cursor: pointer;
	font-family: inherit;
	transition: background 0.2s, color 0.2s;
}

.ccb-questions__btn:hover {
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
}

/* ── Lead Capture CTA ───────────────────────────────────────────── */

.ccb-lead-capture-cta {
	display: flex;
	justify-content: center;
	margin-top: 8px;
	animation: ccb-fade-in 0.3s ease;
}

.ccb-lead-capture-cta__btn {
	padding: 8px 16px;
	border-radius: 18px;
	border: 1px solid var(--ccb-primary);
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	transition: opacity 0.2s;
}

.ccb-lead-capture-cta__btn:hover {
	opacity: 0.85;
}

/* ── Checkout CTA ───────────────────────────────────────────────── */

.ccb-checkout-cta {
	display: flex;
	gap: 8px;
	width: 100%;
	animation: ccb-fade-in 0.3s ease;
}

.ccb-checkout-cta__btn {
	flex: 1;
	padding: 8px 12px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	display: block;
	transition: opacity 0.2s;
}

.ccb-checkout-cta__btn--checkout {
	background: var(--ccb-primary);
	color: var(--ccb-primary-text);
}

.ccb-checkout-cta__btn--cart {
	background: transparent;
	color: var(--ccb-primary);
	border: 1px solid var(--ccb-primary);
}

.ccb-checkout-cta__btn:hover {
	opacity: 0.9;
}

/* ── Inline Mode (shortcode) ────────────────────────────────────── */

.ccb-chat--inline {
	position: relative;
	bottom: auto;
	left: auto;
	right: auto;
}

.ccb-chat--inline .ccb-chat__window {
	display: flex;
	width: 100%;
	max-width: 500px;
	max-height: 600px;
	box-shadow: none;
	border: 1px solid var(--ccb-border);
}

.ccb-chat--inline .ccb-chat__bubble {
	display: none;
}

.ccb-chat--inline .ccb-chat__messages {
	max-height: 450px;
}

/* ── Animations ─────────────────────────────────────────────────── */

@keyframes ccb-pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
}

@keyframes ccb-fade-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes ccb-bounce {
	0%, 80%, 100% {
		transform: scale(0);
	}
	40% {
		transform: scale(1);
	}
}

/* ── Responsive: Mobile ─────────────────────────────────────────── */

@media (max-width: 767px) {
	.ccb-chat--right,
	.ccb-chat--left {
		bottom: 12px;
	}

	.ccb-chat--right {
		right: 12px;
	}

	.ccb-chat--left {
		left: 12px;
	}

	.ccb-chat--mobile-open {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 9999999;
		background: var(--ccb-bg);
	}

	.ccb-chat--mobile-open .ccb-chat__window {
		width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
		border: none;
		box-shadow: none;
	}

	.ccb-chat--mobile-open .ccb-chat__messages {
		max-height: none;
		flex: 1;
	}

	.ccb-chat--mobile-open .ccb-chat__bubble {
		display: none;
	}
}
