/* Fiksvik Chat 1.1
 * Fargane kjem frå Kadence-paletten, så mørk modus følgjer med automatisk.
 * Berre transform/opacity blir animert, og ingen animasjonar går i løkke. */

#fvc-rot {
	--fvc-a: var(--global-palette1, #00756C);
	--fvc-b: var(--global-palette2, #005E57);
	--fvc-tekst: var(--global-palette3, #0B2A27);
	--fvc-dempa: var(--global-palette5, #3F5B58);
	--fvc-linje: var(--global-palette7, #D3ECE8);
	--fvc-flate: var(--global-palette8, #E6F4F2);
	--fvc-bg: var(--global-palette9, #FFFFFF);
	--fvc-pa-merke: var(--global-palette9, #FFFFFF);
	--fvc-raud: var(--fv-raud, #B3261E);
	--fvc-gronn: #22C55E;
	--fvc-grad: linear-gradient(135deg, var(--fvc-a) 0%, var(--fvc-b) 100%);
	--fvc-logg-bg: var(--fvc-flate);
	--fvc-glod: rgba(0, 117, 108, .45);
	--fvc-hode-bg:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='96' viewBox='0 0 160 96' fill='none' stroke='white' stroke-opacity='.09' stroke-width='1.4'%3E%3Cpath d='M0 24h36l12 12h40l10-10h62M20 96V70l10-10h44l12 12h30M118 0v18l12 12h30M0 60h10'/%3E%3Ccircle cx='98' cy='26' r='3'/%3E%3Ccircle cx='86' cy='72' r='3'/%3E%3Ccircle cx='118' cy='18' r='3'/%3E%3Ccircle cx='10' cy='60' r='3'/%3E%3C/svg%3E") right top / 160px 96px repeat,
		radial-gradient(120% 140% at 100% 0%, rgba(46, 230, 214, .35) 0%, rgba(46, 230, 214, 0) 55%),
		linear-gradient(135deg, #0B2A27 0%, #0D3D38 55%, #00665E 100%);

	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-family: "Red Hat Text", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--fvc-tekst);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

@supports (color: color-mix(in oklab, red, blue)) {
	#fvc-rot {
		--fvc-grad: linear-gradient(135deg, color-mix(in oklab, var(--fvc-a), #fff 16%) 0%, var(--fvc-a) 45%, var(--fvc-b) 100%);
		--fvc-logg-bg: color-mix(in oklab, var(--fvc-flate) 50%, var(--fvc-bg));
		--fvc-glod: color-mix(in oklab, var(--fvc-a) 50%, transparent);
	}
}

#fvc-rot *,
#fvc-rot *::before,
#fvc-rot *::after {
	box-sizing: border-box;
}

#fvc-rot button {
	margin: 0;
	font: inherit;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	min-height: 0;
	min-width: 0;
	box-shadow: none;
	-webkit-tap-highlight-color: transparent;
}

#fvc-rot svg {
	display: block;
	width: 100%;
	height: 100%;
}

#fvc-rot :focus-visible {
	outline: 3px solid var(--fvc-a);
	outline-offset: 2px;
}

/* ---------- avatar ---------- */

#fvc-rot .fvc-avatar {
	position: relative;
	flex: none;
	display: block;
	width: 30px;
	height: 30px;
	border-radius: 999px;
	background: #0B1514;
	box-shadow: 0 0 0 1px var(--fvc-linje);
}

#fvc-rot .fvc-avatar img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	object-fit: cover;
}

#fvc-rot .fvc-avatar-gnist {
	padding: 7px;
	background: var(--fvc-grad);
	color: var(--fvc-pa-merke);
}

/* ---------- opne-knappen ---------- */

#fvc-rot .fvc-knapp {
	position: relative;
	isolation: isolate;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 58px;
	padding: 0 24px 0 9px;
	border: 0;
	border-radius: 999px;
	background: var(--fvc-grad);
	color: var(--fvc-pa-merke);
	cursor: pointer;
	box-shadow: 0 14px 34px -10px var(--fvc-glod), 0 3px 8px rgba(0, 0, 0, .14);
	transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease, padding .3s ease, gap .3s ease;
}

#fvc-rot .fvc-knapp:hover {
	transform: translateY(-3px);
	box-shadow: 0 20px 42px -10px var(--fvc-glod), 0 4px 10px rgba(0, 0, 0, .16);
}

#fvc-rot .fvc-knapp:active {
	transform: translateY(-1px) scale(.98);
}

