/**
 * WP Live Chat & Query - Frontend Widget Styles (100% Theme-Isolated)
 */

:root {
	--lchat-primary: #2563eb;
	--lchat-primary-hover: #1d4ed8;
	--lchat-bg: #ffffff;
	--lchat-text: #0f172a;
	--lchat-muted: #64748b;
	--lchat-border: #e2e8f0;
	--lchat-radius: 18px;
	--lchat-shadow: 0 12px 40px rgba(0, 0, 0, 0.16), 0 3px 10px rgba(0, 0, 0, 0.06);
}

/* ==========================================================
   CSS RESET SCOPED TO WIDGET ROOT
   Prevents aggressive WordPress theme styles from bleeding in
   ========================================================== */
#lchat-widget-root,
#lchat-widget-root * {
	box-sizing: border-box !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
	line-height: 1.45 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	text-decoration: none;
}

#lchat-widget-root button {
	text-transform: none !important;
	letter-spacing: normal !important;
	font-family: inherit !important;
	border: none !important;
	outline: none !important;
	margin: 0 !important;
	background: none !important;
	box-shadow: none !important;
	cursor: pointer !important;
}

/* ==========================================================
   ROOT POSITIONING
   ========================================================== */
#lchat-widget-root {
	position: fixed !important;
	bottom: 26px !important;
	z-index: 999999 !important;
	font-size: 14px !important;
	color: var(--lchat-text) !important;
	-webkit-font-smoothing: antialiased !important;
}

#lchat-widget-root.lchat-pos-right {
	right: 26px !important;
	left: auto !important;
}

#lchat-widget-root.lchat-pos-left {
	left: 26px !important;
	right: auto !important;
}

/* ==========================================================
   FLOATING LAUNCHER TRIGGER BUTTON
   ========================================================== */
#lchat-widget-root button.lchat-trigger-btn,
#lchat-widget-root .lchat-trigger-btn {
	width: 62px !important;
	height: 62px !important;
	min-width: 62px !important;
	min-height: 62px !important;
	max-width: 62px !important;
	max-height: 62px !important;
	border-radius: 50% !important;
	background: var(--lchat-primary, #2563eb) !important;
	background-color: var(--lchat-primary, #2563eb) !important;
	color: #ffffff !important;
	border: none !important;
	outline: none !important;
	cursor: pointer !important;
	box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4), 0 2px 6px rgba(0, 0, 0, 0.08) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	position: relative !important;
	padding: 0 !important;
	margin: 0 !important;
	transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease !important;
}

#lchat-widget-root .lchat-trigger-btn:hover {
	transform: scale(1.08) !important;
	box-shadow: 0 10px 30px rgba(37, 99, 235, 0.55), 0 3px 8px rgba(0, 0, 0, 0.12) !important;
}

#lchat-widget-root .lchat-trigger-btn:active {
	transform: scale(0.94) !important;
}

#lchat-widget-root .lchat-trigger-btn svg {
	color: #ffffff !important;
	stroke: #ffffff !important;
	fill: none !important;
	transition: transform 0.25s ease !important;
}

#lchat-widget-root .lchat-trigger-btn .lchat-icon-close {
	display: none !important;
}

#lchat-widget-root.lchat-open .lchat-trigger-btn .lchat-icon-open {
	display: none !important;
}

#lchat-widget-root.lchat-open .lchat-trigger-btn .lchat-icon-close {
	display: block !important;
	transform: rotate(90deg);
}

#lchat-widget-root .lchat-unread-dot {
	position: absolute !important;
	top: -2px !important;
	right: -2px !important;
	background-color: #ef4444 !important;
	color: #ffffff !important;
	font-size: 11px !important;
	font-weight: 700 !important;
	min-width: 21px !important;
	height: 21px !important;
	border-radius: 50% !important;
	align-items: center !important;
	justify-content: center !important;
	border: 2px solid #ffffff !important;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
	animation: lchatPulse 1.8s infinite !important;
	display: none !important;
}

#lchat-widget-root .lchat-unread-dot.lchat-has-unread {
	display: flex !important;
}

@keyframes lchatPulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.15); }
	100% { transform: scale(1); }
}

/* ==========================================================
   CHAT BOX POPUP WINDOW
   ========================================================== */
