/**
 * AI Chatbot Widget Styles
 * Black & White theme
 */

/* ── Toggle Button ── */
.chatbot-toggle {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: #fff;
	color: #000;
	border: none;
	cursor: pointer;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(255, 255, 255, 0.25);
	transition: transform 0.3s, box-shadow 0.3s;
}

.chatbot-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 28px rgba(255, 255, 255, 0.35);
}

.chatbot-toggle svg {
	width: 28px;
	height: 28px;
	transition: opacity 0.2s;
}

.chatbot-toggle .chatbot-icon-close {
	display: none;
}

.chatbot-toggle--active .chatbot-icon-open {
	display: none;
}

.chatbot-toggle--active .chatbot-icon-close {
	display: block;
}

/* ── Chat Window ── */
.chatbot-window {
	position: fixed;
	bottom: 100px;
	right: 24px;
	width: 380px;
	max-height: 520px;
	background: #000;
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 16px;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
	z-index: 9998;
	display: none;
	flex-direction: column;
	overflow: hidden;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.chatbot-window--open {
	display: flex;
	animation: chatbotSlideIn 0.3s ease-out;
}

@keyframes chatbotSlideIn {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ── Header ── */
.chatbot-header {
	background: #111;
	padding: 16px 20px;
	display: flex;
	align-items: center;
	gap: 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	flex-shrink: 0;
}

.chatbot-header__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.chatbot-header__avatar svg {
	width: 22px;
	height: 22px;
	color: #fff;
}

.chatbot-header__info {
	flex: 1;
	min-width: 0;
}

.chatbot-header__name {
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	margin: 0;
}

.chatbot-header__status {
	color: #aaa;
	font-size: 12px;
	margin: 2px 0 0;
}

.chatbot-header__actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.chatbot-header__btn {
	background: none;
	border: none;
	color: #888;
	cursor: pointer;
	padding: 5px;
	border-radius: 6px;
	transition: color 0.2s, background 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.chatbot-header__btn:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
}

.chatbot-header__whatsapp {
	color: #25d366;
}

.chatbot-header__whatsapp:hover {
	color: #2bf075;
	background: rgba(37, 211, 102, 0.15);
}


/* ── Messages Area ── */
.chatbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 4px;
}

/* ── Message Bubbles ── */
.chatbot-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
}

