/* ============================================================
   RCN Chat & Notifications
   ============================================================ */

.rcn-chat { margin-top: 16px; }

.rcn-chat__layout {
	display: grid;
	grid-template-columns: 340px 1fr;
	gap: 0;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	overflow: hidden;
	min-height: 600px;
	height: 70vh;
}

/* ===== Sidebar ===== */
.rcn-chat__sidebar {
	border-right: 1px solid #e5e7eb;
	display: flex;
	flex-direction: column;
	background: #fafbfc;
	overflow: hidden;
}
.rcn-chat__sidebar-head {
	padding: 16px 20px;
	border-bottom: 1px solid #e5e7eb;
	background: #fff;
}
body.rcn-theme .rcn-chat__sidebar-head h2 {
	margin: 0;
	font-size: 17px;
	font-weight: 800;
	color: #0f172a;
	display: flex;
	align-items: center;
	gap: 8px;
}
.rcn-chat__count {
	background: #dc2626;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 999px;
	min-width: 18px;
	text-align: center;
}
.rcn-chat__list {
	flex: 1;
	overflow-y: auto;
	padding: 8px;
}

/* ---- Chat list items: high-specificity reset to beat any Motors button
   styles (their .rcn-btn / .btn rules cascade into <button> elements,
   which is what we render). All values are forced. ---- */
