/**
 * Esjecom CTA Buttons — Frontend Buton Stilleri
 *
 * CSS Custom Properties ile tamamen özelleştirilebilir.
 * Inline stil olarak eklenen :root değişkenleri bu dosyadaki
 * varsayılanları override eder.
 *
 * @package Esjecom\CTA
 */

/* ═══════════════════════════════════════════
   CSS Variables (Defaults)
   ═══════════════════════════════════════════ */
:root {
	--esjecom-wa-color: #25D366;
	--esjecom-wa-icon-color: #ffffff;
	--esjecom-wa-size: 60px;
	--esjecom-wa-bottom: 20px;
	--esjecom-wa-side: 20px;

	--esjecom-phone-color: #0066FF;
	--esjecom-phone-icon-color: #ffffff;
	--esjecom-phone-size: 60px;
	--esjecom-phone-bottom: 20px;
	--esjecom-phone-side: 20px;
}

/* ═══════════════════════════════════════════
   Base Button Styles
   ═══════════════════════════════════════════ */
.esjecom-cta-btn {
	position: fixed;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	text-decoration: none;
	cursor: pointer;
	border: none;
	outline: none;

	/* GPU Optimizasyonu — CLS & INP */
	will-change: transform, opacity;
	contain: layout style;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;

	/* Giriş animasyonu */
	opacity: 0;
	transform: scale(0.5) translateY(20px);
	animation: esjecom-cta-entrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
	animation-delay: 1s;

	/* Geçiş */
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
	            box-shadow 0.3s ease;
}

.esjecom-cta-btn:focus {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* Hover efekti */
.esjecom-cta-btn:hover {
	transform: scale(1.1) !important;
}

.esjecom-cta-btn:active {
	transform: scale(0.95) !important;
}

/* ═══════════════════════════════════════════
   WhatsApp Button
   ═══════════════════════════════════════════ */
.esjecom-cta-whatsapp {
	width: var(--esjecom-wa-size);
	height: var(--esjecom-wa-size);
	background-color: var(--esjecom-wa-color);
	color: var(--esjecom-wa-icon-color);
	bottom: var(--esjecom-wa-bottom);
	box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4),
	            0 2px 6px rgba(0, 0, 0, 0.1);
}

.esjecom-cta-whatsapp:hover {
	box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5),
	            0 4px 12px rgba(0, 0, 0, 0.15);
	color: var(--esjecom-wa-icon-color);
}

.esjecom-cta-whatsapp:visited,
.esjecom-cta-whatsapp:focus {
	color: var(--esjecom-wa-icon-color);
}

/* ═══════════════════════════════════════════
   Phone Button
   ═══════════════════════════════════════════ */
.esjecom-cta-phone {
	width: var(--esjecom-phone-size);
	height: var(--esjecom-phone-size);
	background-color: var(--esjecom-phone-color);
	color: var(--esjecom-phone-icon-color);
	bottom: var(--esjecom-phone-bottom);
	box-shadow: 0 4px 15px rgba(0, 102, 255, 0.4),
	            0 2px 6px rgba(0, 0, 0, 0.1);
	animation-delay: 1.15s;
}

.esjecom-cta-phone:hover {
	box-shadow: 0 6px 24px rgba(0, 102, 255, 0.5),
	            0 4px 12px rgba(0, 0, 0, 0.15);
	color: var(--esjecom-phone-icon-color);
}

.esjecom-cta-phone:visited,
.esjecom-cta-phone:focus {
	color: var(--esjecom-phone-icon-color);
}

/* ═══════════════════════════════════════════
   Position Classes
   ═══════════════════════════════════════════ */
.esjecom-cta-whatsapp.esjecom-cta-pos-right {
	right: var(--esjecom-wa-side);
	left: auto;
}

.esjecom-cta-whatsapp.esjecom-cta-pos-left {
	left: var(--esjecom-wa-side);
	right: auto;
}

.esjecom-cta-phone.esjecom-cta-pos-right {
	right: var(--esjecom-phone-side);
	left: auto;
}

.esjecom-cta-phone.esjecom-cta-pos-left {
	left: var(--esjecom-phone-side);
	right: auto;
}

/* ═══════════════════════════════════════════
   Icon
   ═══════════════════════════════════════════ */
.esjecom-cta-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.esjecom-cta-icon svg {
	display: block;
}

/* ═══════════════════════════════════════════
   Tooltip
   ═══════════════════════════════════════════ */
.esjecom-cta-tooltip {
	position: absolute;
	white-space: nowrap;
	background: #1e293b;
	color: #fff;
	font-size: 13px;
	font-weight: 500;
	padding: 6px 14px;
	border-radius: 6px;
	pointer-events: none;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	line-height: 1.4;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Tooltip oku */
.esjecom-cta-tooltip::after {
	content: "";
	position: absolute;
	width: 8px;
	height: 8px;
	background: #1e293b;
	transform: rotate(45deg);
}

/* Sağ taraftaki butonlar — tooltip solda */
.esjecom-cta-pos-right .esjecom-cta-tooltip {
	right: calc(100% + 12px);
	top: 50%;
	transform: translateY(-50%) translateX(4px);
}

.esjecom-cta-pos-right .esjecom-cta-tooltip::after {
	right: -4px;
	top: 50%;
	transform: translateY(-50%) rotate(45deg);
}

/* Sol taraftaki butonlar — tooltip sağda */
.esjecom-cta-pos-left .esjecom-cta-tooltip {
	left: calc(100% + 12px);
	top: 50%;
	transform: translateY(-50%) translateX(-4px);
}

.esjecom-cta-pos-left .esjecom-cta-tooltip::after {
	left: -4px;
	top: 50%;
	transform: translateY(-50%) rotate(45deg);
}

/* Hover'da tooltip göster */
.esjecom-cta-btn:hover .esjecom-cta-tooltip {
	opacity: 1;
}

.esjecom-cta-pos-right:hover .esjecom-cta-tooltip {
	transform: translateY(-50%) translateX(0);
}

.esjecom-cta-pos-left:hover .esjecom-cta-tooltip {
	transform: translateY(-50%) translateX(0);
}

/* ═══════════════════════════════════════════
   Pulse Animation
   ═══════════════════════════════════════════ */
.esjecom-cta-pulse::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: inherit;
	opacity: 0;
	z-index: -1;
	will-change: transform, opacity;
	contain: layout style;
	animation: esjecom-cta-pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
	animation-delay: 2s;
}

@keyframes esjecom-cta-pulse {
	0% {
		transform: scale(1);
		opacity: 0.5;
	}
	100% {
		transform: scale(1.8);
		opacity: 0;
	}
}

/* ═══════════════════════════════════════════
   Entrance Animation
   ═══════════════════════════════════════════ */
@keyframes esjecom-cta-entrance {
	from {
		opacity: 0;
		transform: scale(0.5) translateY(20px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

/* ═══════════════════════════════════════════
   Reduced Motion — erişilebilirlik
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
	.esjecom-cta-btn {
		animation: none;
		opacity: 1;
		transform: none;
		will-change: auto;
	}

	.esjecom-cta-pulse::before {
		animation: none;
		will-change: auto;
	}

	.esjecom-cta-btn:hover {
		transform: none !important;
	}
}
