/* =============================================================================
   WSH Live Visitor — Chat Widget (Frontend) v1.10.0
   ============================================================================= */

/* Hide on mobile */
@media ( max-width: 767px ) {
	.wsh-chat-widget {
		display: none !important;
	}
}

.wsh-chat-widget {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
}

/* =============================================================================
   Bubble button
   ============================================================================= */

.wsh-chat-bubble {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #3182ce;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba( 49, 130, 206, 0.4 );
	transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
	position: relative;
}

.wsh-chat-bubble:hover {
	transform: scale( 1.08 );
	box-shadow: 0 6px 20px rgba( 49, 130, 206, 0.5 );
}

.wsh-chat-bubble-hidden {
	opacity: 0;
	pointer-events: none;
	transform: scale( 0.5 );
}

/* Unread badge */
.wsh-chat-unread {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 14px;
	height: 14px;
	background: #e53e3e;
	border-radius: 50%;
	border: 2px solid #fff;
}

/* =============================================================================
   Chat panel
   ============================================================================= */

.wsh-chat-panel {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 380px;
	height: 520px;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 8px 40px rgba( 0, 0, 0, 0.15 );
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY( 20px ) scale( 0.95 );
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.wsh-chat-panel-open {
	opacity: 1;
	transform: translateY( 0 ) scale( 1 );
	pointer-events: auto;
}

.wsh-chat-panel-minimized {
	opacity: 0;
	transform: translateY( 10px ) scale( 0.9 );
	pointer-events: none;
}

/* ── Header ── */

.wsh-chat-header {
	background: #1a202c;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.wsh-chat-header-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wsh-chat-header-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid #48bb78;
	flex-shrink: 0;
}

.wsh-chat-header-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #48bb78;
	display: inline-block;
	margin-right: 4px;
}

.wsh-chat-header-name {
	color: #e2e8f0;
	font-size: 14px;
	font-weight: 600;
	display: block;
}

.wsh-chat-header-status {
	font-size: 11px;
	color: #48bb78;
	display: block;
}

.wsh-chat-header-status.wsh-status-offline {
	color: #a0aec0;
}

.wsh-chat-header-dot.wsh-dot-offline {
	background: #a0aec0;
}

.wsh-chat-header-btns {
	display: flex;
	gap: 4px;
}

.wsh-chat-minimize,
.wsh-chat-close {
	background: none;
	border: none;
	color: #718096;
	font-size: 20px;
	cursor: pointer;
	padding: 0 4px;
	line-height: 1;
	transition: color 0.15s;
}

.wsh-chat-minimize:hover,
.wsh-chat-close:hover {
	color: #e2e8f0;
}

.wsh-chat-minimize {
	font-weight: 700;
}

/* ── Messages area ── */

.wsh-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #f7fafc;
}

/* Message row */
.wsh-msg {
	display: flex;
	gap: 8px;
	max-width: 85%;
}

.wsh-msg-admin {
	align-self: flex-start;
}

.wsh-msg-visitor {
	align-self: flex-end;
	flex-direction: row-reverse;
}

/* Avatar */
.wsh-msg-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #3182ce;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
}

