/* ==========================================================================
   ACF Media Gallery Preview Elementor Addon - Styling
   ========================================================================== */

.acf-gallery-grid-container {
	width: 100%;
	display: block;
	box-sizing: border-box;
}

/* Grid System */
.acf-gallery-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	width: 100%;
	box-sizing: border-box;
}

/* Card Item Base */
.acf-gallery-item {
	position: relative;
	overflow: hidden;
	background-color: #f4f5f7;
	aspect-ratio: 16 / 10;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: box-shadow 0.3s ease, transform 0.3s ease;
	box-sizing: border-box;
	isolation: isolate; /* Force clean stacking context for glassmorphic blur over HTML5 video */
	transform: translateZ(0);
}

.acf-gallery-item.is-clickable {
	cursor: pointer;
}

/* Media Wrapper */
.acf-gallery-media-wrapper {
	width: 100%;
	height: 100%;
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1;
}

/* Image & Video & Canvas Preview */
.acf-media-preview-img,
.acf-media-preview-video,
.acf-pdf-canvas {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease, filter 0.3s ease;
	transform: translateZ(0);
}

.acf-media-preview-video {
	pointer-events: none;
}

.acf-pdf-canvas {
	background-color: #ffffff;
}

/* Hover Zoom Effect */
.acf-gallery-grid.has-hover-zoom .acf-gallery-item:hover .acf-media-preview-img,
.acf-gallery-grid.has-hover-zoom .acf-gallery-item:hover .acf-media-preview-video,
.acf-gallery-grid.has-hover-zoom .acf-gallery-item:hover .acf-pdf-canvas {
	transform: scale(1.05) translateZ(0);
}

/* Badges for Media Types */
.acf-media-type-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	background: rgba(0, 0, 0, 0.65);
	color: #ffffff;
	border-radius: 4px;
	padding: 4px 8px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.5px;
	display: flex;
	align-items: center;
	gap: 4px;
	z-index: 5;
	pointer-events: none;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.acf-media-type-badge.video-badge {
	padding: 6px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.7);
}

.acf-media-type-badge.video-badge svg {
	display: block;
}

/* Glassmorphism Bottom Banner (Works seamlessly over Videos & Images) */
.acf-gallery-banner {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background-color: rgba(255, 255, 255, 0.85);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	padding: 10px 20px;
	text-align: right; /* Default RTL support for Hebrew */
	z-index: 10;
	transform: translateZ(0); /* Hardware compositing layer for blur over video */
	box-sizing: border-box;
	transition: background-color 0.3s ease;
}

.acf-gallery-item:hover .acf-gallery-banner {
	background-color: rgba(255, 255, 255, 0.95);
}

.acf-gallery-banner-title {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 18px;
	font-weight: 700;
	color: #111111;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Admin Notices */
.acf-gallery-notice {
	background: #fff8e5;
	border-left: 4px solid #ffb900;
	padding: 15px 20px;
	font-size: 14px;
	color: #444;
	margin: 10px 0;
}

/* Lightbox Modal */
.acf-lightbox-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.88);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	padding: 30px;
	box-sizing: border-box;
}

.acf-lightbox-modal.is-active {
	opacity: 1;
	visibility: visible;
}

.acf-lightbox-content-box {
	position: relative;
	max-width: 90vw;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.acf-lightbox-content-box img,
.acf-lightbox-content-box video,
.acf-lightbox-content-box iframe {
	max-width: 90vw;
	max-height: 80vh;
	border-radius: 8px;
	box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.acf-lightbox-close {
	position: absolute;
	top: -45px;
	right: -10px;
	color: #ffffff;
	font-size: 32px;
	cursor: pointer;
	line-height: 1;
	opacity: 0.8;
	transition: opacity 0.2s ease;
}

.acf-lightbox-close:hover {
	opacity: 1;
}

.acf-lightbox-caption {
	margin-top: 15px;
	color: #ffffff;
	font-size: 16px;
	font-weight: 500;
	text-align: center;
}