#fvc-rot .fvc-knapp-ikon {
	position: relative;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .18);
}

#fvc-rot .fvc-knapp-ikon svg {
	grid-area: 1 / 1;
	width: 24px;
	height: 24px;
	transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
}

#fvc-rot .fvc-knapp .fvc-hol {
	fill: var(--fvc-a);
}

#fvc-rot .fvc-i-ned {
	opacity: 0;
	transform: rotate(-90deg) scale(.6);
}

#fvc-rot .fvc-knapp-status {
	position: absolute;
	top: 1px;
	right: 1px;
	width: 11px;
	height: 11px;
	border: 2px solid var(--fvc-a);
	border-radius: 999px;
	background: var(--fvc-gronn);
	transition: opacity .2s ease;
}

#fvc-rot .fvc-knapp-tekst {
	display: block;
	max-width: 180px;
	overflow: hidden;
	white-space: nowrap;
	font-family: "Red Hat Display", system-ui, sans-serif;
	font-size: 16.5px;
	font-weight: 700;
	letter-spacing: -.01em;
	transition: max-width .3s ease, opacity .2s ease;
}

/* Puls rundt knappen: tre gonger, berre første sidevisning i økta. */
#fvc-rot.fvc-puls .fvc-knapp::before,
#fvc-rot.fvc-puls .fvc-knapp::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	background: var(--fvc-a);
	opacity: 0;
	pointer-events: none;
	animation: fvc-puls 2.4s cubic-bezier(.2, .6, .3, 1) 1.2s 3;
}

#fvc-rot.fvc-puls .fvc-knapp::after {
	animation-delay: 1.6s;
}

@keyframes fvc-puls {
	0% { opacity: .45; transform: scale(1, 1); }
	75%, 100% { opacity: 0; transform: scale(1.12, 1.45); }
}

/* Open: knappen blir ein rund «lukk»-knapp med pil ned. */
#fvc-rot.fvc-er-open .fvc-knapp {
	gap: 0;
	padding: 0 9px;
}

#fvc-rot.fvc-er-open .fvc-knapp-tekst {
	max-width: 0;
	opacity: 0;
}

#fvc-rot.fvc-er-open .fvc-i-chat {
	opacity: 0;
	transform: rotate(90deg) scale(.6);
}

#fvc-rot.fvc-er-open .fvc-i-ned {
	opacity: 1;
	transform: none;
}

#fvc-rot.fvc-er-open .fvc-knapp-status,
#fvc-rot.fvc-er-open .fvc-knapp::before,
#fvc-rot.fvc-er-open .fvc-knapp::after {
	opacity: 0;
	animation: none;
}

/* ---------- helsinga over knappen ---------- */

#fvc-rot .fvc-teaser {
	position: relative;
	width: 300px;
	max-width: calc(100vw - 32px);
	margin-bottom: 14px;
	border: 1px solid var(--fvc-linje);
	border-radius: 20px 20px 6px 20px;
	background: var(--fvc-bg);
	box-shadow: 0 18px 44px -14px rgba(2, 40, 36, .35), 0 2px 6px rgba(0, 0, 0, .06);
	animation: fvc-teaser-inn .45s cubic-bezier(.2, .9, .25, 1.15) both;
	transform-origin: 100% 100%;
}

#fvc-rot .fvc-teaser[hidden] {
	display: none;
}

@keyframes fvc-teaser-inn {
	from { opacity: 0; transform: translateY(10px) scale(.92); }
	to { opacity: 1; transform: none; }
}

#fvc-rot .fvc-teaser-opne {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
	padding: 14px 40px 15px 14px;
	border: 0;
	border-radius: inherit;
	background: transparent;
	color: var(--fvc-tekst);
	text-align: left;
	cursor: pointer;
}

