/**
 * Ninja Live Chat — front-end widget styles.
 * All colors/sizes are driven by CSS custom properties injected from settings.
 */

.nlc-root {
	--nlc-primary: #2563eb;
	--nlc-accent: #1e40af;
	--nlc-on-primary: #ffffff;
	--nlc-visitor-bg: #2563eb;
	--nlc-visitor-text: #ffffff;
	--nlc-agent-bg: #f1f5f9;
	--nlc-agent-text: #0f172a;
	--nlc-radius: 16px;
	--nlc-surface: #ffffff;
	--nlc-text: #111827;
	--nlc-muted: #6b7280;
	--nlc-border: #e5e7eb;
	--nlc-input-bg: #ffffff;
	--nlc-shadow: 0 18px 48px rgba(15, 23, 42, .18);
	--nlc-offset-x: 24px;
	--nlc-offset-y: 24px;

	position: fixed;
	z-index: 999999;
	font-size: 15px;
	line-height: 1.5;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--nlc-text);
	-webkit-font-smoothing: antialiased;
}

.nlc-root.nlc-dark {
	--nlc-surface: #111827;
	--nlc-text: #f9fafb;
	--nlc-muted: #9ca3af;
	--nlc-border: #1f2937;
	--nlc-agent-bg: #1f2937;
	--nlc-agent-text: #f3f4f6;
	--nlc-input-bg: #1f2937;
	--nlc-shadow: 0 18px 48px rgba(0, 0, 0, .5);
}

.nlc-root * {
	box-sizing: border-box;
}

/* Positioning ----------------------------------------------------------- */

.nlc-root.nlc-bottom-right {
	right: var(--nlc-offset-x);
	bottom: var(--nlc-offset-y);
	align-items: flex-end;
}

.nlc-root.nlc-bottom-left {
	left: var(--nlc-offset-x);
	bottom: var(--nlc-offset-y);
	align-items: flex-start;
}

/* Launcher -------------------------------------------------------------- */

.nlc-launcher {
	display: flex;
	align-items: center;
	gap: 10px;
	border: 0;
	cursor: pointer;
	background: var(--nlc-primary);
	color: var(--nlc-on-primary);
	box-shadow: 0 10px 26px rgba(37, 99, 235, .38);
	transition: transform .18s ease, box-shadow .18s ease;
	font: inherit;
	font-weight: 600;
	padding: 0;
	position: relative;
}

.nlc-launcher:hover {
	transform: translateY(-2px) scale(1.03);
	box-shadow: 0 14px 32px rgba(37, 99, 235, .48);
}

.nlc-launcher:focus-visible {
	outline: 3px solid var(--nlc-accent);
	outline-offset: 3px;
}

.nlc-launcher.nlc-style-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	justify-content: center;
}

.nlc-launcher.nlc-style-pill {
	height: 54px;
	border-radius: 999px;
	padding: 0 22px 0 18px;
}

.nlc-launcher.nlc-style-bar {
	height: 50px;
	border-radius: var(--nlc-radius) var(--nlc-radius) 0 0;
	padding: 0 24px;
}

.nlc-launcher svg {
	width: 26px;
	height: 26px;
	flex: 0 0 auto;
	fill: currentColor;
}

.nlc-launcher-label {
	white-space: nowrap;
}

.nlc-launcher.nlc-style-bubble .nlc-launcher-label {
	display: none;
}

.nlc-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	border-radius: 11px;
	background: #ef4444;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0 6px;
	border: 2px solid var(--nlc-surface);
}

.nlc-badge.nlc-show {
	display: flex;
}

/* Teaser bubble --------------------------------------------------------- */

.nlc-teaser {
	display: none;
	max-width: 270px;
	background: var(--nlc-surface);
	color: var(--nlc-text);
	border: 1px solid var(--nlc-border);
	border-radius: 14px;
	padding: 13px 38px 13px 15px;
	margin-bottom: 12px;
	box-shadow: var(--nlc-shadow);
	position: relative;
	cursor: pointer;
	font-size: 14px;
	animation: nlc-pop .3s ease;
}

.nlc-teaser.nlc-show {
	display: block;
}

.nlc-teaser-close {
	position: absolute;
	top: 6px;
	right: 8px;
	background: none;
	border: 0;
	color: var(--nlc-muted);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 5px;
	border-radius: 5px;
}

.nlc-teaser-close:hover {
	background: var(--nlc-agent-bg);
}

/* Panel ----------------------------------------------------------------- */

.nlc-panel {
	display: none;
	flex-direction: column;
	width: 372px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 120px);
	background: var(--nlc-surface);
	border-radius: var(--nlc-radius);
	box-shadow: var(--nlc-shadow);
	overflow: hidden;
	margin-bottom: 14px;
	border: 1px solid var(--nlc-border);
}

