/* LagaChat widget v2 – two-tab UI, palette derived from lagaiphone.se (#D5E0EB) */
#lagachat {
	--lc-blue: #1f5c8b;
	--lc-blue-dark: #174766;
	--lc-mist: #d5e0eb;
	--lc-mist-light: #eef3f8;
	--lc-ink: #1d2b36;
	--lc-white: #ffffff;
	--lc-muted: #62717d;
	position: fixed;
	z-index: 999999;
	right: 20px;
	bottom: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 14px;
	color: var(--lc-ink);
}
#lagachat * { box-sizing: border-box; }
#lagachat button { font-family: inherit; }
/* Defend against theme CSS leaking in (uppercase, letter-spacing, shadows) */
#lagachat button, #lagachat .lc-card, #lagachat .lc-card strong, #lagachat .lc-card em,
#lagachat .lc-opt, #lagachat .lc-tab, #lagachat .lc-msg, #lagachat #lc-hero h2 {
	text-transform: none !important;
	letter-spacing: normal !important;
	text-shadow: none !important;
}
#lagachat .lc-card em, #lagachat .lc-tab { font-weight: 400 !important; }
#lc-panel { overflow-x: hidden; }
/* Theme leak: global margin-bottom rules (p/form/button/input etc.) inflate widget spacing */
#lagachat blockquote, #lagachat dl, #lagachat figure, #lagachat form,
#lagachat ol, #lagachat p, #lagachat pre, #lagachat ul {
	margin: 0 0 .3em !important;
}
#lagachat .button, #lagachat button, #lagachat fieldset,
#lagachat input, #lagachat select, #lagachat textarea {
	margin-bottom: 0 !important;
}

/* ---------- Bubble ---------- */
#lc-bubble {
	width: 58px; height: 58px;
	border: none; border-radius: 50%;
	background: var(--lc-blue);
	color: var(--lc-white);
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 18px rgba(23, 71, 102, .35);
	transition: transform .15s ease, background .15s ease;
}
#lc-bubble:hover { background: var(--lc-blue-dark); transform: scale(1.06); }
#lc-bubble.lc-hidden { display: none; }

/* ---------- Panel ---------- */
#lc-panel {
	position: fixed;
	right: 20px; bottom: 20px;
	width: 370px; max-width: min(calc(100vw - 24px), 100vw);
	/* Desktop: fill the viewport height (20px margin top+bottom). dvh matches the
	   mobile sizing below; the vh line is the fallback for browsers without dvh. */
	height: calc(100vh - 40px);
	height: calc(100dvh - 40px);
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	background: var(--lc-white);
	border-radius: 18px;
	box-shadow: 0 12px 40px rgba(23, 71, 102, .28);
	display: flex; flex-direction: column;
	overflow: hidden;
}
@media (max-width: 480px) {
	#lc-panel {
		top: 0; right: 0; bottom: 0; left: 0;
		width: 100%; max-width: 100vw;
		height: 100vh; height: 100dvh; max-height: 100dvh;
		border-radius: 0;
	}
	#lc-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
	#lc-hero { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
	#lc-chat-header { padding-top: calc(2px + env(safe-area-inset-top, 0px)); }
	#lc-hero { padding: 10px 14px 44px; }
	#lc-hero h2 { font-size: 18px; }
	#lc-home-body { margin-top: -34px; padding: 0 12px 10px; }
	.lc-card { padding: 8px 11px; margin-bottom: 6px; }
	.lc-msg { font-size: 13px; padding: 6px 10px; margin: 3px 0; }
	.lc-opt { padding: 3px 9px; font-size: 12px; }
	#lc-messages { padding: 8px 10px; }
	.lc-tab svg { width: 18px; height: 18px; }
	#lc-footer { padding: 1px 8px 3px; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	#lc-input { font-size: 16px !important; padding: 7px 4px; }
	#lc-nav .lc-tab { padding: 5px 0 3px; }
}
.lc-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* The [hidden] attribute must always win over display:flex above */
#lc-panel[hidden],
.lc-view[hidden] { display: none !important; }

.lc-x {
	background: none; border: none;
	color: inherit; opacity: .8;
	font-size: 22px; line-height: 1;
	cursor: pointer; padding: 4px 8px;
}
.lc-x:hover { opacity: 1; }