#fvc-rot .fvc-teaser-opne .fvc-avatar {
	width: 40px;
	height: 40px;
}

#fvc-rot .fvc-teaser-tekst {
	display: flex;
	flex-direction: column;
	gap: 3px;
	line-height: 1.4;
}

#fvc-rot .fvc-teaser-tekst strong {
	font-family: "Red Hat Display", system-ui, sans-serif;
	font-size: 15.5px;
	font-weight: 700;
	color: var(--fvc-tekst);
}

#fvc-rot .fvc-teaser-tekst span {
	font-size: 14px;
	color: var(--fvc-dempa);
}

#fvc-rot .fvc-teaser-lukk {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 28px;
	height: 28px;
	padding: 6px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--fvc-dempa);
	cursor: pointer;
}

#fvc-rot .fvc-teaser-lukk:hover {
	background: var(--fvc-flate);
	color: var(--fvc-tekst);
}

/* ---------- vindauget ---------- */

#fvc-rot .fvc-panel {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: 400px;
	height: min(660px, calc(100vh - 124px));
	height: min(660px, calc(100dvh - 124px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--fvc-linje);
	border-radius: 26px;
	background: var(--fvc-bg);
	box-shadow: 0 30px 70px -18px rgba(2, 40, 36, .42), 0 4px 14px rgba(0, 0, 0, .08);
	transform-origin: 100% 100%;
	animation: fvc-panel-inn .32s cubic-bezier(.2, .9, .25, 1) both;
}

#fvc-rot .fvc-panel[hidden] {
	display: none;
}

@keyframes fvc-panel-inn {
	from { opacity: 0; transform: translateY(16px) scale(.95); }
	to { opacity: 1; transform: none; }
}

#fvc-rot .fvc-hode {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 18px 12px 18px 18px;
	background: var(--fvc-hode-bg);
	color: #fff;
}

#fvc-rot .fvc-avatar-stor {
	width: 44px;
	height: 44px;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 6px 16px rgba(0, 0, 0, .3);
}

#fvc-rot .fvc-online {
	position: absolute;
	right: -1px;
	bottom: -1px;
	width: 13px;
	height: 13px;
	border: 2.5px solid #0D3D38;
	border-radius: 999px;
	background: var(--fvc-gronn);
}

#fvc-rot .fvc-hode-tekst {
	flex: 1;
	min-width: 0;
}

#fvc-rot .fvc-tittel {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	font-family: "Red Hat Display", system-ui, sans-serif;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -.01em;
	text-transform: none;
	color: #fff;
}

#fvc-rot .fvc-test-merke {
	padding: 3px 7px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .16);
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #B8F5EE;
}

#fvc-rot .fvc-under {
	margin: 3px 0 0;
	font-size: 13px;
	line-height: 1.3;
	color: rgba(255, 255, 255, .78);
}

#fvc-rot .fvc-ikon {
	flex: none;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 9px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: rgba(255, 255, 255, .85);
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}

#fvc-rot .fvc-ikon:hover {
	background: rgba(255, 255, 255, .14);
	color: #fff;
}

#fvc-rot .fvc-hode :focus-visible {
	outline-color: #fff;
}

/* ---------- meldingar ---------- */

#fvc-rot .fvc-logg {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px 16px 12px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--fvc-logg-bg);
	scrollbar-width: thin;
	scrollbar-color: var(--fvc-linje) transparent;
}

#fvc-rot .fvc-rad,
#fvc-rot .fvc-info {
	animation: fvc-opp .3s cubic-bezier(.2, .8, .2, 1) both;
}

#fvc-rot .fvc-stille .fvc-rad,
#fvc-rot .fvc-stille .fvc-info {
	animation: none;
}

@keyframes fvc-opp {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

#fvc-rot .fvc-rad {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

#fvc-rot .fvc-deg {
	justify-content: flex-end;
}

/* Berre første bot-melding i ei rekkje får synleg avatar. */
#fvc-rot .fvc-bot + .fvc-bot .fvc-avatar {
	visibility: hidden;
}

