/**
 * Mobile Chat Admin Styles
 * Optimized for mobile devices with touch-friendly UI
 */

* {
	box-sizing: border-box;
}

body.chat-eshop-mobile-admin {
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	background: #f5f5f5;
	color: #333;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.mobile-chat-container {
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh; /* Dynamic viewport height for mobile */
	overflow: hidden;
	background: #fff;
}

/* Header */
.mobile-chat-header {
	background: #fff;
	border-bottom: 1px solid #e0e0e0;
	padding: 12px 16px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-content {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
}

.mobile-chat-header h1 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: #333;
}

.unread-badge {
	background: #d63638;
	color: #fff;
	border-radius: 12px;
	padding: 2px 8px;
	font-size: 12px;
	font-weight: 600;
	min-width: 20px;
	text-align: center;
}

.header-actions {
	display: flex;
	gap: 8px;
}

.logout-btn {
	padding: 6px 12px;
	font-size: 14px;
	color: #666;
	text-decoration: none;
	border-radius: 4px;
	transition: background 0.2s;
}

.logout-btn:hover,
.logout-btn:focus {
	background: #f0f0f0;
	color: #333;
}

/* Main Content */
.mobile-chat-main {
	flex: 1;
	display: flex;
	overflow: hidden;
	position: relative;
}

/* Chat List */
.chat-list-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
}

.chat-list-container.hidden {
	display: none;
}

.chat-list-header {
	padding: 12px 16px;
	border-bottom: 1px solid #e0e0e0;
	background: #fff;
}

.chat-search-input {
	width: 100%;
	padding: 10px 12px;
	font-size: 14px;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #f5f5f5;
	outline: none;
	transition: border-color 0.2s;
}

.chat-search-input:focus {
	border-color: #2271b1;
	background: #fff;
}

.chat-list {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.chat-list::-webkit-scrollbar {
	width: 4px;
}

.chat-list::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 2px;
}

.empty-state {
	padding: 40px 20px;
	text-align: center;
	color: #999;
}

.empty-state p {
	margin: 0;
	font-size: 14px;
}

/* Chat Item */
.chat-item {
	display: flex;
	padding: 12px 16px;
	border-bottom: 1px solid #f0f0f0;
	cursor: pointer;
	transition: background 0.2s;
	touch-action: manipulation;
}

.chat-item:active {
	background: #f5f5f5;
}

.chat-item.live-chat {
	background: #f0f7ff;
}

.chat-item-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: #2271b1;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 600;
	flex-shrink: 0;
	margin-right: 12px;
}

.chat-item-avatar.live {
	background: #00a32a;
}

.chat-item-content {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.chat-item-header {
	display: flex;
	align-items: center;
	gap: 8px;
}

.chat-item-name {
	font-weight: 600;
	font-size: 15px;
	color: #333;
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chat-item-unread {
	background: #d63638;
	color: #fff;
	border-radius: 10px;
	padding: 2px 6px;
	font-size: 11px;
	font-weight: 600;
	min-width: 18px;
	text-align: center;
}

.chat-item-time {
	font-size: 12px;
	color: #999;
	white-space: nowrap;
}

.chat-item-intent {
	margin-top: 2px;
}

.intent-badge {
	display: inline-block;
	padding: 2px 8px;
	font-size: 11px;
	background: #e0e0e0;
	color: #666;
	border-radius: 4px;
}

.chat-item-preview {
	font-size: 13px;
	color: #666;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 6px;
}

.live-badge {
	display: inline-block;
	padding: 2px 6px;
	font-size: 10px;
	background: #00a32a;
	color: #fff;
	border-radius: 3px;
	font-weight: 600;
	flex-shrink: 0;
}

/* Chat Detail */
.chat-detail-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: #fff;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10;
}

.chat-detail-container.hidden {
	display: none;
}

.chat-detail-header {
	background: #fff;
	border-bottom: 1px solid #e0e0e0;
	padding: 12px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	position: sticky;
	top: 0;
	z-index: 10;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.back-btn {
	background: none;
	border: none;
	padding: 8px;
	cursor: pointer;
	color: #333;
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: manipulation;
	border-radius: 4px;
	transition: background 0.2s;
}

.back-btn:active {
	background: #f0f0f0;
}

.chat-detail-title {
	flex: 1;
}

.chat-detail-title span {
	font-size: 16px;
	font-weight: 600;
	color: #333;
}

.chat-messages {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #f5f5f5;
}

.chat-messages::-webkit-scrollbar {
	width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 2px;
}

.messages-loading {
	padding: 20px;
	text-align: center;
	color: #999;
}

.messages-loading p {
	margin: 0;
	font-size: 14px;
}

/* Message Bubbles */
.message {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-width: 75%;
}

.message.customer {
	align-self: flex-start;
	align-items: flex-start;
}

.message.owner {
	align-self: flex-end;
	align-items: flex-end;
}

.message-bubble {
	display: inline-block;
	padding: 10px 14px;
	border-radius: 18px;
	font-size: 15px;
	line-height: 1.4;
	word-break: break-word;
	white-space: pre-wrap;
}

.message.customer .message-bubble {
	background: #e9e9eb;
	color: #333;
	border-bottom-left-radius: 4px;
}

.message.owner .message-bubble {
	background: #2271b1;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.message-time {
	font-size: 11px;
	color: #999;
	padding: 0 4px;
}

.message-image {
	max-width: 100%;
	border-radius: 8px;
	margin-top: 4px;
}

.message-image img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
}

/* Chat Input */
.chat-input-container {
	background: #fff;
	border-top: 1px solid #e0e0e0;
	padding: 16px;
	padding-bottom: max(16px, env(safe-area-inset-bottom));
	position: sticky;
	bottom: 0;
	z-index: 10;
}

.chat-input-wrapper {
	display: flex;
	align-items: flex-end;
	gap: 10px;
}

.chat-input {
	flex: 1;
	padding: 14px 16px;
	font-size: 16px;
	border: 1px solid #ddd;
	border-radius: 24px;
	resize: none;
	outline: none;
	font-family: inherit;
	line-height: 1.5;
	min-height: 52px;
	max-height: 120px;
	overflow-y: auto;
	transition: border-color 0.2s;
}

.chat-input:focus {
	border-color: #2271b1;
}

.chat-send-btn {
	background: #2271b1;
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	touch-action: manipulation;
	transition: background 0.2s;
	flex-shrink: 0;
}

.chat-send-btn:active {
	background: #135e96;
}

.chat-send-btn:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.chat-send-btn svg {
	width: 20px;
	height: 20px;
}

/* Responsive adjustments */
@media (min-width: 768px) {
	.mobile-chat-container {
		max-width: 600px;
		margin: 0 auto;
		box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
	}
}

/* Loading states */
.loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Error states */
.error-message {
	padding: 12px;
	background: #fff3cd;
	color: #856404;
	border-radius: 4px;
	margin: 8px 16px;
	font-size: 14px;
}