/* ---------- TAB 1: Hem ---------- */
#lc-hero {
	background: linear-gradient(160deg, var(--lc-blue) 0%, #2e7db3 55%, var(--lc-mist) 130%);
	color: var(--lc-white);
	padding: 14px 16px 34px;
	flex-shrink: 0;
}
#lc-hero-top {
	display: flex; align-items: flex-start; justify-content: space-between;
}
#lc-hero h2 {
	margin: 0; font-size: 20px; font-weight: 500; line-height: 1.25;
	color: rgba(255,255,255,.85);
}
#lc-hero h2 span { font-weight: 800; color: var(--lc-white); }

#lc-home-body {
	flex: 1; overflow-y: auto; overflow-x: hidden;
	padding: 0 14px 10px;
	margin-top: -26px; /* cards overlap the hero */
	scrollbar-width: thin;
}

.lc-card {
	display: flex; align-items: center; justify-content: space-between;
	width: 100%;
	text-align: left;
	background: var(--lc-white);
	border: 1px solid var(--lc-mist);
	border-radius: 11px;
	padding: 8px 12px;
	margin-bottom: 6px;
	cursor: pointer;
	box-shadow: 0 3px 12px rgba(23, 71, 102, .10);
	transition: transform .12s ease, box-shadow .12s ease;
}
.lc-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(23, 71, 102, .16); }
.lc-card strong { font-size: 14px; color: var(--lc-ink); }
.lc-card em { font-style: normal; font-size: 12px; color: var(--lc-muted); }
.lc-card-arrow { font-size: 20px; color: var(--lc-blue); margin-left: 12px; }
.lc-card-main { border: 1.5px solid var(--lc-blue); }
.lc-card-main strong { color: var(--lc-blue); }

/* ---------- TAB 2: Meddelanden ---------- */
#lc-chat-header {
	background: var(--lc-blue);
	color: var(--lc-white);
	padding: 2px 14px;
	display: flex; align-items: center; justify-content: space-between;
	flex-shrink: 0;
}
#lc-chat-header strong { display: block; font-size: 15px; }
#lc-chat-header span { font-size: 12px; opacity: .85; }

#lc-messages {
	flex: 1; overflow-y: auto;
	padding: 10px 12px;
	background: var(--lc-mist-light);
}
.lc-msg {
	max-width: 88%;
	padding: 7px 11px;
	margin: 4px 0;
	border-radius: 12px;
	font-size: 13.5px;
	word-wrap: break-word;
	white-space: pre-line;
}
.lc-assistant {
	background: var(--lc-white);
	border: 1px solid var(--lc-mist);
	border-bottom-left-radius: 4px;
	margin-right: auto;
}
.lc-user {
	background: var(--lc-blue);
	color: var(--lc-white);
	border-bottom-right-radius: 4px;
	margin-left: auto;
}
.lc-msg a { color: var(--lc-blue); text-decoration: underline; }
.lc-user a { color: var(--lc-white); }
.lc-link {
	display: inline-flex; align-items: center; gap: 3px;
	color: #1a63c9 !important;
	font-weight: 600;
	text-decoration: underline;
	white-space: nowrap;
}
.lc-link:hover { color: var(--lc-blue-dark) !important; }
.lc-user .lc-link { color: var(--lc-white) !important; }
.lc-info { color: #1e7d46; }
.lc-msg strong { font-weight: 700; }

.lc-dot {
	display: inline-block; width: 7px; height: 7px; margin: 0 2px;
	background: var(--lc-blue); border-radius: 50%; opacity: .4;
	animation: lc-blink 1.2s infinite;
}
.lc-dot:nth-child(2) { animation-delay: .2s; }
.lc-dot:nth-child(3) { animation-delay: .4s; }
@keyframes lc-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lc-dot { animation: none; opacity: .6; } }

#lc-options {
	display: flex; flex-wrap: wrap; gap: 5px;
	padding: 0 12px;
	background: var(--lc-mist-light);
	flex-shrink: 0;
}
#lc-options:not(:empty) { padding-bottom: 7px; }
.lc-opt {
	background: var(--lc-white);
	border: 1px solid var(--lc-blue);
	color: var(--lc-blue);
	border-radius: 999px;
	padding: 4px 10px;
	font-size: 12.5px;
	line-height: 1.5;
	cursor: pointer;
	transition: background .12s ease, color .12s ease;
}
.lc-opt:hover, .lc-opt:focus-visible { background: var(--lc-blue); color: var(--lc-white); }

/* "◀ Ändra" – secondary chip that steps one level back in the guided menu */
.lc-opt-back {
	border-color: var(--lc-mist) !important;
	color: #6b7280 !important;
	background: transparent !important;
}
.lc-opt-back:hover, .lc-opt-back:focus-visible {
	background: var(--lc-mist-light) !important;
	color: #374151 !important;
}

