/**
 * Frontend Styles for Global Compliance Icons
 */

.gcw-product-image-wrapper {
	position: relative;
	display: inline-block;
	width: 100%;
	overflow: hidden; /* Ensure icons stay within image bounds */
}

.gcw-product-image-wrapper img {
	display: block;
	width: 100%;
	height: auto;
}

/* Shop loop wrapper */
.woocommerce ul.products li.product {
	position: relative;
}

.woocommerce ul.products li.product .woocommerce-loop-product__link {
	position: relative;
	display: block;
}

.woocommerce ul.products li.product .gcw-icons-container {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 10;
}

/* Single product wrapper */
.gcw-single-product-gallery-wrapper {
	position: relative;
}

.woocommerce div.product .woocommerce-product-gallery {
	position: relative;
}

.woocommerce div.product .woocommerce-product-gallery__wrapper {
	position: relative;
}

.woocommerce div.product .woocommerce-product-gallery__image {
	position: relative;
}

.woocommerce div.product .gcw-icons-container {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 10;
}

.gcw-icons-container {
	position: absolute;
	z-index: 10;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 8px;
	pointer-events: none;
	max-width: 100%; /* Prevent overflow */
	max-height: 100%; /* Prevent overflow */
	box-sizing: border-box; /* Include padding in width calculation */
}

.gcw-icons-container .gcw-icon {
	width: var(--gcw-icon-size, 40px);
	height: var(--gcw-icon-size, 40px);
	min-width: var(--gcw-icon-size, 40px);
	min-height: var(--gcw-icon-size, 40px);
	max-width: var(--gcw-icon-size, 40px);
	max-height: var(--gcw-icon-size, 40px);
	flex-shrink: 0; /* Prevent icons from shrinking */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	
	/* Simple, clean background - can be overridden by dynamic CSS */
	background: #ffffff;
	border: 2px solid rgba(0, 0, 0, 0.1);
	border-radius: 50%;
	
	/* Simple shadow for depth - can be overridden by dynamic CSS */
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	
	pointer-events: auto;
	cursor: help;
	transition: all 0.2s ease;
	box-sizing: border-box;
	position: relative;
	
	/* Touch-friendly: ensure minimum touch target size */
	min-width: 44px;
	min-height: 44px;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	
	/* Prevent text selection on touch devices */
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	
	/* Simple fade-in animation */
	animation: gcw-icon-fade-in 0.3s ease-out;
}

.gcw-icons-container .gcw-icon:hover,
.gcw-icons-container .gcw-icon:focus {
	/* Simple hover effect */
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	border-color: rgba(0, 0, 0, 0.15);
	z-index: 11;
}

.gcw-icons-container .gcw-icon:active {
	/* Simple active/pressed effect */
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
	transform: scale(0.98);
}

.gcw-icons-container .gcw-icon img,
.gcw-icons-container .gcw-icon svg {
	width: 85%;
	height: 85%;
	object-fit: contain;
	padding: 0;
	position: relative;
	z-index: 2;
	/* Simple visibility enhancement */
	filter: 
		drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2))
		contrast(1.1)
		brightness(1.05);
	transition: all 0.2s ease;
	/* Ensure icons are crisp and clear */
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
	pointer-events: none;
}

/* Position Classes - Ensure proper positioning */
.gcw-position-top-left {
	top: 8px !important;
	left: 8px !important;
	right: auto !important;
	bottom: auto !important;
	justify-content: flex-start;
	align-items: flex-start;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
	transform: none !important;
}

.gcw-position-top-center {
	top: 8px !important;
	left: 50% !important;
	right: auto !important;
	bottom: auto !important;
	transform: translateX(-50%) !important;
	justify-content: center;
	align-items: flex-start;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
}

.gcw-position-top-right {
	top: 8px !important;
	right: 8px !important;
	left: auto !important;
	bottom: auto !important;
	justify-content: flex-end;
	align-items: flex-start;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
	transform: none !important;
}

.gcw-position-middle-left {
	top: 50% !important;
	left: 8px !important;
	right: auto !important;
	bottom: auto !important;
	transform: translateY(-50%) !important;
	justify-content: flex-start;
	align-items: center;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
}

.gcw-position-middle-center {
	top: 50% !important;
	left: 50% !important;
	right: auto !important;
	bottom: auto !important;
	transform: translate(-50%, -50%) !important;
	justify-content: center;
	align-items: center;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
}

