/**
 * WebBuildDev AI Chatbot — Front-end Styles
 * Website: https://webbuilddev.com
 *
 * Palette: #FF6B00 (orange), #FFFFFF (white), dark/black base
 */

:root {
	--oac-orange: #FF6B00;
	--oac-orange-light: #FF8A33;
	--oac-orange-dark: #CC5600;
	--oac-white: #FFFFFF;
	--oac-black: #000000;
	--oac-surface: rgba(255, 255, 255, 0.04);
	--oac-surface-strong: rgba(255, 255, 255, 0.08);
	--oac-border: rgba(255, 255, 255, 0.14);
	--oac-border-orange: rgba(255, 107, 0, 0.45);
	--oac-shadow-orange: rgba(255, 107, 0, 0.35);
	--oac-radius-lg: 20px;
	--oac-radius-md: 14px;
	--oac-radius-sm: 10px;
	--oac-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#oac-chatbot-root,
#oac-chatbot-root * {
	box-sizing: border-box;
	font-family: var(--oac-font);
	-webkit-font-smoothing: antialiased;
	cursor: default !important;
}

/* Fine-grained cursor overrides */
#oac-chatbot-root .oac-chat-window   { cursor: default !important; }
#oac-chatbot-root .oac-header        { cursor: default !important; }
#oac-chatbot-root .oac-messages      { cursor: default !important; }
#oac-chatbot-root .oac-bubble        { cursor: text !important; }
#oac-chatbot-root .oac-bubble a      { cursor: pointer !important; }
#oac-chatbot-root .oac-message-input { cursor: text !important; }
#oac-chatbot-root button             { cursor: pointer !important; }
#oac-chatbot-root .oac-quick-btn     { cursor: pointer !important; }
#oac-chatbot-root .oac-copy-btn      { cursor: pointer !important; }
#oac-chatbot-root .oac-toggle-btn    { cursor: pointer !important; }
#oac-chatbot-root .oac-close-btn     { cursor: pointer !important; }
#oac-chatbot-root .oac-send-btn      { cursor: pointer !important; }
#oac-chatbot-root a                  { cursor: pointer !important; }

#oac-chatbot-root {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 999999;
}

/* ── Toggle Button ── */
.oac-toggle-btn {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: linear-gradient(145deg, var(--oac-orange-light), var(--oac-orange) 55%, var(--oac-orange-dark));
	color: var(--oac-white);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow:
		0 0 0 0 rgba(255, 107, 0, 0.55),
		0 8px 24px var(--oac-shadow-orange),
		0 2px 6px rgba(0, 0, 0, 0.5);
	transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
	animation: oac-pulse-glow 2.6s ease-in-out infinite;
}

.oac-toggle-btn:hover {
	transform: translateY(-3px) scale(1.06);
	box-shadow:
		0 0 0 0 rgba(255, 107, 0, 0.55),
		0 12px 32px var(--oac-shadow-orange),
		0 2px 8px rgba(0, 0, 0, 0.6);
}

.oac-toggle-btn:active { transform: translateY(-1px) scale(0.97); }
.oac-toggle-btn:focus-visible { outline: 2px solid var(--oac-white); outline-offset: 3px; }

@keyframes oac-pulse-glow {
	0%, 100% {
		box-shadow:
			0 0 0 0 rgba(255, 107, 0, 0.45),
			0 8px 24px var(--oac-shadow-orange),
			0 2px 6px rgba(0, 0, 0, 0.5);
	}
	50% {
		box-shadow:
			0 0 0 10px rgba(255, 107, 0, 0),
			0 8px 28px rgba(255, 107, 0, 0.5),
			0 2px 6px rgba(0, 0, 0, 0.5);
	}
}

.oac-toggle-icon {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.oac-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.oac-icon-chat  { opacity: 1; transform: rotate(0) scale(1); }

#oac-chatbot-root.oac-is-open .oac-icon-chat  { opacity: 0; transform: rotate(90deg) scale(0.6); }
#oac-chatbot-root.oac-is-open .oac-icon-close { opacity: 1; transform: rotate(0) scale(1); }

.oac-notify-dot {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--oac-white);
	border: 2px solid var(--oac-orange-dark);
}