#fvc-rot .fvc-boble {
	max-width: 82%;
	padding: 10px 14px;
	border-radius: 20px;
	overflow-wrap: anywhere;
	font-size: 15px;
	line-height: 1.5;
}

#fvc-rot .fvc-bot .fvc-boble {
	border: 1px solid var(--fvc-linje);
	border-bottom-left-radius: 6px;
	background: var(--fvc-bg);
	color: var(--fvc-tekst);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

#fvc-rot .fvc-deg .fvc-boble {
	border-bottom-right-radius: 6px;
	background: var(--fvc-grad);
	color: var(--fvc-pa-merke);
	white-space: pre-wrap;
	box-shadow: 0 6px 16px -8px var(--fvc-glod);
}

#fvc-rot .fvc-boble p {
	margin: 0 0 7px;
	padding: 0;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
}

#fvc-rot .fvc-boble p:last-child,
#fvc-rot .fvc-boble ul:last-child,
#fvc-rot .fvc-boble ol:last-child {
	margin-bottom: 0;
}

#fvc-rot .fvc-boble ul,
#fvc-rot .fvc-boble ol {
	margin: 0 0 7px;
	padding: 0 0 0 18px;
}

#fvc-rot .fvc-boble li {
	margin: 3px 0;
	padding: 0;
}

#fvc-rot .fvc-boble li::marker {
	color: var(--fvc-a);
}

#fvc-rot .fvc-boble strong {
	font-weight: 700;
	color: inherit;
}

#fvc-rot .fvc-boble a {
	color: var(--fvc-b);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
	text-underline-offset: 2px;
}

#fvc-rot .fvc-info {
	align-self: center;
	max-width: 92%;
	padding: 7px 14px;
	border-radius: 999px;
	background: var(--fvc-flate);
	border: 1px solid var(--fvc-linje);
	color: var(--fvc-tekst);
	font-size: 13px;
	font-weight: 600;
	text-align: center;
}

#fvc-rot .fvc-info.fvc-feil {
	border-radius: 14px;
	border-color: var(--fvc-raud);
	background: var(--fvc-bg);
	color: var(--fvc-raud);
	font-weight: 500;
}

/* skriv-prikkar */
#fvc-rot .fvc-ventar .fvc-boble {
	display: flex;
	gap: 5px;
	padding: 15px 16px;
}

#fvc-rot .fvc-prikk {
	width: 7px;
	height: 7px;
	border-radius: 999px;
	background: var(--fvc-a);
	opacity: .3;
	animation: fvc-prikk 1.2s infinite ease-in-out;
}

#fvc-rot .fvc-prikk:nth-child(2) { animation-delay: .15s; }
#fvc-rot .fvc-prikk:nth-child(3) { animation-delay: .3s; }

@keyframes fvc-prikk {
	0%, 80%, 100% { opacity: .3; transform: none; }
	40% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- forslag ---------- */

#fvc-rot .fvc-forslag {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	padding: 4px 16px 14px;
	background: var(--fvc-logg-bg);
}

#fvc-rot .fvc-forslag[hidden] {
	display: none;
}

#fvc-rot .fvc-chip {
	padding: 8px 13px;
	border: 1px solid var(--fvc-linje);
	border-radius: 999px;
	background: var(--fvc-bg);
	color: var(--fvc-tekst);
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
	transition: border-color .15s ease, color .15s ease, transform .15s ease;
}

#fvc-rot .fvc-chip:hover {
	border-color: var(--fvc-a);
	color: var(--fvc-b);
	transform: translateY(-1px);
}

/* ---------- skrivefelt ---------- */

#fvc-rot .fvc-fot {
	padding: 12px 14px 10px;
	border-top: 1px solid var(--fvc-linje);
	background: var(--fvc-bg);
}

#fvc-rot .fvc-skjema {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	margin: 0;
	padding: 5px 5px 5px 16px;
	border: 1.5px solid var(--fvc-linje);
	border-radius: 26px;
	background: var(--fvc-bg);
	transition: border-color .15s ease, box-shadow .15s ease;
}

