/* BIM Verdi ByggChat – frontend-stiler */

.bvbc-widget {
	--bvbc-accent: #e8622d;
	--bvbc-green: #4a9d3f;
	--bvbc-bg: #ffffff;
	--bvbc-user-bg: #eef4fb;
	--bvbc-bot-bg: #f5f6f7;
	--bvbc-border: #e2e4e7;
	--bvbc-text: #1f2328;
	--bvbc-muted: #6b7280;
	--bvbc-height: 560px;

	display: flex;
	flex-direction: column;
	max-width: 720px;
	height: var(--bvbc-height);
	margin: 1.5em auto;
	background: var(--bvbc-bg);
	border: 1px solid var(--bvbc-border);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--bvbc-text);
	font-size: 15px;
	line-height: 1.5;
}

.bvbc-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--bvbc-border);
	font-weight: 600;
	background: linear-gradient(90deg, #fafafa, #fff);
}

.bvbc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bvbc-green); box-shadow: 0 0 0 3px rgba(74, 157, 63, 0.15); }
.bvbc-title { color: var(--bvbc-accent); }

.bvbc-version {
	margin-left: auto;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #fff;
	background: var(--bvbc-green);
	padding: 2px 8px;
	border-radius: 999px;
}

.bvbc-widget-locked .bvbc-locked-body {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 14px;
	padding: 28px;
}
.bvbc-lock-icon { font-size: 34px; line-height: 1; }
.bvbc-locked-text { margin: 0; max-width: 360px; color: var(--bvbc-muted); }
.bvbc-login-btn {
	display: inline-block;
	padding: 10px 22px;
	background: var(--bvbc-accent);
	color: #fff !important;
	text-decoration: none;
	font-weight: 600;
	border-radius: 10px;
	transition: background 0.15s ease;
}
.bvbc-login-btn:hover { background: #cf5424; }

.bvbc-log { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }

.bvbc-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bvbc-msg-user { align-self: flex-end; background: var(--bvbc-user-bg); border-bottom-right-radius: 4px; }
.bvbc-msg-bot { align-self: flex-start; background: var(--bvbc-bot-bg); border-bottom-left-radius: 4px; }
.bvbc-msg-error { align-self: flex-start; background: #fdecea; color: #a12622; border-bottom-left-radius: 4px; }
.bvbc-msg a { color: var(--bvbc-accent); }

.bvbc-cite { color: var(--bvbc-accent); font-weight: 600; text-decoration: none; cursor: pointer; }
.bvbc-cite:hover { text-decoration: underline; }

.bvbc-sources { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--bvbc-border); }
.bvbc-sources-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--bvbc-muted); margin-bottom: 6px; }
.bvbc-source {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 6px 8px;
	border: 1px solid var(--bvbc-border);
	border-radius: 8px;
	margin-bottom: 6px;
	background: #fff;
	text-decoration: none;
	color: var(--bvbc-text);
	transition: border-color 0.15s ease, background 0.15s ease;
}
.bvbc-source:hover { border-color: var(--bvbc-accent); background: #fff7f3; }
.bvbc-source-n {
	flex: 0 0 auto;
	min-width: 22px;
	height: 22px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
	background: var(--bvbc-accent);
	border-radius: 6px;
}
.bvbc-source-title { font-size: 14px; flex: 1 1 auto; }
.bvbc-source-group {
	flex: 0 0 auto;
	font-size: 11px;
	font-weight: 600;
	color: #2b6cb0;
	background: #e8f0fe;
	padding: 2px 8px;
	border-radius: 999px;
	white-space: nowrap;
}

.bvbc-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--bvbc-bot-bg); border-radius: 14px; border-bottom-left-radius: 4px; }
.bvbc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--bvbc-muted); opacity: 0.5; animation: bvbc-blink 1.2s infinite both; }
.bvbc-typing span:nth-child(2) { animation-delay: 0.2s; }
.bvbc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bvbc-blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 0.9; transform: translateY(-3px); } }

