html {
	background: transparent !important;
	padding: 0 !important;
	border: 0 !important;
	margin: 0 !important;

	body {
		background: transparent !important;
		padding: 30px !important;
		border: 0 !important;
		margin: 0 !important;

		> * {
			display: none !important;
		}

		> .zoom-new-instagram-widget {
			display: block !important;
			padding: 0 !important;
			border: 0 !important;
			margin: 0 !important;

			.zoom-instagram {
				border: none;
			}
		}
		
		.zoom-instagram {
			background: rgba(0, 0, 0, 0.05);
			padding: 25px;
			// border: 1px solid rgba(0, 0, 0, 0.1) !important;
            border: 20px solid rgba(0, 0, 0, 0.0) !important;
			border-radius: 3px;

			.button,
			.wpzinsta-pro-load-more input[type='submit'],
			.wpzinsta-pro-load-more button[type='submit'],
			.wpzinsta-pro-load-more-wrapper .wpzinsta-pro-load-more-btn {
				display: flex !important;
				flex-direction: row !important;
				align-items: center !important;
				justify-content: center !important;
				gap: 10px !important;
				cursor: pointer;
				font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
				font-size: 0.929em !important;
				font-weight: 600 !important;
				text-decoration: none !important;
				line-height: 35px !important;
				color: #fff !important;
				background: #3496ff !important;
				min-height: 35px !important;
				padding: 0 12px !important;
				border: 0 !important;
				border-radius: 2px !important;
				transition: all 0.2s ease !important;

				&:hover,
				&:active {
					text-decoration: none !important;
					color: #fff !important;
					background: #70b5fe !important;
				}

				&.disabled {
					pointer-events: none !important;
					opacity: 0.5 !important;
				}

				> .button-icon {
					height: 18px !important;
					width: 18px !important;
				}
			}

			.select-a-feed {
				display: flex;
				align-items: center;
				justify-content: center;
				gap: 8px;
				cursor: default;
				line-height: 24px;
				padding: 0;
				margin: 0;

				svg {
					flex-shrink: 0;
					color: #3496ff;
					height: 24px;
					width: 24px;
					animation: point 1s infinite;
				}
			}
		}
	}
}

@keyframes point {
	0% {
		transform: translateX(0%);
	}
	50% {
		transform: translateX(-30%);
	}
	100% {
		transform: translateX(0%);
	}
}

// Match frontend: item and image sizing so preview matches live feed
.zoom-new-instagram-widget .zoom-instagram .zoom-instagram-widget__item {
	position: relative;
	list-style-type: none !important;

	.zoom-instagram-widget__item-inner-wrap {
		position: relative;
		height: 100%;
		overflow: hidden;
	}

	img:not(.wpz-insta-product-popover-item-img) {
		object-fit: cover;
		object-position: center;
		height: 100%;
		width: 100%;
		display: block;
	}
}

// WooCommerce Product Link button (inside iframe preview)
.zoom-instagram-widget__item-inner-wrap {
	position: relative;
}

.wpz-insta-link-product-btn {
	display: none; // Shown only when Product Links tab is active (body.wpz-insta-product-links-tab-active)
	position: absolute;
	bottom: 16px;
	left: 16px;
	right: 16px;
	background: #3496ff;
	color: #fff;
	border: none;
	padding: 12px 16px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 12px;
	align-items: center;
	justify-content: center;
	gap: 5px;
	z-index: 10;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	transition: background 0.2s, border-color 0.2s, color 0.2s;
	width: auto;

	&:hover {
		background: #2b88e9;
	}

	.dashicons {
		font-size: 16px;
		width: 16px;
		height: 16px;
	}

	// Edit Product Link state (when item is already linked)
    &--linked {
        background-color:  #2e7d32;
        color: #fff;

        &:hover {
            background-color: #1e4620;
        }

        .dashicons-edit {
            opacity: 0.95;
        }
    }
}

// Show "Link to a product" buttons only when Product Links tab is active (no iframe reload)
body.wpz-insta-product-links-tab-active .zoom-instagram-widget__item:not(.wpz-insta-post-hidden) .wpz-insta-link-product-btn {
	display: flex;
}

// =============================
// Moderate Posts - Eye button (inside iframe preview)
// =============================
.wpz-insta-moderate-btn {
	display: none; // Shown only when Moderate tab is active
	position: absolute;
	top: 8px;
	right: 8px;
	background-color: rgba(0, 0, 0, 0.9);
	color: #fff;
	border: none;
	padding: 0;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	cursor: pointer;
	z-index: 10;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, transform 0.15s;
	svg {
		width: 20px;
		height: 20px;
		display: block;
		pointer-events: none;
	}

	&:hover {
		background: rgba(0, 0, 0, 0.8);
		transform: scale(1.1);
	}
}