#oac-chatbot-root.oac-is-open .oac-notify-dot,
#oac-chatbot-root.oac-notified .oac-notify-dot { display: none; }

/* ── Chat Window — opens to ~50% viewport height ── */
.oac-chat-window {
	position: absolute;
	right: 0;
	bottom: 78px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 50vh;              /* ← half screen height */
	min-height: 420px;
	max-height: calc(100vh - 130px);
	background: rgba(0, 0, 0, 0.94);
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
	border: 1px solid var(--oac-border-orange);
	border-radius: var(--oac-radius-lg);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow:
		0 20px 60px rgba(0, 0, 0, 0.65),
		0 0 40px rgba(255, 107, 0, 0.12);

	/* Closed state */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(20px) scale(0.93);
	transform-origin: bottom right;
	transition:
		opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
		transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
		height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
		visibility 0.4s;
}

#oac-chatbot-root.oac-is-open .oac-chat-window {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0) scale(1);
}

/* ── Header ── */
.oac-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	background: linear-gradient(135deg, rgba(255, 107, 0, 0.18), rgba(255, 107, 0, 0.04));
	border-bottom: 1px solid var(--oac-border);
	flex-shrink: 0;
}

.oac-header-info { display: flex; align-items: center; gap: 10px; }

.oac-bot-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--oac-orange);
	color: var(--oac-white);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.25);
}

.oac-bot-avatar-sm { width: 26px; height: 26px; }
.oac-header-text { display: flex; flex-direction: column; line-height: 1.25; }
.oac-bot-name { color: var(--oac-white); font-weight: 600; font-size: 15px; letter-spacing: 0.2px; }
.oac-status { display: flex; align-items: center; gap: 5px; font-size: 12px; color: rgba(255,255,255,0.65); }
.oac-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--oac-orange); box-shadow: 0 0 6px var(--oac-orange); }

.oac-close-btn {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 1px solid transparent;
	background: transparent;
	color: var(--oac-white);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.oac-close-btn:hover {
	background: rgba(255, 107, 0, 0.12);
	border-color: var(--oac-border-orange);
	transform: rotate(90deg);
}

/* ── Quick Reply Buttons ── */
.oac-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--oac-border);
	flex-shrink: 0;
	background: rgba(255,107,0,0.03);
}

.oac-quick-btn {
	background: transparent;
	border: 1px solid var(--oac-border-orange);
	color: var(--oac-orange-light);
	padding: 5px 11px;
	border-radius: 20px;
	font-size: 12.5px;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, transform 0.15s;
	white-space: nowrap;
}

.oac-quick-btn:hover {
	background: rgba(255,107,0,0.15);
	color: var(--oac-white);
	transform: translateY(-1px);
}

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

.oac-messages::-webkit-scrollbar { width: 5px; }
.oac-messages::-webkit-scrollbar-track { background: transparent; }
.oac-messages::-webkit-scrollbar-thumb { background: rgba(255,107,0,0.35); border-radius: 10px; }

