/**
 * Frontend Styles
 *
 * @package My_Custom_AI
 */

/* Widget Container */
/* Widget Container */
.myai-widget-container {
	position: fixed !important;
	bottom: var(--myai-offset-desktop, 24px) !important;
	right: 20px !important;
	z-index: 999999 !important;
    font-family: Vazir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif !important;
	display: block !important;
	visibility: visible !important;
	--myai-primary-color: #0073aa;
	--myai-bubble-color: #667eea;
	--myai-bubble-shadow: rgba(102, 126, 234, 0.45);
	--myai-glass-bg: rgba(255, 255, 255, 0.55);
	--myai-glass-border: rgba(255, 255, 255, 0.25);
	--myai-offset-mobile: 16px;
}

.myai-widget-container.position-bottom-left {
	right: auto !important;
	left: 20px !important;
}

@media (max-width: 640px) {
	.myai-widget-container {
		bottom: var(--myai-offset-mobile, 16px) !important;
	}
}

/* Chat Bubble Button */
.myai-chat-bubble {
	width: 62px !important;
	height: 62px !important;
	border-radius: 50% !important;
	background: var(--myai-bubble-color, #667eea) !important;
	background: linear-gradient(
		135deg,
		color-mix(in srgb, var(--myai-bubble-color, #667eea) 92%, #ffffff 8%) 0%,
		color-mix(in srgb, var(--myai-bubble-color, #667eea) 68%, #1d1d1d 32%) 100%
	) !important;
	color: #fff !important;
	border: 3px solid rgba(255, 255, 255, 0.7) !important;
	cursor: pointer !important;
	box-shadow: 0 18px 36px var(--myai-bubble-shadow, rgba(0, 0, 0, 0.25)) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	font-size: 24px !important;
	transition: transform 0.3s ease, box-shadow 0.3s ease !important;
	visibility: visible !important;
	opacity: 1 !important;
	overflow: hidden !important;
	padding: 0 !important;
}

.myai-chat-icon {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	border-radius: 50% !important;
}

.myai-chat-bubble:hover {
	transform: scale(1.08) translateY(-4px);
	box-shadow: 0 18px 36px rgba(0, 0, 0, 0.25) !important;
}

.myai-chat-bubble:active {
	transform: scale(0.95);
}

.myai-chat-bubble:focus {
	outline: 2px solid rgba(255, 255, 255, 0.85);
	outline-offset: 2px;
}

/* Chat Window */
.myai-chat-window {
	position: absolute !important;
	bottom: calc(var(--myai-offset-desktop, 24px) + 78px) !important;
	right: 0 !important;
	width: 380px !important;
	max-width: calc(100vw - 40px) !important;
	height: 500px !important;
	max-height: calc(100vh - 110px) !important;
	background: var(--myai-glass-bg, rgba(255, 255, 255, 0.55)) !important;
	border-radius: 22px !important;
	box-shadow: 0 30px 60px rgba(15, 23, 42, 0.18) !important;
	backdrop-filter: blur(20px) saturate(180%) !important;
	-webkit-backdrop-filter: blur(20px) saturate(180%) !important;
	border: 1px solid var(--myai-glass-border, rgba(255, 255, 255, 0.25)) !important;
	display: none !important;
	flex-direction: column !important;
	overflow: hidden !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.myai-widget-container.position-bottom-left .myai-chat-window {
	right: auto !important;
	left: 0 !important;
}

.myai-chat-window.active {
	display: flex !important;
	visibility: visible !important;
	opacity: 1 !important;
}

/* Chat Header */
.myai-chat-header {
	background: linear-gradient(135deg, var(--myai-primary-color, #0073aa) 0%, var(--myai-bubble-color, #667eea) 100%);
	color: #fff;
	padding: 18px 22px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.myai-chat-header h3 {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.3px;
	color: var(--myai-header-title-color, #ffffff) !important;
}

.myai-chat-close {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #fff;
	font-size: 22px;
	cursor: pointer;
	padding: 0;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	transition: background 0.2s ease;
}

.myai-chat-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.myai-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 22px;
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.32) 100%),
		radial-gradient(circle at top right, rgba(255, 255, 255, 0.55), transparent 55%);
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--myai-primary-color, #0073aa) 65%, rgba(255, 255, 255, 0.2) 35%) transparent;
}

.myai-chat-messages::-webkit-scrollbar {
	width: 8px;
}

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

.myai-chat-messages::-webkit-scrollbar-thumb {
	background: color-mix(in srgb, var(--myai-primary-color, #0073aa) 60%, rgba(255, 255, 255, 0.2) 40%);
	border-radius: 999px;
}

.myai-message {
	margin-bottom: 15px;
	display: flex;
	flex-direction: column;
}

.myai-message.user {
	align-items: flex-end;
}

.myai-message.assistant {
	align-items: flex-start;
}

.myai-message-bubble {
	max-width: 80%;
	padding: 12px 16px;
	border-radius: 18px;
	word-wrap: break-word;
	line-height: 1.6;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.myai-message.user .myai-message-bubble {
	background: rgba(0, 115, 170, 0.92);
	background: color-mix(in srgb, var(--myai-primary-color, #0073aa) 92%, #ffffff 8%);
	color: #ffffff;
	border-bottom-right-radius: 6px;
	box-shadow: 0 10px 24px rgba(13, 60, 97, 0.25);
}

.myai-message.assistant .myai-message-bubble {
	background: rgba(255, 255, 255, 0.85);
	background: color-mix(in srgb, rgba(255, 255, 255, 0.92) 95%, var(--myai-primary-color, #0073aa) 5%);
	color: #111827;
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-bottom-left-radius: 6px;
	box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.myai-message-bubble a.myai-product-link {
	color: #0073aa !important;
	text-decoration: underline !important;
	font-weight: 600 !important;
	word-break: break-all !important;
	display: inline-block !important;
	margin: 2px 0 !important;
	cursor: pointer !important;
}

.myai-message-bubble a.myai-product-link:hover {
	color: #005177 !important;
	text-decoration: none !important;
	background: rgba(0, 115, 170, 0.1) !important;
	padding: 2px 4px !important;
	border-radius: 3px !important;
}

.myai-message-time {
	font-size: 11px;
	color: #999;
	margin-top: 4px;
}

/* Typing Indicator */
.myai-typing-indicator {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 16px;
}

.myai-typing-indicator span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #999;
	animation: typing 1.4s infinite;
}

.myai-typing-indicator span:nth-child(2) {
	animation-delay: 0.2s;
}

.myai-typing-indicator span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes typing {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.7;
	}
	30% {
		transform: translateY(-10px);
		opacity: 1;
	}
}

/* Chat Input */
.myai-chat-input-container {
	padding: 16px;
	background: rgba(255, 255, 255, 0.72);
	border-top: 1px solid rgba(255, 255, 255, 0.35);
	display: flex;
	gap: 10px;
}

.myai-chat-input {
	flex: 1;
	padding: 11px 16px;
	border: 1px solid rgba(148, 163, 184, 0.35);
	border-radius: 22px;
	font-size: 14px;
	outline: none;
	background: rgba(255, 255, 255, 0.85);
}

.myai-chat-input:focus {
	border-color: var(--myai-primary-color, #0073aa);
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.15);
}

.myai-chat-send {
	padding: 11px 22px;
	background: var(--myai-primary-color, #0073aa);
	color: #fff;
	border: none;
	border-radius: 22px;
	cursor: pointer;
	font-weight: 600;
	transition: background 0.2s ease, transform 0.2s ease;
}

.myai-chat-send:hover {
	background: #005177;
	transform: translateY(-1px);
}

.myai-chat-send:disabled {
	background: rgba(203, 213, 225, 0.8);
	cursor: not-allowed;
}

/* Consent Modal */
.myai-consent-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.myai-consent-content {
	background: #fff;
	border-radius: 12px;
	padding: 30px;
	max-width: 500px;
	margin: 20px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.myai-consent-content h3 {
	margin-top: 0;
}

.myai-consent-buttons {
	display: flex;
	gap: 10px;
	margin-top: 20px;
}

.myai-consent-buttons button {
	flex: 1;
	padding: 12px;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 600;
	transition: opacity 0.2s;
}

.myai-consent-accept {
	background: #0073aa;
	color: #fff;
}

.myai-consent-decline {
	background: #e5e5e5;
	color: #333;
}

/* Quick Questions */
.myai-quick-questions {
	margin-top: 15px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.myai-quick-question {
	background: rgba(255, 255, 255, 0.7);
	border: 1px solid rgba(148, 163, 184, 0.35);
	border-radius: 18px;
	padding: 10px 16px;
	cursor: pointer;
	text-align: right;
	font-size: 13px;
	color: #1f2937;
	transition: all 0.2s ease;
	word-wrap: break-word;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.myai-quick-question:hover {
	background: rgba(255, 255, 255, 0.95);
	border-color: var(--myai-primary-color, #0073aa);
	color: var(--myai-primary-color, #0073aa);
	transform: translateX(-3px);
}

.myai-quick-question:active {
	transform: translateX(0);
	background: rgba(255, 255, 255, 0.85);
}

/* Responsive */
@media (max-width: 480px) {
	.myai-chat-window {
		width: 100%;
		height: 100%;
		max-height: 100%;
	/*	bottom: calc(var(--myai-offset-mobile, 16px) + 70px) !important; */
		right: 0;
		border-radius: 0;
	}

	.myai-widget-container.position-bottom-left .myai-chat-window {
		left: 0;
	}
}

