/* -----------------------------------------------------------------------
   Badge op het account-icoon in de header (naast het bestaande hartje).
   Wordt door chat-widget.js dynamisch in de bestaande header-link
   geplaatst (a.elementor-icon[href="/account/advertenties"]).
----------------------------------------------------------------------- */
.autoofy-chat-header-badge {
	position: absolute !important;
	top: -6px !important;
	right: -8px !important;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px !important;
	background: #E3A008 !important;
	color: #fff !important;
	font-size: 10.5px !important;
	font-weight: 700 !important;
	line-height: 18px !important;
	text-align: center;
	border: 2px solid #fff !important;
	pointer-events: none;
	z-index: 1;
}

/* -----------------------------------------------------------------------
   Autoofy Chat — vaste bubbel rechtsonder

   LET OP: veel regels hier gebruiken !important. Dat is bewust: de
   bubbel-elementen (launcher, inbox-items, verstuurknoppen) zijn
   <button>-tags, en het thema van de site blijkt generieke button-
   styling te hebben die anders voorrang krijgt (net zoals in de
   bestaande vehicle-template-CSS elders op de site, die om dezelfde
   reden ook overal !important gebruikt).
----------------------------------------------------------------------- */
#autoofy-chat-bubble-root {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 100000;
	font-family: inherit;
}

.autoofy-chat-launcher {
	position: relative;
	width: 56px;
	height: 56px;
	border-radius: 50% !important;
	border: none !important;
	background: #B22234 !important;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform 0.15s ease, background-color 0.2s ease;
	padding: 0 !important;
}

.autoofy-chat-launcher:hover {
	background: #941c2b !important;
	transform: scale(1.05);
}

.autoofy-chat-launcher.is-open {
	background: #1D3557 !important;
}

.autoofy-chat-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px !important;
	background: #E3A008 !important;
	color: #fff !important;
	font-size: 11px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff !important;
}

/* -----------------------------------------------------------------------
   Uitklappaneel
----------------------------------------------------------------------- */
.autoofy-chat-panel {
	position: absolute;
	right: 0;
	bottom: 72px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: #fff !important;
	border-radius: 14px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid #eef0f3;
	box-sizing: border-box;
}

.autoofy-chat-panel-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 16px;
	background: #1D3557 !important;
	color: #fff !important;
	flex-shrink: 0;
}

.autoofy-chat-panel-title {
	flex: 1;
	font-weight: 700;
	font-size: 15px;
	color: #fff !important;
}

.autoofy-chat-panel-back,
.autoofy-chat-panel-close {
	border: none !important;
	background: none !important;
	color: #fff !important;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.autoofy-chat-panel-close {
	font-size: 24px;
	line-height: 1;
}

.autoofy-chat-panel-body {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	background: #fff !important;
}

/* -----------------------------------------------------------------------
   Inbox-lijst (bubbel + "Mijn berichten"-pagina)

   Dit zijn de rijen die eerder per ongeluk rood/onleesbaar oogden door
   thema-CSS die op alle <button>-elementen inbrak — hier expliciet
   witte achtergrond + donkere tekst afgedwongen.
----------------------------------------------------------------------- */
.autoofy-chat-list {
	display: flex;
	flex-direction: column;
}

.autoofy-chat-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 12px 16px;
	border: none !important;
	border-bottom: 1px solid #eef0f3 !important;
	border-radius: 0 !important;
	background: #fff !important;
	text-align: left;
	cursor: pointer;
	text-decoration: none !important;
	font-family: inherit;
	font-weight: 400 !important;
}

.autoofy-chat-item-thumb {
	width: 44px;
	height: 44px;
	border-radius: 8px !important;
	object-fit: cover;
	flex-shrink: 0;
	background: #f1f3f5 !important;
	border: 1px solid #eef0f3 !important;
}

.autoofy-chat-item-thumb-placeholder {
	display: flex !important;
	align-items: center;
	justify-content: center;
}

