/* AI Receptionist chat widget — professional, mobile-perfect. */

#airec-root {
	--airec-color: #2563eb;
	--airec-color-dark: #1d4ed8;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	z-index: 99999;
}

/* ---------- Floating bubble ---------- */

#airec-bubble {
	position: fixed;
	right: 24px;
	bottom: 24px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--airec-color);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	border: none;
	padding: 0;
	transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.2s ease;
	animation: airec-pulse 3s infinite;
}

#airec-root.airec-pos-bottom-left #airec-bubble {
	right: auto;
	left: 24px;
}

@keyframes airec-pulse {
	0%, 100% { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
	50% { box-shadow: 0 6px 28px rgba(0, 0, 0, 0.25), 0 0 0 8px color-mix(in srgb, var(--airec-color) 12%, transparent); }
}

#airec-bubble:hover {
	transform: scale(1.08);
}

#airec-bubble:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

#airec-bubble.airec-hidden {
	opacity: 0;
	transform: scale(0.6);
	pointer-events: none;
	animation: none;
}

/* ---------- Teaser bubble ---------- */

#airec-teaser {
	position: fixed;
	right: 96px;
	bottom: 38px;
	max-width: 240px;
	background: #fff;
	color: #1f2937;
	font-size: 13.5px;
	line-height: 1.45;
	padding: 10px 14px;
	border-radius: 14px;
	border-bottom-right-radius: 4px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	animation: airec-teaser-in 0.35s ease;
}

#airec-root.airec-pos-bottom-left #airec-teaser {
	right: auto;
	left: 96px;
	border-bottom-right-radius: 14px;
	border-bottom-left-radius: 4px;
}

@keyframes airec-teaser-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

#airec-teaser-close {
	background: none;
	border: none;
	color: #9ca3af;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 0 0 0 4px;
	flex-shrink: 0;
}

#airec-teaser-close:hover {
	color: #4b5563;
}

/* ---------- Chat window ---------- */

#airec-window {
	position: fixed;
	right: 24px;
	bottom: 24px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 48px);
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px) scale(0.96);
	transform-origin: bottom right;
	pointer-events: none;
	transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

#airec-root.airec-pos-bottom-left #airec-window {
	right: auto;
	left: 24px;
	transform-origin: bottom left;
}

#airec-window.airec-open {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

#airec-header {
	background: linear-gradient(135deg, var(--airec-color), var(--airec-color-dark, #1d4ed8));
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

#airec-title-wrap {
	display: flex;
	align-items: center;
	gap: 11px;
	min-width: 0;
}

#airec-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.22);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 18px;
	flex-shrink: 0;
}

#airec-title {
	font-weight: 600;
	font-size: 15.5px;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#airec-subtitle {
	font-size: 12px;
	opacity: 0.85;
	display: flex;
	align-items: center;
	gap: 5px;
}

#airec-subtitle::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
}

#airec-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
	transition: background 0.15s ease;
}

#airec-close:hover {
	background: rgba(255, 255, 255, 0.2);
}

/* v3.1.0: New Chat button in the header. */
#airec-new-chat {
	background: rgba(255, 255, 255, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	padding: 6px 10px;
	border-radius: 999px;
	margin-right: 6px;
	transition: background 0.15s ease;
	white-space: nowrap;
}
#airec-new-chat:hover {
	background: rgba(255, 255, 255, 0.3);
}
#airec-new-chat:disabled {
	opacity: 0.5;
	cursor: default;
}

/* ---------- Messages ---------- */

#airec-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f6f7f9;
}

.airec-msg {
	max-width: 82%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.55;
	word-wrap: break-word;
	white-space: pre-wrap;
	animation: airec-msg-in 0.22s ease;
}

@keyframes airec-msg-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

.airec-msg-bot {
	background: #fff;
	color: #1f2937;
	border-bottom-left-radius: 5px;
	align-self: flex-start;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

/* v3.0.0: staff (human takeover) messages. */
.airec-msg-staff {
	background: #fff8e1;
	color: #1f2937;
	border: 1px solid #f0d970;
	border-bottom-left-radius: 5px;
	align-self: flex-start;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.airec-msg-label {
	font-size: 11px;
	font-weight: 700;
	color: #8a6d00;
	margin-bottom: 4px;
}

.airec-typing {
	display: flex;
	gap: 5px;
	align-items: center;
	padding: 15px 17px;
}

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

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

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

/* ---------- Footer ---------- */

#airec-footer {
	text-align: center;
	font-size: 11px;
	color: #9ca3af;
	padding: 7px 0;
	background: #fff;
	border-top: 1px solid #f0f1f4;
	flex-shrink: 0;
	letter-spacing: 0.02em;
}

/* ---------- Input ---------- */

#airec-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	background: #fff;
	flex-shrink: 0;
}

#airec-input {
	flex: 1;
	border: 1px solid #d1d5db;
	border-radius: 24px;
	padding: 10px 16px;
	font-size: 14px;
	outline: none;
	min-width: 0;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#airec-input:focus {
	border-color: var(--airec-color);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--airec-color) 15%, transparent);
}

#airec-input:disabled {
	background: #f3f4f6;
}