#lchat-widget-root .lchat-box {
	position: absolute !important;
	bottom: 78px !important;
	width: 380px !important;
	max-width: calc(100vw - 32px) !important;
	height: 570px !important;
	max-height: calc(100vh - 110px) !important;
	background: #ffffff !important;
	border-radius: var(--lchat-radius) !important;
	box-shadow: var(--lchat-shadow) !important;
	display: flex !important;
	flex-direction: column !important;
	overflow: hidden !important;
	opacity: 0 !important;
	visibility: hidden !important;
	transform: translateY(18px) scale(0.96) !important;
	transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s !important;
	border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

#lchat-widget-root.lchat-pos-right .lchat-box {
	right: 0 !important;
	left: auto !important;
}

#lchat-widget-root.lchat-pos-left .lchat-box {
	left: 0 !important;
	right: auto !important;
}

#lchat-widget-root.lchat-open .lchat-box {
	opacity: 1 !important;
	visibility: visible !important;
	transform: translateY(0) scale(1) !important;
}

/* ==========================================================
   HEADER
   ========================================================== */
#lchat-widget-root .lchat-header {
	background: linear-gradient(135deg, var(--lchat-primary, #2563eb) 0%, #1d4ed8 100%) !important;
	color: #ffffff !important;
	padding: 16px 18px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	flex-shrink: 0 !important;
	border-top-left-radius: var(--lchat-radius) !important;
	border-top-right-radius: var(--lchat-radius) !important;
}

#lchat-widget-root .lchat-header-info {
	display: flex !important;
	align-items: center !important;
	gap: 12px !important;
}

#lchat-widget-root .lchat-avatar {
	width: 38px !important;
	height: 38px !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.22) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	position: relative !important;
	color: #ffffff !important;
	flex-shrink: 0 !important;
}

#lchat-widget-root .lchat-avatar svg {
	stroke: #ffffff !important;
	color: #ffffff !important;
}

#lchat-widget-root .lchat-status-dot {
	position: absolute !important;
	bottom: 0px !important;
	right: 0px !important;
	width: 10px !important;
	height: 10px !important;
	border-radius: 50% !important;
	background-color: #22c55e !important;
	border: 2px solid #ffffff !important;
}

#lchat-widget-root .lchat-header-text {
	display: flex !important;
	flex-direction: column !important;
}

#lchat-widget-root .lchat-title {
	font-weight: 700 !important;
	font-size: 15.5px !important;
	color: #ffffff !important;
	margin: 0 !important;
	line-height: 1.25 !important;
}

#lchat-widget-root .lchat-agent-status {
	font-size: 12px !important;
	color: rgba(255, 255, 255, 0.88) !important;
	margin-top: 2px !important;
}

#lchat-widget-root .lchat-header-actions {
	display: flex !important;
	align-items: center !important;
	gap: 6px !important;
}

#lchat-widget-root button.lchat-hdr-btn,
#lchat-widget-root .lchat-hdr-btn {
	background: rgba(255, 255, 255, 0.18) !important;
	background-color: rgba(255, 255, 255, 0.18) !important;
	border: none !important;
	color: #ffffff !important;
	border-radius: 50% !important;
	width: 32px !important;
	height: 32px !important;
	min-width: 32px !important;
	min-height: 32px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	transition: background 0.2s ease, transform 0.1s !important;
	padding: 0 !important;
}

#lchat-widget-root .lchat-hdr-btn:hover {
	background: rgba(255, 255, 255, 0.32) !important;
	background-color: rgba(255, 255, 255, 0.32) !important;
	transform: scale(1.06) !important;
}

#lchat-widget-root .lchat-hdr-btn svg {
	color: #ffffff !important;
	stroke: #ffffff !important;
	fill: none !important;
}

/* ==========================================================
   SCREENS
   ========================================================== */
#lchat-widget-root .lchat-screen {
	display: none !important;
	flex-direction: column !important;
	flex: 1 !important;
	overflow: hidden !important;
	background: #ffffff !important;
}

#lchat-widget-root .lchat-screen.lchat-screen-visible {
	display: flex !important;
}

/* SCREEN 1: PRE-CHAT */
#lchat-widget-root .lchat-welcome-banner {
	background: #f8fafc !important;
	padding: 12px 18px !important;
	border-bottom: 1px solid var(--lchat-border) !important;
}