.nlc-panel.nlc-open {
	display: flex;
	animation: nlc-slide-up .26s cubic-bezier(.16, 1, .3, 1);
}

@keyframes nlc-slide-up {
	from {
		opacity: 0;
		transform: translateY(18px) scale(.97);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes nlc-pop {
	from {
		opacity: 0;
		transform: scale(.92);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* Header ---------------------------------------------------------------- */

.nlc-header {
	background: linear-gradient(135deg, var(--nlc-primary), var(--nlc-accent));
	color: var(--nlc-on-primary);
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 0 0 auto;
}

.nlc-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .22);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 16px;
	overflow: hidden;
	flex: 0 0 auto;
}

.nlc-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nlc-header-text {
	flex: 1 1 auto;
	min-width: 0;
}

.nlc-title {
	font-weight: 600;
	font-size: 16px;
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nlc-subtitle {
	font-size: 12.5px;
	opacity: .9;
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
}

.nlc-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #22c55e;
	flex: 0 0 auto;
	box-shadow: 0 0 0 3px rgba(34, 197, 94, .3);
}

.nlc-dot.nlc-away {
	background: #f59e0b;
	box-shadow: 0 0 0 3px rgba(245, 158, 11, .3);
}

.nlc-header-actions {
	display: flex;
	gap: 2px;
	flex: 0 0 auto;
}

.nlc-icon-btn {
	background: rgba(255, 255, 255, .16);
	border: 0;
	color: inherit;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	line-height: 1;
	transition: background .15s ease;
}

.nlc-icon-btn:hover {
	background: rgba(255, 255, 255, .3);
}

/* Body ------------------------------------------------------------------ */

.nlc-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px;
	background: var(--nlc-surface);
	scrollbar-width: thin;
}

.nlc-body::-webkit-scrollbar {
	width: 7px;
}

.nlc-body::-webkit-scrollbar-thumb {
	background: var(--nlc-border);
	border-radius: 4px;
}

/* Messages -------------------------------------------------------------- */

.nlc-msg {
	display: flex;
	margin-bottom: 12px;
	animation: nlc-pop .2s ease;
}

.nlc-msg.nlc-from-visitor {
	justify-content: flex-end;
}

.nlc-bubble {
	max-width: 78%;
	padding: 10px 14px;
	border-radius: 15px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	font-size: 14.5px;
}

.nlc-from-visitor .nlc-bubble {
	background: var(--nlc-visitor-bg);
	color: var(--nlc-visitor-text);
	border-bottom-right-radius: 5px;
}

.nlc-from-agent .nlc-bubble {
	background: var(--nlc-agent-bg);
	color: var(--nlc-agent-text);
	border-bottom-left-radius: 5px;
}

.nlc-bubble a {
	color: inherit;
	text-decoration: underline;
}

.nlc-meta {
	font-size: 11px;
	color: var(--nlc-muted);
	margin-top: 4px;
	padding: 0 4px;
}

.nlc-from-visitor .nlc-meta {
	text-align: right;
}

.nlc-msg-wrap {
	max-width: 82%;
}

.nlc-system {
	text-align: center;
	font-size: 12px;
	color: var(--nlc-muted);
	margin: 14px 0;
	position: relative;
}

.nlc-system span {
	background: var(--nlc-surface);
	padding: 0 10px;
	position: relative;
	z-index: 1;
}

.nlc-system::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 1px;
	background: var(--nlc-border);
}

/* Typing indicator ------------------------------------------------------ */

.nlc-typing {
	display: none;
	align-items: center;
	gap: 4px;
	padding: 11px 15px;
	background: var(--nlc-agent-bg);
	border-radius: 15px;
	border-bottom-left-radius: 5px;
	width: fit-content;
	margin-bottom: 12px;
}

.nlc-typing.nlc-show {
	display: flex;
}

.nlc-typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--nlc-muted);
	animation: nlc-blink 1.3s infinite both;
}

.nlc-typing i:nth-child(2) {
	animation-delay: .18s;
}

.nlc-typing i:nth-child(3) {
	animation-delay: .36s;
}

@keyframes nlc-blink {
	0%, 80%, 100% {
		opacity: .28;
		transform: translateY(0);
	}
	40% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

/* Forms ----------------------------------------------------------------- */

.nlc-form {
	padding: 4px 0;
}

.nlc-form-intro {
	font-size: 14px;
	color: var(--nlc-muted);
	margin-bottom: 16px;
}

.nlc-field {
	margin-bottom: 12px;
}

.nlc-field label {
	display: block;
	font-size: 12.5px;
	font-weight: 600;
	margin-bottom: 5px;
	color: var(--nlc-text);
}

.nlc-field .nlc-req {
	color: #ef4444;
}

.nlc-root input[type="text"],
.nlc-root input[type="email"],
.nlc-root input[type="tel"],
.nlc-root textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--nlc-border);
	border-radius: 9px;
	font: inherit;
	font-size: 14px;
	background: var(--nlc-input-bg);
	color: var(--nlc-text);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.nlc-root input:focus,
