/**
 * Floating WhatsApp & App Download Pro — Frontend styles.
 * Mobile-first, jQuery-free, pure CSS animations.
 *
 * Dynamic values come from CSS custom properties injected inline:
 *   --fwap-size, --fwap-bottom, --fwap-side, --fwap-btn-bg, --fwap-label-bg
 */

:root {
	--fwap-size: 60px;
	--fwap-bottom: 20px;
	--fwap-side: 20px;
	--fwap-btn-bg: #1a73e8;
	--fwap-label-bg: #111827;
	--fwap-whatsapp: #25d366;
	--fwap-whatsapp-dark: #128c7e;
	--fwap-gap: 10px;
	--fwap-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.12);
	--fwap-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.26), 0 4px 10px rgba(0, 0, 0, 0.16);
}

/* ============================================================
   Floating stack (mobile-first: bottom 80px / side 15px / 50px)
   ============================================================ */

.fwap-stack {
	position: fixed;
	bottom: 80px;
	right: 15px;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: var(--fwap-gap);
	-webkit-tap-highlight-color: transparent;
	pointer-events: none; /* only children are interactive */
}

.fwap-stack.fwap-pos-left {
	right: auto;
	left: 15px;
	align-items: flex-start;
}

.fwap-item {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	pointer-events: auto;
}

.fwap-pos-left .fwap-item {
	justify-content: flex-start;
}

/* ============================================================
   Buttons
   ============================================================ */

.fwap-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	min-width: 48px; /* touch friendly */
	min-height: 48px;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	text-decoration: none;
	color: #fff;
	box-shadow: var(--fwap-shadow);
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
	will-change: transform;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	outline-offset: 3px;
}

.fwap-btn:hover,
.fwap-btn:focus-visible {
	transform: scale(1.1);
	box-shadow: var(--fwap-shadow-hover);
	color: #fff;
}

.fwap-btn:active {
	transform: scale(0.96);
}

.fwap-btn-whatsapp {
	background: linear-gradient(135deg, var(--fwap-whatsapp) 0%, var(--fwap-whatsapp-dark) 100%);
}

.fwap-btn-app {
	background: linear-gradient(135deg, var(--fwap-btn-bg) 0%, color-mix(in srgb, var(--fwap-btn-bg) 70%, #000) 100%);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.fwap-btn-app {
		background: var(--fwap-btn-bg);
	}
}

.fwap-svg {
	width: 58%;
	height: 58%;
	display: block;
}

.fwap-app-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

/* Button logo rendered as background-image — immune to theme img/svg CSS */
.fwap-btn-app.fwap-has-icon {
	background-size: cover !important;
	background-position: center !important;
	background-repeat: no-repeat !important;
	background-color: #fff;
}

/* ============================================================
   Badge
   ============================================================ */

.fwap-badge {
	position: absolute;
	top: -6px;
	right: -4px;
	background: #ef4444;
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	letter-spacing: 0.4px;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 999px;
	box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
	z-index: 2;
	pointer-events: none;
}

/* ============================================================
   Hover labels (tooltips)
   ============================================================ */

.fwap-label {
	position: absolute;
	right: calc(100% + 12px);
	white-space: nowrap;
	background: var(--fwap-label-bg);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	line-height: 1;
	padding: 9px 14px;
	border-radius: 999px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
	opacity: 0;
	visibility: hidden;
	transform: translateX(8px);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
	pointer-events: none;
	z-index: 1;
}

.fwap-label::after {
	content: "";
	position: absolute;
	top: 50%;
	right: -4px;
	width: 8px;
	height: 8px;
	background: inherit;
	transform: translateY(-50%) rotate(45deg);
	border-radius: 2px;
}

.fwap-pos-left .fwap-label {
	right: auto;
	left: calc(100% + 12px);
	transform: translateX(-8px);
}

.fwap-pos-left .fwap-label::after {
	right: auto;
	left: -4px;
}

.fwap-item:hover .fwap-label,
.fwap-item:focus-within .fwap-label {
	opacity: 1;
	visibility: visible;
	transform: translateX(0);
}

/* ============================================================
   Animations (only when .fwap-animated)
   ============================================================ */

.fwap-animated .fwap-item {
	animation: fwap-slide-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.fwap-animated .fwap-item:nth-child(1) {
	animation-delay: 0.15s;
}

.fwap-animated .fwap-item:nth-child(2) {
	animation-delay: 0.3s;
}

/* Pulse ring every 5 seconds on the WhatsApp button */
.fwap-animated .fwap-btn-whatsapp::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--fwap-whatsapp);
	z-index: -1;
	animation: fwap-pulse 5s ease-out infinite;
}