#lc-form-wrap {
	padding: 7px 10px 2px;
	border-top: 1px solid var(--lc-mist);
	background: var(--lc-white);
	flex-shrink: 0;
}
/* Chat ended by the server (price-stop): composer is closed, \u21bb starts a new one */
#lc-ended {
	font-size: 12px !important;
	line-height: 1.45 !important;
	color: var(--lc-muted);
	text-align: center;
	padding: 2px 6px 8px;
}
#lc-form.lc-off { opacity: .55; }
#lc-form input:disabled,
#lc-form button:disabled { cursor: not-allowed; }
#lc-form button[type=submit]:disabled,
#lc-form button[type=submit]:disabled:hover { background: var(--lc-muted) !important; }

#lc-form {
	display: flex; align-items: center; gap: 2px;
	width: 100%;
	border: none;
	border-radius: 999px;
	background: var(--lc-white);
	padding: 3px 4px 3px 14px;
	transition: border-color .12s ease, box-shadow .12s ease;
}
#lc-form:focus-within {
	box-shadow: 0 0 0 3px rgba(31, 92, 139, .18);
}
#lc-input {
	flex: 1;
	border: none !important;
	background: transparent !important;
	box-shadow: none !important;
	margin: 0 !important;
	border-radius: 0;
	padding: 7px 4px;
	font-size: 14px;
	outline: none !important;
	min-width: 0;
}
#lc-form button[type=submit] {
	width: 32px; height: 32px; flex-shrink: 0;
	border: none; border-radius: 50%;
	background: var(--lc-blue); color: var(--lc-white);
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
#lc-form button[type=submit]:hover { background: var(--lc-blue-dark); }
/* Theme-proof the send icon (same treatment as the mic) */
#lc-form button[type=submit] svg {
	width: 16px !important;
	height: 16px !important;
	min-width: 18px !important;
	min-height: 18px !important;
	max-width: none !important;
	max-height: none !important;
	flex-shrink: 0 !important;
	display: block !important;
	stroke: var(--lc-white) !important;
	fill: none !important;
	opacity: 1 !important;
}
#lc-form button[type=submit] {
	-webkit-appearance: none !important;
	appearance: none !important;
}

#lc-footer {
	padding: 1px 12px 3px;
	font-size: 8px;
	color: var(--lc-muted);
	background: var(--lc-white);
	text-align: center;
	flex-shrink: 0;
	border-top: 1px solid var(--lc-mist);
}
#lc-footer a { color: var(--lc-muted); }

/* ---------- Bottom nav ---------- */
#lc-nav {
	display: flex;
	border-top: 1px solid var(--lc-mist);
	background: var(--lc-white);
	flex-shrink: 0;
}
.lc-tab {
	flex: 1;
	background: none; border: none;
	padding: 6px 0 3px;
	cursor: pointer;
	color: var(--lc-muted);
	display: flex; flex-direction: column; align-items: center; gap: 1px;
	font-size: 11px;
	transition: color .12s ease;
}
.lc-tab:hover { color: var(--lc-blue-dark); }
.lc-tab.lc-active { color: var(--lc-blue); font-weight: 600; }

/* ---------- A11y ---------- */
#lagachat button:focus-visible, #lc-input:focus-visible {
	outline: 2px solid var(--lc-blue-dark);
	outline-offset: 2px;
}

/* ---------- Proactive teaser ---------- */
#lc-teaser {
	position: absolute;
	right: 0; bottom: 70px;
	width: max-content;
	max-width: min(320px, calc(100vw - 40px));
	background: var(--lc-white);
	color: var(--lc-ink);
	border: 1px solid var(--lc-mist);
	border-radius: 14px 14px 4px 14px;
	box-shadow: 0 8px 24px rgba(23, 71, 102, .22);
	padding: 11px 30px 11px 14px;
	font-size: 14.5px;
	line-height: 1.45;
	cursor: pointer;
	animation: lc-teaser-in .35s ease;
}
@media (max-width: 480px) {
	#lc-teaser { max-width: calc(100vw - 40px); font-size: 15px; padding: 12px 32px 12px 15px; }
}
#lc-teaser:hover { border-color: var(--lc-blue); }
#lc-teaser-close {
	position: absolute; top: 2px; right: 4px;
	background: none; border: none;
	font-size: 17px; color: var(--lc-muted);
	cursor: pointer; padding: 2px 6px;
}
#lc-teaser-close:hover { color: var(--lc-ink); }
@keyframes lc-teaser-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Gentle pulse on the bubble while the teaser shows (3 pulses, then still) */
#lc-bubble.lc-pulse { animation: lc-pulse 1.6s ease 3; }
@keyframes lc-pulse {
	0%   { box-shadow: 0 6px 18px rgba(23, 71, 102, .35), 0 0 0 0 rgba(31, 92, 139, .45); }
	60%  { box-shadow: 0 6px 18px rgba(23, 71, 102, .35), 0 0 0 14px rgba(31, 92, 139, 0); }
	100% { box-shadow: 0 6px 18px rgba(23, 71, 102, .35), 0 0 0 0 rgba(31, 92, 139, 0); }
}
@media (prefers-reduced-motion: reduce) {
	#lc-teaser { animation: none; }
	#lc-bubble.lc-pulse { animation: none; }
}