#lchat-widget-root .lchat-welcome-text {
	margin: 0 !important;
	font-size: 13px !important;
	color: var(--lchat-muted) !important;
	line-height: 1.45 !important;
}

/* ==========================================================
   SEGMENTED TABS (LIVE CHAT VS SEND QUERY)
   ========================================================== */
#lchat-widget-root .lchat-tabs {
	display: flex !important;
	background: #f1f5f9 !important;
	padding: 4px !important;
	margin: 12px 16px 8px !important;
	border-radius: 12px !important;
	gap: 4px !important;
	border: none !important;
}

#lchat-widget-root button.lchat-tab-btn,
#lchat-widget-root .lchat-tab-btn {
	flex: 1 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px !important;
	padding: 8px 12px !important;
	border: none !important;
	background: transparent !important;
	background-color: transparent !important;
	color: var(--lchat-muted) !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	border-radius: 9px !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	box-shadow: none !important;
}

#lchat-widget-root .lchat-tab-btn svg {
	stroke: currentColor !important;
}

#lchat-widget-root .lchat-tab-btn.active {
	background: #ffffff !important;
	background-color: #ffffff !important;
	color: var(--lchat-primary, #2563eb) !important;
	font-weight: 700 !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
	border: none !important;
}

#lchat-widget-root .lchat-tab-btn.active svg {
	stroke: var(--lchat-primary, #2563eb) !important;
}

/* ==========================================================
   FORM INPUTS & LABELS
   ========================================================== */
#lchat-widget-root .lchat-tab-content {
	display: none !important;
	flex: 1 !important;
	overflow-y: auto !important;
	padding: 10px 16px 16px !important;
}

#lchat-widget-root .lchat-tab-content.active {
	display: block !important;
}

#lchat-widget-root .lchat-form-hint {
	font-size: 12px !important;
	color: var(--lchat-muted) !important;
	margin: 0 0 10px !important;
}

#lchat-widget-root .lchat-form-group {
	margin-bottom: 12px !important;
}

#lchat-widget-root .lchat-form-group label {
	display: block !important;
	font-size: 12.5px !important;
	font-weight: 600 !important;
	color: #334155 !important;
	margin-bottom: 4px !important;
}

#lchat-widget-root .lchat-required {
	color: #ef4444 !important;
}

#lchat-widget-root .lchat-optional {
	font-weight: normal !important;
	color: #94a3b8 !important;
	font-size: 11.5px !important;
}

#lchat-widget-root input[type="text"],
#lchat-widget-root input[type="email"],
#lchat-widget-root textarea {
	width: 100% !important;
	box-sizing: border-box !important;
	padding: 10px 13px !important;
	border: 1.5px solid var(--lchat-border) !important;
	border-radius: 9px !important;
	font-size: 13.5px !important;
	font-family: inherit !important;
	background: #f8fafc !important;
	color: #0f172a !important;
	transition: border-color 0.2s, box-shadow 0.2s, background 0.2s !important;
	box-shadow: none !important;
}

#lchat-widget-root input[type="text"]:focus,
#lchat-widget-root input[type="email"]:focus,
#lchat-widget-root textarea:focus {
	outline: none !important;
	background: #ffffff !important;
	border-color: var(--lchat-primary, #2563eb) !important;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

#lchat-widget-root textarea {
	resize: none !important;
}

#lchat-widget-root .lchat-form-error {
	background: #fef2f2 !important;
	color: #b91c1c !important;
	padding: 8px 12px !important;
	border-radius: 6px !important;
	font-size: 12px !important;
	margin-bottom: 10px !important;
	border-left: 3px solid #ef4444 !important;
}

/* ==========================================================
   PRIMARY SUBMIT BUTTONS
   Fixes the transparent/red-border theme overrides
   ========================================================== */
#lchat-widget-root button.lchat-submit-btn,
#lchat-widget-root .lchat-submit-btn {
	width: 100% !important;
	background: var(--lchat-primary, #2563eb) !important;
	background-color: var(--lchat-primary, #2563eb) !important;
	color: #ffffff !important;
	border: none !important;
	padding: 12px 18px !important;
	border-radius: 10px !important;
	font-size: 14.5px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px !important;
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.32) !important;
	transition: background 0.2s, transform 0.12s, box-shadow 0.2s !important;
	text-decoration: none !important;
}

