/**
 * Agentorie Chat Widget Styles
 *
 * Uses CSS custom properties for customization via Appearance settings.
 *
 * @package Agentorie_Chat
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Custom Properties (Defaults)
   These are overridden by inline styles from class-frontend.php
   ========================================================================== */

:root {
	--agentorie-primary: #6366f1;
	--agentorie-primary-dark: #4f46e5;
	--agentorie-primary-text: #ffffff;
	--agentorie-user-bubble: #6366f1;
	--agentorie-user-text: #ffffff;
	--agentorie-bot-bubble: #f3f4f6;
	--agentorie-bot-text: #1f2937;
	--agentorie-background: #ffffff;
	--agentorie-button-size: 60px;
	--agentorie-chat-width: 380px;
	--agentorie-chat-height: 550px;
	--agentorie-border-radius: 16px;
	--agentorie-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Widget Container
   ========================================================================== */

.agentorie-chat-widget {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	box-sizing: border-box;
}

.agentorie-chat-widget *,
.agentorie-chat-widget *::before,
.agentorie-chat-widget *::after {
	box-sizing: border-box;
}

/* Reset buttons and inputs to prevent theme interference */
.agentorie-chat-widget button,
.agentorie-chat-widget input {
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	margin: 0;
}

.agentorie-chat-widget button:focus,
.agentorie-chat-widget input:focus {
	outline: none;
}

.agentorie-chat-widget.bottom-right {
	bottom: var(--agentorie-button-margin-bottom, 20px);
	right: 20px;
}

.agentorie-chat-widget.bottom-left {
	bottom: var(--agentorie-button-margin-bottom, 20px);
	left: 20px;
}

/* ==========================================================================
   Chat Toggle Button (Launcher)
   ========================================================================== */

.agentorie-chat-toggle {
	width: var(--agentorie-button-size);
	height: var(--agentorie-button-size);
	border-radius: 50%;
	background: var(--agentorie-primary);
	color: var(--agentorie-primary-text);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	position: relative;
	overflow: visible;
	padding: 0;
}

.agentorie-chat-toggle:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.agentorie-chat-toggle:active {
	transform: scale(0.95);
}

.agentorie-chat-toggle svg {
	width: calc(var(--agentorie-button-size) * 0.45);
	height: calc(var(--agentorie-button-size) * 0.45);
	fill: var(--agentorie-primary-text);
}

.agentorie-toggle-icon {
	font-size: calc(var(--agentorie-button-size) * 0.45);
	line-height: 1;
}

/* Button Styles (applied via JS) */
.agentorie-chat-toggle.style-solid {
	background: var(--agentorie-primary);
}

.agentorie-chat-toggle.style-gradient {
	background: linear-gradient(135deg, var(--agentorie-primary) 0%, var(--agentorie-primary-dark) 100%);
}

.agentorie-chat-toggle.style-outline {
	background: transparent;
	border: 3px solid var(--agentorie-primary);
	box-shadow: none;
}

.agentorie-chat-toggle.style-outline svg {
	fill: var(--agentorie-primary);
}

.agentorie-chat-toggle.style-outline:hover {
	background: var(--agentorie-primary);
}

.agentorie-chat-toggle.style-outline:hover svg {
	fill: var(--agentorie-primary-text);
}

/* Pulse Animation */
.agentorie-chat-toggle.pulse::before {
	content: '';
	position: absolute;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: var(--agentorie-primary);
	opacity: 0;
	animation: agentorie-pulse 2s ease-out infinite;
	z-index: -1;
}

@keyframes agentorie-pulse {
	0% {
		transform: scale(1);
		opacity: 0.4;
	}
	100% {
		transform: scale(1.5);
		opacity: 0;
	}
}

/* Unread Badge */
.agentorie-chat-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	background: #ef4444;
	color: #ffffff;
	font-size: 11px;
	font-weight: 600;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: agentorie-bounce 0.3s ease;
}

@keyframes agentorie-bounce {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.2); }
}