body.rcn-theme .rcn-chat__item,
body .rcn-chat__item,
.rcn-chat__item {
	display: flex !important;
	gap: 12px !important;
	padding: 12px 14px !important;
	background: #fff !important;
	border: 1px solid transparent !important;
	border-radius: 10px !important;
	width: 100% !important;
	cursor: pointer !important;
	text-align: left !important;
	font-family: inherit !important;
	font-size: 14px !important;
	font-weight: 500 !important;
	transition: background .15s, border-color .15s, box-shadow .15s !important;
	position: relative !important;
	color: #0f172a !important;
	margin: 0 0 4px 0 !important;
	text-decoration: none !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	min-height: 0 !important;
	height: auto !important;
	line-height: 1.4 !important;
}
body.rcn-theme .rcn-chat__item:hover,
body .rcn-chat__item:hover,
.rcn-chat__item:hover {
	background: #f8fafc !important;
	border-color: #e5e7eb !important;
}
body.rcn-theme .rcn-chat__item.active,
body .rcn-chat__item.active,
.rcn-chat__item.active {
	background: #fff !important;
	border-color: #dc2626 !important;
	box-shadow: 0 2px 8px rgba(220, 38, 38, .12) !important;
}
body.rcn-theme .rcn-chat__item.active::before,
.rcn-chat__item.active::before {
	content: "";
	position: absolute;
	left: 0; top: 12px; bottom: 12px;
	width: 3px;
	background: #dc2626;
	border-radius: 0 2px 2px 0;
}
/* Unread = subtle accent (left border + bolder text), NOT red background */
body.rcn-theme .rcn-chat__item.unread,
.rcn-chat__item.unread {
	background: #fff !important;
	border-left: 3px solid #dc2626 !important;
	padding-left: 11px !important;
}
.rcn-chat__item.unread strong { font-weight: 800 !important; color: #0f172a !important; }
.rcn-chat__item.unread .rcn-chat__item-preview { color: #0f172a !important; font-weight: 600 !important; }

.rcn-chat__avatar {
	width: 42px; height: 42px;
	border-radius: 50%;
	flex-shrink: 0;
	object-fit: cover;
}
.rcn-chat__avatar--sm { width: 28px; height: 28px; }

.rcn-chat__item-body { flex: 1; min-width: 0; }
.rcn-chat__item-top {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 6px;
}
.rcn-chat__item-top strong {
	font-size: 14px !important;
	color: #0f172a !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.rcn-chat__time {
	font-size: 11px;
	color: #94a3b8 !important;
	flex-shrink: 0;
	font-weight: 500 !important;
}
.rcn-chat__item-listing {
	font-size: 11.5px;
	color: #dc2626 !important;
	font-weight: 600 !important;
	margin: 2px 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.rcn-chat__item-preview {
	font-size: 12.5px;
	color: #6b7280 !important;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-weight: 500 !important;
}
.rcn-chat__badge {
	background: #dc2626;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	align-self: center;
	flex-shrink: 0;
}

.rcn-chat__empty {
	text-align: center;
	padding: 48px 20px;
	color: #94a3b8;
}
.rcn-chat__empty p { font-size: 13px; margin: 10px 0 0; }
.rcn-chat__loading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px;
	color: #6b7280;
	font-size: 13px;
	justify-content: center;
}

/* ===== Thread ===== */
.rcn-chat__thread {
	display: flex;
	flex-direction: column;
	background: #fff;
	overflow: hidden;
}
.rcn-chat__thread-body {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.rcn-chat__placeholder {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: #94a3b8;
	padding: 40px;
	text-align: center;
}
.rcn-chat__placeholder svg { color: #cbd5e1; margin-bottom: 14px; }
.rcn-chat__placeholder h3 { color: #475569; margin: 0; }
.rcn-chat__placeholder p { color: #94a3b8; margin: 0; }

.rcn-chat__thread-head {
	padding: 14px 20px;
	border-bottom: 1px solid #e5e7eb;
	background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
	display: flex;
	align-items: center;
	gap: 14px;
}
.rcn-chat__back {
	background: transparent;
	border: 1px solid #e5e7eb;
	cursor: pointer;
	padding: 8px 10px;
	border-radius: 8px;
	display: none;
	color: #6b7280;
}
.rcn-chat__back:hover { background: #f1f5f9; color: #dc2626; }
.rcn-chat__thread-user {
	flex: 1;
	display: flex;
	gap: 12px;
	text-decoration: none;
	color: inherit;
	min-width: 0;
}
.rcn-chat__thread-user strong {
	color: #0f172a;
	font-size: 15.5px;
	font-weight: 700;
}
.rcn-chat__thread-listing {
	font-size: 12.5px;
	color: #6b7280;
	margin-top: 2px;
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}
.rcn-chat__thread-listing a {
	color: #dc2626;
	font-weight: 600;
	text-decoration: none;
}
.rcn-chat__thread-price {
	font-weight: 800;
	color: #0f172a;
	font-family: 'JetBrains Mono', monospace;
}

/* Messages */
.rcn-chat__messages {
	flex: 1;
	overflow-y: auto;
	padding: 18px 22px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: linear-gradient(180deg, #f8fafc 0%, #fff 30%);
}
.rcn-chat__msg {
	display: flex;
	gap: 10px;
	align-items: flex-end;
	max-width: 75%;
}
.rcn-chat__msg--mine {
	align-self: flex-end;
	justify-content: flex-end;
}
.rcn-chat__bubble {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 14px 14px 14px 4px;
	padding: 10px 14px;
	color: #0f172a;
	font-size: 14px;
	line-height: 1.5;
	box-shadow: 0 1px 2px rgba(0,0,0,.04);
	min-width: 80px;
}
.rcn-chat__msg--mine .rcn-chat__bubble {
	background: #dc2626;
	color: #fff;
	border-color: #dc2626;
	border-radius: 14px 14px 4px 14px;
}
.rcn-chat__bubble-body p { margin: 0 0 6px; }
.rcn-chat__bubble-body p:last-child { margin: 0; }
.rcn-chat__bubble-meta {
	display: flex;
	gap: 6px;
	margin-top: 4px;
	font-size: 11px;
	color: #94a3b8;
	justify-content: flex-end;
}
.rcn-chat__msg--mine .rcn-chat__bubble-meta {
	color: rgba(255, 255, 255, .8);
}
.rcn-chat__read { color: #4ade80; font-weight: 700; }
.rcn-chat__msg--mine .rcn-chat__read { color: #86efac; }
.rcn-chat__typing {
	align-self: flex-start;
	color: #94a3b8;
	font-size: 12px;
	font-style: italic;
	padding-left: 50px;
}

/* Composer */
.rcn-chat__composer {
	display: flex;
	gap: 10px;
	padding: 14px 18px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
	align-items: flex-end;
}
.rcn-chat__composer textarea {
	flex: 1;
	border: 1.5px solid #e5e7eb;
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	min-height: 44px;
	max-height: 140px;
	color: #0f172a;
	transition: border-color .15s;
}
.rcn-chat__composer textarea:focus {
	border-color: #dc2626;
	outline: none;
	box-shadow: 0 0 0 4px rgba(220, 38, 38, .08);
}
.rcn-chat__composer .rcn-btn {
	flex-shrink: 0;
	padding: 11px 18px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

@media ( max-width: 768px ) {
	.rcn-chat__layout {
		grid-template-columns: 1fr;
		height: auto;
		min-height: 70vh;
	}
	.rcn-chat__sidebar { display: flex; }
	.rcn-chat__sidebar.is-mobile-hidden { display: none; }
	.rcn-chat__thread { display: none; }
	.rcn-chat__thread.is-active { display: flex; }
	.rcn-chat__back { display: inline-flex; align-items: center; }
}

/* ============================================================
   Notifications page + dropdown
   ============================================================ */
.rcn-notif-page { margin-top: 16px; }
.rcn-notif-filters {
	display: flex;
	gap: 6px;
	margin-bottom: 16px;
}
.rcn-notif-filter {
	background: #fff;
	border: 1.5px solid #e5e7eb;
	color: #6b7280;
	font-size: 13.5px;
	font-weight: 600;
	padding: 8px 16px;
	border-radius: 999px;
	cursor: pointer;
	font-family: inherit;
	display: inline-flex;
	gap: 6px;
	align-items: center;
}
.rcn-notif-filter:hover { border-color: #cbd5e1; }
.rcn-notif-filter.active {
	background: #dc2626;
	border-color: #dc2626;
	color: #fff;
}
.rcn-notif-filter__count {
	background: rgba(255, 255, 255, .25);
	padding: 1px 7px;
	border-radius: 999px;
	font-size: 11px;
}

.rcn-notif-list {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	overflow: hidden;
}
.rcn-notif-item {
	display: flex;
	gap: 14px;
	padding: 16px 20px;
	text-decoration: none;
	color: inherit;
	border-bottom: 1px solid #f1f5f9;
	transition: background .15s;
	position: relative;
}
.rcn-notif-item:last-child { border-bottom: none; }
.rcn-notif-item:hover { background: #fafbfc; }
.rcn-notif-item.unread { background: #fef2f2; }
.rcn-notif-item.unread:hover { background: #fee2e2; }

.rcn-notif-icon {
	width: 38px; height: 38px;
	background: #f3f4f6;
	color: #475569;
	border-radius: 50%;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.rcn-notif-icon--new_message { background: #fef2f2; color: #dc2626; }
.rcn-notif-icon--saved_search_match { background: #dbeafe; color: #2563eb; }
.rcn-notif-icon--listing_approved { background: #d1fae5; color: #15803d; }

.rcn-notif-body { flex: 1; min-width: 0; }
.rcn-notif-body strong {
	display: block;
	color: #0f172a;
	font-size: 14.5px;
	font-weight: 700;
	margin-bottom: 2px;
}
.rcn-notif-body p {
	margin: 0 0 4px;
	color: #6b7280;
	font-size: 13.5px;
	line-height: 1.5;
}
.rcn-notif-body small {
	color: #94a3b8;
	font-size: 11.5px;
}
.rcn-notif-dot {
	width: 10px; height: 10px;
	background: #dc2626;
	border-radius: 50%;
	align-self: center;
	flex-shrink: 0;
	box-shadow: 0 0 0 3px rgba(220, 38, 38, .2);
}
