/**
 * Frontend Widget Styles - Enhanced Design
 */

/* Chat toggle button */
#whc-toggle {
	position: fixed !important;
	bottom: 20px !important;
	right: 20px !important;
	left: auto !important;
	width: 90px;
	height: 90px;
	border-radius: 50%;
	background: linear-gradient(135deg, #0073aa 0%, #005a87 60%, #004a6d 100%);
	color: #fff;
	border: 3px solid rgba(255, 255, 255, 0.2);
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(0, 115, 170, 0.4), 0 6px 10px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	/* Remove font-size that overrides emoji */
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 999998;
	overflow: visible;
	position: relative;
}

/* Tooltip bubble */
.whc-tooltip-bubble {
	position: absolute;
	bottom: 105px;
	right: 0;
	background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
	color: #2c3e50;
	padding: 14px 20px;
	border-radius: 22px;
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 5px 12px rgba(0, 115, 170, 0.3);
	border: 3px solid #0073aa;
	opacity: 0;
	transform: translateY(10px) scale(0.95);
	animation: whc-tooltip-float 3s ease-in-out 1s infinite, whc-tooltip-appear 0.5s ease forwards 0.5s;
	pointer-events: none;
	z-index: 999999;
	min-width: 200px;
	text-align: center;
}

.whc-tooltip-bubble::after {
	content: '';
	position: absolute;
	bottom: -14px;
	right: 32px;
	width: 0;
	height: 0;
	border-left: 12px solid transparent;
	border-right: 12px solid transparent;
	border-top: 14px solid #0073aa;
}

.whc-tooltip-bubble::before {
	content: '';
	position: absolute;
	bottom: -9px;
	right: 35px;
	width: 0;
	height: 0;
	border-left: 9px solid transparent;
	border-right: 9px solid transparent;
	border-top: 11px solid #ffffff;
	z-index: 1;
}

@keyframes whc-tooltip-appear {
	0% {
		opacity: 0;
		transform: translateY(10px) scale(0.95);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes whc-tooltip-float {
	0%, 100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-8px);
	}
}

/* Hide tooltip when chat is open or on hover */
#whc-chat-window.whc-open ~ #whc-toggle .whc-tooltip-bubble,
#whc-toggle:hover .whc-tooltip-bubble {
	opacity: 0;
	transform: translateY(10px) scale(0.9);
	transition: all 0.3s ease;
}

#whc-toggle::before {
	content: '';
	position: absolute;
	top: -3px;
	left: -3px;
	right: -3px;
	bottom: -3px;
	background: linear-gradient(135deg, var(--whc-color, #0073aa), #00a0dc);
	border-radius: 50%;
	opacity: 0;
	z-index: -1;
	transition: opacity 0.3s ease;
}

#whc-toggle:hover {
	transform: scale(1.1) rotate(5deg);
	box-shadow: 0 12px 32px rgba(0, 115, 170, 0.4), 0 6px 12px rgba(0, 0, 0, 0.2);
}

#whc-toggle:hover::before {
	opacity: 0.3;
	animation: whc-pulse 2s infinite;
}

.whc-bot-avatar {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	font-size: 70px !important;
	line-height: 1 !important;
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
	transform-origin: center;
	transform: scale(1) !important;
	width: 70px;
	height: 70px;
	/* No animation - keep it stable and visible */
}

@keyframes whc-wave {
	0%, 100% {
		transform: rotate(0deg) scale(1);
	}
	10% {
		transform: rotate(-15deg) scale(1.05);
	}
	20% {
		transform: rotate(15deg) scale(1.05);
	}
	30% {
		transform: rotate(-15deg) scale(1.05);
	}
	40%, 100% {
		transform: rotate(0deg) scale(1);
	}
}

@keyframes whc-pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
}

#whc-toggle:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Position variants - FORCE RIGHT POSITION */
.whc-position-bottom-left #whc-toggle,
.whc-position-bottom-right #whc-toggle {
	right: 20px !important;
	left: auto !important;
}

/* Chat window */
#whc-chat-window {
	position: fixed;
	bottom: 110px;
	right: 20px;
	width: 400px;
	max-width: calc(100vw - 40px);
	height: 600px;
	max-height: calc(100vh - 150px);
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 8px 20px rgba(0, 0, 0, 0.1);
	display: none;
	flex-direction: column;
	z-index: 999999;
	overflow: hidden;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	opacity: 0;
	transform: translateY(30px) scale(0.9);
}