.nlc-root textarea:focus {
	outline: 0;
	border-color: var(--nlc-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}

.nlc-root textarea {
	resize: vertical;
	min-height: 84px;
}

.nlc-btn {
	width: 100%;
	padding: 11px 18px;
	border: 0;
	border-radius: 9px;
	background: var(--nlc-primary);
	color: var(--nlc-on-primary);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: filter .15s ease;
}

.nlc-btn:hover {
	filter: brightness(1.08);
}

.nlc-btn:disabled {
	opacity: .6;
	cursor: not-allowed;
}

.nlc-btn-ghost {
	background: transparent;
	color: var(--nlc-primary);
	border: 1px solid var(--nlc-border);
}

.nlc-consent {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	font-size: 12.5px;
	color: var(--nlc-muted);
	margin-bottom: 14px;
}

.nlc-consent input {
	margin-top: 3px;
	flex: 0 0 auto;
}

.nlc-error {
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
	border-radius: 8px;
	padding: 9px 12px;
	font-size: 13px;
	margin-bottom: 12px;
	display: none;
}

.nlc-error.nlc-show {
	display: block;
}

.nlc-success {
	background: #f0fdf4;
	color: #15803d;
	border: 1px solid #bbf7d0;
	border-radius: 8px;
	padding: 9px 12px;
	font-size: 13px;
	margin-bottom: 12px;
}

/* Composer -------------------------------------------------------------- */

.nlc-composer {
	flex: 0 0 auto;
	border-top: 1px solid var(--nlc-border);
	padding: 11px 12px;
	background: var(--nlc-surface);
	display: none;
}

.nlc-composer.nlc-show {
	display: block;
}

.nlc-composer-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.nlc-composer textarea {
	flex: 1 1 auto;
	min-height: 42px;
	max-height: 120px;
	border-radius: 21px;
	padding: 11px 15px;
	resize: none;
	overflow-y: auto;
}

.nlc-send {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 0;
	background: var(--nlc-primary);
	color: var(--nlc-on-primary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	transition: filter .15s ease;
}

.nlc-send:hover {
	filter: brightness(1.1);
}

.nlc-send svg {
	width: 19px;
	height: 19px;
	fill: currentColor;
}

.nlc-counter {
	font-size: 11px;
	color: var(--nlc-muted);
	text-align: right;
	margin-top: 4px;
	min-height: 14px;
}

/* Rating ---------------------------------------------------------------- */

.nlc-rating {
	text-align: center;
	padding: 8px 0 4px;
}

.nlc-rating-prompt {
	font-size: 13.5px;
	color: var(--nlc-muted);
	margin-bottom: 8px;
}

.nlc-stars {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-bottom: 10px;
}

.nlc-star {
	background: none;
	border: 0;
	font-size: 25px;
	line-height: 1;
	cursor: pointer;
	color: #d1d5db;
	transition: transform .12s ease, color .12s ease;
	padding: 0;
}

.nlc-star:hover,
.nlc-star.nlc-active {
	color: #f59e0b;
	transform: scale(1.14);
}

/* Footer ---------------------------------------------------------------- */

.nlc-footer {
	flex: 0 0 auto;
	text-align: center;
	font-size: 11px;
	color: var(--nlc-muted);
	padding: 7px;
	border-top: 1px solid var(--nlc-border);
	background: var(--nlc-surface);
}

.nlc-footer a {
	color: var(--nlc-muted);
	text-decoration: none;
}

/* Quick replies --------------------------------------------------------- */

.nlc-quick {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	margin-bottom: 12px;
}

.nlc-chip {
	background: transparent;
	border: 1px solid var(--nlc-primary);
	color: var(--nlc-primary);
	border-radius: 999px;
	padding: 6px 13px;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.nlc-chip:hover {
	background: var(--nlc-primary);
	color: var(--nlc-on-primary);
}

/* Mobile ---------------------------------------------------------------- */

@media (max-width: 480px) {
	.nlc-panel {
		width: 100vw;
		height: 100vh;
		max-height: 100vh;
		max-width: 100vw;
		border-radius: 0;
		margin: 0;
		border: 0;
		position: fixed;
		inset: 0;
	}

	.nlc-root.nlc-panel-open .nlc-launcher,
	.nlc-root.nlc-panel-open .nlc-teaser {
		display: none;
	}

	.nlc-root {
		--nlc-offset-x: 16px;
		--nlc-offset-y: 16px;
	}
}

.nlc-hidden {
	display: none !important;
}

.nlc-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