.chatbot-msg--bot {
	background: #1a1a1a;
	color: #e0e0e0;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

.chatbot-msg--user {
	background: #fff;
	color: #000;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}

.chatbot-msg--error {
	background: #2a1a1a;
	color: #ccc;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

/* ── Greeting Bubble ── */
.chatbot-greeting {
	display: none;
	position: fixed;
	bottom: 100px;
	right: 24px;
	width: 260px;
	background: #fff;
	color: #000;
	border-radius: 14px;
	padding: 14px 18px;
	font-size: 14px;
	line-height: 1.5;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
	z-index: 9997;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
	animation: greetingFadeIn 0.4s ease-out;
}

.chatbot-greeting--visible {
	display: block;
}

.chatbot-greeting::after {
	content: '';
	position: absolute;
	bottom: -8px;
	right: 28px;
	width: 16px;
	height: 16px;
	background: #fff;
	transform: rotate(45deg);
	border-radius: 0 0 4px 0;
}

.chatbot-greeting__close {
	position: absolute;
	top: 6px;
	right: 10px;
	background: none;
	border: none;
	color: #888;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	padding: 2px;
}

.chatbot-greeting__close:hover {
	color: #000;
}

@keyframes greetingFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ── Typing Indicator ── */
.chatbot-typing {
	display: none;
	align-self: flex-start;
	padding: 10px 14px;
	background: #1a1a1a;
	border-radius: 12px;
	border-bottom-left-radius: 4px;
	gap: 4px;
}

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

.chatbot-typing__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #fff;
	animation: chatbotTyping 1.4s infinite;
}

.chatbot-typing__dot:nth-child(2) {
	animation-delay: 0.2s;
}

.chatbot-typing__dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes chatbotTyping {
	0%, 60%, 100% {
		opacity: 0.3;
		transform: translateY(0);
	}
	30% {
		opacity: 1;
		transform: translateY(-4px);
	}
}

/* ── Input Area ── */
.chatbot-input {
	padding: 12px 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	display: flex;
	gap: 8px;
	background: #0a0a0a;
	flex-shrink: 0;
}

.chatbot-input__field {
	flex: 1;
	background: #1a1a1a;
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 10px;
	padding: 10px 14px;
	color: #e0e0e0;
	font-size: 14px;
	font-family: inherit;
	outline: none;
	transition: border-color 0.2s;
	resize: none;
	min-height: 40px;
	max-height: 80px;
}

.chatbot-input__field::placeholder {
	color: #666;
}

.chatbot-input__field:focus {
	border-color: #fff;
}

.chatbot-input__send {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: #fff;
	color: #000;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s, transform 0.2s;
	flex-shrink: 0;
	align-self: flex-end;
}

.chatbot-input__send:hover {
	opacity: 0.85;
	transform: scale(1.05);
}

.chatbot-input__send:disabled {
	opacity: 0.3;
	cursor: not-allowed;
	transform: none;
}

.chatbot-input__send svg {
	width: 18px;
	height: 18px;
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
	.chatbot-window {
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		max-height: 100%;
		border-radius: 0;
		border: none;
	}

	.chatbot-window--open {
		animation: chatbotMobileIn 0.3s ease-out;
	}

	@keyframes chatbotMobileIn {
		from {
			opacity: 0;
			transform: translateY(100%);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	.chatbot-header {
		padding: 14px 16px;
		border-radius: 0;
		flex-shrink: 0;
	}

	.chatbot-messages {
		padding: 12px;
		gap: 10px;
		flex: 1;
		-webkit-overflow-scrolling: touch;
	}

	.chatbot-msg {
		max-width: 90%;
		font-size: 14px;
		padding: 10px 12px;
	}

	.chatbot-input {
		padding: 10px 12px;
		flex-shrink: 0;
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	}

	.chatbot-input__field {
		padding: 10px 12px;
		font-size: 16px; /* prevents iOS zoom on focus */
	}

	.chatbot-toggle {
		bottom: 16px;
		right: 16px;
		width: 56px;
		height: 56px;
	}

	.chatbot-greeting {
		bottom: 84px;
		right: 16px;
		left: 16px;
		width: auto;
		font-size: 13px;
		border-radius: 12px;
	}

	.chatbot-greeting::after {
		right: 32px;
	}
}

/* ── Message markdown support ── */
.chatbot-msg a {
	color: #ccc;
	text-decoration: underline;
}

.chatbot-msg a:hover {
	color: #fff;
}

.chatbot-msg p {
	margin: 0 0 8px;
}

.chatbot-msg p:last-child {
	margin-bottom: 0;
}

.chatbot-msg ul,
.chatbot-msg ol {
	margin: 4px 0;
	padding-left: 20px;
}

.chatbot-msg li {
	margin: 2px 0;
}

.chatbot-msg strong {
	font-weight: 600;
}

.chatbot-msg code {
	background: rgba(255, 255, 255, 0.1);
	padding: 1px 5px;
	border-radius: 4px;
	font-size: 13px;
}

/* ── Typing Cursor ── */
.chatbot-cursor {
	display: inline-block;
	width: 2px;
	height: 14px;
	background: #fff;
	margin-left: 1px;
	vertical-align: text-bottom;
	animation: chatbotCursorBlink 0.6s step-end infinite;
}

@keyframes chatbotCursorBlink {
	0%, 100% { opacity: 1; }
	50% { opacity: 0; }
}

/* ── Suggestion Chips ── */
.chatbot-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0 6px;
	padding: 2px 0;
}

.chatbot-chip {
	background: #181818;
	border: 1px solid rgba(255, 255, 255, 0.15);
	color: #e6e6e6;
	padding: 7px 13px;
	border-radius: 20px;
	font-size: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
	font-family: inherit;
	white-space: nowrap;
	outline: none;
}

.chatbot-chip:hover {
	background: #ffffff;
	color: #000000;
	border-color: #ffffff;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.chatbot-chip:active {
	transform: translateY(0);
}

/* ── Ensure Back-to-Top Button doesn't overlap Chatbot toggle ── */
.back-to-top {
	bottom: 96px !important;
	right: 24px !important;
}

@media (max-width: 768px) {
	.back-to-top {
		bottom: 84px !important;
		right: 16px !important;
	}
}

