/* Castech Pest Services AI Chatbot — widget styles */
:root {
	--castech-accent: #B02A2A;        /* eco green */
	--castech-accent-dark: #8C1F1F;   /* deep forest green */
	--castech-bg: #ffffff;
	--castech-user-bubble: #B02A2A;   /* user bubbles in brand green */
	--castech-bot-bubble: #f1f5f9;
	--castech-text: #1f2933;
	--castech-muted: #6b7280;
	--castech-shadow: 0 12px 38px rgba(140, 31, 31, 0.28);
}

#castech-bot-root, #castech-bot-root * {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Launcher button */
#castech-bot-launcher {
	position: fixed;
	bottom: 22px;
	right: 22px;
	width: 62px;
	height: 62px;
	border-radius: 50%;
	background: #B02A2A;
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: var(--castech-shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999998;
	overflow: visible;
	transition: transform .18s ease, background .18s ease;
}
#castech-bot-launcher:hover { transform: scale(1.06); background: #8C1F1F; }
#castech-bot-launcher svg {
	width: 32px !important; height: 32px !important; position: relative; z-index: 2;
	display: block !important; color: #fff; stroke: #fff; overflow: visible;
}
#castech-bot-launcher .castech-pulse {
	position: absolute; inset: 0; border-radius: 50%; z-index: 1; pointer-events: none;
	box-shadow: 0 0 0 0 rgba(176,42,42,.55);
	animation: castech-pulse 2.2s infinite;
}
@keyframes castech-pulse {
	0% { box-shadow: 0 0 0 0 rgba(176,42,42,.5); }
	70% { box-shadow: 0 0 0 16px rgba(176,42,42,0); }
	100% { box-shadow: 0 0 0 0 rgba(176,42,42,0); }
}

/* Panel */
#castech-bot-panel {
	position: fixed;
	bottom: 96px;
	right: 22px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 130px);
	background: var(--castech-bg);
	border-radius: 16px;
	box-shadow: var(--castech-shadow);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 999999;
	opacity: 0;
	transform: translateY(14px);
	transition: opacity .2s ease, transform .2s ease;
}
#castech-bot-panel.castech-open { display: flex; opacity: 1; transform: translateY(0); }

/* Header */
#castech-bot-header {
	background: linear-gradient(135deg, #B02A2A 0%, #9A2323 55%, #8C1F1F 100%);
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
}
#castech-bot-header .castech-avatar {
	width: 40px; height: 40px; border-radius: 50%;
	background: rgba(255,255,255,.18);
	display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
#castech-bot-header .castech-avatar svg { width: 22px; height: 22px; }
#castech-bot-header .castech-titles { line-height: 1.25; flex: 1; min-width: 0; }
#castech-bot-header .castech-title { font-weight: 700; font-size: 15px; }
#castech-bot-header .castech-subtitle { font-size: 12px; opacity: .85; }
#castech-bot-header .castech-status { font-size: 11px; opacity: .9; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
#castech-bot-header .castech-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
#castech-bot-close { background: none; border: none; color: #fff; cursor: pointer; font-size: 22px; line-height: 1; opacity: .85; padding: 4px; }
#castech-bot-close:hover { opacity: 1; }

/* Messages */
#castech-bot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #fafbfc;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.castech-msg { max-width: 84%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.castech-msg.bot { align-self: flex-start; background: var(--castech-bot-bubble); color: var(--castech-text); border-bottom-left-radius: 4px; }
.castech-msg.user { align-self: flex-end; background: var(--castech-user-bubble); color: #fff; border-bottom-right-radius: 4px; }
.castech-msg a { color: inherit; text-decoration: underline; }
.castech-msg.user a { color: #fff; }

/* Quick replies */
#castech-bot-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 6px; background: #fafbfc; }
.castech-quick-btn {
	background: #fff; border: 1px solid #d4dde6; color: #B02A2A;
	border-radius: 18px; padding: 7px 12px; font-size: 12.5px; cursor: pointer; transition: all .15s ease;
}
.castech-quick-btn:hover { background: #B02A2A; color: #fff; border-color: #B02A2A; }

/* Typing indicator */
.castech-typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.castech-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa6b2; animation: castech-bounce 1.3s infinite; }
.castech-typing span:nth-child(2) { animation-delay: .2s; }
.castech-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes castech-bounce { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Input */
#castech-bot-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e6ebf0; background: #fff; }
#castech-bot-input {
	flex: 1; resize: none; border: 1px solid #d4dde6; border-radius: 10px;
	padding: 10px 12px; font-size: 14px; max-height: 90px; line-height: 1.4; outline: none; color: var(--castech-text);
}
#castech-bot-input:focus { border-color: #B02A2A; }
#castech-bot-send {
	background: #B02A2A; border: none; color: #fff; border-radius: 10px;
	width: 44px; flex: 0 0 auto; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s ease;
}
#castech-bot-send:hover { background: #8C1F1F; }
#castech-bot-send:disabled { opacity: .5; cursor: default; }
#castech-bot-send svg { width: 20px !important; height: 20px !important; display: block !important; stroke: #fff; }
#castech-bot-send svg path { stroke: #fff; }

#castech-bot-footer { text-align: center; font-size: 10.5px; color: var(--castech-muted); padding: 0 0 8px; background: #fff; }

/* ---- Mobile: full-screen sheet ---------------------------------------- */
@media (max-width: 600px) {
	#castech-bot-launcher {
		bottom: 16px; right: 16px;
		width: 56px; height: 56px;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
		right: calc(16px + env(safe-area-inset-right, 0px));
	}
	#castech-bot-launcher svg { width: 28px !important; height: 28px !important; }

	#castech-bot-panel {
		top: 0; left: 0; right: 0; bottom: 0;
		width: 100%;
		height: 100%;
		height: 100vh;
		height: 100dvh;
		max-width: 100%;
		max-height: none;
		border-radius: 0;
		transform: translateY(100%);
	}
	#castech-bot-panel.castech-open { transform: translateY(0); }

	#castech-bot-header {
		padding: 14px 16px;
		padding-top: calc(14px + env(safe-area-inset-top, 0px));
	}
	#castech-bot-close { font-size: 28px; padding: 8px; }

	#castech-bot-messages { padding: 14px; }
	.castech-msg { max-width: 88%; font-size: 15px; }

	#castech-bot-input-row {
		padding: 10px 12px;
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	}
	#castech-bot-input { font-size: 16px; }
	#castech-bot-send { width: 48px; }

	#castech-bot-quick { padding: 0 14px 8px; }
	.castech-quick-btn { font-size: 13px; padding: 8px 13px; }
}

@media (max-width: 360px) {
	#castech-bot-launcher { width: 52px; height: 52px; }
}
