/**
 * IndianAgri Social Share — Frontend Stylesheet
 * Responsive, accessible floating share button and modal popup.
 */

:root {
	--iaqss-primary: #2e7d32;
	--iaqss-primary-hover: #1b5e20;
	--iaqss-accent: #4caf50;
	--iaqss-bg-light: #f0fdf4;
	--iaqss-text-main: #1f2937;
	--iaqss-text-muted: #6b7280;
	--iaqss-border: #e5e7eb;
	--iaqss-shadow-floating: 0 4px 18px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
	--iaqss-shadow-popup: 0 12px 32px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
	--iaqss-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	--iaqss-zindex: 99990;
}

/* Visibility classes */
@media (max-width: 768px) {
	.iaqss-vis-desktop {
		display: none !important;
	}
}
@media (min-width: 769px) {
	.iaqss-vis-mobile {
		display: none !important;
	}
}

/* Container */
.iaqss-container {
	position: fixed;
	top: var(--iaqss-v-offset, 65%);
	transform: translateY(-50%);
	z-index: var(--iaqss-zindex);
	font-family: var(--iaqss-font);
	box-sizing: border-box;
}

.iaqss-container *,
.iaqss-container *::before,
.iaqss-container *::after,
.iaqss-popup,
.iaqss-popup *,
.iaqss-popup *::before,
.iaqss-popup *::after {
	box-sizing: border-box;
}

/* Lateral Placement for Trigger Container */
.iaqss-container.iaqss-pos-right,
.iaqss-pos-right.iaqss-container {
	right: 0;
}
.iaqss-container.iaqss-pos-left,
.iaqss-pos-left.iaqss-container {
	left: 0;
}

/* Floating Trigger Button */
.iaqss-floating-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: none;
	cursor: pointer;
	box-shadow: var(--iaqss-shadow-floating);
	transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
	font-weight: 600;
	font-size: 14px;
	line-height: 1;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	padding: 0;
}