/* ==========================================================================
   Toggle Button Effects
   ========================================================================== */

.agentorie-chat-toggle.effect-glossy::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 50%;
	background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 100%);
	border-radius: inherit;
	pointer-events: none;
	z-index: 1;
}

.agentorie-chat-toggle.effect-radiant::after {
	content: '';
	position: absolute;
	inset: -2px;
	border-radius: inherit;
	background: conic-gradient(from 0deg, rgba(255,255,255,0.4), transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%, rgba(255,255,255,0.4));
	z-index: -1;
	animation: agentorie-radiant-spin 3s linear infinite;
}

@keyframes agentorie-radiant-spin {
	to { transform: rotate(360deg); }
}

.agentorie-chat-toggle.effect-glassmorphism {
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(255,255,255,0.2);
}

.agentorie-chat-toggle.effect-glassmorphism::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 50%;
	background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 100%);
	border-radius: inherit;
	pointer-events: none;
	z-index: 1;
}

/* ==========================================================================
   Toggle Button Animations
   ========================================================================== */

.agentorie-chat-toggle.anim-bounce {
	animation: agentorie-anim-bounce 2s ease infinite;
}

@keyframes agentorie-anim-bounce {
	0%, 100% { transform: translateY(0); }
	15% { transform: translateY(-8px); }
	30% { transform: translateY(0); }
	45% { transform: translateY(-4px); }
	60% { transform: translateY(0); }
}

.agentorie-chat-toggle.anim-shake {
	animation: agentorie-anim-shake 3s ease-in-out infinite;
}

@keyframes agentorie-anim-shake {
	0%, 85%, 100% { transform: rotate(0); }
	88% { transform: rotate(-8deg); }
	91% { transform: rotate(8deg); }
	94% { transform: rotate(-6deg); }
	97% { transform: rotate(4deg); }
}

.agentorie-chat-toggle.anim-rotate {
	animation: agentorie-anim-rotate 4s ease-in-out infinite;
}

@keyframes agentorie-anim-rotate {
	0%, 100% { transform: rotate(0deg) scale(1); }
	25% { transform: rotate(5deg) scale(1.03); }
	75% { transform: rotate(-5deg) scale(1.03); }
}

/* ==========================================================================
   Header Effects
   ========================================================================== */

.agentorie-chat-header.effect-glossy {
	position: relative;
	overflow: hidden;
}

.agentorie-chat-header.effect-glossy::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 50%;
	background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
	pointer-events: none;
}

.agentorie-chat-header.effect-glassmorphism {
	position: relative;
	overflow: hidden;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid rgba(255,255,255,0.15);
}

.agentorie-chat-header.effect-glassmorphism::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 50%;
	background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
	pointer-events: none;
}

/* ==========================================================================
   Chat Container (Window)
   ========================================================================== */

.agentorie-chat-container {
	position: absolute;
	bottom: 0;
	width: var(--agentorie-chat-width);
	height: var(--agentorie-chat-height);
	max-height: calc(100vh - 100px);
	min-height: 350px;
	background: var(--agentorie-background);
	border-radius: var(--agentorie-border-radius);
	box-shadow: var(--agentorie-shadow);
	display: none;
	flex-direction: column;
	overflow: hidden;
}

.agentorie-chat-widget.bottom-right .agentorie-chat-container {
	right: 0;
}

.agentorie-chat-widget.bottom-left .agentorie-chat-container {
	left: 0;
}

.agentorie-chat-container.active {
	display: flex;
	animation: agentorie-slideUp 0.3s ease;
}

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

/* Resize Handle */
.agentorie-chat-resize-handle {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 20px;
	cursor: ns-resize;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(180deg, rgba(0,0,0,0.03) 0%, transparent 100%);
	border-radius: var(--agentorie-radius) var(--agentorie-radius) 0 0;
	transition: background 0.2s;
}

