/**
 * ClickSyncr Telegram Chat Widget Styles
 *
 * @package ClickSyncr_Telegram_Chat
 * @version 1.0.0
 */

/* ========================================
   Variables & Resets
   ======================================== */
:root {
	--parle-primary: #0088cc;
	--parle-primary-hover: #006da8;
	--parle-bg-light: #ffffff;
	--parle-bg-dark: #f8f9fa;
	--parle-text-dark: #2c3e50;
	--parle-text-light: #7f8c8d;
	--parle-border: #e1e8ed;
	--parle-shadow: rgba(0, 0, 0, 0.1);
	--parle-shadow-lg: rgba(0, 0, 0, 0.15);
	--parle-bubble-visitor: #0088cc;
	--parle-bubble-admin: #ecf0f1;
	--parle-z-index: 999999;
}

/* ========================================
   Utility Classes
   ======================================== */
.parle-hidden {
	display: none !important;
}

/* ========================================
   Chat Widget Container
   ======================================== */
#parle-chat-widget {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: var(--parle-z-index);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

#parle-chat-widget * {
	box-sizing: border-box;
}

/* ========================================
   Chat Button
   ======================================== */
.parle-chat-button {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--parle-primary);
	color: #ffffff;
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 12px var(--parle-shadow-lg);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	align-items: center;
	justify-content: center;
	outline: none;
}

.parle-chat-button:hover {
	background: var(--parle-primary-hover);
	transform: scale(1.05);
	box-shadow: 0 6px 16px var(--parle-shadow-lg);
}

.parle-chat-button:active {
	transform: scale(0.95);
}

.parle-chat-button svg {
	width: 28px;
	height: 28px;
	transition: opacity 0.2s;
}

/* Unread Badge */
.parle-unread-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: #e74c3c;
	color: #ffffff;
	border-radius: 12px;
	min-width: 24px;
	height: 24px;
	padding: 0 6px;
	font-size: 12px;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Chat Window
   ======================================== */
.parle-chat-window {
	position: absolute;
	bottom: 80px;
	right: 0;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: 600px;
	max-height: calc(100vh - 120px);
	background: var(--parle-bg-light);
	border-radius: 16px;
	box-shadow: 0 8px 32px var(--parle-shadow-lg);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px) scale(0.95);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.parle-chat-window:not(.parle-hidden) {
	opacity: 1;
	transform: translateY(0) scale(1);
}

/* ========================================
   Chat Header
   ======================================== */
.parle-chat-header {
	background: var(--parle-primary);
	color: #ffffff;
	padding: 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.parle-header-content {
	flex: 1;
	min-width: 0;
}

.parle-header-title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
}

.parle-header-subtitle {
	margin: 4px 0 0;
	font-size: 13px;
	opacity: 0.9;
	line-height: 1.3;
}

.parle-close-button {
	background: transparent;
	border: none;
	color: #ffffff;
	cursor: pointer;
	padding: 4px;
	margin: 0 0 0 12px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	flex-shrink: 0;
	outline: none;
}

.parle-close-button:hover {
	background: rgba(255, 255, 255, 0.2);
}

.parle-close-button svg {
	width: 20px;
	height: 20px;
}

/* ========================================
   Messages Container
   ======================================== */
.parle-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	background: var(--parle-bg-dark);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.parle-messages::-webkit-scrollbar {
	width: 6px;
}

.parle-messages::-webkit-scrollbar-track {
	background: transparent;
}

.parle-messages::-webkit-scrollbar-thumb {
	background: var(--parle-border);
	border-radius: 3px;
}

.parle-messages::-webkit-scrollbar-thumb:hover {
	background: #bdc3c7;
}

/* ========================================
   Message Bubbles
   ======================================== */
.parle-message {
	display: flex;
	flex-direction: column;
	max-width: 80%;
	animation: parle-message-in 0.3s ease-out;
}

@keyframes parle-message-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

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

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

.parle-message-bubble {
	padding: 12px 16px;
	border-radius: 18px;
	word-wrap: break-word;
	word-break: break-word;
	white-space: pre-wrap;
}