.iaqss-pos-right .iaqss-floating-btn {
	border-top-left-radius: 28px;
	border-bottom-left-radius: 28px;
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.iaqss-pos-left .iaqss-floating-btn {
	border-top-right-radius: 28px;
	border-bottom-right-radius: 28px;
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

/* Sizes */
.iaqss-size-compact .iaqss-floating-btn {
	min-width: 44px;
	height: 44px;
	padding: 0 12px;
}
.iaqss-size-standard .iaqss-floating-btn {
	min-width: 50px;
	height: 50px;
	padding: 0 14px;
}
.iaqss-size-large .iaqss-floating-btn {
	min-width: 56px;
	height: 56px;
	padding: 0 16px;
}

/* Themes */
.iaqss-theme-forest_green .iaqss-floating-btn {
	background-color: #2e7d32;
	color: #ffffff;
}
.iaqss-theme-forest_green .iaqss-floating-btn:hover {
	background-color: #1b5e20;
	transform: scale(1.05);
}

.iaqss-theme-emerald .iaqss-floating-btn {
	background-color: #059669;
	color: #ffffff;
}
.iaqss-theme-emerald .iaqss-floating-btn:hover {
	background-color: #047857;
	transform: scale(1.05);
}

.iaqss-theme-leaf_green .iaqss-floating-btn {
	background-color: #4caf50;
	color: #ffffff;
}
.iaqss-theme-leaf_green .iaqss-floating-btn:hover {
	background-color: #388e3c;
	transform: scale(1.05);
}

.iaqss-theme-minimal .iaqss-floating-btn {
	background-color: #ffffff;
	color: #2e7d32;
	border: 2px solid #2e7d32;
}
.iaqss-theme-minimal .iaqss-floating-btn:hover {
	background-color: #f0fdf4;
	transform: scale(1.05);
}

/* Focus styles for accessibility */
.iaqss-floating-btn:focus-visible,
.iaqss-close-btn:focus-visible,
.iaqss-item:focus-visible {
	outline: 3px solid #2e7d32;
	outline-offset: 2px;
}

.iaqss-btn-icon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.iaqss-btn-text {
	padding-right: 4px;
}

/* Backdrop overlay */
.iaqss-backdrop {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100vw;
	width: 100dvw;
	height: 100vh;
	height: 100dvh;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	z-index: calc(var(--iaqss-zindex) + 5);
	opacity: 0;
	transition: opacity 0.25s ease;
	touch-action: none;
}

.iaqss-backdrop.iaqss-active {
	display: block;
	opacity: 1;
}

/* Popup Dialog */
.iaqss-popup {
	display: none;
	position: fixed;
	top: var(--iaqss-v-offset, 65%);
	font-family: var(--iaqss-font);
	width: 320px;
	max-width: calc(100vw - 32px);
	background: #ffffff;
	border-radius: 16px;
	border: 1px solid var(--iaqss-border);
	box-shadow: var(--iaqss-shadow-popup);
	z-index: calc(var(--iaqss-zindex) + 10);
	opacity: 0;
	transform: translateY(-50%) scale(0.92);
	transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
	overflow: hidden;
}

.iaqss-pos-right.iaqss-popup,
.iaqss-pos-right .iaqss-popup {
	right: 68px;
	left: auto;
	top: var(--iaqss-v-offset, 65%);
	transform: translateY(-50%) scale(0.92);
}

.iaqss-pos-left.iaqss-popup,
.iaqss-pos-left .iaqss-popup {
	left: 68px;
	right: auto;
	top: var(--iaqss-v-offset, 65%);
	transform: translateY(-50%) scale(0.92);
}

.iaqss-popup.iaqss-open {
	display: block;
	opacity: 1;
}

.iaqss-pos-right.iaqss-popup.iaqss-open,
.iaqss-pos-right .iaqss-popup.iaqss-open {
	transform: translateY(-50%) scale(1);
}

.iaqss-pos-left.iaqss-popup.iaqss-open,
.iaqss-pos-left .iaqss-popup.iaqss-open {
	transform: translateY(-50%) scale(1);
}

/* Popup Header */
.iaqss-popup-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
	border-bottom: 1px solid var(--iaqss-border);
}

.iaqss-header-titles {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.iaqss-badge {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #2e7d32;
	background: rgba(46, 125, 50, 0.12);
	padding: 2px 6px;
	border-radius: 4px;
	width: fit-content;
}

.iaqss-popup-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: var(--iaqss-text-main);
	line-height: 1.25;
}

.iaqss-close-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--iaqss-text-muted);
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.iaqss-close-btn:hover {
	background-color: #f3f4f6;
	color: #111827;
}

/* Grid of Share Buttons */
.iaqss-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	padding: 16px;
}

.iaqss-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 6px;
	border-radius: 12px;
	text-decoration: none;
	background: #f9fafb;
	border: 1px solid #f3f4f6;
	color: var(--iaqss-text-main);
	cursor: pointer;
	transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
	font-size: 12px;
	font-weight: 600;
	text-align: center;
	line-height: 1.2;
	-webkit-tap-highlight-color: transparent;
}

.iaqss-item:hover {
	transform: translateY(-2px);
	background: #ffffff;
	border-color: #e5e7eb;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
	color: #111827;
}

.iaqss-item:active {
	transform: translateY(0);
}

.iaqss-icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	transition: transform 0.15s ease;
}

.iaqss-item:hover .iaqss-icon-wrap {
	transform: scale(1.08);
}

/* Platform specific branding accents */
.iaqss-wa .iaqss-icon-wrap {
	background-color: #e8f8ed;
	color: #25d366;
}
.iaqss-tg .iaqss-icon-wrap {
	background-color: #e6f3fb;
	color: #0088cc;
}
.iaqss-fb .iaqss-icon-wrap {
	background-color: #e7eef9;
	color: #1877f2;
}
.iaqss-x .iaqss-icon-wrap {
	background-color: #f0f0f0;
	color: #000000;
}
.iaqss-native .iaqss-icon-wrap {
	background-color: #f3f0ff;
	color: #7c3aed;
}
.iaqss-copy .iaqss-icon-wrap {
	background-color: #ecfdf5;
	color: #059669;
}

