/* NordTvätt Supportbot – allt är scopat under #ntsb-root och nollställt, så att temat (Astra/Elementor) inte kan påverka det. */
#ntsb-root {
	--ntsb-blue: #1863DC;
	--ntsb-blue-dark: #1150B8;
	--ntsb-navy: #0A1E3C;
	--ntsb-bg: #FFFFFF;
	--ntsb-soft: #F4F7FC;
	--ntsb-border: #E3E9F3;
	--ntsb-text: #1A2333;
	--ntsb-muted: #6A768A;
	--ntsb-online: #22C55E;
	--ntsb-right: 25px;
	--ntsb-bottom: 25px;
	position: fixed;
	right: var(--ntsb-right);
	bottom: var(--ntsb-bottom);
	z-index: 2147483000; /* över cookie-knappar och andra flytande widgets */
	font-family: 'Noto Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--ntsb-text);
	text-align: left;
	-webkit-font-smoothing: antialiased;
}
/* Ligger Chaty-knappen i samma hörn lyfts chatten ovanför den (sätts av chat.js). */
#ntsb-root.ntsb-above-chaty { --ntsb-bottom: 95px; }

#ntsb-root *, #ntsb-root *::before, #ntsb-root *::after { box-sizing: border-box; }
#ntsb-root button, #ntsb-root textarea {
	all: unset;
	box-sizing: border-box;
	font-family: inherit;
}
#ntsb-root button { cursor: pointer; }
#ntsb-root button:focus-visible, #ntsb-root textarea:focus-visible {
	outline: 3px solid rgba(24, 99, 220, .45);
	outline-offset: 2px;
}
#ntsb-root a { color: var(--ntsb-blue); text-decoration: underline; text-underline-offset: 2px; }
#ntsb-root svg { display: block; flex: none; }

/* ---------- Startknapp ---------- */
#ntsb-root .ntsb-launcher {
	display: flex; align-items: center; gap: 10px;
	margin-left: auto;
	height: 54px;
	padding: 0 20px 0 16px;
	border-radius: 999px;
	background: var(--ntsb-blue);
	color: #fff;
	font-family: 'Montserrat', 'Noto Sans', system-ui, sans-serif;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: 0;
	text-transform: none;
	box-shadow: 0 8px 24px rgba(24, 99, 220, .35), 0 2px 6px rgba(10, 30, 60, .15);
	transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
	animation: ntsb-pop .35s ease-out both;
}
#ntsb-root .ntsb-launcher:hover { background: var(--ntsb-blue-dark); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(24, 99, 220, .4), 0 2px 6px rgba(10, 30, 60, .15); }
#ntsb-root .ntsb-launcher svg { width: 24px; height: 24px; }
#ntsb-root .ntsb-launcher-close { display: none; }
#ntsb-root.ntsb-open .ntsb-launcher { width: 54px; padding: 0; justify-content: center; }
#ntsb-root.ntsb-open .ntsb-launcher-label,
#ntsb-root.ntsb-open .ntsb-launcher-chat { display: none; }
#ntsb-root.ntsb-open .ntsb-launcher-close { display: block; }

/* ---------- Panel ---------- */
#ntsb-root .ntsb-panel {
	position: absolute;
	right: 0;
	bottom: 68px;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 600px;
	max-height: calc(100vh - var(--ntsb-bottom) - 90px);
	background: var(--ntsb-bg);
	border-radius: 20px;
	box-shadow: 0 24px 64px rgba(10, 30, 60, .25), 0 4px 12px rgba(10, 30, 60, .08);
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(.98);
	transform-origin: bottom right;
	transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
#ntsb-root.ntsb-open .ntsb-panel {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity .2s ease, transform .2s ease;
}

#ntsb-root .ntsb-head {
	display: flex; align-items: center; gap: 12px;
	padding: 16px 14px 16px 18px;
	background: linear-gradient(135deg, var(--ntsb-navy) 0%, #13306A 100%);
	color: #fff;
}
#ntsb-root .ntsb-avatar {
	position: relative;
	width: 42px; height: 42px; border-radius: 50%;
	background: var(--ntsb-blue);
	display: flex; align-items: center; justify-content: center;
	flex: none;
}
#ntsb-root .ntsb-avatar svg { width: 22px; height: 22px; color: #fff; }
#ntsb-root .ntsb-avatar::after {
	content: ''; position: absolute; right: 0; bottom: 1px;
	width: 11px; height: 11px; border-radius: 50%;
	background: var(--ntsb-online); border: 2px solid var(--ntsb-navy);
}
#ntsb-root .ntsb-head-text { flex: 1; min-width: 0; }
#ntsb-root .ntsb-head-title {
	display: block;
	font-family: 'Montserrat', 'Noto Sans', system-ui, sans-serif;
	font-weight: 700; font-size: 16px; line-height: 1.25; color: #fff;
}
#ntsb-root .ntsb-head-sub { display: block; font-size: 12.5px; color: rgba(255, 255, 255, .75); margin-top: 2px; }
#ntsb-root .ntsb-close {
	width: 34px; height: 34px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: #fff; opacity: .8;
	transition: background .15s, opacity .15s;
}
#ntsb-root .ntsb-close:hover { background: rgba(255, 255, 255, .12); opacity: 1; }
#ntsb-root .ntsb-close svg { width: 18px; height: 18px; }