/* Visual indicator (grip dots) */
.agentorie-chat-resize-handle::before {
	content: '';
	width: 40px;
	height: 4px;
	background: rgba(0,0,0,0.15);
	border-radius: 2px;
	transition: background 0.2s, width 0.2s;
}

.agentorie-chat-resize-handle:hover {
	background: linear-gradient(180deg, rgba(0,0,0,0.06) 0%, transparent 100%);
}

.agentorie-chat-resize-handle:hover::before {
	background: rgba(0,0,0,0.25);
	width: 50px;
}

/* Active state during resize */
.agentorie-chat-resize-handle:active::before,
.agentorie-chat-container.resizing .agentorie-chat-resize-handle::before {
	background: var(--agentorie-primary);
	width: 60px;
}

.agentorie-chat-container.resizing {
	user-select: none;
}

/* ==========================================================================
   Chat Header
   ========================================================================== */

.agentorie-chat-header {
	background: var(--agentorie-primary);
	color: var(--agentorie-primary-text);
	padding: 15px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.agentorie-chat-header.style-gradient {
	background: linear-gradient(135deg, var(--agentorie-primary) 0%, var(--agentorie-primary-dark) 100%);
}

.agentorie-chat-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1;
	min-width: 0;
}

.agentorie-chat-avatar {
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	flex-shrink: 0;
	position: relative;
	border: 2px solid rgba(255, 255, 255, 0.5);
	box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3);
	animation: agentorie-avatar-pulse 4s ease-in-out infinite;
}

@keyframes agentorie-avatar-pulse {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35);
	}
	50% {
		box-shadow: 0 0 0 5px rgba(255, 255, 255, 0);
	}
}

.agentorie-chat-avatar.hidden {
	display: none;
}

.agentorie-chat-header-text {
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

.agentorie-chat-header-text .agentorie-chat-bot-name {
	display: block;
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: inherit;
}

.agentorie-chat-header-text .agentorie-chat-bot-name span {
	font-size: inherit;
	font-weight: inherit;
	opacity: 1;
}

.agentorie-chat-header-status {
	font-size: 12px;
	opacity: 0.85;
	display: flex;
	align-items: center;
	gap: 5px;
}

.agentorie-status-dot {
	width: 8px;
	height: 8px;
	background: #22c55e;
	border-radius: 50%;
	display: inline-block;
}

.agentorie-chat-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.agentorie-chat-reset {
	width: 28px;
	height: 28px;
	background: rgba(255, 255, 255, 0.1);
	border: none;
	border-radius: 6px;
	color: inherit;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, transform 0.2s;
	padding: 0;
	opacity: 0.7;
}

.agentorie-chat-reset:hover {
	background: rgba(255, 255, 255, 0.2);
	opacity: 1;
	transform: rotate(-30deg);
}

.agentorie-chat-reset svg {
	width: 16px;
	height: 16px;
}

/* Reset Notice (admin only) */
.agentorie-reset-notice {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	margin: 10px 15px;
	background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
	border: 1px solid #bae6fd;
	border-radius: 8px;
	font-size: 12px;
	color: #0369a1;
	transition: opacity 0.3s ease;
}

.agentorie-reset-notice .reset-notice-icon {
	font-size: 14px;
}

.agentorie-reset-notice .reset-notice-text strong {
	color: #0c4a6e;
}

.agentorie-chat-close {
	width: 32px;
	height: 32px;
	background: rgba(255, 255, 255, 0.1);
	border: none;
	border-radius: 8px;
	color: inherit;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	padding: 0;
}

.agentorie-chat-close:hover {
	background: rgba(255, 255, 255, 0.2);
}

.agentorie-chat-close svg {
	width: 20px;
	height: 20px;
}

/* ==========================================================================
   Chat Messages
   ========================================================================== */

.agentorie-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 15px;
	background: var(--agentorie-background);
}

/* Welcome Message */
.agentorie-welcome-message {
	text-align: center;
	padding: 20px;
}