.parle-message-visitor .parle-message-bubble {
	background: var(--parle-bubble-visitor);
	color: #ffffff;
	border-bottom-right-radius: 4px;
}

.parle-message-admin .parle-message-bubble {
	background: var(--parle-bubble-admin);
	color: var(--parle-text-dark);
	border-bottom-left-radius: 4px;
}

.parle-message-time {
	font-size: 11px;
	color: var(--parle-text-light);
	margin-top: 4px;
	padding: 0 4px;
}

/* ========================================
   Typing Indicator
   ======================================== */
.parle-typing {
	display: flex;
	gap: 4px;
	padding: 12px 16px;
	background: var(--parle-bubble-admin);
	border-radius: 18px;
	width: fit-content;
	align-self: flex-start;
	margin: 0 20px 12px;
}

.parle-typing-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--parle-text-light);
	animation: parle-typing 1.4s infinite;
}

.parle-typing-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.parle-typing-dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes parle-typing {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.7;
	}
	30% {
		transform: translateY(-10px);
		opacity: 1;
	}
}

/* ========================================
   Input Area
   ======================================== */
.parle-input-area {
	padding: 16px;
	background: var(--parle-bg-light);
	border-top: 1px solid var(--parle-border);
	flex-shrink: 0;
}

/* Name Prompt */
.parle-name-prompt {
	display: flex;
	gap: 8px;
}

.parle-input {
	flex: 1;
	padding: 12px 16px;
	border: 1px solid var(--parle-border);
	border-radius: 8px;
	font-size: 15px;
	font-family: inherit;
	outline: none;
	transition: border-color 0.2s;
}

.parle-input:focus {
	border-color: var(--parle-primary);
}

.parle-button {
	padding: 12px 20px;
	background: var(--parle-primary);
	color: #ffffff;
	border: none;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.2s;
	white-space: nowrap;
	outline: none;
}

.parle-button:hover {
	background: var(--parle-primary-hover);
}

.parle-button:active {
	transform: scale(0.98);
}

/* Message Input */
.parle-message-input {
	display: flex;
	gap: 8px;
	align-items: flex-end;
}

.parle-textarea {
	flex: 1;
	padding: 12px 16px;
	border: 1px solid var(--parle-border);
	border-radius: 24px;
	font-size: 15px;
	font-family: inherit;
	resize: none;
	outline: none;
	transition: border-color 0.2s;
	max-height: 120px;
	overflow-y: auto;
}

.parle-textarea:focus {
	border-color: var(--parle-primary);
}

.parle-textarea::-webkit-scrollbar {
	width: 4px;
}

.parle-textarea::-webkit-scrollbar-thumb {
	background: var(--parle-border);
	border-radius: 2px;
}

.parle-send-button {
	width: 44px;
	height: 44px;
	background: var(--parle-primary);
	color: #ffffff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	flex-shrink: 0;
	outline: none;
}

.parle-send-button:hover {
	background: var(--parle-primary-hover);
	transform: scale(1.05);
}

.parle-send-button:active {
	transform: scale(0.95);
}

.parle-send-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.parle-send-button svg {
	width: 20px;
	height: 20px;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 480px) {
	#parle-chat-widget {
		bottom: 10px;
		right: 10px;
		left: 10px;
	}

	.parle-chat-window {
		width: 100%;
		max-width: 100%;
		height: calc(100vh - 80px);
		max-height: calc(100vh - 80px);
		bottom: 70px;
		right: 0;
		left: 0;
		border-radius: 16px 16px 0 0;
	}

	.parle-message {
		max-width: 85%;
	}
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
	#parle-chat-widget {
		display: none !important;
	}
}

/* ========================================
   Accessibility
   ======================================== */
.parle-chat-button:focus-visible,
.parle-close-button:focus-visible,
.parle-input:focus-visible,
.parle-textarea:focus-visible,
.parle-button:focus-visible,
.parle-send-button:focus-visible {
	outline: 2px solid var(--parle-primary);
	outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.parle-chat-button,
	.parle-chat-window,
	.parle-message,
	.parle-typing-dot {
		animation: none;
		transition: none;
	}
}