.gcw-position-middle-right {
	top: 50% !important;
	right: 8px !important;
	left: auto !important;
	bottom: auto !important;
	transform: translateY(-50%) !important;
	justify-content: flex-end;
	align-items: center;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
}

.gcw-position-bottom-left {
	bottom: 8px !important;
	left: 8px !important;
	top: auto !important;
	right: auto !important;
	justify-content: flex-start;
	align-items: flex-end;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
	transform: none !important;
}

.gcw-position-bottom-center {
	bottom: 8px !important;
	left: 50% !important;
	top: auto !important;
	right: auto !important;
	transform: translateX(-50%) !important;
	justify-content: center;
	align-items: flex-end;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
}

.gcw-position-bottom-right {
	bottom: 8px !important;
	right: 8px !important;
	top: auto !important;
	left: auto !important;
	justify-content: flex-end;
	align-items: flex-end;
	max-width: calc(100% - 16px);
	max-height: calc(100% - 16px);
	transform: none !important;
}

/* Shop loop specific positioning */
.woocommerce ul.products li.product .woocommerce-loop-product__link {
	position: relative;
	display: block;
	overflow: hidden; /* Ensure icons stay within image bounds */
}

.woocommerce ul.products li.product .woocommerce-loop-product__link img {
	display: block;
	width: 100%;
	height: auto;
}

.woocommerce ul.products li.product .gcw-icons-container {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	max-width: 100%;
	max-height: 100%;
	box-sizing: border-box;
}

/* Single product specific positioning */
.woocommerce div.product .woocommerce-product-gallery__image {
	position: relative;
	overflow: hidden; /* Ensure icons stay within image bounds */
}

.woocommerce div.product .woocommerce-product-gallery__image img {
	display: block;
	width: 100%;
	height: auto;
}

.woocommerce div.product .woocommerce-product-gallery__wrapper .gcw-icons-container {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	max-width: 100%;
	max-height: 100%;
	box-sizing: border-box;
}

/* Enhanced Tooltip Styles with 3D Effect */
.gcw-tooltip {
	position: absolute;
	background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
	color: #fff;
	padding: 8px 14px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
	z-index: 1000;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.3s ease, transform 0.2s ease;
	box-shadow: 
		0 4px 12px rgba(0, 0, 0, 0.3),
		0 2px 6px rgba(0, 0, 0, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.1);
	transform: translateY(-5px);
}

.gcw-tooltip.show {
	opacity: 1;
	transform: translateY(0);
}