.autoofy-chat-thread-thumb {
	width: 26px;
	height: 26px;
	border-radius: 6px !important;
	object-fit: cover;
	flex-shrink: 0;
	background: #f1f3f5 !important;
	border: 1px solid #eef0f3 !important;
}

.autoofy-chat-item:hover {
	background: #f8fafc !important;
}

.autoofy-chat-item-main {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.autoofy-chat-item-title {
	font-weight: 700 !important;
	font-size: 14px;
	color: #0f172a !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 220px;
}

.autoofy-chat-item-preview {
	font-size: 12.5px;
	color: #6b7280 !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 220px;
}

.autoofy-chat-item-side {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.autoofy-chat-item-time {
	font-size: 11px;
	color: #9ca3af !important;
	white-space: nowrap;
}

.autoofy-chat-item-dot {
	width: 9px;
	height: 9px;
	border-radius: 50% !important;
	background: #E3A008 !important;
	display: inline-block;
	flex-shrink: 0;
}

/* Losstaande "Mijn berichten"-pagina: iets ruimere kaartachtige items. */
.autoofy-chat-list-page .autoofy-chat-item {
	border: 1px solid #eef0f3 !important;
	border-radius: 8px !important;
	margin-bottom: 8px;
}

.autoofy-chat-list-page .autoofy-chat-item-title,
.autoofy-chat-list-page .autoofy-chat-item-preview {
	max-width: none;
}

/* -----------------------------------------------------------------------
   Lege staat / foutmelding / laden
----------------------------------------------------------------------- */
.autoofy-chat-empty {
	padding: 28px 20px;
	text-align: center;
	color: #6b7280 !important;
	font-size: 14px;
	margin: auto 0;
}

.autoofy-chat-empty-hint {
	margin-top: 8px;
	font-size: 13px;
}

.autoofy-chat-empty a,
.autoofy-chat-thread-link {
	color: #B22234 !important;
	font-weight: 700 !important;
	text-decoration: none !important;
}

.autoofy-chat-empty a:hover,
.autoofy-chat-thread-link:hover {
	text-decoration: underline !important;
}

.autoofy-chat-loading {
	padding: 24px 16px;
	color: #6b7280 !important;
	font-size: 14px;
	text-align: center;
}

.autoofy-chat-error-msg {
	padding: 16px;
	color: #b91c1c !important;
	font-size: 13.5px;
	text-align: center;
}

/* -----------------------------------------------------------------------
   Start-formulier (nieuwe vraag)
----------------------------------------------------------------------- */
.autoofy-chat-form {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px;
	background: #fff !important;
}

.autoofy-chat-intro {
	margin: 0 0 6px;
	color: #374151 !important;
	font-size: 13.5px;
	line-height: 1.4;
}

.autoofy-chat-form label {
	font-size: 0.8rem;
	font-weight: 600 !important;
	color: #374151 !important;
	margin-top: 6px;
}

.autoofy-chat-form input,
.autoofy-chat-form textarea {
	width: 100%;
	padding: 9px 10px;
	border: 1px solid #d1d5db !important;
	border-radius: 6px !important;
	background: #fff !important;
	color: #111827 !important;
	font-size: 14.5px;
	font-family: inherit;
	box-sizing: border-box;
}

.autoofy-chat-form input:focus,
.autoofy-chat-form textarea:focus {
	outline: none;
	border-color: #1D3557 !important;
}

.autoofy-chat-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}

.autoofy-chat-submit {
	margin-top: 12px;
	padding: 11px 18px;
	border: none !important;
	border-radius: 6px !important;
	background: #B22234 !important;
	color: #fff !important;
	font-weight: 700 !important;
	font-size: 14.5px;
	cursor: pointer;
	transition: background-color 0.2s ease;
	width: 100%;
}

.autoofy-chat-submit:hover:not(:disabled) {
	background: #941c2b !important;
}

.autoofy-chat-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

/* -----------------------------------------------------------------------
   Gespreksthread (binnen bubbel én op losse /gesprek/-pagina)
----------------------------------------------------------------------- */
.autoofy-chat-thread-vehicle {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border-bottom: 1px solid #eef0f3 !important;
	flex-shrink: 0;
	background: #fff !important;
}

.autoofy-chat-thread-vehicle a {
	font-weight: 700 !important;
	font-size: 13.5px;
	color: #0f172a !important;
	text-decoration: none !important;
}

.autoofy-chat-messages {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 16px;
	background: #f6f7f8 !important;
}

.autoofy-chat-message {
	max-width: 82%;
	padding: 9px 12px;
	border-radius: 12px !important;
	background: #fff !important;
	border: 1px solid #eef0f3 !important;
}

.autoofy-chat-message.is-visitor {
	align-self: flex-end;
	background: #B22234 !important;
	border-color: #B22234 !important;
	color: #fff !important;
	border-bottom-right-radius: 3px !important;
}

.autoofy-chat-message.is-dealer {
	align-self: flex-start;
	border-bottom-left-radius: 3px !important;
}

.autoofy-chat-message.is-visitor .autoofy-chat-sender {
	color: rgba(255, 255, 255, 0.75) !important;
}

.autoofy-chat-message.is-visitor p {
	color: #fff !important;
}

.autoofy-chat-message.is-dealer p {
	color: #111827 !important;
}

.autoofy-chat-sender {
	display: block;
	font-size: 10.5px;
	font-weight: 700 !important;
	color: #6b7280 !important;
	margin-bottom: 2px;
}

.autoofy-chat-message p {
	margin: 0;
	line-height: 1.4;
	font-size: 14px;
	white-space: pre-wrap;
	word-break: break-word;
}

.autoofy-chat-reply {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	padding: 10px 12px;
	border-top: 1px solid #eef0f3 !important;
	flex-shrink: 0;
	background: #fff !important;
}

.autoofy-chat-reply textarea {
	flex: 1;
	padding: 9px 10px;
	border: 1px solid #d1d5db !important;
	border-radius: 8px !important;
	background: #fff !important;
	color: #111827 !important;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	max-height: 90px;
}

.autoofy-chat-reply textarea:focus {
	outline: none;
	border-color: #1D3557 !important;
}

.autoofy-chat-reply button {
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	border-radius: 50% !important;
	border: none !important;
	background: #B22234 !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
}

.autoofy-chat-reply button:hover:not(:disabled) {
	background: #941c2b !important;
}

.autoofy-chat-reply button:disabled {
	opacity: 0.6;
	cursor: default;
}

/* Losse /gesprek/-pagina: geeft de threadweergave wat pagina-marges,
   want daar zit geen bubbel-paneel omheen. */
.autoofy-chat-standalone-thread {
	max-width: 560px;
	margin: 0 auto;
	border: 1px solid #eef0f3;
	border-radius: 12px;
	overflow: hidden;
	height: 70vh;
	display: flex;
	flex-direction: column;
	background: #fff !important;
}

/* -----------------------------------------------------------------------
   Mobiel: paneel vult het scherm, net als een app
----------------------------------------------------------------------- */
@media (max-width: 480px) {
	#autoofy-chat-bubble-root {
		right: 14px !important;
		bottom: 14px !important;
	}

	.autoofy-chat-panel {
		position: fixed !important;
		top: 0 !important;
		left: 0 !important;
		right: 0 !important;
		bottom: 0 !important;
		width: 100vw !important;
		height: 100vh !important;
		max-width: none !important;
		max-height: none !important;
		border-radius: 0 !important;
		margin: 0 !important;
		box-sizing: border-box;
	}

	.autoofy-chat-standalone-thread {
		height: 80vh;
		border-radius: 0;
		border-left: none;
		border-right: none;
	}
}