.agentorie-welcome-title {
	font-size: 24px;
	margin-bottom: 8px;
	color: var(--agentorie-bot-text);
	font-weight: var(--agentorie-welcome-weight, 600);
}

.agentorie-welcome-text {
	color: var(--agentorie-bot-text);
	font-size: 14px;
	font-weight: var(--agentorie-welcome-weight, 600);
}

/* Message Bubble */
.agentorie-message {
	display: flex;
	gap: 10px;
	max-width: 85%;
	animation: agentorie-fadeIn 0.3s ease;
}

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

.agentorie-message.user,
.agentorie-message.client {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.agentorie-message.bot,
.agentorie-message.assistant {
	align-self: flex-start;
}

.agentorie-message-avatar {
	width: 32px;
	height: 32px;
	background: #e5e7eb;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
}

.agentorie-message.user .agentorie-message-avatar,
.agentorie-message.client .agentorie-message-avatar {
	display: none;
}

/* Show client avatar when enabled */
.agentorie-chat-widget.show-client-avatar .agentorie-message.user .agentorie-message-avatar,
.agentorie-chat-widget.show-client-avatar .agentorie-message.client .agentorie-message-avatar {
	display: flex;
	background: var(--agentorie-user-bubble);
	color: var(--agentorie-user-text);
}

.agentorie-message-content {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.agentorie-message-text {
	padding: 12px 16px;
	border-radius: 16px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.agentorie-message.user .agentorie-message-text,
.agentorie-message.client .agentorie-message-text {
	background: var(--agentorie-user-bubble);
	color: var(--agentorie-user-text);
	border-bottom-right-radius: 4px;
}

.agentorie-message.bot .agentorie-message-text,
.agentorie-message.assistant .agentorie-message-text {
	background: var(--agentorie-bot-bubble);
	color: var(--agentorie-bot-text);
	border-bottom-left-radius: 4px;
}

/* Admin takeover message style */
.agentorie-message.admin .agentorie-message-text,
.agentorie-message.admin-message .agentorie-message-text {
	background: var(--agentorie-bot-bubble);
	color: var(--agentorie-bot-text);
	border-bottom-left-radius: 4px;
	border-left: 3px solid var(--agentorie-primary);
}

.agentorie-message-time {
	font-size: 11px;
	color: #9ca3af;
	padding: 0 4px;
}

.agentorie-message.user .agentorie-message-time,
.agentorie-message.client .agentorie-message-time {
	text-align: right;
}

/* TTS Button - next to timestamp */
.agentorie-message-footer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 4px;
}

.agentorie-tts-btn {
	background: none !important;
	background-color: transparent !important;
	border: none !important;
	box-shadow: none !important;
	cursor: pointer;
	padding: 2px !important;
	margin: 0 !important;
	opacity: 0.5;
	transition: opacity 0.2s, color 0.2s;
	color: #9ca3af;
	font-size: 14px;
	line-height: 1;
	display: inline-flex;
	align-items: center;
}

.agentorie-tts-btn:hover,
.agentorie-tts-btn:focus,
.agentorie-tts-btn:active {
	opacity: 1;
	color: var(--agentorie-primary);
	background: none !important;
	background-color: transparent !important;
	border: none !important;
	box-shadow: none !important;
	outline: none !important;
}

.agentorie-tts-btn.playing,
.agentorie-tts-btn.speaking {
	color: var(--agentorie-primary);
	opacity: 1;
}

.agentorie-tts-btn .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
	vertical-align: middle;
}

/* Typing Indicator */
.agentorie-typing {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 5px 0;
}

.agentorie-typing-avatar {
	width: 32px;
	height: 32px;
	background: #e5e7eb;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	flex-shrink: 0;
}

.agentorie-typing-dots {
	display: inline-flex;
	gap: 4px;
	padding: 12px 16px;
	background: var(--agentorie-bot-bubble);
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	width: auto;
}

.agentorie-typing-dot {
	width: 8px;
	height: 8px;
	background: #9ca3af;
	border-radius: 50%;
	animation: agentorie-typing 1.4s infinite;
}

.agentorie-typing-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.agentorie-typing-dot:nth-child(3) {
	animation-delay: 0.4s;
}

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

/* Admin Takeover Notice */
.agentorie-takeover-notice {
	text-align: center;
	padding: 10px;
	background: #fef3c7;
	color: #92400e;
	font-size: 13px;
	border-radius: 8px;
	margin: 10px 0;
}

/* ==========================================================================
   Chat Input
   ========================================================================== */

.agentorie-chat-input {
	padding: 15px 20px;
	border-top: 1px solid #e5e7eb;
	background: var(--agentorie-background);
	flex-shrink: 0;
}

.agentorie-input-wrapper {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #f3f4f6;
	border-radius: 24px;
	padding: 8px 8px 8px 16px;
}

.agentorie-chat-input input[type="text"] {
	flex: 1;
	border: none !important;
	background: transparent !important;
	font-size: 14px;
	line-height: 1.5;
	padding: 4px 0 !important;
	outline: none !important;
	box-shadow: none !important;
	font-family: inherit;
	min-width: 0;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.agentorie-chat-input input[type="text"]:focus,
.agentorie-chat-input input[type="text"]:active {
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
}

.agentorie-chat-input input[type="text"]::placeholder {
	color: #9ca3af;
}

.agentorie-chat-send {
	width: 36px;
	height: 36px;
	background: var(--agentorie-primary);
	color: var(--agentorie-primary-text);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s, transform 0.2s;
	padding: 0;
}

.agentorie-chat-send svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.agentorie-chat-send:hover {
	background: var(--agentorie-primary-dark);
}

/* Override theme styles (Astra, etc.) on focus/hover */
.agentorie-chat-widget .agentorie-chat-send:focus,
.agentorie-chat-widget .agentorie-chat-send:hover,
.agentorie-chat-widget .agentorie-chat-send:active,
.agentorie-chat-widget button.agentorie-chat-send:focus,
.agentorie-chat-widget button.agentorie-chat-send:hover {
	background: var(--agentorie-primary-dark) !important;
	background-color: var(--agentorie-primary-dark) !important;
	color: var(--agentorie-primary-text) !important;
	border-color: var(--agentorie-primary-dark) !important;
	outline: none;
}

.agentorie-chat-send:active {
	transform: scale(0.95);
}

.agentorie-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Voice/Mic Button */
.agentorie-chat-mic-btn {
	width: 36px;
	height: 36px;
	background: transparent;
	color: #6b7280;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: color 0.2s, background 0.2s;
	padding: 0;
}

.agentorie-chat-mic-btn:hover {
	color: var(--agentorie-primary);
	background: rgba(99, 102, 241, 0.1);
}

/* Override theme styles on mic button */
.agentorie-chat-widget .agentorie-chat-mic-btn:focus,
.agentorie-chat-widget .agentorie-chat-mic-btn:hover,
.agentorie-chat-widget button.agentorie-chat-mic-btn:focus,
.agentorie-chat-widget button.agentorie-chat-mic-btn:hover {
	color: var(--agentorie-primary) !important;
	background: rgba(99, 102, 241, 0.1) !important;
	background-color: rgba(99, 102, 241, 0.1) !important;
	border-color: transparent !important;
	outline: none;
}

/* Override theme styles on close button */
.agentorie-chat-widget .agentorie-chat-close:focus,
.agentorie-chat-widget .agentorie-chat-close:hover,
.agentorie-chat-widget button.agentorie-chat-close:focus,
.agentorie-chat-widget button.agentorie-chat-close:hover {
	background: rgba(255, 255, 255, 0.2) !important;
	background-color: rgba(255, 255, 255, 0.2) !important;
	color: inherit !important;
	border-color: transparent !important;
	outline: none;
}

/* Override theme styles on toggle button */
.agentorie-chat-widget .agentorie-chat-toggle:focus,
.agentorie-chat-widget .agentorie-chat-toggle:hover,
.agentorie-chat-widget button.agentorie-chat-toggle:focus,
.agentorie-chat-widget button.agentorie-chat-toggle:hover {
	background: var(--agentorie-primary) !important;
	background-color: var(--agentorie-primary) !important;
	color: var(--agentorie-primary-text) !important;
	border-color: var(--agentorie-primary) !important;
	outline: none;
}

.agentorie-chat-mic-btn.recording {
	color: #ef4444;
	background: rgba(239, 68, 68, 0.1);
	animation: agentorie-recording-pulse 1s infinite;
}

@keyframes agentorie-recording-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

.agentorie-chat-mic-btn .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}


/* ==========================================================================
   Contact Form
   ========================================================================== */

.agentorie-contact-form {
	padding: 20px;
	background: var(--agentorie-background);
}

.agentorie-contact-form .agentorie-form-title {
	margin: 0 0 15px 0;
	font-size: 16px;
	color: #1f2937;
}

.agentorie-form-group {
	margin-bottom: 12px;
}

.agentorie-form-group label {
	display: block;
	font-size: 12px;
	font-weight: 500;
	color: #374151;
	margin-bottom: 4px;
}

.agentorie-form-group input,
.agentorie-form-group textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	transition: border-color 0.2s;
}

