/**
 * Frontend Styles
 *
 * Styles for the frontend of the plugin
 * Font: IranSans (IRANSans)
 *
 * @package Damoon
 */

/* Apply IranSans font to frontend elements */
.damoon-phone-display,
.damoon-phone-display * {
	font-family: 'IranSans', 'IRANSans', 'Tahoma', 'Arial', sans-serif !important;
}

/* Phone Number Display Styles */
.damoon-phone-display {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.damoon-phone-image {
	margin-bottom: 10px;
}

.damoon-phone-image img {
	width: auto;
	height: auto;
	max-width: 100px;
	border-radius: 50%;
}

.damoon-phone-name {
	font-weight: 700;
	font-size: 18px;
	color: #1d2327;
}

.damoon-phone-number {
	display: flex;
	align-items: center;
	justify-content: center;
}

/* WhatsApp Link Styles */
.damoon-whatsapp-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	transition: all 0.3s ease;
}

/* Desktop: Show WhatsApp icon, hide text */
.damoon-whatsapp-desktop {
	display: none !important; /* Hidden on mobile by default */
}

@media (min-width: 768px) {
	.damoon-whatsapp-desktop {
		display: inline-flex !important;
	}
	
	.damoon-whatsapp-mobile {
		display: none !important;
	}
}

/* Mobile: Show text, hide icon */
.damoon-whatsapp-mobile {
	display: inline-block !important; /* Visible on mobile by default */
	font-size: 18px;
	font-weight: 700;
	color: #25D366;
	padding: 8px 16px;
	border-radius: 8px;
	background-color: rgba(37, 211, 102, 0.1);
}

.damoon-whatsapp-mobile:hover {
	background-color: rgba(37, 211, 102, 0.2);
	color: #128C7E;
}

@media (min-width: 768px) {
	.damoon-whatsapp-mobile {
		display: none !important;
	}
}

/* WhatsApp Icon Styles (Desktop) */
.damoon-whatsapp-icon {
	width: 48px;
	height: 48px;
	fill: #25D366;
	transition: all 0.3s ease;
}

.damoon-whatsapp-desktop:hover .damoon-whatsapp-icon {
	fill: #128C7E;
	transform: scale(1.1);
}

/* Responsive adjustments */
@media (max-width: 767px) {
	.damoon-phone-display {
		gap: 8px;
	}
	
	.damoon-phone-name {
		font-size: 16px;
	}
	
	.damoon-whatsapp-mobile {
		font-size: 16px;
		padding: 6px 12px;
	}
}

/* ========================================
   Floating WhatsApp Button (Always Visible)
   ======================================== */

.damoon-floating-whatsapp {
	position: fixed;
	bottom: 20px;
	left: 20px;
	z-index: 9999;
	font-family: 'IranSans', 'IRANSans', 'Tahoma', 'Arial', sans-serif;
}

/* Popup positioning for floating button */
.damoon-floating-whatsapp .damoon-hover-popup {
	bottom: calc(100% + 15px);
	left: 0;
	transform: translateX(0);
}

.damoon-floating-whatsapp .damoon-hover-popup::after {
	left: 30px;
	transform: translateX(0);
}

.damoon-floating-whatsapp:hover .damoon-hover-popup {
	transform: translateX(0) translateY(-5px);
}

.damoon-floating-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
	border-radius: 50%;
	box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
	text-decoration: none;
	transition: all 0.3s ease;
	cursor: pointer;
	position: relative;
	overflow: hidden;
}

.damoon-floating-button::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	background: rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	transition: width 0.6s, height 0.6s;
}

.damoon-floating-button:hover::before {
	width: 100%;
	height: 100%;
}

.damoon-floating-button:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 25px rgba(37, 211, 102, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.damoon-floating-button:active {
	transform: scale(0.95);
}

/* Floating Icon (Desktop) */
.damoon-floating-icon {
	width: 32px;
	height: 32px;
	fill: #ffffff;
	position: relative;
	z-index: 1;
	transition: transform 0.3s ease;
}

.damoon-floating-icon-mobile {
	display: none;
}

.damoon-floating-icon-desktop {
	display: block;
}

.damoon-floating-button:hover .damoon-floating-icon {
	transform: scale(1.1) rotate(5deg);
}

/* Floating Text (Mobile) */
.damoon-floating-text {
	display: none;
	font-size: 14px;
	font-weight: 700;
	color: #ffffff;
	position: relative;
	z-index: 1;
	white-space: nowrap;
	padding: 0 8px;
}

/* Mobile Styles */
@media (max-width: 767px) {
	.damoon-floating-whatsapp {
		bottom: 15px;
		left: 15px;
	}
	
	.damoon-floating-button {
		width: auto;
		height: 50px;
		min-width: 50px;
		padding: 0 15px;
		border-radius: 25px;
	}
	
	.damoon-floating-icon-desktop {
		display: none;
	}
	
	.damoon-floating-icon-mobile {
		display: block;
	}
	
	.damoon-floating-text {
		display: block;
	}
}

/* Animation on load - Optimized for performance */
@keyframes damoonFloat {
	0% {
		transform: translateY(20px);
		opacity: 0;
	}
	100% {
		transform: translateY(0);
		opacity: 1;
	}
}

/* Initial state - will be animated by JavaScript after page load */
.damoon-floating-whatsapp {
	/* Animation disabled by default to prevent blocking */
	opacity: 1;
	/* Use will-change for better performance */
	will-change: transform, opacity;
}

/* Pulse animation */
@keyframes damoonPulse {
	0% {
		box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
	}
	50% {
		box-shadow: 0 4px 20px rgba(37, 211, 102, 0.6), 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 10px rgba(37, 211, 102, 0.1);
	}
	100% {
		box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
	}
}

.damoon-floating-button {
	animation: damoonPulse 2s infinite;
}

/* ========================================
   Hover Popup Styles
   ======================================== */

.damoon-hover-popup {
	position: absolute;
	bottom: calc(100% + 15px);
	left: 50%;
	transform: translateX(-50%);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
	z-index: 10000;
	white-space: nowrap;
	margin-bottom: 10px;
}

.damoon-hover-popup::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 10px solid transparent;
	border-right: 10px solid transparent;
	border-top: 10px solid #ffffff;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.damoon-popup-content {
	background: #ffffff;
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
	min-width: 250px;
	max-width: 300px;
	text-align: center;
	font-family: 'IranSans', 'IRANSans', 'Tahoma', 'Arial', sans-serif;
	direction: rtl;
}

.damoon-popup-message {
	margin: 0 0 15px 0;
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
	line-height: 1.6;
	white-space: normal;
}

.damoon-popup-image {
	margin: 0 auto 10px;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	overflow: hidden;
	border: 3px solid #25D366;
	box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.damoon-popup-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.damoon-popup-name {
	font-size: 16px;
	font-weight: 700;
	color: #25D366;
	margin-top: 8px;
}

/* Show popup on hover */
.damoon-floating-whatsapp:hover .damoon-hover-popup {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(0) translateY(-5px);
}

.damoon-whatsapp-wrapper:hover .damoon-hover-popup {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(-5px);
}

/* Wrapper for shortcode WhatsApp button */
.damoon-whatsapp-wrapper {
	position: relative;
	display: inline-block;
}

/* Responsive adjustments for popup */
@media (max-width: 767px) {
	.damoon-hover-popup {
		display: none; /* Hide popup on mobile for better UX */
	}
	
	.damoon-floating-whatsapp:hover .damoon-hover-popup {
		display: none;
	}
}

