/**
 * WP ChatRoom Styles
 */

:root {
	--wp-chatroom-bg-color: #f5f5f5;
	--wp-chatroom-primary-color: #0073aa;
	--wp-chatroom-accent-color: #00a0d2;
	--wp-chatroom-bubble-self: #0073aa;
	--wp-chatroom-bubble-other: #e5e5e5;
	--wp-chatroom-font-size: 14px;
	--wp-chatroom-message-spacing: 12px;
}

/* Login Required Message */
.wp-chatroom-login-required {
	padding: 2rem;
	text-align: center;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	margin: 1rem 0;
}

.wp-chatroom-login-link {
	display: inline-block;
	padding: 0.5rem 1.5rem;
	background: var(--wp-chatroom-primary-color);
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	transition: background 0.3s;
}

.wp-chatroom-login-link:hover {
	background: var(--wp-chatroom-accent-color);
	color: #fff;
}

/* Chatroom Wrapper */
.wp-chatroom-wrapper {
	display: flex;
	gap: 0;
	height: 600px;
	max-height: 80vh;
	border: 1px solid #ddd;
	border-radius: 8px;
	overflow: hidden;
	position: relative;
}

/* Sidebar */
.wp-chatroom-sidebar {
	width: 280px;
	background: #fff;
	border-right: 1px solid #ddd;
	display: flex;
	flex-direction: column;
	transition: transform 0.3s ease;
}

.wp-chatroom-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem;
	border-bottom: 1px solid #ddd;
}

.wp-chatroom-sidebar-header h3 {
	margin: 0;
	font-size: 1.1em;
	font-weight: 600;
}

.wp-chatroom-toggle-sidebar {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.25rem;
	color: #666;
	display: none;
}

.wp-chatroom-toggle-sidebar:hover {
	color: #333;
}

.wp-chatroom-sidebar-content {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

/* Chat Type Selector */
.wp-chatroom-chat-type-selector {
	display: flex;
	border-bottom: 1px solid #ddd;
}

.wp-chatroom-chat-type-btn {
	flex: 1;
	padding: 0.75rem;
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	font-size: 0.9em;
	color: #666;
	transition: all 0.3s;
}

.wp-chatroom-chat-type-btn:hover {
	background: #f5f5f5;
	color: #333;
}

.wp-chatroom-chat-type-btn.active {
	border-bottom-color: var(--wp-chatroom-primary-color);
	color: var(--wp-chatroom-primary-color);
	font-weight: 600;
}

.wp-chatroom-chat-type-btn .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* Users List */
.wp-chatroom-users-list {
	flex: 1;
	overflow-y: auto;
}

.wp-chatroom-user-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	cursor: pointer;
	transition: background 0.2s;
	border-bottom: 1px solid #f0f0f0;
	position: relative;
}

.wp-chatroom-user-item:hover {
	background: #f5f5f5;
}

.wp-chatroom-user-item.active {
	background: #e8f4f8;
}

.wp-chatroom-user-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.wp-chatroom-user-name {
	flex: 1;
	font-weight: 500;
	color: #333;
}

.wp-chatroom-user-badge {
	color: var(--wp-chatroom-primary-color);
	font-size: 0.8em;
}

.wp-chatroom-no-users {
	padding: 2rem 1rem;
	text-align: center;
	color: #666;
	font-size: 0.9em;
}

/* Chatroom Container */
.wp-chatroom-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: var(--wp-chatroom-bg-color);
	font-size: var(--wp-chatroom-font-size);
	position: relative;
}

/* Chat Header */
.wp-chatroom-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem;
	background: #fff;
	border-bottom: 1px solid #ddd;
}

.wp-chatroom-header-info {
	flex: 1;
}

.wp-chatroom-chat-title {
	margin: 0;
	font-size: 1.1em;
	font-weight: 600;
	color: #333;
}

.wp-chatroom-recipient-name {
	display: block;
	font-size: 0.85em;
	color: #666;
	margin-top: 0.25rem;
}

.wp-chatroom-toggle-sidebar-mobile {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
	color: #666;
	display: none;
}

.wp-chatroom-toggle-sidebar-mobile:hover {
	color: #333;
}

.wp-chatroom-toggle-sidebar-mobile .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
}

/* Messages Area */
.wp-chatroom-messages {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: var(--wp-chatroom-message-spacing);
}

.wp-chatroom-messages::-webkit-scrollbar {
	width: 8px;
}

.wp-chatroom-messages::-webkit-scrollbar-track {
	background: #f1f1f1;
}

.wp-chatroom-messages::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 4px;
}

.wp-chatroom-messages::-webkit-scrollbar-thumb:hover {
	background: #555;
}

.wp-chatroom-loading {
	text-align: center;
	padding: 2rem;
	color: #666;
}

/* Message Item */
.wp-chatroom-message {
	display: flex;
	gap: 0.75rem;
	align-items: flex-start;
	max-width: 80%;
	animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.wp-chatroom-message.self {
	align-self: flex-end;
	flex-direction: row-reverse;
	margin-left: auto;
}

.wp-chatroom-message.other {
	align-self: flex-start;
}

/* Avatar */
.wp-chatroom-message-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	flex-shrink: 0;
	object-fit: cover;
}

