.spotmart-chat-trigger {
	margin-top: 1rem;
}

/* -------------------------------------------------------------------------- */
/* Product page widget                                                        */
/* -------------------------------------------------------------------------- */

.spotmart-chat-overlay {
	position: fixed;
	inset: 0;
	background: rgba(18, 40, 18, 0.45);
	z-index: 998;
}

.spotmart-chat-widget {
	position: fixed;
	right: 2%;
	bottom: 2%;
	width: 360px;
	max-width: 90vw;
	background: #ffffff;
	border-radius: 4px;
	border: 1px solid rgba(12, 165, 60, 0.12);
	box-shadow: 0 18px 32px rgba(12, 102, 42, 0.18);
	display: flex;
	flex-direction: column;
	z-index: 999;
	transform: translateY(18px);
	opacity: 0;
	transition: all 0.2s ease;
	overflow: hidden;
	height: clamp(300px, 60vh, 440px);
}

.spotmart-chat-widget.is-open {
	transform: translateY(0);
	opacity: 1;
}

.spotmart-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-bottom: 1px solid rgba(12, 165, 60, 0.12);
	background: rgba(12, 165, 60, 0.05);
	border-radius: 4px 4px 0 0;
}

.spotmart-chat-header-text strong {
	display: block;
	font-size: 0.95rem;
	color: var(--spotmart-color-heading, #142914);
}

.spotmart-chat-header-text span {
	color: var(--spotmart-color-muted, #627065);
	font-size: 0.75rem;
}

.spotmart-chat-close {
	border: none;
	background: transparent;
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
	color: var(--spotmart-color-muted, #627065);
}

.spotmart-chat-messages {
	padding: 14px 16px;
	overflow-y: auto;
	background: #ffffff;
	flex: 1;
	min-height: 0;
}

.spotmart-chat-input {
	display: grid;
	align-items: center;
	grid-template-columns: 1fr auto;
	gap: 8px;
	padding: 12px 14px 14px;
	border-top: 1px solid rgba(12, 165, 60, 0.12);
	background: rgba(246, 253, 247, 0.7);
	border-radius: 0 0 4px 4px;
}

.spotmart-chat-input textarea {
	width: 100%;
	min-height: 38px;
	max-height: 140px;
	border-radius: 4px;
	padding: 8px 10px;
	border: 1px solid rgba(12, 165, 60, 0.2);
	resize: none;
	font-size: 0.9rem;
	font-family: inherit;
	box-shadow: none;
	line-height: 1.4;
	overflow-y: auto;
}

.spotmart-chat-input textarea:focus {
	outline: none;
	border-color: var(--spotmart-color-primary, #0ca53c);
	box-shadow: 0 0 0 3px rgba(12, 165, 60, 0.16);
}

.spotmart-chat-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 4px;
	border: none;
	background: var(--spotmart-color-primary, #0ca53c);
	color: #ffffff;
	cursor: pointer;
	box-shadow: 0 10px 18px rgba(12, 102, 42, 0.22);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.spotmart-chat-send:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 26px rgba(12, 102, 42, 0.24);
}

.spotmart-chat-send .dashicons {
	font-size: 1.1rem;
	line-height: 1;
}

/* -------------------------------------------------------------------------- */
/* Shared dashboard layout                                                    */
/* -------------------------------------------------------------------------- */

.spotmart-chat-shell {
	display: grid;
	grid-template-columns: minmax(320px, 420px) 1fr;
	background: #ffffff;
	border-radius: 4px;
	box-shadow: 0 20px 45px rgba(12, 102, 42, 0.14);
	border: 1px solid rgba(12, 165, 60, 0.12);
	height: clamp(520px, 100vh, 780px);
	overflow: hidden;
	min-height: 0;
}

.spotmart-chat-sidebar {
	background: rgba(246, 253, 247, 0.82);
	border-right: 1px solid rgba(12, 165, 60, 0.12);
	padding: 16px 12px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	overflow: hidden;
	height: 100%;
	min-height: 0;
}

.spotmart-chat-sidebar__header {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.spotmart-chat-sidebar__title {
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--spotmart-color-heading, #142914);
}

.spotmart-chat-sidebar__search {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.85);
	border: 1px solid rgba(12, 165, 60, 0.14);
	box-shadow: 0 10px 24px rgba(12, 102, 42, 0.08);
}

.spotmart-chat-sidebar__search input {
	flex: 1;
	border: none;
	background: transparent;
	font-size: 0.9rem;
}

.spotmart-chat-sidebar__search input:focus {
	outline: none;
}

.spotmart-chat-pane {
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1;
	min-height: 0;
}

.spotmart-chat-pane[hidden] {
	display: none !important;
}

.spotmart-chat-pane__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.spotmart-chat-pane__header h3 {
	margin: 0;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--spotmart-color-heading, #142914);
}

.spotmart-chat-pane__header--inline {
	display: flex;
	align-items: center;
	gap: 8px;
}

.spotmart-chat-pane__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-height: 140px;
	max-height: 100%;
	overflow-y: auto;
	padding-right: 6px;
	flex: 1;
}

.spotmart-chat-back {
	border: none;
	background: rgba(12, 165, 60, 0.15);
	color: var(--spotmart-color-primary, #0ca53c);
	width: 32px;
	height: 32px;
	border-radius: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.spotmart-chat-main {
	display: flex;
	flex-direction: column;
	background: rgba(246, 253, 247, 0.9);
	height: 100%;
	min-height: 0;
}

.spotmart-chat-main__head {
	padding: 20px 24px;
	border-bottom: 1px solid rgba(12, 165, 60, 0.12);
}

.spotmart-chat-main__head h2 {
	margin: 0;
	font-size: 1.25rem;
	color: var(--spotmart-color-heading, #142914);
}

.spotmart-chat-main__head p {
	margin: 6px 0 0;
	font-size: 0.85rem;
	color: var(--spotmart-color-muted, #627065);
}

.spotmart-chat-main__body {
	flex: 1;
	min-height: 0;
	padding: 22px;
	overflow-y: auto;
	position: relative;
	display: flex;
	flex-direction: column;
}

.spotmart-chat-composer {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 12px 22px 18px;
	border-top: 1px solid rgba(12, 165, 60, 0.12);
	background: #ffffff;
}

.spotmart-chat-composer textarea {
	width: 100%;
	min-height: 38px;
	max-height: 160px;
	border-radius: 4px;
	border: 1px solid rgba(12, 165, 60, 0.18);
	padding: 8px 12px;
	resize: none;
	font-size: 0.92rem;
	font-family: inherit;
	box-shadow: none;
	line-height: 1.4;
	overflow-y: auto;
}

.spotmart-chat-composer textarea:focus {
	outline: none;
	border-color: var(--spotmart-color-primary, #0ca53c);
	box-shadow: 0 0 0 3px rgba(12, 165, 60, 0.16);
}

/* -------------------------------------------------------------------------- */
/* Lists & badges                                                             */
/* -------------------------------------------------------------------------- */

.spotmart-chat-items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.spotmart-chat-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid transparent;
	box-shadow: 0 10px 24px rgba(12, 102, 42, 0.08);
	cursor: pointer;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
	min-height: 60px;
	height: 60px;
	max-height: 60px;
}

.spotmart-chat-item:hover {
	border-color: rgba(12, 165, 60, 0.28);
	box-shadow: 0 12px 28px rgba(12, 102, 42, 0.12);
	transform: translateY(-1px);
}

.spotmart-chat-item.is-active {
	border-color: rgba(12, 165, 60, 0.45);
	background: rgba(12, 165, 60, 0.12);
	box-shadow: 0 14px 32px rgba(12, 102, 42, 0.16);
}

/* Seller chat inbox - increased padding and height for product and buyer cards */
.spotmart-chat-shell--seller .spotmart-chat-item {
	padding: 18px 20px !important;
	min-height: 80px;
	height: 80px;
	max-height: 80px;
}
.spotmart-chat-shell--buyer .spotmart-chat-item {
	padding: 18px 20px !important;
	min-height: 80px;
	height: 80px;
	max-height: 80px;
}

.spotmart-chat-item-text {
	flex: 1;
	min-width: 0;
	font-weight: 600;
	color: var(--spotmart-color-heading, #142914);
	font-size: 0.92rem;
	line-height: 1.4;
	word-wrap: break-word;
	overflow-wrap: break-word;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

.spotmart-chat-item-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: center;
	padding: 0;
	gap: 4px;
	font-size: 0.72rem;
	color: rgba(20, 41, 20, 0.58);
	flex-shrink: 0;
	white-space: nowrap;
	text-align: right;
	max-width: 120px;
}

.spotmart-chat-item-meta > span {
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
}

.spotmart-chat-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 18px;
	border-radius: 4px;
	background: var(--spotmart-color-primary, #0ca53c);
	color: #ffffff;
	padding: 0 6px;
	font-size: 0.68rem;
	font-weight: 600;
	line-height: 1;
	flex-shrink: 0;
}

.spotmart-chat-thumb {
	width: 48px;
	height: 48px;
	border-radius: 4px;
	overflow: hidden;
	flex-shrink: 0;
	background: rgba(12, 165, 60, 0.16);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--spotmart-color-primary-dark, #06772a);
	font-weight: 700;
	letter-spacing: 0.04em;
}

.spotmart-chat-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.spotmart-chat-item.is-hidden {
	display: none !important;
}

/* -------------------------------------------------------------------------- */
/* Conversation bubbles                                                       */
/* -------------------------------------------------------------------------- */

.spotmart-chat-bubble {
	max-width: 72%;
	align-self: flex-start;
	background: rgba(12, 165, 60, 0.08);
	border: 1px solid rgba(12, 165, 60, 0.18);
	border-radius: 4px;
	padding: 10px 14px;
	margin-bottom: 10px;
	color: var(--spotmart-color-heading, #142914);
	box-shadow: 0 12px 24px rgba(12, 102, 42, 0.12);
}

.spotmart-chat-bubble--own {
	margin-left: auto;
	background: var(--spotmart-color-primary, #0ca53c);
	border-color: transparent;
	color: #ffffff;
	box-shadow: 0 16px 28px rgba(12, 102, 42, 0.22);
}

.spotmart-chat-bubble-content p {
	margin: 0 0 6px;
}

.spotmart-chat-bubble-content p:last-child {
	margin-bottom: 0;
}

.spotmart-chat-bubble-meta {
	display: block;
	margin-top: 4px;
	font-size: 0.7rem;
	text-align: right;
	color: rgba(20, 41, 20, 0.55);
}

.spotmart-chat-bubble--own .spotmart-chat-bubble-meta {
	color: rgba(255, 255, 255, 0.78);
}

/* -------------------------------------------------------------------------- */
/* Placeholders & empty states                                                */
/* -------------------------------------------------------------------------- */

.spotmart-chat-placeholder {
	color: var(--spotmart-color-muted, #627065);
	text-align: center;
	padding: 20px 12px;
	font-size: 0.85rem;
}

.spotmart-chat-placeholder--search {
	font-style: italic;
}

.spotmart-chat-error {
	color: #b91c1c;
	padding: 20px 12px;
	text-align: center;
}

.spotmart-chat-empty {
	margin: auto;
	text-align: center;
	color: var(--spotmart-color-muted, #627065);
	display: grid;
	gap: 10px;
	place-items: center;
}

.spotmart-chat-empty .dashicons {
	font-size: 2rem;
	color: var(--spotmart-color-primary, #0ca53c);
}

/* -------------------------------------------------------------------------- */
/* Responsive adjustments                                                     */
/* -------------------------------------------------------------------------- */

@media (max-width: 960px) {
	.spotmart-chat-shell {
		grid-template-columns: 1fr;
		min-height: 0;
	}

	.spotmart-chat-sidebar {
		border-right: none;
		border-bottom: 1px solid rgba(12, 165, 60, 0.12);
	}

	.spotmart-chat-main__body {
		min-height: 320px;
	}
}

/* -------------------------------------------------------------------------- */
/* Navigation Menu Badges (Seller & Buyer)                                    */
/* -------------------------------------------------------------------------- */

/* Base badge styling for navigation menus */
.dokan-dashboard-menu .spotmart-chat-badge,
.woocommerce-MyAccount-navigation .spotmart-chat-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background-color: #dc3545;
	color: #ffffff;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	border-radius: 9px;
	vertical-align: middle;
}

/* Dokan dashboard icon badge positioning - absolute overlay on icon */
.dokan-dashboard-menu li a {
	position: relative;
}

.dokan-dashboard-menu .spotmart-chat-badge {
	position: absolute;
	top: 8px;
	right: 38px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	font-size: 10px;
	margin-left: 0;
}

/* WooCommerce My Account menu badge - inline after text */
.woocommerce-MyAccount-navigation-link--chat-inbox .spotmart-chat-badge {
	margin-left: 8px;
}

/* Ensure badge displays inline in navigation */
.woocommerce-MyAccount-navigation a .spotmart-chat-badge,
.dokan-dashboard-menu a .spotmart-chat-badge {
	vertical-align: baseline;
}
