/**
 * Frontend styles for Solutiontech WhatsApp
 *
 * @package Solutiontech_WhatsApp
 */

:root {
	--st-wa-primary: #25D366;
	--st-wa-header: #075E54;
	--st-wa-text-light: #ffffff;
	--st-wa-bg-light: #f0f2f5;
	--st-wa-bubble-bg: #e1ffc7;
	--st-wa-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
	--st-wa-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.24);
	--st-wa-radius: 28px;
}

/* Container */
.st-wa-container {
	position: relative;
	z-index: 999990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Floating button wrapper */
.st-wa-widget-wrapper {
	position: fixed;
	z-index: 999991;
	display: flex;
	align-items: center;
}

/* Floating Button Base */
.st-wa-floating-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background-color: var(--st-wa-primary);
	color: var(--st-wa-text-light);
	border: none;
	border-radius: var(--st-wa-radius);
	padding: 12px 20px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	box-shadow: var(--st-wa-shadow);
	transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
	text-decoration: none !important;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

.st-wa-floating-btn:hover {
	transform: scale(1.06);
	box-shadow: var(--st-wa-shadow-hover);
	color: var(--st-wa-text-light);
}

.st-wa-floating-btn:active {
	transform: scale(0.96);
}

.st-wa-floating-btn svg {
	width: 24px;
	height: 24px;
	fill: currentColor;
	flex-shrink: 0;
	display: block;
}

/* Notification Badge ("1") */
.st-wa-badge {
	position: absolute;
	top: -6px;
	right: -6px;
	background-color: #ef4444;
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #ffffff;
	box-shadow: 0 2px 5px rgba(0,0,0,0.25);
	animation: stWaBadgePulse 1.8s infinite;
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s;
}

.st-wa-badge.st-wa-hidden {
	display: none !important;
}

@keyframes stWaBadgePulse {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.18);
	}
	100% {
		transform: scale(1);
	}
}

/* Animations */
@keyframes stWaPulse {
	0% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.65);
	}
	70% {
		box-shadow: 0 0 0 16px rgba(37, 211, 102, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
	}
}

.st-wa-anim-pulse {
	animation: stWaPulse 2s infinite ease-in-out;
}

@keyframes stWaBounce {
	0%, 20%, 50%, 80%, 100% {
		transform: translateY(0);
	}
	40% {
		transform: translateY(-10px);
	}
	60% {
		transform: translateY(-5px);
	}
}

.st-wa-anim-bounce {
	animation: stWaBounce 3s infinite;
}

/* Popup Chat Box */
.st-wa-popup-wrapper {
	position: fixed;
	width: 350px;
	max-width: calc(100vw - 32px);
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
	overflow: hidden;
	z-index: 999992;
	opacity: 1;
	transform: translateY(0) scale(1);
	transform-origin: bottom right;
	transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
}

.st-wa-popup-wrapper.st-wa-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(20px) scale(0.92);
}

/* Popup Header */
.st-wa-popup-header {
	background: var(--st-wa-header);
	color: #ffffff;
	padding: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	position: relative;
}

.st-wa-header-avatar {
	position: relative;
}

.st-wa-header-avatar svg {
	width: 38px;
	height: 38px;
	fill: #25D366;
	background: rgba(255, 255, 255, 0.12);
	padding: 6px;
	border-radius: 50%;
	display: block;
}

.st-wa-header-dot {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: 2px solid #ffffff;
}

.st-wa-status-online {
	background-color: #25D366;
}

.st-wa-status-offline {
	background-color: #9ca3af;
}

.st-wa-header-info {
	flex: 1;
	min-width: 0;
}

.st-wa-header-info h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #ffffff;
	line-height: 1.2;
}

.st-wa-header-info p {
	margin: 4px 0 0;
	font-size: 12px;
	opacity: 0.85;
	line-height: 1.2;
}