// Show moderate buttons only when Moderate tab is active
body.wpz-insta-moderate-tab-active .wpz-insta-moderate-btn {
	display: flex;
}

body:not(.wpz-insta-moderate-tab-active) .zoom-instagram-widget__item.wpz-insta-post-hidden {
	img{
		opacity: 0.2 !important;
	}
	&::after{
		content: '';
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		width: 46px;
		height: 46px;
		background: rgba(0, 0, 0, 0.5);
		border-radius: 8px;
		z-index: 10;
		pointer-events: none;
		display: block;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'%3E%3C/path%3E%3Cline x1='1' y1='1' x2='23' y2='23'%3E%3C/line%3E%3C/svg%3E");
		background-repeat: no-repeat;
		background-position: center;
		background-size: 20px 20px;
	}
}
// Hidden post state - dimmed with overlay
body.wpz-insta-moderate-tab-active .zoom-instagram-widget__item.wpz-insta-post-hidden {
	.zoom-instagram-widget__item-inner-wrap {
		position: relative;

		&::after {
			content: '';
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			background-color: rgba(255, 255, 255, 0.5);
			z-index: 5;
			pointer-events: none;
			backdrop-filter: blur(6px);
		}
	}

	// Keep the moderate button above the overlay
	.wpz-insta-moderate-btn {
		z-index: 10;
		background: rgba(220, 50, 50, 0.8);

		&:hover {
			background: rgba(220, 50, 50, 1);
		}
	}
}

// Hide items loaded via AJAX (Load more) and the Load more button when layout is not grid or masonry.
// body.page-layout-* is set by preview.js when layout is updated via postMessage.
// .wpz-insta-ajax-loaded-item is added by preview.js to items appended by the preview Load more AJAX.
body:not(.page-layout-grid):not(.page-layout-masonry) {
	.zoom-instagram-widget__item.wpz-insta-ajax-loaded-item {
		display: none !important;
	}
	.wpzinsta-pro-load-more-wrapper {
		display: none !important;
	}
}

// Layout styles for preview iframe (index.scss uses .widget.zoom-new-instagram-widget; preview wrapper has only .zoom-new-instagram-widget)
// Ensures layout-grid, layout-fullwidth, layout-carousel and layout-masonry apply when design is updated via postMessage
.zoom-new-instagram-widget .zoom-instagram .zoom-instagram-widget__items {
	padding: 0;
	margin: 0;

	&::before,
	&::after {
		display: none;
	}

	&.layout-grid .zoom-instagram-widget__item img:not(.wpz-insta-product-popover-item-img) {
		object-fit: cover;
		width: 100%;
		aspect-ratio: 1 / 1;
		height: 100% !important;
	}

	&.layout-fullwidth {
		white-space: nowrap;
		display: grid;
		grid-template-rows: auto;
		grid-auto-rows: 0;

		.zoom-instagram-widget__item img:not(.wpz-insta-product-popover-item-img) {
			aspect-ratio: 1;
			height: 100% !important;
		}
	}

	&.layout-carousel {
		display: flex !important;
		height: auto !important;
		overflow: hidden;
		flex-wrap: nowrap;

		.zoom-instagram-widget__item {
			height: auto;
			flex: 0 0 calc(100% / var(--wpz-insta-perpage, 3));
			min-width: 0;

			img:not(.wpz-insta-product-popover-item-img) {
				aspect-ratio: 1;
				object-fit: cover;
				height: auto;
				width: 100%;
			}
		}
	}
}

// Masonry in preview: show as grid and hide the masonry sizer (extra li)
.zoom-new-instagram-widget .zoom-instagram.wpz-insta-preview-masonry .zoom-instagram-widget__items .masonry-items-sizer {
	display: none !important;
}

// Notice when masonry or carousel is selected (preview shows static layout; effect applied on frontend)
.wpz-insta-preview-masonry-notice,
.wpz-insta-preview-carousel-notice {
	display: block;
	margin: 0 0 12px;
	padding: 10px 14px;
	font-size: 13px;
	line-height: 1.4;
	color: #1d2327;
	background: #f0f6fc;
	border-left: 4px solid #2271b1;
	border-radius: 0 2px 2px 0;
	box-sizing: border-box;
}

.zoom-new-instagram-widget .zoom-instagram.layout-masonry .zoom-instagram-widget__items .zoom-instagram-widget__item img,
.zoom-new-instagram-widget .zoom-instagram.layout-masonry .zoom-instagram-widget__items .masonry-items-sizer img {
	filter: none;
}