/* ---------- Answer feedback (thumbs) ---------- */
.lc-fb {
	display: flex; gap: 4px; align-items: center;
	margin-top: 5px;
}
.lc-fb-btn {
	background: none; border: none;
	color: #9aa8b3;
	cursor: pointer;
	padding: 2px 4px;
	line-height: 1;
	transition: color .12s ease;
}
.lc-fb-btn:hover { color: var(--lc-blue); }
.lc-fb-done { font-size: 11px; color: var(--lc-muted); }


/* ---------- Voice input ---------- */
#lc-mic {
	width: 32px; height: 32px; flex-shrink: 0;
	border: none; border-radius: 50%;
	background: none; color: var(--lc-blue);
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	transition: background .12s ease, color .12s ease;
}
#lc-mic:hover { background: var(--lc-mist-light); }
/* Theme-proof the mic icon: some themes force button colors (white-on-white = invisible icon) */
#lc-mic, #lc-mic svg {
	color: var(--lc-blue) !important;
	stroke: var(--lc-blue) !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}
#lc-mic svg {
	width: 18px !important;
	height: 18px !important;
	min-width: 18px !important;
	min-height: 18px !important;
	max-width: none !important;
	max-height: none !important;
	flex-shrink: 0 !important;
	display: block !important;
	fill: none !important;
	opacity: 1 !important;
}
#lc-mic.lc-mic-live, #lc-mic.lc-mic-live svg {
	color: #c0392b !important;
	stroke: #c0392b !important;
}
#lc-mic[hidden], #lc-vlang[hidden] { display: none !important; }
#lc-mic.lc-mic-live {
	color: #c0392b; border-color: #c0392b;
	animation: lc-mic-pulse 1.4s ease infinite;
}
@keyframes lc-mic-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(192, 57, 43, .35); }
	70%  { box-shadow: 0 0 0 10px rgba(192, 57, 43, 0); }
	100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}
#lc-vlang {
	flex-shrink: 0;
	border: none; background: none;
	color: var(--lc-muted);
	font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
	cursor: pointer; padding: 0 2px;
	align-self: center;
}
#lc-vlang:hover { color: var(--lc-blue); }
@media (prefers-reduced-motion: reduce) {
	#lc-mic.lc-mic-live { animation: none; }
}


/* Neutralize theme svg size caps (max-width beats width even with !important) */
#lagachat svg {
	max-width: none !important;
	max-height: none !important;
}


/* Correct direction for RTL languages (Arabic, Persian…) per paragraph */
#lagachat .lc-msg { unicode-bidi: plaintext; }


/* Any touch device (incl. landscape phones, tablets): 16px input = no iOS focus zoom */
@media (pointer: coarse) {
	#lc-input { font-size: 16px !important; }
}


/* ---------- Offert intake: in-chat upload zone + checkout CTA ---------- */
.lc-upload-zone { margin: 6px 0 10px; padding: 10px 12px; border: 1px dashed #9db8c9; border-radius: 12px; background: #f7fafc; }
.lc-upload-btn { display: inline-block; position: relative; cursor: pointer; padding: 8px 16px; border: 1.5px solid var(--lc-blue); border-radius: 999px; color: var(--lc-blue); background: var(--lc-white); font-size: 14px; font-weight: 600; }
.lc-upload-btn:hover { background: var(--lc-blue); color: var(--lc-white); }
.lc-upload-list { margin-top: 6px; font-size: 12.5px; }
.lc-upload-list div { margin-top: 4px; }
.lc-checkout-btn { display: block; margin: 6px 0 12px; padding: 12px 16px; text-align: center; background: var(--lc-blue); color: var(--lc-white) !important; border-radius: 12px; font-size: 15px; font-weight: 700; text-decoration: none !important; }
.lc-checkout-btn:hover { background: var(--lc-blue-dark); }


/* ---------- Voice language chips ---------- */
.lc-voicelang { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 10px; }