.st-wa-header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.st-wa-header-btn,
.st-wa-close-btn {
	background: none;
	border: none;
	color: #ffffff;
	font-size: 20px;
	cursor: pointer;
	padding: 4px;
	line-height: 1;
	opacity: 0.8;
	transition: opacity 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.st-wa-header-btn:hover,
.st-wa-close-btn:hover {
	opacity: 1;
}

/* Popup Body */
.st-wa-popup-body {
	background-color: #efeae2;
	background-image: radial-gradient(#d5cebe 1px, transparent 1px);
	background-size: 16px 16px;
	padding: 16px 14px;
	max-height: 390px;
	overflow-y: auto;
}

/* Speech Bubble */
.st-wa-chat-bubble {
	background-color: #ffffff;
	border-radius: 0 10px 10px 10px;
	padding: 10px 14px;
	margin-bottom: 12px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	position: relative;
	max-width: 90%;
}

.st-wa-offline-bubble {
	border-left: 3px solid #f59e0b;
	background-color: #fffbeb;
}

.st-wa-chat-bubble p {
	margin: 0;
	font-size: 14px;
	color: #111b21;
	line-height: 1.45;
}

.st-wa-bubble-time {
	display: block;
	text-align: right;
	font-size: 10px;
	color: #667781;
	margin-top: 4px;
}

/* Desktop QR Code View */
.st-wa-qr-view {
	background: #ffffff;
	border-radius: 12px;
	padding: 18px 14px;
	text-align: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	margin-bottom: 12px;
}

.st-wa-qr-view.st-wa-hidden {
	display: none;
}

.st-wa-qr-tip {
	font-size: 13px;
	color: #374151;
	margin: 0 0 12px;
	line-height: 1.35;
	font-weight: 500;
}

.st-wa-qr-canvas-wrap {
	display: flex;
	justify-content: center;
	align-items: center;
	margin: 10px 0;
	padding: 8px;
	background: #ffffff;
	border: 1px dashed #d1d5db;
	border-radius: 8px;
}

.st-wa-qr-canvas-wrap canvas,
.st-wa-qr-canvas-wrap img {
	max-width: 170px !important;
	height: auto !important;
	display: block;
}

.st-wa-qr-back-btn {
	margin-top: 10px !important;
	font-size: 12px !important;
	padding: 4px 12px !important;
	border-radius: 16px !important;
	cursor: pointer;
}

/* Privacy & GDPR Checkbox */
.st-wa-gdpr-wrap {
	margin: 10px 0 12px;
	padding: 8px 10px;
	background: rgba(255, 255, 255, 0.7);
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	transition: border-color 0.2s, background-color 0.2s;
}

.st-wa-gdpr-wrap.st-wa-gdpr-error {
	border-color: #ef4444;
	background: #fef2f2;
	animation: stWaShake 0.4s ease-in-out;
}

@keyframes stWaShake {
	0%, 100% { transform: translateX(0); }
	20%, 60% { transform: translateX(-5px); }
	40%, 80% { transform: translateX(5px); }
}

.st-wa-gdpr-label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	cursor: pointer;
	user-select: none;
}

.st-wa-gdpr-checkbox {
	margin-top: 3px !important;
	cursor: pointer;
	accent-color: var(--st-wa-primary);
}

.st-wa-gdpr-text {
	font-size: 11px;
	color: #4b5563;
	line-height: 1.35;
}

.st-wa-gdpr-text a {
	color: var(--st-wa-header);
	text-decoration: underline;
}

/* Single Agent Call To Action Button */
.st-wa-single-cta {
	text-align: center;
	margin-top: 6px;
}

.st-wa-btn-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	background-color: var(--st-wa-primary);
	color: #ffffff !important;
	padding: 12px 18px;
	border-radius: 24px;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	box-shadow: 0 2px 6px rgba(37, 211, 102, 0.35);
	transition: background-color 0.2s, transform 0.2s;
	box-sizing: border-box;
}

.st-wa-btn-cta:hover {
	background-color: #1ebc59;
	transform: translateY(-1px);
}

.st-wa-btn-cta svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

/* Multi-Agent Section */
.st-wa-agents-section {
	margin-top: 4px;
}

.st-wa-agents-title {
	font-size: 12px;
	font-weight: 600;
	color: #54656f;
	margin: 0 0 8px 4px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.st-wa-agent-cards {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.st-wa-agent-item {
	display: flex;
	align-items: center;
	gap: 12px;
	background: #ffffff;
	border-radius: 10px;
	padding: 10px 12px;
	text-decoration: none;
	color: inherit;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.st-wa-agent-item:hover {
	background-color: #f7f9fa;
	transform: translateY(-2px);
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.st-wa-agent-avatar {
	position: relative;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
}

.st-wa-agent-avatar img {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

.st-wa-avatar-placeholder {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background-color: #25D366;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 16px;
}

.st-wa-status-dot {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: 2px solid #ffffff;
}

.st-wa-agent-meta {
	flex: 1;
	min-width: 0;
}

.st-wa-agent-meta strong {
	display: block;
	font-size: 14px;
	color: #111b21;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.st-wa-agent-meta span {
	display: block;
	font-size: 12px;
	color: #667781;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.st-wa-agent-action svg {
	width: 22px;
	height: 22px;
	fill: #25D366;
	display: block;
}

/* Shortcode Button Styling */
.st-wa-shortcode-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 18px;
	color: #ffffff !important;
	border-radius: 6px;
	text-decoration: none !important;
	font-weight: 600;
	font-size: 14px;
	transition: opacity 0.2s, transform 0.15s;
	margin: 6px 0;
}

.st-wa-shortcode-btn:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.st-wa-shortcode-btn svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* WooCommerce Button Styling */
.st-wa-woo-btn-wrap {
	margin: 12px 0;
}

.button.st-wa-woo-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px !important;
	background-color: var(--st-wa-primary) !important;
	color: #ffffff !important;
	border: none !important;
	border-radius: 4px !important;
	padding: 12px 20px !important;
	font-size: 15px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	transition: opacity 0.2s ease !important;
}

.button.st-wa-woo-btn:hover {
	opacity: 0.9 !important;
	color: #ffffff !important;
}

.st-wa-woo-btn svg {
	width: 20px !important;
	height: 20px !important;
	fill: #ffffff !important;
}

.st-wa-woo-cart-btn-wrap {
	margin: 10px 0;
}