.wsh-msg-avatar-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wsh-msg-content {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wsh-msg-name {
	font-size: 11px;
	font-weight: 600;
	color: #718096;
}

.wsh-msg-bubble {
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.45;
	word-break: break-word;
	white-space: pre-wrap;
}

.wsh-msg-admin .wsh-msg-bubble {
	background: #ffffff;
	color: #2d3748;
	border: 1px solid #e2e8f0;
	border-radius: 4px 12px 12px 12px;
}

.wsh-msg-visitor .wsh-msg-bubble {
	background: #3182ce;
	color: #ffffff;
	border-radius: 12px 4px 12px 12px;
}

.wsh-msg-time {
	font-size: 10px;
	color: #a0aec0;
}

.wsh-msg-visitor .wsh-msg-time {
	text-align: right;
}

/* Message image */
.wsh-msg-image {
	max-width: 100%;
	max-height: 200px;
	border-radius: 8px;
	display: block;
	cursor: pointer;
}

/* Message file link */
.wsh-msg-file {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #3182ce;
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
}

.wsh-msg-file:hover {
	text-decoration: underline;
}

/* ── Typing indicator ── */

.wsh-chat-typing {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	background: #f7fafc;
	border-top: 1px solid #edf2f7;
	flex-shrink: 0;
}

.wsh-typing-name {
	font-size: 12px;
	color: #718096;
	font-style: italic;
}

.wsh-typing-dots {
	display: flex;
	gap: 3px;
	align-items: center;
}

.wsh-typing-dots span {
	width: 5px;
	height: 5px;
	background: #a0aec0;
	border-radius: 50%;
	animation: wsh-typing-bounce 1.4s infinite both;
}

.wsh-typing-dots span:nth-child(2) {
	animation-delay: 0.2s;
}

.wsh-typing-dots span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes wsh-typing-bounce {
	0%, 80%, 100% {
		transform: scale( 0.6 );
		opacity: 0.4;
	}
	40% {
		transform: scale( 1 );
		opacity: 1;
	}
}

/* ── Input area ── */

.wsh-chat-input-area {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	padding: 10px 14px;
	border-top: 1px solid #e2e8f0;
	background: #ffffff;
	flex-shrink: 0;
}

.wsh-chat-attach {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	color: #a0aec0;
	cursor: pointer;
	border-radius: 6px;
	transition: color 0.15s, background 0.15s;
	flex-shrink: 0;
}

.wsh-chat-attach:hover {
	color: #3182ce;
	background: #ebf4ff;
}

.wsh-chat-input {
	flex: 1;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 9px 12px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	line-height: 1.4;
	max-height: 100px;
	outline: none;
	transition: border-color 0.15s;
}

.wsh-chat-input:focus {
	border-color: #3182ce;
}

.wsh-chat-input::placeholder {
	color: #a0aec0;
}

.wsh-chat-send {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #3182ce;
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s;
}

.wsh-chat-send:hover {
	background: #2c5282;
}

/* ── Leave email form (no-reply timeout) ── */

.wsh-chat-email-form {
	background: #ebf8ff;
	border-radius: 10px;
	padding: 14px 16px;
	margin-top: 8px;
}

.wsh-chat-email-form p {
	font-size: 13px;
	color: #2d3748;
	font-weight: 500;
	margin: 0 0 10px;
}

.wsh-email-input {
	display: block;
	width: 100%;
	border: 1px solid #bee3f8;
	border-radius: 6px;
	padding: 8px 10px;
	font-size: 13px;
	font-family: inherit;
	margin-bottom: 8px;
	outline: none;
	box-sizing: border-box;
}

.wsh-email-input:focus {
	border-color: #3182ce;
}

.wsh-email-btn {
	background: #3182ce;
	color: #fff;
	border: none;
	border-radius: 6px;
	padding: 8px 18px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
}

.wsh-email-btn:hover {
	background: #2c5282;
}

.wsh-email-thanks {
	font-size: 13px;
	color: #276749;
	margin: 0;
}

/* ── Satisfaction rating ── */

.wsh-chat-rating {
	background: #f0fff4;
	border-radius: 10px;
	padding: 14px 16px;
	text-align: center;
	margin-top: 8px;
}

.wsh-chat-rating p {
	font-size: 13px;
	color: #2d3748;
	font-weight: 500;
	margin: 0 0 10px;
}

.wsh-rating-btns {
	display: flex;
	justify-content: center;
	gap: 16px;
}

.wsh-rate-btn {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 8px 20px;
	font-size: 22px;
	cursor: pointer;
	transition: transform 0.15s, border-color 0.15s;
}

.wsh-rate-btn:hover {
	transform: scale( 1.15 );
	border-color: #3182ce;
}

.wsh-rating-thanks {
	font-size: 13px;
	color: #276749;
	margin: 0;
}

/* ── Email transcript (v1.10.0) ── */

.wsh-chat-transcript {
	background: #ebf8ff;
	border-radius: 10px;
	padding: 14px 16px;
	margin-top: 8px;
}

.wsh-chat-transcript p {
	font-size: 13px;
	color: #2d3748;
	font-weight: 500;
	margin: 0 0 10px;
}

/* =============================================================================
   Responsive — smaller screens
   ============================================================================= */

@media ( max-width: 480px ) {
	.wsh-chat-panel {
		width: calc( 100vw - 40px );
		height: calc( 100vh - 100px );
		bottom: 0;
		right: 0;
		border-radius: 12px 12px 0 0;
	}
}