.bvbc-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--bvbc-border); background: #fafafa; }
.bvbc-input { flex: 1 1 auto; resize: none; border: 1px solid var(--bvbc-border); border-radius: 10px; padding: 10px 12px; font: inherit; color: var(--bvbc-text); max-height: 120px; background: #fff; }
.bvbc-input:focus { outline: none; border-color: var(--bvbc-accent); box-shadow: 0 0 0 3px rgba(232, 98, 45, 0.15); }
.bvbc-send { flex: 0 0 auto; border: none; border-radius: 10px; padding: 0 18px; background: var(--bvbc-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; transition: background 0.15s ease; }
.bvbc-send:hover { background: #cf5424; }
.bvbc-send:disabled { opacity: 0.55; cursor: not-allowed; }

@media (max-width: 600px) {
	.bvbc-widget { height: 70vh; border-radius: 10px; }
	.bvbc-msg { max-width: 94%; }
}

/* --- Flytende popup-boble --- */
.bvbc-popup {
	position: fixed;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Vertikal plassering */
.bvbc-popup[data-position="right"],
.bvbc-popup[data-position="left"],
.bvbc-popup[data-position="bottom-right"],
.bvbc-popup[data-position="bottom-left"] { bottom: 20px; }
.bvbc-popup[data-position="top-right"],
.bvbc-popup[data-position="top-left"] { top: 20px; }
/* Horisontal plassering */
.bvbc-popup[data-position="right"],
.bvbc-popup[data-position="bottom-right"],
.bvbc-popup[data-position="top-right"] { right: 20px; }
.bvbc-popup[data-position="left"],
.bvbc-popup[data-position="bottom-left"],
.bvbc-popup[data-position="top-left"] { left: 20px; }

.bvbc-launcher {
	position: relative;
	width: 86px;
	height: 86px;
	border-radius: 50%;
	border: none;
	background: #fff;
	padding: 0;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.bvbc-launcher:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3); }
.bvbc-launcher:focus-visible { outline: 3px solid rgba(232, 98, 45, 0.45); outline-offset: 2px; }

.bvbc-launcher-ring {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}
.bvbc-launcher-ring text {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.5px;
	fill: #e8622d;
}
.bvbc-launcher-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 52px;
	height: 52px;
	object-fit: contain;
	pointer-events: none;
}
@keyframes bvbc-spin { to { transform: rotate(360deg); } }

/* Liten logo i chat-headeren (erstatter statusprikken) */
.bvbc-logo { width: 24px; height: 24px; object-fit: contain; border-radius: 6px; flex: 0 0 auto; }

.bvbc-popup-panel {
	position: absolute;
	width: 380px;
	max-width: calc(100vw - 40px);
}
/* Panelet åpner seg mot midten fra hjørnet */
.bvbc-popup[data-position="right"] .bvbc-popup-panel,
.bvbc-popup[data-position="bottom-right"] .bvbc-popup-panel,
.bvbc-popup[data-position="top-right"] .bvbc-popup-panel { right: 0; left: auto; }
.bvbc-popup[data-position="left"] .bvbc-popup-panel,
.bvbc-popup[data-position="bottom-left"] .bvbc-popup-panel,
.bvbc-popup[data-position="top-left"] .bvbc-popup-panel { left: 0; right: auto; }
.bvbc-popup[data-position="right"] .bvbc-popup-panel,
.bvbc-popup[data-position="left"] .bvbc-popup-panel,
.bvbc-popup[data-position="bottom-right"] .bvbc-popup-panel,
.bvbc-popup[data-position="bottom-left"] .bvbc-popup-panel { bottom: 100px; top: auto; }
.bvbc-popup[data-position="top-right"] .bvbc-popup-panel,
.bvbc-popup[data-position="top-left"] .bvbc-popup-panel { top: 100px; bottom: auto; }

.bvbc-popup-panel .bvbc-widget {
	margin: 0;
	width: 100%;
	max-width: none;
	height: min(70vh, 560px);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.bvbc-close {
	background: none;
	border: none;
	color: var(--bvbc-muted, #6b7280);
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	padding: 0 2px;
	margin-left: 8px;
}
.bvbc-close:hover { color: #1f2328; }

@media (max-width: 480px) {
	.bvbc-popup[data-position="right"], .bvbc-popup[data-position="bottom-right"], .bvbc-popup[data-position="bottom-left"], .bvbc-popup[data-position="left"] { bottom: 14px; }
	.bvbc-popup[data-position="top-right"], .bvbc-popup[data-position="top-left"] { top: 14px; }
	.bvbc-popup[data-position="right"], .bvbc-popup[data-position="bottom-right"], .bvbc-popup[data-position="top-right"] { right: 14px; }
	.bvbc-popup[data-position="left"], .bvbc-popup[data-position="bottom-left"], .bvbc-popup[data-position="top-left"] { left: 14px; }
	.bvbc-popup-panel { width: calc(100vw - 28px); }
	.bvbc-popup[data-position="right"] .bvbc-popup-panel, .bvbc-popup[data-position="left"] .bvbc-popup-panel, .bvbc-popup[data-position="bottom-right"] .bvbc-popup-panel, .bvbc-popup[data-position="bottom-left"] .bvbc-popup-panel { bottom: 96px; }
	.bvbc-popup[data-position="top-right"] .bvbc-popup-panel, .bvbc-popup[data-position="top-left"] .bvbc-popup-panel { top: 96px; }
	.bvbc-popup-panel .bvbc-widget { height: min(75vh, 560px); }
}

/* Tilbakemelding (tommel opp/ned) */
.bvbc-feedback { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; opacity: .85; }
.bvbc-feedback-label { margin-right: 2px; }
.bvbc-feedback-btn { background: transparent; border: 1px solid rgba(128,128,128,.4); border-radius: 6px; padding: 2px 8px; font-size: 14px; line-height: 1.4; cursor: pointer; }
.bvbc-feedback-btn:hover:not(:disabled) { background: rgba(128,128,128,.12); }
.bvbc-feedback-btn:disabled { cursor: default; opacity: .5; }
.bvbc-feedback-btn.is-selected { opacity: 1; background: rgba(128,128,128,.18); }