@keyframes fwap-slide-in {
	from {
		opacity: 0;
		transform: translateY(24px) scale(0.8);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes fwap-pulse {
	0% {
		transform: scale(1);
		opacity: 0.7;
	}
	12% {
		transform: scale(1.55);
		opacity: 0;
	}
	13%,
	100% {
		transform: scale(1);
		opacity: 0;
	}
}

/* ============================================================
   Glassmorphism popup
   ============================================================ */

.fwap-popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 23, 42, 0.45);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.fwap-popup-overlay.fwap-open {
	opacity: 1;
}

.fwap-popup-overlay[hidden] {
	display: none;
}

.fwap-popup {
	position: relative;
	width: 100%;
	max-width: 360px;
	text-align: center;
	background: white;
	border-radius: 24px;
	
	padding: 32px 24px 28px;
	transform: translateY(24px) scale(0.94);
	transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.fwap-popup-overlay.fwap-open .fwap-popup {
	transform: translateY(0) scale(1);
}

.fwap-popup-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: rgba(15, 23, 42, 0.08);
	color: #334155;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.fwap-popup-close:hover {
	background: rgba(15, 23, 42, 0.16);
	transform: rotate(90deg);
}

.fwap-popup-icon {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: 18px;
	margin: 0 auto 14px;
	display: block;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.fwap-popup-title {
	margin: 0 0 6px;
	font-size: 22px;
	font-weight: 600;
	color: #0f172a;
	letter-spacing: -0.02em;
}

.fwap-popup-sub {
	margin: 0 0 22px;
	font-size: 14px;
	color: #475569;
}

.fwap-popup-actions {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.fwap-store-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 52px;
	padding: 10px 18px;
	border-radius: 14px;
	text-decoration: none;
	color: #fff;
	background: #0f172a;
	box-shadow: 0 6px 16px rgba(15, 23, 42, 0.3);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fwap-store-btn:hover,
.fwap-store-btn:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.4);
	color: #fff;
}

.fwap-store-btn svg {
	width: 26px;
	height: 26px;
	flex-shrink: 0;
}

.fwap-store-btn span {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.15;
}

.fwap-store-btn small {
	font-size: 10px;
	font-weight: 500;
	opacity: 0.75;
	text-transform: uppercase;
	letter-spacing: 0.6px;
}

.fwap-store-play {
	background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
	box-shadow: 0 6px 16px rgba(22, 163, 74, 0.35);
}

.fwap-store-play:hover,
.fwap-store-play:focus-visible {
	box-shadow: 0 10px 24px rgba(22, 163, 74, 0.45);
}

.fwap-store-apple {
	background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* Lock page scroll while popup is open */
body.fwap-no-scroll {
	overflow: hidden;
}

/* ============================================================
   Responsive — tablet & desktop (admin-controlled values)
   ============================================================ */

@media (min-width: 769px) {
	.fwap-stack {
		bottom: var(--fwap-bottom);
		right: var(--fwap-side);
		--fwap-gap: 12px;
	}

	.fwap-stack.fwap-pos-left {
		right: auto;
		left: var(--fwap-side);
	}

	.fwap-btn {
		width: var(--fwap-size);
		height: var(--fwap-size);
	}
}

/* Short landscape phones: keep buttons clear of browser UI */
@media (max-height: 450px) and (orientation: landscape) {
	.fwap-stack {
		bottom: 16px;
	}
}

/* Very small screens (320px): slightly tighter */
@media (max-width: 359px) {
	.fwap-stack {
		right: 12px;
	}

	.fwap-stack.fwap-pos-left {
		right: auto;
		left: 12px;
	}

	.fwap-label {
		font-size: 12px;
		padding: 8px 12px;
	}
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
	.fwap-animated .fwap-item,
	.fwap-animated .fwap-btn-whatsapp::before {
		animation: none;
	}

	.fwap-btn,
	.fwap-label,
	.fwap-popup,
	.fwap-popup-overlay,
	.fwap-store-btn {
		transition: none;
	}
}