#fvc-rot .fvc-skjema:focus-within {
	border-color: var(--fvc-a);
	box-shadow: 0 0 0 4px var(--fvc-flate);
}

#fvc-rot .fvc-felt {
	flex: 1;
	min-height: 40px;
	max-height: 120px;
	margin: 0;
	padding: 9px 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--fvc-tekst);
	font: inherit;
	font-size: 16px; /* hindrar zoom på iPhone */
	line-height: 1.4;
	resize: none;
	box-shadow: none;
	outline: none;
}

#fvc-rot .fvc-felt:focus-visible {
	outline: none;
}

#fvc-rot .fvc-felt::placeholder {
	color: var(--fvc-dempa);
	opacity: .75;
}

#fvc-rot .fvc-send {
	flex: none;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 10px;
	border: 0;
	border-radius: 999px;
	background: var(--fvc-grad);
	color: var(--fvc-pa-merke);
	cursor: pointer;
	transition: transform .15s ease, opacity .15s ease;
}

#fvc-rot .fvc-send:hover:not(:disabled) {
	transform: scale(1.06);
}

#fvc-rot .fvc-send:disabled {
	background: var(--fvc-linje);
	color: var(--fvc-dempa);
	cursor: default;
}

#fvc-rot .fvc-notis {
	margin: 8px 4px 0;
	padding: 0;
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--fvc-dempa);
	text-align: center;
}

#fvc-rot .fvc-notis a {
	color: inherit;
	text-decoration: underline;
}

/* Kadence si «til toppen»-knapp flyttar seg opp over chatknappen. */
html.fvc-aktiv #kt-scroll-up {
	bottom: 100px !important;
}

/* ---------- mobil ---------- */

@media (max-width: 600px) {
	/* Over heimelinja på iPhone og verktøylinja i nettlesaren. */
	#fvc-rot {
		right: 14px;
		bottom: calc(14px + env(safe-area-inset-bottom));
	}

	/* Pille med tekst. Blir rund (fvc-kompakt) medan ein rullar nedover for å lese,
	   og får teksten att når ein rullar opp eller er øvst på sida. */
	#fvc-rot .fvc-knapp {
		gap: 8px;
		height: 54px;
		padding: 0 18px 0 7px;
	}

	#fvc-rot .fvc-knapp-tekst {
		font-size: 15.5px;
	}

	#fvc-rot.fvc-kompakt .fvc-knapp {
		gap: 0;
		padding: 0 7px;
	}

	#fvc-rot.fvc-kompakt .fvc-knapp-tekst {
		max-width: 0;
		opacity: 0;
	}

	/* Mindre helsing. */
	#fvc-rot .fvc-teaser {
		width: auto;
		max-width: min(290px, calc(100vw - 28px));
		margin-bottom: 10px;
	}

	#fvc-rot .fvc-teaser-opne {
		gap: 10px;
		padding: 11px 38px 12px 11px;
	}

	#fvc-rot .fvc-teaser-opne .fvc-avatar {
		width: 34px;
		height: 34px;
	}

	#fvc-rot .fvc-teaser-tekst strong {
		font-size: 14.5px;
	}

	#fvc-rot .fvc-teaser-tekst span {
		font-size: 13.5px;
	}

	#fvc-rot.fvc-er-open {
		inset: 0;
	}

	#fvc-rot .fvc-panel {
		position: fixed;
		inset: 0;
		width: auto;
		height: auto;
		border: 0;
		border-radius: 0;
	}

	#fvc-rot .fvc-hode {
		padding-top: calc(16px + env(safe-area-inset-top));
	}

	#fvc-rot .fvc-fot {
		padding-bottom: calc(10px + env(safe-area-inset-bottom));
	}

	/* Administratorar har adminlinja (46 px) øvst på mobil. */
	.admin-bar #fvc-rot .fvc-panel {
		top: 46px;
	}

	#fvc-rot.fvc-er-open .fvc-knapp,
	#fvc-rot.fvc-er-open .fvc-teaser {
		display: none;
	}

	html.fvc-open,
	html.fvc-open body {
		overflow: hidden;
	}
}

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