.agentorie-form-group input:focus,
.agentorie-form-group textarea:focus {
	outline: none;
	border-color: var(--agentorie-primary);
}

.agentorie-form-group textarea {
	resize: vertical;
	min-height: 80px;
}

.agentorie-form-submit {
	width: 100%;
	padding: 12px;
	background: var(--agentorie-primary);
	color: var(--agentorie-primary-text);
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.2s;
}

.agentorie-form-submit:hover {
	background: var(--agentorie-primary-dark);
}

.agentorie-form-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.agentorie-form-success {
	text-align: center;
	padding: 20px;
	color: #059669;
}

.agentorie-form-success-icon {
	font-size: 48px;
	margin-bottom: 10px;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 480px) {
	.agentorie-chat-widget.bottom-right,
	.agentorie-chat-widget.bottom-left {
		bottom: 10px;
		right: 10px;
		left: 10px;
	}

	.agentorie-chat-container {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100% !important;
		height: 100% !important;
		max-height: 100%;
		border-radius: 0;
	}

	.agentorie-chat-widget.bottom-right .agentorie-chat-container,
	.agentorie-chat-widget.bottom-left .agentorie-chat-container {
		right: 0;
		left: 0;
	}

	.agentorie-chat-toggle {
		position: fixed;
		bottom: 15px;
		right: 15px;
	}

	.agentorie-chat-widget.bottom-left .agentorie-chat-toggle {
		right: auto;
		left: 15px;
	}

	.agentorie-chat-resize-handle {
		display: none;
	}

}