/* ---------- Meddelanden ---------- */
#ntsb-root .ntsb-list {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 18px 16px 8px;
	display: flex; flex-direction: column; gap: 10px;
	background: var(--ntsb-soft);
}
#ntsb-root .ntsb-msg {
	max-width: 86%;
	padding: 10px 14px;
	border-radius: 18px;
	font-size: 14.5px;
	line-height: 1.5;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	animation: ntsb-in .2s ease-out both;
}
#ntsb-root .ntsb-bot {
	align-self: flex-start;
	background: #fff;
	color: var(--ntsb-text);
	border-bottom-left-radius: 6px;
	box-shadow: 0 1px 2px rgba(10, 30, 60, .06), 0 0 0 1px var(--ntsb-border);
}
#ntsb-root .ntsb-user {
	align-self: flex-end;
	background: var(--ntsb-blue);
	color: #fff;
	border-bottom-right-radius: 6px;
}
#ntsb-root .ntsb-user a { color: #fff; }

#ntsb-root .ntsb-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 6px; }
#ntsb-root .ntsb-chip {
	padding: 8px 13px;
	border-radius: 999px;
	background: #fff;
	color: var(--ntsb-blue);
	font-size: 13.5px; font-weight: 600; line-height: 1.2;
	box-shadow: inset 0 0 0 1.5px rgba(24, 99, 220, .35);
	transition: background .15s, box-shadow .15s;
}
#ntsb-root .ntsb-chip:hover { background: rgba(24, 99, 220, .07); box-shadow: inset 0 0 0 1.5px var(--ntsb-blue); }

#ntsb-root .ntsb-typing { display: flex; gap: 5px; padding: 14px 16px; }
#ntsb-root .ntsb-typing span {
	width: 7px; height: 7px; border-radius: 50%;
	background: #9AA6B8;
	animation: ntsb-blink 1.2s infinite ease-in-out;
}
#ntsb-root .ntsb-typing span:nth-child(2) { animation-delay: .15s; }
#ntsb-root .ntsb-typing span:nth-child(3) { animation-delay: .3s; }

/* ---------- Inmatning ---------- */
#ntsb-root .ntsb-form {
	display: flex; align-items: flex-end; gap: 8px;
	margin: 0;
	padding: 12px 12px 10px;
	background: #fff;
	border-top: 1px solid var(--ntsb-border);
}
#ntsb-root .ntsb-input {
	flex: 1;
	display: block;
	min-height: 44px;
	max-height: 120px;
	padding: 11px 14px;
	border-radius: 22px;
	background: var(--ntsb-soft);
	color: var(--ntsb-text);
	font-size: 15px;
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-y: auto;
	resize: none;
	box-shadow: inset 0 0 0 1px var(--ntsb-border);
	transition: box-shadow .15s, background .15s;
}
#ntsb-root .ntsb-input::placeholder { color: #8C97A8; opacity: 1; }
#ntsb-root .ntsb-input:focus { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ntsb-blue); outline: none; }
#ntsb-root .ntsb-send {
	width: 44px; height: 44px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	flex: none;
	background: var(--ntsb-blue);
	color: #fff;
	transition: background .15s, opacity .15s, transform .15s;
}
#ntsb-root .ntsb-send:hover { background: var(--ntsb-blue-dark); }
#ntsb-root .ntsb-send:active { transform: scale(.94); }
#ntsb-root .ntsb-send:disabled { opacity: .45; cursor: default; }
#ntsb-root .ntsb-send svg { width: 20px; height: 20px; margin-left: 2px; }

#ntsb-root .ntsb-attach {
	width: 40px; height: 44px;
	display: flex; align-items: center; justify-content: center;
	flex: none;
	margin-right: -4px;
	border-radius: 50%;
	color: var(--ntsb-muted);
	transition: color .15s, background .15s;
}
#ntsb-root .ntsb-attach:hover { color: var(--ntsb-blue); background: rgba(24, 99, 220, .07); }
#ntsb-root .ntsb-attach:disabled { opacity: .45; cursor: default; }
#ntsb-root .ntsb-attach svg { width: 21px; height: 21px; }

#ntsb-root .ntsb-msg .ntsb-img {
	display: block;
	max-width: 100%;
	max-height: 220px;
	border-radius: 12px;
	margin: -4px -8px 6px;
	width: calc(100% + 16px);
	object-fit: cover;
}
#ntsb-root .ntsb-msg .ntsb-img:last-child { margin-bottom: -4px; }
#ntsb-root .ntsb-img-placeholder { display: block; opacity: .85; font-size: 13.5px; }
#ntsb-root .ntsb-img-placeholder + .ntsb-text { display: block; margin-top: 4px; }

#ntsb-root .ntsb-foot {
	display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px;
	padding: 0 16px 12px;
	background: #fff;
	font-size: 11.5px; line-height: 1.4;
	color: var(--ntsb-muted);
}
#ntsb-root .ntsb-foot a { color: var(--ntsb-muted); }
#ntsb-root .ntsb-foot .ntsb-call { color: var(--ntsb-blue); font-weight: 600; text-decoration: none; }
#ntsb-root .ntsb-foot .ntsb-call:hover { text-decoration: underline; }

/* ---------- Animationer ---------- */
@keyframes ntsb-pop { from { opacity: 0; transform: translateY(10px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes ntsb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ntsb-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Mobil ---------- */
@media (max-width: 600px) {
	#ntsb-root { --ntsb-right: 16px; }
	#ntsb-root .ntsb-launcher { width: 54px; padding: 0; justify-content: center; }
	#ntsb-root .ntsb-launcher-label { display: none; }
	#ntsb-root .ntsb-panel {
		position: fixed;
		inset: 0;
		width: auto; max-width: none;
		height: 100%; max-height: none;
		border-radius: 0;
		transform: translateY(24px);
	}
	#ntsb-root.ntsb-open .ntsb-launcher { display: none; }
	#ntsb-root .ntsb-input { font-size: 16px; } /* hindrar iOS från att zooma in */
}

@media (prefers-reduced-motion: reduce) {
	#ntsb-root *, #ntsb-root *::before, #ntsb-root *::after { animation: none !important; transition: none !important; }
}