.gcw-tooltip::after {
	content: '';
	position: absolute;
	width: 0;
	height: 0;
	border: 6px solid transparent;
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.gcw-tooltip.top::after {
	bottom: -12px;
	left: 50%;
	transform: translateX(-50%);
	border-top-color: #2c3e50;
}

.gcw-tooltip.bottom::after {
	top: -12px;
	left: 50%;
	transform: translateX(-50%);
	border-bottom-color: #2c3e50;
}

.gcw-tooltip.left::after {
	right: -12px;
	top: 50%;
	transform: translateY(-50%);
	border-left-color: #2c3e50;
}

.gcw-tooltip.right::after {
	left: -12px;
	top: 50%;
	transform: translateY(-50%);
	border-right-color: #2c3e50;
}

/* Shop Loop Context - Enhanced for Better Visibility */
.gcw-context-loop .gcw-icons-container {
	padding: 6px;
	gap: 6px;
}

.gcw-context-loop .gcw-icon {
	width: calc(var(--gcw-icon-size, 40px) * 0.85) !important;
	height: calc(var(--gcw-icon-size, 40px) * 0.85) !important;
	min-width: calc(var(--gcw-icon-size, 40px) * 0.85) !important;
	min-height: calc(var(--gcw-icon-size, 40px) * 0.85) !important;
	max-width: calc(var(--gcw-icon-size, 40px) * 0.85) !important;
	max-height: calc(var(--gcw-icon-size, 40px) * 0.85) !important;
}

/* Enhanced Tooltip Styles with 3D Effect */
.gcw-tooltip {
	position: absolute;
	background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
	color: #fff;
	padding: 8px 14px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
	z-index: 1000;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.3s ease, transform 0.2s ease;
	box-shadow: 
		0 4px 12px rgba(0, 0, 0, 0.3),
		0 2px 6px rgba(0, 0, 0, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.1);
	transform: translateY(-5px);
}

.gcw-tooltip.show {
	opacity: 1;
	transform: translateY(0);
}

.gcw-tooltip::after {
	content: '';
	position: absolute;
	width: 0;
	height: 0;
	border: 6px solid transparent;
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.gcw-tooltip.top::after {
	bottom: -12px;
	left: 50%;
	transform: translateX(-50%);
	border-top-color: #2c3e50;
}

.gcw-tooltip.bottom::after {
	top: -12px;
	left: 50%;
	transform: translateX(-50%);
	border-bottom-color: #2c3e50;
}

.gcw-tooltip.left::after {
	right: -12px;
	top: 50%;
	transform: translateY(-50%);
	border-left-color: #2c3e50;
}

.gcw-tooltip.right::after {
	left: -12px;
	top: 50%;
	transform: translateY(-50%);
	border-right-color: #2c3e50;
}

/* High DPI / Retina Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
	.gcw-icon img,
	.gcw-icon svg {
		image-rendering: -webkit-optimize-contrast;
		image-rendering: crisp-edges;
	}
}

/* Simple Animation for icon appearance */
@keyframes gcw-icon-fade-in {
	from {
		opacity: 0;
		transform: scale(0.9);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Stagger animation for multiple icons */
.gcw-icons-container .gcw-icon:nth-child(1) {
	animation-delay: 0s;
}

.gcw-icons-container .gcw-icon:nth-child(2) {
	animation-delay: 0.1s;
}

.gcw-icons-container .gcw-icon:nth-child(3) {
	animation-delay: 0.2s;
}

.gcw-icons-container .gcw-icon:nth-child(4) {
	animation-delay: 0.3s;
}

.gcw-icons-container .gcw-icon:nth-child(n+5) {
	animation-delay: 0.4s;
}

/* Mobile & Touch Device Optimizations */
@media (max-width: 768px) {
	/* Ensure icons are large enough for touch on mobile */
	.gcw-icons-container .gcw-icon {
		min-width: 44px !important;
		min-height: 44px !important;
		width: max(var(--gcw-icon-size, 40px), 44px) !important;
		height: max(var(--gcw-icon-size, 40px), 44px) !important;
	}
	
	/* Increase spacing between icons on mobile for easier tapping */
	.gcw-icons-container {
		gap: 8px !important;
		padding: 8px !important;
	}
	
	/* Larger touch targets for tooltips */
	.gcw-tooltip {
		font-size: 14px;
		padding: 10px 16px;
	}
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
	/* For touch devices, remove hover effects and use active states */
	.gcw-icons-container .gcw-icon:hover {
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	}
	
	.gcw-icons-container .gcw-icon:active {
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
		transform: scale(0.95);
		background: #f5f5f5;
	}
	
	/* Ensure minimum touch target size on all touch devices */
	.gcw-icons-container .gcw-icon {
		min-width: 44px;
		min-height: 44px;
	}
}

/* Custom CSS support */
.gcw-icons-container.custom-position {
	position: static;
}

/* Theme-specific compatibility: Manjits 2025 Theme */
/* Shop loop - icons positioned next to circular product image */
.gcw-theme-shop-icons-wrapper {
	position: absolute;
	top: -50px;
	left: 130px; /* 20px (image left) + 100px (image width) + 10px (spacing) */
	z-index: 20;
	pointer-events: none;
	max-width: calc(100% - 140px); /* Prevent overflow */
}

.gcw-theme-shop-icons-wrapper .gcw-icons-container {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0;
	pointer-events: none;
}

/* Ensure icons are visible and properly sized on shop page */
.gcw-theme-shop-icons-wrapper .gcw-icon {
	pointer-events: auto;
	flex-shrink: 0;
}

/* Single product - product image slider container */
.gcw-theme-single-icons-wrapper {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 20;
	pointer-events: none;
}

.gcw-theme-single-icons-wrapper .gcw-icons-container {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
}

/* Target theme's specific image containers */
.product-main-image-container .gcw-icons-container,
.product-images-slider .gcw-icons-container {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	z-index: 15;
}

/* Ensure icons work with theme's circular image on shop page */
.woocommerce ul.products li.product .relative .absolute.rounded-full .gcw-icons-container {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	overflow: hidden;
}

/* Prevent icon overflow on theme's circular images */
.woocommerce ul.products li.product .absolute.rounded-full {
	overflow: visible !important;
}

.woocommerce ul.products li.product .absolute.rounded-full .gcw-icons-container {
	overflow: visible;
}