#lchat-widget-root .lchat-submit-btn:hover {
	background: var(--lchat-primary-hover, #1d4ed8) !important;
	background-color: var(--lchat-primary-hover, #1d4ed8) !important;
	box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45) !important;
	transform: translateY(-1px) !important;
}

#lchat-widget-root .lchat-submit-btn:active {
	transform: translateY(0) !important;
}

#lchat-widget-root .lchat-submit-btn span {
	color: #ffffff !important;
	font-weight: 600 !important;
}

#lchat-widget-root .lchat-submit-btn svg {
	color: #ffffff !important;
	stroke: #ffffff !important;
	fill: none !important;
}

#lchat-widget-root .lchat-submit-btn:disabled {
	opacity: 0.7 !important;
	cursor: not-allowed !important;
}

/* SUCCESS CARD */
#lchat-widget-root .lchat-success-card {
	text-align: center !important;
	padding: 30px 16px !important;
}

#lchat-widget-root .lchat-success-icon {
	width: 56px !important;
	height: 56px !important;
	border-radius: 50% !important;
	background: #dcfce7 !important;
	color: #16a34a !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	margin: 0 auto 16px !important;
}

#lchat-widget-root .lchat-success-icon svg {
	stroke: #16a34a !important;
}

#lchat-widget-root .lchat-success-card h4 {
	margin: 0 0 8px !important;
	font-size: 18px !important;
	color: #0f172a !important;
	font-weight: 700 !important;
}

#lchat-widget-root .lchat-success-card p {
	font-size: 13px !important;
	color: var(--lchat-muted) !important;
	line-height: 1.5 !important;
	margin: 0 0 20px !important;
}

#lchat-widget-root button.lchat-btn-secondary,
#lchat-widget-root .lchat-btn-secondary {
	background: #f1f5f9 !important;
	background-color: #f1f5f9 !important;
	color: #334155 !important;
	border: 1px solid var(--lchat-border) !important;
	padding: 9px 18px !important;
	border-radius: 8px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
}

#lchat-widget-root .lchat-btn-secondary:hover {
	background: #e2e8f0 !important;
}

/* ==========================================================
   SCREEN 2: ACTIVE LIVE CHAT
   ========================================================== */
#lchat-widget-root .lchat-chat-subheader {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	padding: 8px 16px !important;
	background: #f8fafc !important;
	border-bottom: 1px solid var(--lchat-border) !important;
	font-size: 12px !important;
}

#lchat-widget-root .lchat-chat-session-badge {
	color: #16a34a !important;
	font-weight: 600 !important;
	display: flex !important;
	align-items: center !important;
	gap: 6px !important;
}

#lchat-widget-root .lchat-chat-session-badge::before {
	content: "" !important;
	width: 7px !important;
	height: 7px !important;
	border-radius: 50% !important;
	background-color: #22c55e !important;
	display: inline-block !important;
}

#lchat-widget-root button.lchat-link-btn,
#lchat-widget-root .lchat-link-btn {
	background: none !important;
	border: none !important;
	color: #94a3b8 !important;
	font-size: 12px !important;
	cursor: pointer !important;
	text-decoration: underline !important;
	padding: 0 !important;
}

#lchat-widget-root .lchat-link-btn:hover {
	color: #ef4444 !important;
}

#lchat-widget-root .lchat-messages-container {
	flex: 1 !important;
	overflow-y: auto !important;
	padding: 16px !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 12px !important;
	background: #f8fafc !important;
}

/* Chat Bubbles */
#lchat-widget-root .lchat-msg-row {
	display: flex !important;
	flex-direction: column !important;
	max-width: 80% !important;
}

#lchat-widget-root .lchat-msg-row.lchat-msg-visitor {
	align-self: flex-end !important;
	align-items: flex-end !important;
}

#lchat-widget-root .lchat-msg-row.lchat-msg-agent {
	align-self: flex-start !important;
	align-items: flex-start !important;
}

#lchat-widget-root .lchat-msg-row.lchat-msg-system {
	align-self: center !important;
	align-items: center !important;
	max-width: 90% !important;
}

#lchat-widget-root .lchat-msg-sender {
	font-size: 11px !important;
	color: var(--lchat-muted) !important;
	margin-bottom: 3px !important;
	font-weight: 600 !important;
}

#lchat-widget-root .lchat-msg-bubble {
	padding: 10px 14px !important;
	border-radius: 14px !important;
	font-size: 13.5px !important;
	line-height: 1.45 !important;
	word-break: break-word !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

