/**
 * Messagerie client <-> administrateur.
 * Style inspiré de WhatsApp (palette #075e54 / #128c7e / #dcf8c6 / #ece5dd).
 */

/* ===== Badges de notifications ===== */

.cwc-msg-badge {
	display: inline-block;
	min-width: 20px;
	height: 20px;
	line-height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: #25d366;
	color: #075e54;
	font-size: 12px;
	font-weight: 700;
	text-align: center;
}

.cwc-msg-badge--hidden {
	display: none;
}

.cwc-msg-badge--tab {
	margin-left: 6px;
	vertical-align: middle;
}

/* ===== Conversation client ===== */

.cwc-msg {
	max-width: 720px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	background: #ece5dd;
	border: 1px solid #e2e2e2;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.cwc-msg__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	background: #075e54;
	color: #fff;
}

.cwc-msg__title {
	font-size: 16px;
	font-weight: 600;
}

.cwc-msg__thread {
	display: flex;
	flex-direction: column;
	gap: 6px;
	height: 420px;
	padding: 16px 14px;
	overflow-y: auto;
}

.cwc-msg__empty {
	margin: auto;
	color: #9a9a9a;
	text-align: center;
	font-size: 14px;
}

.cwc-msg__bubble--sent,
.cwc-msg__bubble--received {
	max-width: 75%;
	padding: 8px 12px;
	border-radius: 12px;
	position: relative;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
	word-break: break-word;
}

.cwc-msg__bubble--sent {
	align-self: flex-end;
	background: #dcf8c6;
	border-top-right-radius: 2px;
}

.cwc-msg__bubble--received {
	align-self: flex-start;
	background: #fff;
	border-top-left-radius: 2px;
}

.cwc-msg__text {
	margin: 0 0 4px;
	font-size: 14px;
	line-height: 1.45;
}

.cwc-msg__image {
	display: block;
	max-width: 100%;
	max-height: 260px;
	width: auto;
	height: auto;
	border-radius: 8px;
	margin: 0 0 4px;
	cursor: pointer;
}

.cwc-msg__download {
	display: inline-block;
	margin-bottom: 4px;
	font-size: 12px;
	color: #128c7e;
	text-decoration: underline;
}

.cwc-msg__meta {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 6px;
	font-size: 11px;
	color: #8a8a8a;
}

.cwc-msg__read {
	color: #4fc3f7;
	font-weight: 700;
}

/* ===== Aperçu de la pièce jointe ===== */

.cwc-msg__file-preview {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	background: #fff;
	border-top: 1px solid #e2e2e2;
}

.cwc-msg__file-preview[hidden] {
	display: none;
}

.cwc-msg__file-thumb {
	width: 44px;
	height: 44px;
	object-fit: cover;
	border-radius: 6px;
}

.cwc-msg__filename {
	flex: 1;
	min-width: 0;
	font-size: 13px;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cwc-msg__file-remove {
	width: 26px;
	height: 26px;
	border: 0;
	border-radius: 50%;
	background: #eee;
	color: #666;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.cwc-msg__file-remove:hover {
	background: #ddd;
}

/* ===== Composer ===== */

.cwc-msg__composer {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding: 12px 14px;
	background: #f0f0f0;
}

.cwc-msg__attach {
	cursor: pointer;
	flex-shrink: 0;
}

.cwc-msg__attach span {
	display: block;
	padding: 6px 4px;
	font-size: 22px;
	line-height: 1;
}

.cwc-msg__input {
	flex: 1;
	min-height: 44px;
	max-height: 120px;
	resize: none;
	padding: 10px 14px;
	border: 1px solid #ddd;
	border-radius: 20px;
	background: #fff;
	font: inherit;
	font-size: 14px;
	outline: none;
}

.cwc-msg__input:focus {
	border-color: #25d366;
}

.cwc-msg__send {
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	border: 0;
	border-radius: 50%;
	background: #075e54;
	color: #fff;
	font-size: 18px;
	cursor: pointer;
}

.cwc-msg__send:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.cwc-msg__send--label {
	width: auto;
	height: auto;
	min-height: 44px;
	padding: 0 20px;
	border-radius: 22px;
	font-size: 14px;
}

.cwc-msg-admin__avatar--img {
	object-fit: cover;
	background: #128c7e;
}

/* ===== Boîte de réception administrateur ===== */

.cwc-msg-admin {
	display: grid;
	grid-template-columns: 320px 1fr;
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.cwc-msg-admin__list {
	border-right: 1px solid #e2e2e2;
	background: #f7f7f7;
}

.cwc-msg-admin__list-head {
	padding: 14px 16px;
	background: #075e54;
	color: #fff;
	font-weight: 600;
}

.cwc-msg-admin__convs {
	max-height: 520px;
	overflow-y: auto;
}

.cwc-msg-admin__empty {
	padding: 24px 16px;
	text-align: center;
	color: #9a9a9a;
	font-size: 14px;
}

.cwc-msg-admin__conv {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 12px 14px;
	border: 0;
	border-bottom: 1px solid #ececec;
	background: none;
	text-align: left;
	cursor: pointer;
	color: inherit;
	text-decoration: none;
}

.cwc-msg-admin__conv:hover {
	background: #f0f0f0;
}

.cwc-msg-admin__conv.is-active {
	background: #e6f7ec;
}

.cwc-msg-admin__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	border-radius: 50%;
	background: #128c7e;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
}

.cwc-msg-admin__conv-body {
	flex: 1;
	min-width: 0;
}

.cwc-msg-admin__conv-name {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #333;
}

.cwc-msg-admin__conv-preview {
	display: block;
	font-size: 12px;
	color: #888;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cwc-msg-admin__conv-side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	flex-shrink: 0;
}

.cwc-msg-admin__conv-time {
	font-size: 11px;
	color: #aaa;
}

.cwc-msg-admin__main {
	display: flex;
	flex-direction: column;
	min-height: 520px;
}

.cwc-msg-admin__thread {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
	max-height: 470px;
	padding: 16px 14px;
	background: #ece5dd;
	overflow-y: auto;
}

.cwc-msg-admin__placeholder {
	margin: auto;
	color: #9a9a9a;
	font-size: 14px;
}

/* ===== Toast de notification ===== */

.cwc-msg-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 99999;
	padding: 10px 18px;
	border-radius: 8px;
	background: #075e54;
	color: #fff;
	font-size: 14px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	animation: cwc-msg-toast-in 0.25s ease;
}

.cwc-msg-toast.is-leaving {
	opacity: 0;
	transition: opacity 0.3s;
}

@keyframes cwc-msg-toast-in {
	from {
		opacity: 0;
		transform: translate(-50%, 8px);
	}
	to {
		opacity: 1;
		transform: translate(-50%, 0);
	}
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
	.cwc-msg-admin {
		grid-template-columns: 1fr;
	}

	.cwc-msg-admin__list {
		border-right: 0;
		border-bottom: 1px solid #e2e2e2;
	}

	.cwc-msg-admin__convs {
		max-height: 220px;
	}

	.cwc-msg-admin__main {
		min-height: 0;
	}

	.cwc-msg-admin__thread {
		max-height: 340px;
	}

	.cwc-msg__bubble--sent,
	.cwc-msg__bubble--received {
		max-width: 85%;
	}
}