/* ==========================================================================
   Hide Widget Class
   ========================================================================== */

.agentorie-chat-widget.hidden {
	display: none !important;
}

/* ==========================================================================
   Scrollbar Styling
   ========================================================================== */

.agentorie-chat-messages::-webkit-scrollbar {
	width: 6px;
}

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

.agentorie-chat-messages::-webkit-scrollbar-thumb {
	background: #d1d5db;
	border-radius: 3px;
}

.agentorie-chat-messages::-webkit-scrollbar-thumb:hover {
	background: #9ca3af;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.agentorie-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Focus styles */
.agentorie-chat-toggle:focus,
.agentorie-chat-close:focus,
.agentorie-chat-send:focus,
.agentorie-chat-mic-btn:focus {
	outline: 2px solid var(--agentorie-primary);
	outline-offset: 2px;
}

.agentorie-chat-input input:focus-visible {
	outline: none;
}

/* ============================================
   LANGUAGE SELECTOR
   ============================================ */

/* --- Header Language Button --- */
.agentorie-lang-header-btn {
	display: flex;
	align-items: center;
	gap: 3px;
	height: 28px;
	padding: 0 8px;
	background: rgba(255, 255, 255, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 6px;
	color: inherit;
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.5px;
	transition: background 0.2s;
	white-space: nowrap;
}

.agentorie-lang-header-btn:hover {
	background: rgba(255, 255, 255, 0.25);
}

.agentorie-lang-header-btn.agentorie-hidden {
	display: none;
}

.agentorie-lang-header-code {
	font-size: 12px;
	font-weight: 700;
}

.agentorie-lang-chevron {
	width: 10px;
	height: 10px;
	opacity: 0.7;
}

/* --- Language Selector Panel (in messages area) --- */
.agentorie-lang-selector {
	padding: 8px 12px 16px;
	animation: agentorie-fadeIn 0.3s ease;
}

.agentorie-lang-selector-title {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 16px;
	font-weight: 600;
	color: var(--agentorie-bot-text);
	margin-bottom: 16px;
}

.agentorie-lang-globe {
	font-size: 20px;
}

/* --- Grid Mode (up to 10 languages) --- */
.agentorie-lang-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

/* Odd count: last item centered */
.agentorie-lang-grid .agentorie-lang-btn:last-child:nth-child(odd) {
	grid-column: 1 / -1;
	max-width: calc(50% - 4px);
	justify-self: center;
}

.agentorie-lang-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: var(--agentorie-bot-bubble);
	border: 2px solid transparent;
	border-radius: 10px;
	color: var(--agentorie-bot-text);
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	transition: all 0.2s ease;
	text-align: left;
	width: 100%;
}

.agentorie-lang-btn:hover {
	border-color: var(--agentorie-primary);
	background: var(--agentorie-background);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.agentorie-lang-btn.active {
	border-color: var(--agentorie-primary);
	background: var(--agentorie-primary);
	color: var(--agentorie-primary-text);
}

.agentorie-lang-btn.active .agentorie-lang-badge {
	background: rgba(255, 255, 255, 0.25);
	color: inherit;
}

.agentorie-lang-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	height: 22px;
	padding: 0 5px;
	background: var(--agentorie-primary);
	color: var(--agentorie-primary-text);
	border-radius: 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.5px;
	flex-shrink: 0;
}

.agentorie-lang-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* --- Dropdown Mode (more than 10 languages) --- */
.agentorie-lang-dropdown-wrap {
	padding: 0 4px;
}

.agentorie-lang-dropdown {
	width: 100%;
	padding: 10px 12px;
	border: 2px solid var(--agentorie-bot-bubble);
	border-radius: 10px;
	background: var(--agentorie-background);
	color: var(--agentorie-bot-text);
	font-size: 14px;
	font-family: inherit;
	cursor: pointer;
	transition: border-color 0.2s;
	appearance: auto;
}

.agentorie-lang-dropdown:hover,
.agentorie-lang-dropdown:focus {
	border-color: var(--agentorie-primary);
	outline: none;
}

/* --- Responsive --- */
@media (max-width: 480px) {
	.agentorie-lang-grid {
		gap: 6px;
	}

	.agentorie-lang-btn {
		padding: 8px 10px;
		font-size: 12px;
	}

	.agentorie-lang-badge {
		min-width: 24px;
		height: 20px;
		font-size: 9px;
	}
}

/* ============================================
   ONBOARDING BUTTON
   ============================================ */

.agentorie-onboarding-btn-container {
    padding: 0 12px 8px;
    background: inherit;
}

.agentorie-onboarding-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agentorie-onboarding-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.agentorie-onboarding-btn:active {
    transform: scale(0.98);
}

.agentorie-onboarding-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.agentorie-onboarding-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.agentorie-onboarding-btn.loading .dashicons::before {
    content: "\f463"; /* dashicons-update */
    animation: agentorie-spin 1s linear infinite;
}

@keyframes agentorie-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.agentorie-release-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    margin: 12px 0;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 20px;
    font-size: 13px;
    color: #2e7d32;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

.agentorie-release-notice .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}