.wp-chatroom-message-avatar.hidden {
	display: none;
}

/* Message Bubble */
.wp-chatroom-message-bubble {
	padding: 0.75rem 1rem;
	border-radius: 18px;
	word-wrap: break-word;
	position: relative;
}

.wp-chatroom-message.self .wp-chatroom-message-bubble {
	background: var(--wp-chatroom-bubble-self);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.wp-chatroom-message.other .wp-chatroom-message-bubble {
	background: var(--wp-chatroom-bubble-other);
	color: #333;
	border-bottom-left-radius: 4px;
}

/* Message Image */
.wp-chatroom-message-image {
	margin-bottom: 0.5rem;
	border-radius: 8px;
	overflow: hidden;
	max-width: 300px;
}

.wp-chatroom-message-image img {
	width: 100%;
	height: auto;
	display: block;
	cursor: pointer;
	transition: opacity 0.3s;
}

.wp-chatroom-message-image img:hover {
	opacity: 0.9;
}

/* Message Content */
.wp-chatroom-message-content {
	margin: 0;
	line-height: 1.5;
}

/* Message Meta */
.wp-chatroom-message-meta {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.25rem;
	font-size: 0.75em;
	opacity: 0.7;
}

.wp-chatroom-message.self .wp-chatroom-message-meta {
	justify-content: flex-end;
}

.wp-chatroom-message-name {
	font-weight: 600;
}

.wp-chatroom-message-time {
	font-size: 0.9em;
}

.wp-chatroom-message-time.hidden,
.wp-chatroom-message-avatar.hidden {
	display: none;
}

.wp-chatroom-share-button.hidden {
	display: none;
}

/* Share Button */
.wp-chatroom-share-button {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.25rem;
	opacity: 0.6;
	transition: opacity 0.3s;
	font-size: 0.9em;
	color: inherit;
}

.wp-chatroom-share-button:hover {
	opacity: 1;
}

.wp-chatroom-share-button.hidden {
	display: none;
}

/* Input Area */
.wp-chatroom-input-area {
	border-top: 1px solid #ddd;
	background: #fff;
	padding: 1rem;
}

.wp-chatroom-image-preview {
	position: relative;
	margin-bottom: 0.5rem;
	display: inline-block;
}

.wp-chatroom-image-preview img {
	max-width: 200px;
	max-height: 200px;
	border-radius: 8px;
}

.wp-chatroom-remove-image {
	position: absolute;
	top: -8px;
	right: -8px;
	background: #ff4444;
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 24px;
	height: 24px;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wp-chatroom-input-wrapper {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
}

.wp-chatroom-image-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.3s;
	flex-shrink: 0;
}

.wp-chatroom-image-button:hover {
	background: #e0e0e0;
}

.wp-chatroom-image-button .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
	color: #666;
}

.wp-chatroom-message-input {
	flex: 1;
	padding: 0.75rem 1rem;
	border: 1px solid #ddd;
	border-radius: 24px;
	font-size: var(--wp-chatroom-font-size);
	font-family: inherit;
	resize: none;
	min-height: 36px;
	max-height: 120px;
}

.wp-chatroom-message-input:focus {
	outline: none;
	border-color: var(--wp-chatroom-primary-color);
}

.wp-chatroom-send-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: var(--wp-chatroom-primary-color);
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.3s;
	flex-shrink: 0;
}

.wp-chatroom-send-button:hover {
	background: var(--wp-chatroom-accent-color);
}

.wp-chatroom-send-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.wp-chatroom-send-button .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* Social Feed */
.wp-chatroom-feed {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.wp-chatroom-feed-item {
	display: flex;
	gap: 1rem;
	padding: 1rem;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
}

.wp-chatroom-feed-avatar {
	flex-shrink: 0;
}

.wp-chatroom-feed-avatar img {
	border-radius: 50%;
}

.wp-chatroom-feed-content {
	flex: 1;
}

.wp-chatroom-feed-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.wp-chatroom-feed-author {
	font-weight: 600;
	color: #333;
}

.wp-chatroom-feed-time {
	font-size: 0.9em;
	color: #666;
}

.wp-chatroom-feed-image {
	margin: 0.75rem 0;
	border-radius: 8px;
	overflow: hidden;
}

.wp-chatroom-feed-image img {
	width: 100%;
	height: auto;
	display: block;
}

.wp-chatroom-feed-text {
	line-height: 1.6;
	color: #333;
}

/* Responsive */
@media (max-width: 768px) {
	.wp-chatroom-wrapper {
		height: 500px;
	}
	
	.wp-chatroom-sidebar {
		position: absolute;
		left: 0;
		top: 0;
		bottom: 0;
		z-index: 100;
		transform: translateX(-100%);
		box-shadow: 2px 0 8px rgba(0,0,0,0.1);
	}
	
	.wp-chatroom-wrapper.sidebar-open .wp-chatroom-sidebar {
		transform: translateX(0);
	}
	
	.wp-chatroom-toggle-sidebar,
	.wp-chatroom-toggle-sidebar-mobile {
		display: block;
	}
	
	.wp-chatroom-container {
		width: 100%;
	}
	
	.wp-chatroom-message {
		max-width: 90%;
	}
	
	.wp-chatroom-message-image {
		max-width: 200px;
	}
}

