/* ═══════════════════════════════════════════════
   Pixel Beaver Chatbot – Widget Styles
   v1.0.0
   ═══════════════════════════════════════════════ */

/* The CSS custom properties are injected by JS from
   the wp_localize_script config. This file uses
   fallbacks that match the PHP defaults. */

/* ── Reset ── */
#pb-chatbot-wrapper,
#pb-chatbot-wrapper *,
#pb-chatbot-wrapper *::before,
#pb-chatbot-wrapper *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

#pb-chatbot-wrapper {
	--pb-primary: #0b8a6e;
	--pb-header-text: #ffffff;
	--pb-user-bubble: #0b8a6e;
	--pb-bot-bubble: #f0f0f0;
	--pb-bubble-size: 60px;
	--pb-window-w: 380px;
	--pb-window-h: 520px;
	--pb-font: inherit;
	--pb-radius: 16px;
	--pb-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);

	position: fixed;
	z-index: 999999;
	font-family: var(--pb-font);
	font-size: 14px;
	line-height: 1.5;
}

#pb-chatbot-wrapper.pb-pos-bottom-right {
	bottom: 24px;
	right: 24px;
}

#pb-chatbot-wrapper.pb-pos-bottom-left {
	bottom: 24px;
	left: 24px;
}

/* ── Floating Bubble ── */
.pb-chatbot-bubble {
	width: var(--pb-bubble-size);
	height: var(--pb-bubble-size);
	border-radius: 50%;
	background: var(--pb-primary);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: calc(var(--pb-bubble-size) * 0.45);
	box-shadow: var(--pb-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	position: relative;
}

.pb-chatbot-bubble:hover {
	transform: scale(1.08);
	box-shadow: 0 10px 36px rgba(0, 0, 0, 0.2);
}

.pb-chatbot-bubble:active {
	transform: scale(0.96);
}

.pb-chatbot-bubble .pb-close-icon {
	display: none;
	font-size: 22px;
	font-style: normal;
}

.pb-chatbot-bubble.pb-open .pb-avatar-icon {
	display: none;
}

.pb-chatbot-bubble.pb-open .pb-close-icon {
	display: block;
}

/* ── Notification dot ── */
.pb-chatbot-bubble .pb-notif {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 16px;
	height: 16px;
	background: #ef4444;
	border-radius: 50%;
	border: 2px solid #fff;
	display: none;
}

.pb-chatbot-bubble .pb-notif.pb-visible {
	display: block;
	animation: pb-pulse 1.5s ease-in-out infinite;
}

@keyframes pb-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.2); }
}

/* ── Chat Window ── */
.pb-chatbot-window {
	position: absolute;
	bottom: calc(var(--pb-bubble-size) + 16px);
	width: var(--pb-window-w);
	height: var(--pb-window-h);
	max-height: calc(100vh - 120px);
	max-width: calc(100vw - 32px);
	background: #fff;
	border-radius: var(--pb-radius);
	box-shadow: var(--pb-shadow);
	display: none;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.96);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.pb-pos-bottom-right .pb-chatbot-window {
	right: 0;
}

.pb-pos-bottom-left .pb-chatbot-window {
	left: 0;
}

.pb-chatbot-window.pb-visible {
	display: flex;
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* ── Header ── */
.pb-chatbot-header {
	background: var(--pb-primary);
	color: var(--pb-header-text);
	padding: 14px 18px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

.pb-chatbot-header-avatar {
	font-size: 22px;
	line-height: 1;
}

.pb-chatbot-header-name {
	font-weight: 600;
	font-size: 15px;
	flex: 1;
}

.pb-chatbot-header-close {
	background: none;
	border: none;
	color: var(--pb-header-text);
	font-size: 20px;
	cursor: pointer;
	opacity: 0.8;
	transition: opacity 0.15s;
	padding: 0 4px;
	line-height: 1;
}

.pb-chatbot-header-close:hover {
	opacity: 1;
}

/* ── Messages Area ── */
.pb-chatbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
}

.pb-chatbot-messages::-webkit-scrollbar {
	width: 5px;
}

.pb-chatbot-messages::-webkit-scrollbar-track {
	background: transparent;
}

.pb-chatbot-messages::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 10px;
}

/* ── Message Bubbles ── */
.pb-msg {
	max-width: 82%;
	padding: 10px 14px;
	border-radius: 14px;
	word-wrap: break-word;
	white-space: pre-wrap;
	animation: pb-fadeIn 0.2s ease;
}

@keyframes pb-fadeIn {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.pb-msg-bot {
	align-self: flex-start;
	background: var(--pb-bot-bubble);
	color: #333;
	border-bottom-left-radius: 4px;
}

.pb-msg-user {
	align-self: flex-end;
	background: var(--pb-user-bubble);
	color: #fff;
	border-bottom-right-radius: 4px;
}

/* ── Typing Indicator ── */
.pb-typing {
	align-self: flex-start;
	display: none;
	gap: 4px;
	padding: 12px 16px;
	background: var(--pb-bot-bubble);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}

.pb-typing.pb-visible {
	display: flex;
}

.pb-typing span {
	width: 7px;
	height: 7px;
	background: #999;
	border-radius: 50%;
	animation: pb-bounce 1.2s infinite ease-in-out;
}

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

@keyframes pb-bounce {
	0%, 60%, 100% { transform: translateY(0); }
	30% { transform: translateY(-6px); }
}

/* ── Input Area ── */
.pb-chatbot-input {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
	background: #fafafa;
}

.pb-chatbot-input textarea {
	flex: 1;
	border: 1px solid #ddd;
	border-radius: 10px;
	padding: 8px 12px;
	font-size: 14px;
	font-family: var(--pb-font);
	resize: none;
	outline: none;
	max-height: 80px;
	min-height: 36px;
	line-height: 1.4;
	transition: border-color 0.2s;
	background: #fff;
}

.pb-chatbot-input textarea:focus {
	border-color: var(--pb-primary);
}

.pb-chatbot-input button {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: none;
	background: var(--pb-primary);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.15s;
	flex-shrink: 0;
}

.pb-chatbot-input button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.pb-chatbot-input button:hover:not(:disabled) {
	opacity: 0.9;
}

.pb-chatbot-input button svg {
	width: 18px;
	height: 18px;
}

/* ── Powered By ── */
.pb-powered-by {
	text-align: center;
	padding: 6px;
	font-size: 11px;
	color: #aaa;
	background: #fafafa;
	border-top: 1px solid #f0f0f0;
	flex-shrink: 0;
}

.pb-powered-by a {
	color: #999;
	text-decoration: none;
}

.pb-powered-by a:hover {
	color: #666;
	text-decoration: underline;
}

/* ── Cookie Consent Overlay ── */
.pb-consent-overlay {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 32px 24px;
	text-align: center;
	gap: 16px;
	color: #555;
}

.pb-consent-overlay p {
	font-size: 13px;
	line-height: 1.6;
}

.pb-consent-overlay button {
	background: var(--pb-primary);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 10px 24px;
	font-size: 14px;
	cursor: pointer;
	transition: opacity 0.15s;
}

.pb-consent-overlay button:hover {
	opacity: 0.9;
}

/* ── Mobile ── */
@media (max-width: 480px) {
	.pb-chatbot-window {
		width: calc(100vw - 16px);
		height: calc(100vh - 100px);
		bottom: calc(var(--pb-bubble-size) + 12px);
		border-radius: 12px;
	}

	.pb-pos-bottom-right .pb-chatbot-window {
		right: -16px;
	}

	.pb-pos-bottom-left .pb-chatbot-window {
		left: -16px;
	}
}