/* Toast confirmation */
.iaqss-toast {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 0 16px 12px;
	padding: 8px 12px;
	background: #15803d;
	color: #ffffff;
	border-radius: 8px;
	font-size: 12px;
	font-weight: 600;
	text-align: center;
	animation: iaqssFadeIn 0.2s ease;
}

.iaqss-toast.iaqss-toast-visible {
	display: flex;
}

@keyframes iaqssFadeIn {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Popup Footer */
.iaqss-popup-footer {
	padding: 8px 16px 12px;
	font-size: 11px;
	color: var(--iaqss-text-muted);
	text-align: center;
	border-top: 1px solid #f3f4f6;
	background: #fafafa;
}

/* Mobile responsive popup adjustments */
@media (max-width: 600px) {
	/* Hide text label on mobile, keep clean 48px round FAB */
	.iaqss-btn-text {
		display: none !important;
	}

	.iaqss-floating-btn {
		min-width: 48px !important;
		width: 48px !important;
		height: 48px !important;
		padding: 0 !important;
		border-radius: 50% !important;
		touch-action: manipulation;
		box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
	}

	.iaqss-pos-right.iaqss-container {
		right: 10px !important;
	}

	.iaqss-pos-left.iaqss-container {
		left: 10px !important;
	}

	/* Modal Card as a clean, centered bottom sheet */
	.iaqss-popup {
		position: fixed !important;
		top: auto !important;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
		left: 16px !important;
		right: 16px !important;
		width: auto !important;
		max-width: 440px !important;
		margin: 0 auto !important;
		border-radius: 20px !important;
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), 0 4px 12px rgba(0, 0, 0, 0.12) !important;
		z-index: calc(var(--iaqss-zindex) + 10) !important;
		max-height: calc(100dvh - 32px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		transform: translateY(24px) scale(0.96) !important;
	}

	.iaqss-pos-right.iaqss-popup,
	.iaqss-pos-left.iaqss-popup,
	.iaqss-pos-right .iaqss-popup,
	.iaqss-pos-left .iaqss-popup {
		right: 16px !important;
		left: 16px !important;
		top: auto !important;
	}

	.iaqss-popup.iaqss-open,
	.iaqss-pos-right.iaqss-popup.iaqss-open,
	.iaqss-pos-left.iaqss-popup.iaqss-open,
	.iaqss-pos-right .iaqss-popup.iaqss-open,
	.iaqss-pos-left .iaqss-popup.iaqss-open {
		transform: translateY(0) scale(1) !important;
	}

	.iaqss-grid {
		grid-template-columns: repeat(3, 1fr) !important;
		gap: 8px !important;
		padding: 14px 12px !important;
	}

	.iaqss-item {
		padding: 10px 4px !important;
		min-height: 52px !important;
		touch-action: manipulation;
	}

	.iaqss-close-btn {
		width: 36px !important;
		height: 36px !important;
		touch-action: manipulation;
	}

	/* Body scroll lock when modal open on mobile */
	body.iaqss-modal-open {
		overflow: hidden !important;
		touch-action: none;
	}
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.iaqss-floating-btn,
	.iaqss-popup,
	.iaqss-backdrop,
	.iaqss-item,
	.iaqss-icon-wrap,
	.iaqss-toast {
		transition: none !important;
		animation: none !important;
		transform: none !important;
	}

	.iaqss-pos-right.iaqss-popup,
	.iaqss-pos-right .iaqss-popup {
		top: 50%;
		transform: translateY(-50%) !important;
	}
	.iaqss-pos-left.iaqss-popup,
	.iaqss-pos-left .iaqss-popup {
		top: 50%;
		transform: translateY(-50%) !important;
	}
}