#airec-send {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: none;
	background: var(--airec-color);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform 0.15s ease, background 0.15s ease;
}

#airec-send:hover {
	transform: scale(1.07);
	background: var(--airec-color-dark, #1d4ed8);
}

/* ---------- Remember-me consent (v2.0.0) ---------- */

#airec-remember-row {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px;
	background: #fff;
	border-top: 1px solid #f0f1f4;
	font-size: 12px;
	color: #6b7280;
	cursor: pointer;
	flex-shrink: 0;
}

#airec-remember-row input {
	margin: 0;
	accent-color: var(--airec-color);
}

/* ---------- Feedback buttons (v2.0.0) ---------- */

.airec-feedback {
	display: flex;
	gap: 6px;
	margin-top: 7px;
}

.airec-fb-btn {
	background: rgba(0, 0, 0, 0.04);
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 14px;
	font-size: 13px;
	line-height: 1;
	padding: 4px 9px;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.15s ease;
}

.airec-fb-btn:hover:not(:disabled) {
	background: rgba(0, 0, 0, 0.09);
	transform: scale(1.08);
}

.airec-fb-btn:disabled {
	opacity: 0.45;
	cursor: default;
}

.airec-feedback.airec-fb-sent .airec-fb-btn {
	pointer-events: none;
}

/* ---------- Booking (v2.0.0) ---------- */

#airec-bookbar {
	padding: 8px 12px 0;
	background: #fff;
	flex-shrink: 0;
}

#airec-book-btn {
	width: 100%;
	border: 1px dashed var(--airec-color);
	background: color-mix(in srgb, var(--airec-color) 7%, #fff);
	color: var(--airec-color);
	border-radius: 12px;
	padding: 9px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

#airec-book-btn:hover {
	background: color-mix(in srgb, var(--airec-color) 13%, #fff);
}

#airec-booking {
	position: absolute;
	inset: 0;
	background: #fff;
	z-index: 5;
	display: flex;
	flex-direction: column;
	border-radius: 18px;
	overflow: hidden;
}

.airec-bk-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 13px 16px;
	background: var(--airec-color);
	color: #fff;
	font-size: 15px;
	flex-shrink: 0;
}

.airec-bk-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 6px;
}

.airec-bk-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 11px;
}

.airec-bk-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
	font-size: 13px;
	color: #374151;
}

.airec-bk-field input,
.airec-bk-field textarea {
	border: 1px solid #d1d5db;
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 14px;
	font-family: inherit;
	resize: vertical;
}

.airec-bk-field input:focus,
.airec-bk-field textarea:focus {
	border-color: var(--airec-color);
	outline: none;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--airec-color) 15%, transparent);
}

.airec-bk-hint {
	font-size: 12.5px;
	color: #6b7280;
}

.airec-bk-notice {
	font-size: 13px;
	padding: 9px 12px;
	border-radius: 10px;
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
}

.airec-bk-notice.airec-bk-error {
	background: #fef2f2;
	color: #991b1b;
	border-color: #fecaca;
}

.airec-bk-slots {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}

.airec-bk-slot {
	border: 1px solid #d1d5db;
	background: #fff;
	border-radius: 10px;
	padding: 10px 6px;
	font-size: 13px;
	font-weight: 600;
	color: #1f2937;
	cursor: pointer;
	transition: all 0.15s ease;
}

.airec-bk-slot:hover {
	border-color: var(--airec-color);
	background: color-mix(in srgb, var(--airec-color) 8%, #fff);
	color: var(--airec-color);
}

.airec-bk-summary {
	background: #f6f7f9;
	border-radius: 12px;
	padding: 12px 14px;
	font-size: 13.5px;
	line-height: 1.7;
	color: #1f2937;
}

.airec-bk-row {
	display: flex;
	gap: 8px;
}

.airec-bk-row .airec-bk-btn {
	flex: 1;
}

.airec-bk-btn {
	border: 1px solid #d1d5db;
	background: #fff;
	border-radius: 12px;
	padding: 11px;
	font-size: 14px;
	font-weight: 600;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s ease;
}

.airec-bk-btn.airec-bk-primary {
	background: var(--airec-color);
	border-color: var(--airec-color);
	color: #fff;
}

.airec-bk-btn.airec-bk-primary:hover {
	background: var(--airec-color-dark, #1d4ed8);
}

.airec-bk-done {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
	border-radius: 12px;
	padding: 16px;
	font-size: 14px;
	line-height: 1.6;
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
	#airec-window {
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
		height: 80vh;
		max-height: 80vh;
		border-radius: 20px 20px 0 0;
		transform-origin: bottom center;
	}

	#airec-root.airec-pos-bottom-left #airec-window {
		left: 0;
	}

	#airec-bubble {
		right: 16px;
		bottom: 16px;
	}

	#airec-root.airec-pos-bottom-left #airec-bubble {
		left: 16px;
	}

	#airec-teaser {
		right: 88px;
		bottom: 28px;
		max-width: 200px;
	}

	#airec-root.airec-pos-bottom-left #airec-teaser {
		left: 88px;
	}
}

/* Respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
	#airec-bubble, #airec-window, .airec-msg, #airec-teaser {
		animation: none;
		transition: opacity 0.15s ease;
	}
}