#whc-chat-window.whc-open {
	display: flex;
	opacity: 1;
	transform: translateY(0) scale(1);
	animation: whc-slide-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes whc-slide-up {
	0% {
		opacity: 0;
		transform: translateY(30px) scale(0.9);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* FORCE RIGHT POSITION - Override any left positioning */
.whc-position-bottom-left #whc-chat-window,
.whc-position-bottom-right #whc-chat-window {
	right: 20px !important;
	left: auto !important;
}

/* Chat header */
.whc-chat-header {
	background: linear-gradient(135deg, #0073aa 0%, #005a87 60%, #004a6d 100%);
	color: #fff;
	padding: 22px 24px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	box-shadow: 0 4px 12px rgba(0, 115, 170, 0.25);
	position: relative;
}

.whc-chat-header::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.whc-chat-header h3 {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.5px;
	display: flex;
	align-items: center;
	gap: 12px;
	color: #ffffff;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.whc-chat-header h3::before {
	content: '👩‍💼';
	font-size: 28px;
	animation: whc-wave-small 3s ease-in-out infinite;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes whc-wave-small {
	0%, 100% {
		transform: rotate(0deg);
	}
	25% {
		transform: rotate(-10deg);
	}
	75% {
		transform: rotate(10deg);
	}
}

#whc-close {
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: #fff;
	font-size: 28px;
	cursor: pointer;
	padding: 0;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	transition: all 0.2s ease;
	backdrop-filter: blur(10px);
}

#whc-close:hover {
	background: rgba(255, 255, 255, 0.25);
	transform: rotate(90deg);
}

/* Messages container */
#whc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 24px;
	background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
}

/* Messages */
.whc-message {
	margin-bottom: 20px;
	animation: whc-message-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes whc-message-in {
	0% {
		opacity: 0;
		transform: translateY(15px) scale(0.95);
	}
	100% {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.whc-message-content {
	padding: 14px 18px;
	border-radius: 18px;
	max-width: 85%;
	word-wrap: break-word;
	line-height: 1.6;
	font-size: 15px;
	position: relative;
}

.whc-message-user .whc-message-content {
	background: linear-gradient(135deg, #0073aa 0%, #005a87 60%, #004a6d 100%);
	color: #fff;
	margin-left: auto;
	border-bottom-right-radius: 4px;
	box-shadow: 0 4px 14px rgba(0, 115, 170, 0.3);
	font-weight: 500;
}

.whc-message-assistant .whc-message-content,
.whc-message-system .whc-message-content {
	background: #ffffff;
	color: #2c3e50;
	border: 1px solid #e1e8ed;
	border-bottom-left-radius: 4px;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
	line-height: 1.6;
}

.whc-message-assistant .whc-message-content::before {
	content: '👩‍💼';
	position: absolute;
	left: -35px;
	top: 0;
	font-size: 28px;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.whc-message-error .whc-message-content {
	background: linear-gradient(135deg, #fee 0%, #fdd 100%);
	color: #c00;
	border: 1px solid #fcc;
	box-shadow: 0 2px 8px rgba(255, 0, 0, 0.1);
}

/* Typing indicator */
.whc-typing-indicator .whc-message-content {
	padding: 16px 20px;
}

.whc-typing-indicator .whc-message-content::after {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--whc-color, #0073aa);
	animation: whc-typing-dots 1.5s infinite;
	margin-left: 4px;
}

@keyframes whc-typing-dots {
	0%, 60%, 100% {
		opacity: 0.3;
		transform: scale(0.8);
	}
	30% {
		opacity: 1;
		transform: scale(1.2);
	}
}

/* Sources */
.whc-sources {
	margin-top: 14px;
	padding: 16px 18px;
	background: linear-gradient(135deg, #f8f9fa 0%, #f0f3f5 100%);
	border-radius: 14px;
	border: 1px solid #d1dce5;
	font-size: 14px;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.whc-sources strong {
	display: block;
	margin-bottom: 10px;
	color: #555;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.whc-sources ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.whc-sources li {
	margin-bottom: 10px;
	padding: 10px 14px;
	background: #ffffff;
	border-radius: 10px;
	border-left: 4px solid #0073aa;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.whc-sources li:hover {
	transform: translateX(6px);
	box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
	border-left-color: #005a87;
	background: #f8fbff;
}

.whc-sources a {
	color: var(--whc-color, #0073aa);
	text-decoration: none;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 6px;
}

.whc-sources a::before {
	content: '🔗';
	font-size: 14px;
}

.whc-sources a:hover {
	color: #005a87;
}

.whc-source-price {
	color: #2ecc71;
	font-weight: 700;
	font-size: 14px;
	margin-left: 8px;
}

/* Input area */
.whc-input-area {
	padding: 22px 24px;
	background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
	border-top: 2px solid #e1e8ed;
	display: flex;
	gap: 14px;
	box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
	align-items: flex-end;
}

#whc-input {
	flex: 1;
	border: 2px solid #d1dce5;
	border-radius: 26px;
	padding: 14px 22px;
	font-size: 15px;
	line-height: 1.5;
	outline: none;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	resize: none;
	min-height: 50px;
	max-height: 120px;
	background: #ffffff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
	color: #2c3e50;
}

#whc-input:focus {
	border-color: #0073aa;
	background: #ffffff;
	box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.12), 0 4px 12px rgba(0, 115, 170, 0.15);
	transform: translateY(-1px);
}

#whc-input::placeholder {
	color: #95a5a6;
	font-style: italic;
}

#whc-send {
	background: linear-gradient(135deg, #0073aa 0%, #005a87 60%, #004a6d 100%);
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 52px;
	height: 52px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	flex-shrink: 0;
	box-shadow: 0 6px 16px rgba(0, 115, 170, 0.35);
	position: relative;
	overflow: hidden;
}

#whc-send::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.3);
	transform: translate(-50%, -50%);
	transition: width 0.6s, height 0.6s;
}

#whc-send:hover {
	transform: scale(1.08) rotate(5deg);
	box-shadow: 0 8px 24px rgba(0, 115, 170, 0.45);
}

#whc-send:hover::before {
	width: 100px;
	height: 100px;
}

#whc-send:active {
	transform: scale(0.95);
}

#whc-send svg {
	position: relative;
	z-index: 1;
	transition: transform 0.3s ease;
}