#lchat-widget-root .lchat-msg-visitor .lchat-msg-bubble {
	background-color: var(--lchat-primary, #2563eb) !important;
	color: #ffffff !important;
	border-bottom-right-radius: 2px !important;
}

#lchat-widget-root .lchat-msg-agent .lchat-msg-bubble {
	background-color: #ffffff !important;
	color: var(--lchat-text) !important;
	border: 1px solid var(--lchat-border) !important;
	border-bottom-left-radius: 2px !important;
}

#lchat-widget-root .lchat-msg-system .lchat-msg-bubble {
	background-color: #e2e8f0 !important;
	color: #475569 !important;
	font-size: 12px !important;
	padding: 6px 12px !important;
	border-radius: 20px !important;
	text-align: center !important;
}

#lchat-widget-root .lchat-msg-time {
	font-size: 10px !important;
	color: #94a3b8 !important;
	margin-top: 3px !important;
}

/* Closed Banner */
#lchat-widget-root .lchat-closed-banner {
	background: #fef2f2 !important;
	color: #991b1b !important;
	padding: 10px 16px !important;
	font-size: 12px !important;
	text-align: center !important;
	border-top: 1px solid #fee2e2 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 10px !important;
}

#lchat-widget-root button.lchat-btn-mini,
#lchat-widget-root .lchat-btn-mini {
	background: #ef4444 !important;
	background-color: #ef4444 !important;
	color: #ffffff !important;
	border: none !important;
	padding: 3px 8px !important;
	border-radius: 4px !important;
	font-size: 11px !important;
	cursor: pointer !important;
}

/* Chat Input Bar */
#lchat-widget-root .lchat-input-area {
	padding: 12px 14px !important;
	border-top: 1px solid var(--lchat-border) !important;
	background: #ffffff !important;
	display: flex !important;
	align-items: center !important;
	gap: 8px !important;
}

#lchat-widget-root .lchat-input-area textarea {
	flex: 1 !important;
	border: 1.5px solid var(--lchat-border) !important;
	border-radius: 20px !important;
	padding: 9px 14px !important;
	font-size: 13px !important;
	font-family: inherit !important;
	resize: none !important;
	max-height: 100px !important;
	outline: none !important;
	line-height: 1.4 !important;
	color: var(--lchat-text) !important;
	background: #f8fafc !important;
	transition: border-color 0.2s !important;
}

#lchat-widget-root .lchat-input-area textarea:focus {
	border-color: var(--lchat-primary, #2563eb) !important;
	background: #ffffff !important;
}

#lchat-widget-root button.lchat-btn-send,
#lchat-widget-root .lchat-btn-send {
	width: 38px !important;
	height: 38px !important;
	min-width: 38px !important;
	min-height: 38px !important;
	border-radius: 50% !important;
	background: var(--lchat-primary, #2563eb) !important;
	background-color: var(--lchat-primary, #2563eb) !important;
	color: #ffffff !important;
	border: none !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0 !important;
	transition: background 0.2s, transform 0.1s !important;
	padding: 0 !important;
}

#lchat-widget-root .lchat-btn-send:hover {
	background: var(--lchat-primary-hover, #1d4ed8) !important;
	background-color: var(--lchat-primary-hover, #1d4ed8) !important;
	transform: scale(1.05) !important;
}

#lchat-widget-root .lchat-btn-send svg {
	color: #ffffff !important;
	stroke: #ffffff !important;
	fill: none !important;
}

/* Footer Bar */
#lchat-widget-root .lchat-footer-bar {
	text-align: center !important;
	font-size: 11px !important;
	color: #94a3b8 !important;
	padding: 6px !important;
	background: #f8fafc !important;
	border-top: 1px solid #f1f5f9 !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
	#lchat-widget-root {
		bottom: 16px !important;
	}
	#lchat-widget-root.lchat-pos-right {
		right: 16px !important;
	}
	#lchat-widget-root.lchat-pos-left {
		left: 16px !important;
	}
	#lchat-widget-root .lchat-box {
		position: fixed !important;
		bottom: 0 !important;
		left: 0 !important;
		right: 0 !important;
		width: 100vw !important;
		max-width: 100vw !important;
		height: 100vh !important;
		max-height: 100vh !important;
		border-radius: 0 !important;
	}
}