.oac-msg-row {
	display: flex;
	max-width: 90%;
	animation: oac-msg-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.oac-msg-row.oac-msg-user  { align-self: flex-end; justify-content: flex-end; }
.oac-msg-row.oac-msg-bot   { align-self: flex-start; }
.oac-msg-row.oac-msg-error { align-self: flex-start; }

.oac-bubble {
	position: relative;
	padding: 10px 14px;
	border-radius: var(--oac-radius-md);
	font-size: 14px;
	line-height: 1.55;
	word-wrap: break-word;
	white-space: pre-wrap;
}

.oac-msg-user  .oac-bubble {
	background: var(--oac-orange);
	color: var(--oac-white);
	border-bottom-right-radius: 4px;
	box-shadow: 0 4px 14px rgba(255,107,0,0.25);
}

.oac-msg-bot .oac-bubble {
	background: var(--oac-surface);
	border: 1px solid var(--oac-border);
	color: var(--oac-white);
	border-bottom-left-radius: 4px;
}

.oac-msg-error .oac-bubble {
	background: rgba(255,107,0,0.08);
	border: 1px solid var(--oac-border-orange);
	color: var(--oac-white);
	border-bottom-left-radius: 4px;
}

/* Links inside bot/error bubbles */
.oac-msg-bot .oac-bubble a,
.oac-msg-error .oac-bubble a {
	color: var(--oac-orange-light);
	text-decoration: underline;
}

.oac-msg-time {
	display: block;
	font-size: 10px;
	margin-top: 4px;
	opacity: 0.5;
	color: var(--oac-white);
}

.oac-msg-user .oac-msg-time { text-align: right; }

/* ── Copy Button ── */
.oac-copy-btn {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 24px;
	height: 24px;
	border-radius: 6px;
	border: 1px solid var(--oac-border);
	background: rgba(0,0,0,0.4);
	color: rgba(255,255,255,0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s, background 0.2s, color 0.2s;
	font-size: 11px;
	padding: 0;
}

.oac-bubble:hover .oac-copy-btn { opacity: 1; }

.oac-copy-btn:hover {
	background: rgba(255,107,0,0.2);
	border-color: var(--oac-border-orange);
	color: var(--oac-white);
}

.oac-copy-btn.oac-copied {
	color: #4cff91;
	border-color: rgba(76,255,145,0.4);
	opacity: 1;
}

/* ── Typing indicator ── */
.oac-typing-indicator {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 16px 10px;
	flex-shrink: 0;
}

.oac-typing-indicator[hidden] { display: none; }

.oac-typing-dots {
	display: flex;
	align-items: center;
	gap: 4px;
	background: var(--oac-surface);
	border: 1px solid var(--oac-border);
	border-radius: var(--oac-radius-md);
	padding: 8px 12px;
}

.oac-typing-dots span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--oac-orange);
	animation: oac-typing-bounce 1.2s infinite ease-in-out;
}

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

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

/* ── Input Area ── */
.oac-input-area {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding: 12px 14px;
	border-top: 1px solid var(--oac-border);
	background: rgba(255,255,255,0.02);
	flex-shrink: 0;
}

.oac-message-input {
	flex: 1;
	resize: none;
	max-height: 100px;
	min-height: 22px;
	background: transparent;
	border: none;
	outline: none;
	color: var(--oac-white);
	font-size: 14px;
	line-height: 1.4;
	padding: 8px 4px;
}

.oac-message-input::placeholder { color: rgba(255,255,255,0.4); }

.oac-send-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	flex-shrink: 0;
	background: var(--oac-orange);
	color: var(--oac-white);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease, opacity 0.2s ease;
	box-shadow: 0 4px 14px rgba(255,107,0,0.3);
}

.oac-send-btn:hover:not(:disabled) {
	transform: scale(1.08) rotate(8deg);
	box-shadow: 0 6px 18px rgba(255,107,0,0.45);
}

.oac-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Footer Brand — WebBuildDev.com ── */
.oac-footer-brand {
	text-align: center;
	font-size: 10.5px;
	color: rgba(255,255,255,0.35);
	padding: 6px 0 9px;
	flex-shrink: 0;
	letter-spacing: 0.2px;
}

.oac-footer-brand a {
	color: var(--oac-orange-light);
	text-decoration: none;
	font-weight: 500;
}

.oac-footer-brand a:hover { text-decoration: underline; }

/* ── Accessibility ── */
.screen-reader-text {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ── Tablet ── */
@media (max-width: 768px) {
	#oac-chatbot-root { right: 16px; bottom: 16px; }
	.oac-chat-window { width: 350px; }
}

/* ── Mobile — full bottom half ── */
@media (max-width: 480px) {
	#oac-chatbot-root { right: 12px; bottom: 12px; }

	.oac-toggle-btn { width: 54px; height: 54px; }

	#oac-chatbot-root.oac-is-open .oac-toggle-btn {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transform: scale(0.7);
		transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	}

	.oac-chat-window {
		position: fixed;
		right: 8px;
		left: 8px;
		bottom: 12px;
		width: auto;
		max-width: none;
		height: 52vh;
		min-height: 340px;
		max-height: none;
		border-radius: var(--oac-radius-md);
	}
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
	.oac-toggle-btn,
	.oac-chat-window,
	.oac-msg-row,
	.oac-typing-dots span,
	.oac-send-btn,
	.oac-close-btn {
		animation: none !important;
		transition: opacity 0.15s linear !important;
	}
}