#whc-send:hover svg {
	transform: translateX(2px) translateY(-2px);
}
	transform: scale(1.1) rotate(15deg);
	box-shadow: 0 6px 16px rgba(0, 115, 170, 0.35);
}

#whc-send:active {
	transform: scale(0.95);
}

#whc-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

/* Footer */
.whc-footer {
	padding: 12px 20px;
	text-align: center;
	font-size: 11px;
	color: #6c757d;
	background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
	border-top: 1px solid #e0e0e0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.whc-footer-privacy {
	order: 1;
}

.whc-privacy-notice {
	font-size: 10px;
	color: #95a5a6;
	display: block;
	line-height: 1.4;
}

.whc-powered-by {
	order: 2;
	font-size: 12px;
}

.whc-footer a {
	color: #0073aa;
	text-decoration: none;
	font-weight: 600;
	transition: color 0.2s ease;
}

.whc-footer a:hover {
	color: #005177;
	text-decoration: underline;
}

/* Scrollbar styling */
#whc-messages::-webkit-scrollbar {
	width: 8px;
}

#whc-messages::-webkit-scrollbar-track {
	background: transparent;
	margin: 8px 0;
}

#whc-messages::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, var(--whc-color, #0073aa), #005a87);
	border-radius: 10px;
}

#whc-messages::-webkit-scrollbar-thumb:hover {
	background: linear-gradient(180deg, #005a87, #004466);
}

/* Mobile responsive */
@media (max-width: 480px) {
	#whc-chat-window {
		right: 10px;
		left: 10px;
		width: auto;
		max-width: none;
		bottom: 100px;
		border-radius: 16px;
	}
	
	.whc-position-bottom-left #whc-chat-window {
		left: 10px;
	}
	
	#whc-toggle {
		right: 15px;
		bottom: 15px;
		width: 65px;
		height: 65px;
	}
	
	.whc-position-bottom-left #whc-toggle {
		right: auto;
		left: 15px;
	}
	
	.whc-bot-avatar {
		font-size: 34px;
	}
}

/* Accessibility */
#whc-toggle:focus,
#whc-close:focus,
#whc-send:focus,
#whc-input:focus {
	outline: 3px solid var(--whc-color, #0073aa);
	outline-offset: 3px;
}

/* Loading state */
.whc-loading {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: whc-spin 0.8s linear infinite;
}

@keyframes whc-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Print: hide widget */
@media print {
	#whc-chatbot-widget {
		display: none !important;
	}
}

/* Welcome animation */
@keyframes whc-welcome-bounce {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
}

.whc-message-system {
	animation: whc-welcome-bounce 0.5s ease-in-out;
}
